314
edits
Zachlipton (talk | contribs) No edit summary |
Zachlipton (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
== | == Introduction == | ||
As of August 2006, Litmus uses mod_perl to improve performance. Typically, normal CGI scripts must be compiled by the perl interpreter for each http request. Furthermore, every request requires that perl load and compile all the perl modules Litmus uses, connect to the database, go through the Template Toolkit's initialization routines, and all sorts of other activities before Litmus even gets started processing a particular request. mod_perl performs this initialization step only once--at web server startup time--and runs the script within the context of an already running perl interpretor. | As of August 2006, Litmus uses mod_perl to improve performance. Typically, normal CGI scripts must be compiled by the perl interpreter for each http request. Furthermore, every request requires that perl load and compile all the perl modules Litmus uses, connect to the database, go through the Template Toolkit's initialization routines, and all sorts of other activities before Litmus even gets started processing a particular request. mod_perl performs this initialization step only once--at web server startup time--and runs the script within the context of an already running perl interpretor. | ||
Line 8: | Line 8: | ||
See also the [http://perl.apache.org/docs/1.0/guide/porting.html mod_perl porting guidelines] for further details. | See also the [http://perl.apache.org/docs/1.0/guide/porting.html mod_perl porting guidelines] for further details. | ||
== Web Server Restarting / Module Persistence == | |||
Under mod_perl, modules are not reloaded on each http request. This means that if you update Litmus or modify a .pm file within the Litmus tree, those changes will not be picked up until the web server is restarted. | Under mod_perl, modules are not reloaded on each http request. This means that if you update Litmus or modify a .pm file within the Litmus tree, those changes will not be picked up until the web server is restarted. | ||
Line 15: | Line 15: | ||
On rodan, members of group 'litmus' may trigger a web server restart with the command 'litmus-restart'. Use with extreme caution and fix any errors immediately. | On rodan, members of group 'litmus' may trigger a web server restart with the command 'litmus-restart'. Use with extreme caution and fix any errors immediately. | ||
== Global Variables == | |||
Another issue to be aware of when coding for mod_perl is global variables. Unless measures are taken, global variables will not be automatically reset between requests. See the [http://perl.apache.org/docs/1.0/guide/porting.html mod_perl porting guidelines] for more information. | Another issue to be aware of when coding for mod_perl is global variables. Unless measures are taken, global variables will not be automatically reset between requests. See the [http://perl.apache.org/docs/1.0/guide/porting.html mod_perl porting guidelines] for more information. | ||
Litmus provides a special object cache (ripped off from Bugzilla) that ensures that global variables stored in the cache will be destroyed after each request. This cache is used for global objects such as the current CGI.pm or Template.pm instance. These variables may be accessed through Litmus.pm as before. Scripts can also use the object cache to store global data if needed (although good design dictates that globals should be avoided whenever possible). Information on how to do so can be found in Litmus.pm. | Litmus provides a special object cache (ripped off from Bugzilla) that ensures that global variables stored in the cache will be destroyed after each request. This cache is used for global objects such as the current CGI.pm or Template.pm instance. These variables may be accessed through Litmus.pm as before. Scripts can also use the object cache to store global data if needed (although good design dictates that globals should be avoided whenever possible). Information on how to do so can be found in Litmus.pm. | ||
== Module Dependency Loops == | |||
Under mod_cgi, perl scripts could often get away with dependency loops where module A.pm used B.pm and B.pm used A.pm. However, mod_perl typically chokes on these module dependency loops and the error messages it generates are often not helpful (usually they involve "subroutine x does not exist" errors). | Under mod_cgi, perl scripts could often get away with dependency loops where module A.pm used B.pm and B.pm used A.pm. However, mod_perl typically chokes on these module dependency loops and the error messages it generates are often not helpful (usually they involve "subroutine x does not exist" errors). | ||
The current mod_perl enabled version of Litmus contains no such loops. Zach has some fancy graphing tools adapted from the Bugzilla project that map the dependency tree and highlights duplicates. If you're trying to resolve a dependency loop issue, he can get you a copy of the graphing tools. | The current mod_perl enabled version of Litmus contains no such loops. Zach has some fancy graphing tools adapted from the Bugzilla project that map the dependency tree and highlights duplicates. If you're trying to resolve a dependency loop issue, he can get you a copy of the graphing tools. |
edits