[
https://issues.apache.org/jira/browse/GEODE-332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14904875#comment-14904875
]
ASF subversion and git services commented on GEODE-332:
-------------------------------------------------------
Commit 7fcb2fd938338c9fde2a152364c094c196c5a045 in incubator-geode's branch
refs/heads/develop from [~dschneider]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-geode.git;h=7fcb2fd ]
GEODE-332: use thread pools for p2p readers and async close
The old code always created a brand new thread when it
wanted to async close a socket or create a new p2p reader
or handshake with a p2p reader. Now it will reuse threads
which improves latency and having a hard cap on the maximum
number of closer threads prevents a large number of close
threads causing an OutOfMemory exception.
Introduced a new SocketCloser class for async close.
The ConnectionTable has a SocketCloser instance
for closing peer-to-peer sockets and the
CacheClientNotifier has one for closing sockets
used by a cache server to send queue data to clients.
The ConnectionTable closer will have at most 8 threads
per address its sockets are connected to. If these
threads are not used for 120 seconds they will timeout.
This timeout can be configured using the
p2p.ASYNC_CLOSE_POOL_KEEP_ALIVE_SECONDS system property.
The maximum threads per address can be changed from 8
using the p2p.ASYNC_CLOSE_POOL_MAX_THREADS system property.
By default when an async socket close request is made
the requestor does not wait for request to be done.
In previous releases the requestor waited 50 milliseconds.
Now a wait can be configured using the
p2p.ASYNC_CLOSE_WAIT_MILLISECONDS system property.
The CacheClientNotifier closer will have at most 1 thread
per address its sockets are connected to. If these
threads are not used for 120 seconds they will timeout.
This timeout can be configured using the
p2p.ASYNC_CLOSE_POOL_KEEP_ALIVE_SECONDS system property.
Also this closer forces all requestors to wait 50 milliseconds
for the close to be done.
ConnectionTable also uses a thread pool for when ever
it needs a thread for a p2p reader or when a p2p sender
needs a thread to do the initial handshake. This pool
has an unlimited number of threads but if a thread is
not used for 120 seconds it will timeout. This timeout
can be configured using the p2p.READER_POOL_KEEP_ALIVE_TIME
system property.
> Add thread pooling to peer to peer distribution layer
> -----------------------------------------------------
>
> Key: GEODE-332
> URL: https://issues.apache.org/jira/browse/GEODE-332
> Project: Geode
> Issue Type: Improvement
> Reporter: Darrel Schneider
> Assignee: Darrel Schneider
> Original Estimate: 48h
> Remaining Estimate: 48h
>
> Every time geode makes a peer-to-peer connection it creates a thread to read
> from that connection. When the connection is closed it creates another thread
> to do the socket close in the background just in case the close hangs. For
> certain use cases the lifetime of these threads can be short but the rate at
> which they are created can be high.
> It would both improve performance and improve memory footprint if these
> threads were reused from a pool instead of creating them every time.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)