cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How long does it take on average to answer a query made in Node with Serverless?

I'm creating an API to manage a Neo4j database.

I started the project in Serverless with Node.js. My API is already registering and performing searches, by node ID and also by properties.

But I'm getting a much slower response time than I thought I would.

In the first query, it takes an average of 2 seconds, and when I test it repeatedly, the response is around 500 ms.

I tested refactoring the API using Node.js with Express.js, but the response time remains the same (first request 2 seconds and other requests, 500 ms on average).

I created an Index for the label and the property that I'm using in the search (code) and the minimum response time reduced to just over 400 ms (which I still consider a very long time).

I also noticed that the request that is made in "browser.neo4j.io" is taking an average of 500 ms in the first request and approximately 200 ms in the other requests (although the response time message displayed on the screen is 2 ms).

I have other APIs that interact with other types of databases and their response times are much faster. I have an API made in Node, running on an AWS EC2, connected to a PostgreSQL database, for example, which has an average response time of 40 ms.

Is this response time normal, even if I create an Index for this label and this node property?

Note: I am located in Rio de Janeiro, Brazil.
My PostgreSQL API server is located in São Paulo, Brazil (450 km away).
Does the fact that my Neo4j server is on a GCP server and located in Iowa, USA (us-central1), 8,697 km away, make all that difference in the response time?

2 REPLIES 2

You could try creating and endpoint that returns a literal string to see what the round trip time is without neo4j.  Or, are you able to ping the server? 

anthapu
Graph Fellow

Can you check the actual query logs to see how much time the database actually taking to complete the work?

These are the things that can affect the response times.

  • Driver creation. Each time you are creating a driver instance it can have an impact. Please note that what I mean driver creation here mean, creating the driver object. The session creation does not take time. Not sure how you are using the driver. In REST or Spring apps, we create the driver instances only once. 
  • Input data size
  • Query execution (database raw time)
  • Output read time.

Please run profile of the query in the browser and share the results. It is possible either database is doing too much work or returning lot of data.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online