[ 
https://issues.apache.org/jira/browse/TINKERPOP-1774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16610325#comment-16610325
 ] 

ASF GitHub Bot commented on TINKERPOP-1774:
-------------------------------------------

Github user jorgebay commented on the issue:

    https://github.com/apache/tinkerpop/pull/903
  
    Yes, that's the design I was proposing, a minor note:
    
    > Either returns a random `Connection` or returns the least-used 
`Connection` based on an in-flight counter on the `Connection` (the latter 
would be the better solution but is a bit more complex).
    
    The easiest solution is to round robin through connections, we can use a 
"modulo counter":
    
    ```csharp
    // Its important to get a reference of the connection array that doesn't 
change
    // Otherwise the connection length might be modified (see copy-on-write)
    Connection[] connections = GetConnections();
    var connectionIndex = Interlocked.Increment(ref _indexCounter) % 
connections.Length;
    var connectionToReturn = connections[connectionIndex];
    // TODO: Overflow protection for `_indexCounter`
    ```
    
    Regarding whether to implement both approaches, I think implementing 
TINKERPOP-1774 with the current implementation of the pool (dequeuing) comes at 
a cost of introducing complexity (in particular `AsyncAutoResetEvent`).
    
    The implementation for this patch is really good, but we can be introducing 
corner cases and I think it's not worth the risk. I'd say let's wait for both 
solutions to be implemented.


> Gremlin .NET: Support min and max sizes in Connection pool
> ----------------------------------------------------------
>
>                 Key: TINKERPOP-1774
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1774
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: dotnet
>    Affects Versions: 3.2.7
>            Reporter: Jorge Bay
>            Assignee: Florian Hockmann
>            Priority: Minor
>
> Similar to the java connection pool, we should limit the maximum amount of 
> connections and start with a minimum number.
> It would also a good opportunity to remove the synchronous acquisitions of 
> {{lock}} in the pool implementation.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to