Rick Lawson wrote:
On Jul 15, 4:53 am, Jonathan Gardner <jgard...@jonathangardner.net>
wrote:
On Jul 14, 6:34 pm, Rick Lawson <lawso...@gmail.com> wrote:

Appreciate any help on this. I am porting an app from Java to python
and need generic object pooling with hooks for object initialization /
cleanup and be able to specify an object timeout.
Are you looking for something like a thread pool or a connection pool?
Such a thing is easy to code in Python. Might as well write one from
scratch for your particular need.

By the way, a tip for writing Python: Forget Java. If you're porting
an app, consider rewriting it from the architecture on up. You'll save
yourself time and get a better result.

Jonathan,

Thanks for the advice but would like to pick your brain a little more.
The pool I need is not a thread pool or db pool. I need to pool
objects which are a proxy for an external C process that communicates
via sockets.

    "fcgi" is an option for this sort of thing.  With "mod_fcgi" installed
in Apache, and "fcgi.py" used to manage the Python side of the problem, you
can have semi-persistent programs started up and shut down for you on the
server side.

   I use this for "sitetruth.com".  It's useful when CGI is too slow
because the cost of launching Python and loading all the modules is
far greater than the cost of processing the request.

   Once you find and install a working Apache "mod_fcgi" module, and a
working "fcgi.py" module (I suggest "http://svn.saddi.com/py-lib/trunk/fcgi.py";) writing the server side app is no harder than with CGI. But the performance
is far better.

                                John Nagle
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to