Quantcast

Database connection pooling with mod_wsgi help?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Database connection pooling with mod_wsgi help?

Cherrypy-noob
Hi All,

new to cherrypy and a bit confused on how to deal with database connection pooling under mod_wsgi especially coming from Java world where this is a non-issue. Please don't just provide me links, I've read them and they do not answer my questions.

For example
http://tools.cherrypy.org/wiki/Databases

and the example does not help.

Correct me if I'm wrong but this won't work. It is not a connection pool. On each request, a new connection needs to be made and hence requiring some time. In my case the issue is latency. I want a fast response and opening a connection on request has a user perceptible impact. What I want is connections (eg a a connection pool) that persist over requests and eah request can take an already open connection from that pool.

But my understanding of mod_wsgi seems lacking? As far as I can tell it shutdowns everything after each request. Thats why for example file based cherrypy sessions are need and above databases example does not work. See

https://groups.google.com/forum/#!topic/cherrypy-users/_gq-mv3aZ1o

This users seems to have the same issue. I have not found a single example using a connection pool with mod_wsgi and cherrypy. Is this even possible?

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database connection pooling with mod_wsgi help?

Joseph S. Tate
Why are you using mod_wsgi? If latency is so important, use a different hosting model. Reverse proxying is very common. You're right that you need long running processes to take advantage of reusable database connections, so use a hosting model that fits that. I'm sure that mod_wsgi can be used to serve multiple requests though. I get the sense that not many people are using mod_wsgi at scale though.

Why are you using the database libraries directly? Several of the ORM layers offer transparent connection pools. SQLAlchemy is very popular and works well with cherrypy in daemon mode.

I don't like wsgi much anymore, so I just use cherrypy directly, running in multiple processes, and then reverse proxy/round robin from nginx (or apache depending on what else needs to be hosted). I will then front load a cache or load balancer as things scale.

Joseph

On Wed, Feb 8, 2017 at 6:16 AM Cherrypy-noob <[hidden email]> wrote:
Hi All,

new to cherrypy and a bit confused on how to deal with database connection pooling under mod_wsgi especially coming from Java world where this is a non-issue. Please don't just provide me links, I've read them and they do not answer my questions.

For example
http://tools.cherrypy.org/wiki/Databases

and the example does not help.

Correct me if I'm wrong but this won't work. It is not a connection pool. On each request, a new connection needs to be made and hence requiring some time. In my case the issue is latency. I want a fast response and opening a connection on request has a user perceptible impact. What I want is connections (eg a a connection pool) that persist over requests and eah request can take an already open connection from that pool.

But my understanding of mod_wsgi seems lacking? As far as I can tell it shutdowns everything after each request. Thats why for example file based cherrypy sessions are need and above databases example does not work. See

https://groups.google.com/forum/#!topic/cherrypy-users/_gq-mv3aZ1o

This users seems to have the same issue. I have not found a single example using a connection pool with mod_wsgi and cherrypy. Is this even possible?

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Loading...