有没有任何池ThreadingMixIn和ForkingMixIn SocketServer? [英] is there any pool for ThreadingMixIn and ForkingMixIn for SocketServer?

查看:412
本文介绍了有没有任何池ThreadingMixIn和ForkingMixIn SocketServer?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用基于SocketServer
的BaseHttpServer来创建一个http代理,它有两个异步Mixins(ThreadingMixIn和ForkingMixIn)

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)

是有一个Mixin使用一个池的说4个子进程每个
中有40个线程,所以请求被那些已经创建的线程处理?

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.

推荐答案

我开始了一个解决这个问题的项目

I've started a project that solves this issue

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

也许你想加入我完成TODO(在CTRL + C之后清理)

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

这篇关于有没有任何池ThreadingMixIn和ForkingMixIn SocketServer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆