Search code examples
pythonconcurrencyasyncsocketpython-multithreadingsocketserver

is there any pool for ThreadingMixIn and ForkingMixIn for SocketServer?


I was trying to make an http proxy using BaseHttpServer which is based on SocketServer which got 2 asynchronous Mixins (ThreadingMixIn and ForkingMixIn)

the problem with those two that they work on each request (allocate a new thread or fork a new subprocess for each request)

is there a Mixin that utilize a pool of let's say 4 subprocesses and 40 threads in each so requests get handled by those already created threads ?

because this would be a big performance gain and I guess it would save some resources.


Solution

  • I've started a project that solves this issue

    https://github.com/muayyad-alsadi/python-PooledProcessMixIn

    maybe you want to join me finish the TODOs (clean up after CTRL+C)