Hi all,
When running a tg2 app with "paster serve", I was expecting controller
objects to be instantiated once per worker thread.

However, when I add logging to BaseController.__init__, it seems that
the full hierarchy of controller objects is instantiated once per
request.

E.g. when I exercised my app with ab -c 100 -n 1000 (100 concurrent
clients making 1000 requests, total) the controller objects were
instantiated 1000 times...

Is that the expected behaviour with paster serve? Does anyone know if
mod_wsgi, for example, is different?

The reason I ask is that I need (non-DB) connections in my controller
methods which are fairly expensive to create. If controller
instantiation is once per thread, I'll need to create a connection
pool, populate it at startup and manage it over time; is there a best
practice for this?

Perhaps even a drop-in connection pooling mechanism for Pylons/TG2?

Thanks!
James

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to