From 4caca80962e19c4d27576a78a88b48d47c5f3710 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sat, 17 Aug 2019 19:43:52 +0100 Subject: [PATCH] issue #627: reduce the default pool size in a child to 2. Ansible has no blocking services running, or really any service that would have an outsized benefit from multiple IO waiters. Probably we only need 1, but let's start with 2 just in case. --- docs/changelog.rst | 4 ++++ mitogen/service.py | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 80a74785..51cdd2df 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -222,6 +222,10 @@ Core Library to a function call, where the reply might be dropped due to exceeding the maximum configured message size. +* :gh:issue:`624`: the number of threads used for a child's auto-started thread + pool has been reduced from 16 to 2. This may drop to 1 in future, and become + configurable via a :class:`Router` option. + * :gh:commit:`a5536c35`: avoid quadratic buffer management when logging lines received from a child's redirected standard IO. diff --git a/mitogen/service.py b/mitogen/service.py index c8022c04..6bd64eb0 100644 --- a/mitogen/service.py +++ b/mitogen/service.py @@ -55,7 +55,6 @@ except NameError: LOG = logging.getLogger(__name__) -DEFAULT_POOL_SIZE = 16 _pool = None _pool_pid = None #: Serialize pool construction. @@ -88,7 +87,7 @@ def get_or_create_pool(size=None, router=None): _pool = Pool( router, services=[], - size=size or DEFAULT_POOL_SIZE, + size=size or 2, overwrite=True, recv=mitogen.core.Dispatcher._service_recv, )