I have a CE Neo4j instance that receives data from a GCP Cloud Function using the Python driver. The execution rate of this function varies smoothly throughout the day, peaking midday and falling to a minimum overnight. However, the average time it takes to insert a data point into the graph jumps from just 2-3 seconds to 1-2 minutes (see attached image below). I'm wondering if there's an explanation for this, and if there's any particular settings I should test out.
Currently, I have the following settings:
n1-highcpu-96instance (96 CPU, 86 GB memory)
- (Server) dbms.connector.bolt.thread_pool_keep_alive = 10080 minutes (1 week)
- (Server) dbms.connector.bolt.thread_pool_max_size = 800
- (Driver) max_connection_lifetime = 604800 seconds (1 week)
- (Cloud Function) 700 maximum instances
- (Cloud Function) 180 second timeout
The oscillations between 2-3 seconds and 1-2 minutes were more dramatic with the server keep alive at 5 minutes and driver max connection lifetime at 1 hour.
The Cloud Function instantiates the driver as a global variable:
from neo4j import GraphDatabase driver = GraphDatabase.driver(...) def my_function(event, context): my_data = get_data_from_event(event) with driver.session() as session: result = session.write_transaction(_my_transaction_function, my_data)