枪支 /前叉与同步工人和数据库连接
我有一个与这个较旧问题有关的问题:
我们进行了内部讨论,并且更高级的开发人员坚持认为我错了。分离是围绕数据库连接。
当您使用Gunicorn部署WSGI应用程序并有5位同步工人时,我认为每个工人都是一个完全独立的过程,托管完整的WSGI应用程序,而无需与任何其他过程或主过程共享。
本质上,我想解释说,使用数据库连接池可能没有意义,因为每个过程只有1个主动请求,因此只需要1个主动连接。而且,如果您建造一个游泳池,所有5名工人都将拥有自己的完全独立的连接池,这样您最终会得到太多的连接。
因此,我的问题是,我的假设是正确的,还是另一个开发人员声称连接池将在同步工人中共享的权利?
I have a question related to this older question:
What exactly is a pre-fork web server model?
We had an internal discussion and a more senior dev insisted I was wrong. The disuccsion was around database connections.
When you deploy a wsgi application using gunicorn and you have 5 sync workers, I assumed that each worker is a completely separate process hosting the full wsgi application without any sharing with any other process or the master process.
In essence I wanted to explain that using a database connection pool probably doesn't make sense as each process will ever only have 1 active request and hence only ever needs 1 active connection. And that if you make a pool, all 5 workers will have their own completely separate connection pool so you end up with too many connections.
So my question is, are my assumption right or is the other dev right that claims the connection pool will be shared among synchronous workers?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论