Question about connection pool for multithread graph traversal

7 views
Skip to first unread message

Cong Sun

unread,
Sep 11, 2015, 1:11:18 AM9/11/15
to pacer-users
We are trying to do a multithread graph traversal by using a connection pool. Currently, each thread has a new connection and we are having trouble closing the connection and reuse it after the thread is done. The number of connections therefore reaches to the maximum capacity in a very short time.
What we are using is a orient_factory pool; we get a new connection by calling pool.get and get the corresponding graph object by calling graph=Pacer.orient(pool.get). After the use, we try to reuse the graph object by calling pool.surrender(graph). However, the number of connections to my orientdb does not seem to reduce (it just keeps growing as we call more pool.get). We are not quite understanding how graph objects and connections are being reused in the pool.
Our guess is that we are not using the connection pool in a correct way. We also tried to kill the connection right away once the thread is done but it seems very inefficient and makes the pool seem meaningless. Additionally, the kill does not always work either :(
What we want to achieve is that we establish certain number of connections at the beginning in the pool. When a request comes, a connection is then assigned to the thread to do the graph traversal. If too many requests come at the same time, the requests that are not being able to be serviced can be placed in a queue to be further serviced.
I wonder if anybody can provide some help on how to do the multithread graph traversal correctly.
Thanks much!
Cong Sun
Reply all
Reply to author
Forward
0 new messages