Regarding compiling URLconf regexps in the documentation: "This is
blazingly fast, because the regular expressions are compiled at load
time."

If I'm reading that correctly, that means that the compiled regexps
are available to all requests, without recompilation, for the lifetime
of that particular server thread or process. Correct me if that's
wrong.

I come from a PHP, shared-nothing type of background. I'm working on a
Django project that will probably get quite a bit of traffic and has
to interface with a legacy backend on every request. Instantiating a
backend client connection for each request is unnecessary overhead,
because the process is quite expensive. What I'm interested in is, how
could I instantiate this client once and have every request to that
server thread/process just share that client for the lifetime of the
said thread or process?

Would it be enough to simply instantiate the client at the top of
views.py, before defining view functions, and then just call that
shared client instance from inside the views, or does the client
instance have to be manually assigned to the current process/thread
namespace/context/(other proper term) by using some Python
functionality built for this?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to