[
https://issues.apache.org/jira/browse/TINKERPOP-2148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16783507#comment-16783507
]
Florian Hockmann commented on TINKERPOP-2148:
---------------------------------------------
{{ConcurrentQueue}} is an interesting option that I haven't really considered
yet to be honest.
We currently search for the least used connection because we would otherwise
always take the same one until that has reached its limit as the ordering is
probably deterministic. With a queue, we could of course follow the approach
you suggested which would basically result in a round-robin like mechanism. We
could also stop searching for the least used connection in that case as we
would already have a more or less equal distribution of requests over the
available connections.
The only downside I can currently see is that we would do a lot more add/remove
operations. We don't really have any benchmarks right now for the Gremlin.Net
driver, but I would expect the performance impact to be more or less balanced
out by the removed iteration over all connections for each request due to the
round-robin like mechanism.
Another advantage of {{ConcurrentQueue}} would be that TINKERPOP-2135 would
become a no-brainer: If a connection that was popped of the queue is closed,
then we only have to dispose it as it is already removed from the pool at that
moment. We just don't pop it again onto the queue, so we don't need any
{{Remove()}} method at all.
So, overall it seems to me that {{ConcurrentQueue}} is actually the best
collection type for the connection pool. Thanks for this suggestion!
Are you interested in submitting a PR for this? Otherwise, I will give this a
try in the next few days so that it should land in 3.4.1.
> "no connection available!" is being thrown despite lots of free connections
> ---------------------------------------------------------------------------
>
> Key: TINKERPOP-2148
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2148
> Project: TinkerPop
> Issue Type: Bug
> Components: dotnet
> Affects Versions: 3.4.0
> Environment: Windows 10, C#, .NET Core, CosmosDB Graph
> Reporter: Zaoshi
> Priority: Minor
>
> I am submitting multiple graph queries in parallel but in some cases it
> starts throwing this exception:
> {{Gremlin.Net.Driver.Exceptions.NoConnectionAvailableException : no
> connection available!}}
> {{ at Gremlin.Net.Driver.ConnectionPool.GetAvailableConnectionAsync()}}
> {{ at Gremlin.Net.Driver.GremlinClient.SubmitAsync[T](RequestMessage
> requestMessage)}}
> When GremlinClient is initialized with \{PoolSize = 1,
> MaxInProcessPerConnection = 8} everything works fine, however, with
> \{PoolSize = 8, MaxInProcessPerConnection = 1} it starts throwing those
> exceptions even though this connection pool should have same throughput. I
> have tried to increase pool to \{PoolSize = 128, MaxInProcessPerConnection =
> 1} but GremlinClient started to fail even more.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)