[
https://issues.apache.org/jira/browse/PHOENIX-5812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17082684#comment-17082684
]
Pawan Prakash commented on PHOENIX-5812:
----------------------------------------
Thanks [~liuml07] for summarizing the steps needed to clean up the PConnections.
{quote}It's still possible to make PConnection cleaning up significantly less
user facing. I like this idea a lot. One potential solution in my mind is that:
- we *softly* close those PConnection when they are doomed idle and keep them
in separate connection queue in CQSI
- decrease the connection count so we do not consider them when throttling
- auto-open those PConnection when they become active again
- after a hard lifecycle setting (say, 1 day), those idle connections are
*hard* closed and removed.{quote}
I believe that in step 3, the softly closed PConnections would again have to
deal with the throttling scenario since the total active connections might have
reached the threshold. I wonder if the end user would then need to worry about
handling these possible exceptions.
In any case, the soft/hard closing is a plausible solution for idle-connection
handling. I think a good first step would be hard closing idle-connections
(step 4 only). A further improvement to include the soft closing support can be
done as a different JIRA.
We could limit the scope of this Jira to non-PQS use case as multiple folks
have pointed that PQS already have time-bounded cache on Connections. Since we
are focused on closing idle PConnections and not necessarily HConnection, it
might be sufficient for now.
The definition of 'idleness' is somewhat tricky. There seems to be somewhat of
a consensus here that time since last interaction is the idle time. But do we
start measuring the time from the "start" of an interaction or the "end" of an
interaction? In my opinion, it is a matter of convention. Since, it might be
easier to timestamp start of interactions, I would vote for that (I would
gladly accept better alternatives).
> Automatically Close "Idle" Long Open Connections
> ------------------------------------------------
>
> Key: PHOENIX-5812
> URL: https://issues.apache.org/jira/browse/PHOENIX-5812
> Project: Phoenix
> Issue Type: Improvement
> Reporter: Daniel Wong
> Priority: Major
>
> As Phoenix may keep a maximum default number of connections. Badly
> performing client calls or internal errors (See PHOENIX-5802). Can cause
> total available connections to go to 0. Proposing a client connection
> monitor with a connection reaper like task to reap idle connections.
> Definition of "Idle"
> Simple may be simple time based say if a connection has been open for
> configurable amount of minutes simply close.
> More complicated solution may be keeping track of last interaction time.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)