Re: connection pooling
Tim Roberts <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Organization | Providenza & Boekelheide, Inc. |
| Message-ID | <[email protected]> |
David wrote: > What specific benefit does an within-process connection pool provide > to a system? > > Psycopg2 is threadsafe to the cursor level, (threadsafety=2) so a > process can create a global connection that is shared by all threads; > each thread can get a new cursor for its own purposes, and all threads > in the process can benefit from one persistant connection. That would > seem to provide all the benefits of connection pooling, without the > overhead of checking connections into and out-of a pool. > Also, remember that Python-based web applications on Linux typically use multiple processes, not multiple threads. At the risk of igniting a flame war, threading on Linux is somewhat unpleasant, so applications that would be multithreaded on Windows are typically multiprocess on Linux. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc.