When enabling event-based pull replication for a large number of repositories (say several hundred of repos), the target server can reach a thread pool exhaustion state on two levels:
- The simpler issue is with tomcat HTTP threads. Event based pull replication opens one connection per each repository to be replicated to. So 200 repos entail 200 open HTTP threads on each server (source and target, an "inbound" channel thread on the target, and an "outbound" channel thread on the source). The customer will need to increase the maximal amount of threads for inbound connections when working with large volumes of repos.
- The more complex and severe issue that is also harder to triage is with async threads. On HA setups, each channel needs to use HA-propagation to open corresponding channels on other nodes in the cluster:
Each of the nested POST requests require an art-exec thread from our cached async thread pool. By default, the async thread pool spawns up to num_of_cores * 4 threads. When working in large volumes, this thread pool will be significantly over-utilized, sometimes creating a bottleneck of hundreds of propagation tasks in the async queue, leading to the following propagation error:
This situation is very bad because of the snowball effect that it creates - all art-exec threads are used up, and will get cleaned up only after all the queued tasks timeout 3 times each (due to propagation retries), which can take up to 90 seconds per-task (3 * 30s of the default propagation timeout). One obvious side effect is that the Heartbeat job will not be able to run for the entire period of exhaustion, impeding the node's availability.
- Event-based pull replication should opt to using a dedicated thread pool which's size is dynamically calculated by the number of repos configured with event-based pull, or use a significantly higher max threads limitation (say up to 100, configurable by a well-documented property.
- Until something like #1 is implemented, document this limitation and instruct users to increase the async core pool size accordingly when needed.