[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[5187] addons/1.3
- Subject: SF.net SVN: ledger-smb:[5187] addons/1.3
- From: ..hidden..
- Date: Tue, 13 Nov 2012 10:35:41 +0000
Revision: 5187
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5187&view=rev
Author: einhverfr
Date: 2012-11-13 10:35:41 +0000 (Tue, 13 Nov 2012)
Log Message:
-----------
Adding FCGI handler
Added Paths:
-----------
addons/1.3/plack-fcgi/
addons/1.3/plack-fcgi/trunk/
addons/1.3/plack-fcgi/trunk/README
addons/1.3/plack-fcgi/trunk/app.psgi
Added: addons/1.3/plack-fcgi/trunk/README
===================================================================
--- addons/1.3/plack-fcgi/trunk/README (rev 0)
+++ addons/1.3/plack-fcgi/trunk/README 2012-11-13 10:35:41 UTC (rev 5187)
@@ -0,0 +1,26 @@
+README for Plack FCGI interface for LedgerSMB
+Chris Travers
+2012-11-13
+----------------
+
+This addon provides an app.psgi for LedgerSMB which allows you to properly run
+servelets as fcgi scripts instead of as CGI scripts. This makes LedgerSMB
+significantly more responsive but performance is more difficult to manage under
+load.
+
+The current module preloads a fair number of modules and then runs a
+fork/wait/execute loop where the less safe code is run. This performs well on
+platforms which provide copy on write functionality, but may not perform as well
+on Windows. The startup overhead for the dependencies is thus limited in this
+case to a one-time load on starting the servelet. Tests suggest that this
+eliminates 2/3 or more of the startup overhead.
+
+By default this currently starts up to 10 processes. This number can be
+tweaked.
+
+To run the servelet, you will need to run the following from a startup script
+somewhere:
+
+plackup -s FCGI -D --listen /var/run/httpd/fastcgi/lsmb.sock
+
+
Added: addons/1.3/plack-fcgi/trunk/app.psgi
===================================================================
--- addons/1.3/plack-fcgi/trunk/app.psgi (rev 0)
+++ addons/1.3/plack-fcgi/trunk/app.psgi 2012-11-13 10:35:41 UTC (rev 5187)
@@ -0,0 +1,45 @@
+#!/usr/bin/plackup -s FCGI ledgersmb.fcgi
+
+package LedgerSMB::FCGI;
+
+use CGI::Emulate::PSGI;
+use FCGI::ProcManager;
+use FindBin;
+# Preloads
+use LedgerSMB;
+use LedgerSMB::Form;
+use LedgerSMB::Sysconfig;
+use LedgerSMB::Template;
+use LedgerSMB::Template::LaTeX;
+use LedgerSMB::Template::HTML;
+use LedgerSMB::Locale;
+use LedgerSMB::DBObject;
+use LedgerSMB::File;
+
+BEGIN {
+ lib->import($FindBin::Bin) unless $ENV{mod_perl}
+}
+
+# Process Manager
+my $proc_manager = FCGI::ProcManager->new({ n_processes => 10 });
+
+
+my $app = CGI::Emulate::PSGI->handler(
+ sub {
+ if (my $cpid = fork()){
+ wait
+ } else {
+ $proc_manager->pm_pre_dispatch();
+ $uri = $ENV{REQUEST_URI};
+ $uri =~ s/\?.*//;
+ $ENV{SCRIPT_NAME} = $uri;
+ $ENV{SCRIPT_NAME} =~ m/([^\/\\]*.pl)\?*.*$/;
+
+ my $script = $1;
+ warn $script;
+ do "./$script";
+ $proc_manager->pm_post_dispatch();
+ }
+ }
+);
+
Property changes on: addons/1.3/plack-fcgi/trunk/app.psgi
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.