The purpose of adding the session pool is to solve the problem caused by improperly using the connection pool. For example, a common case is that the user generates a new session, executes a query, and releases the session in a loop, like:
// Wrong usage of the connection pool
for(int i=0; i<100; i++) {
// get new session
// execute query
// release session
}
This will cause huge traffic in the meta service and may crash the service.
Usage
See example/SessinPoolExample.py for a more detailed example.
The usage of the connection pool remains unchanged.
Limitation
There are some limitations:
There MUST be an existing space in the DB before initializing the session pool.
Each session pool is corresponding to a single USER and a single Space. This is to ensure that the user's access control is consistent. i.g. The same user may have different access privileges in different spaces. If you need to run queries in different spaces, you may have multiple session pools.
Every time when sessinPool.execute() is called, the session will execute the query in the space set in the session pool config.
Commands that alter passwords or drop users should NOT be executed via session pool.
Why we need a session pool
The purpose of adding the
session pool
is to solve the problem caused by improperly using the connection pool. For example, a common case is that the user generates a new session, executes a query, and releases the session in a loop, like:This will cause huge traffic in the meta service and may crash the service.
Usage
See
example/SessinPoolExample.py
for a more detailed example.The usage of the connection pool remains unchanged.
Limitation
There are some limitations:
space
in the DB before initializing the session pool.sessinPool.execute()
is called, the session will execute the query in the space set in the session pool config.