[issue2551112] Trigger preloading of modules and template compilation with WSGI

Robert Klonner <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
New submission from Robert Klonner:

As discussed with Ralf Schlatterbeck we should add the tracker 
initialization to the init function of the class RoundupDispatcher. 
Otherwise compilation of TAL templates and loading of python modules 
and libraries happends during the first request to Roundup.

This issue poped up during experimentation with pre-loading and lazy 
loading of WSGI processes with Apache. With this patch the request time 
for a rest api call from the first request dropped down from 2 seconds 
to 450ms.

diff --git a/roundup/cgi/wsgi_handler.py b/roundup/cgi/wsgi_handler.py
index 767221ac..ef4547a1 100644
--- a/roundup/cgi/wsgi_handler.py
+++ b/roundup/cgi/wsgi_handler.py
@@ -84,6 +84,9 @@ class RequestDispatcher(object):
                 tracker_home=home)
         else:
             self.translator = None
+        # trigger pre-loading of imports and templates
+        with self.get_tracker():
+            pass
 
     def __call__(self, environ, start_response):
         """Initialize with `apache.Request` object"""

----------
components: Infrastructure
messages: 7059
nosy: tttech-klonner
severity: normal
status: new
title: Trigger preloading of modules and template compilation with WSGI
type: resource usage
versions: 2.0.1

_________________________________________________
Roundup tracker <[email protected]>
<https://issues.roundup-tracker.org/issue2551112>
_________________________________________________
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.