Connecting from google cloud functions

Is it ideal to connect/disconnect to Aerospike instance too frequently? We have our rest api hosted on cloud functions (serverless - similar to AWS Lambda) and would like to connect to Aerospike db.

Is it possible to connect through your node client quickly and disconnect once the function instance goes down?

When you instantiate a client, it must first discover the cluster. This means polling the seed nodes you provided the application to discover other nodes in the cluster. This process of can take a significant amount of time when compared to a read or write operation.

The Aerospike REST client may be the way to go here. Basically you would have these clients running outside of the ‘lambda’ environment where they can maintain this bootstrap state and you applications would make requests to the REST client’s API.

Thanks for the details. I found out that there is a possibility to connect to a vpc. Do you see i can just connect to it with local ip and it works directly?

Thanks, Ayyappa

Since you are running in a lambda like environment, I assume these clients are to be instantiated once per request? The latency from the initial cluster bootstrap process could prohibitive (but you will need to measure). The REST client should perform betters in this environment (assuming I have my assumptions right).

Thank you! I will try with REST then.

© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.