You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "stephen mallette (JIRA)" <ji...@apache.org> on 2016/06/29 11:58:37 UTC

[jira] [Updated] (TINKERPOP-1351) Nb of connections going beyond the pool max size

     [ https://issues.apache.org/jira/browse/TINKERPOP-1351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

stephen mallette updated TINKERPOP-1351:
----------------------------------------
    Affects Version/s:     (was: 3.2.0-incubating)
                       3.1.2-incubating

> Nb of connections going beyond the pool max size
> ------------------------------------------------
>
>                 Key: TINKERPOP-1351
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1351
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: driver
>    Affects Versions: 3.1.2-incubating
>         Environment: RESTful web service using gremlin driver to send request to a Gremlin Server
>            Reporter: Ramzi Oueslati
>             Fix For: 3.1.3, 3.2.1
>
>
> When the gremlin driver is used with an important number of concurrent requests, sockets are opened far beyond the max pool size.
> At some point, the connections are destroyed, the pool is empty and then the borrowConnection process goes through :
> {code:java}
>         if (connections.isEmpty()) {
>             logger.debug("Tried to borrow connection but the pool was empty for {} - scheduling pool creation and waiting for connection", host);
>             for (int i = 0; i < minPoolSize; i++) {
>                 scheduledForCreation.incrementAndGet();
>                 newConnection();
>             }
>             return waitForConnection(timeout, unit);
>         }
> {code}
> If many connections are borrowed at the same time then this code will schedule as many connections for creation.
> I added a check :
> {code:java}
>             for (int i = 0; i < minPoolSize; i++) {
>                 if (scheduledForCreation.get() < minPoolSize) {
>                     scheduledForCreation.incrementAndGet();
>                     logger.debug("borrowConnection: [inc] scheduledForCreation=" + scheduledForCreation.get());
>                     newConnection();
>                 }
>             }
> {code}
> It seems to solve the problem.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)