[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apache2 with Plack;



Hi Marjan,

On Mon, May 16, 2016 at 9:32 PM, Marjanw <..hidden..> wrote:
Hi all,

After I got my new LSMB environment (1.4.27 / AMD-450) up and running
I was a bit surprised to find it performing about the same as my old
LSMB environment (1.2.26 / AMD Duron 800MHz).
Ok, the AMD-450 (2x 1.65GHz) isn't a beast, but 10 secs to list
the Belgium COA on the screen is a long time!

It definitely is! Before you spend more time on various installations, you want to upgrade to 1.4.28. There's a bug in the CoA screen of all 1.4 versions up to and including 1.4.27 which makes it run WAAYYYY too long. (It's not Perl performance here, it's the underlying query that's simply not as efficient as it can be).

We had an instance where it took up to 23 secs run the CoA query. With 1.4.28, that's now 100ms. 230x faster!
 
You may want to try that before you try any of the other installation options.

So I gave starman a try, using the instructions in the INSTALL.
The Belgium COA now took 7 secs to complete due to better Perl
performance!

Well, and if you upgrade to 1.4.28, the response will "feel" instantaneous.
 
On the other hand most of us are familiar with Apache.
Apache can serve both static and dynamic content, offers virtual
hosting, etc. Wouldn't it be nice if we could use LSMB on Apache
in a faster configuration than good old slow CGI?

Absolutely. That's why we have been working to achieve exactly that! And Plack is indeed the answer. The easiest/best way to achieve it, I would expect is to run Apache2 with mod_fastcgi. Unfortunately, that's not in Debian's base repository; it's in the non-free repo. mod_fastcgi can be used with 'plackup -s FCGI tools/starman.psgi' (never mind that you're not using it with Starman, but plackup instead) where mod_fastcgi will manage starting and stopping the fastcgi server process. Unfortunately, I don't have the entire configuration file ready to provide you, but the 1.5 version has a configuration which lets Apache serve static files and passes the rest to Starman (note: starman, not plackup; you need to change the config to achieve that).

I looked at the Dancer deployment page and learned that you can
run Dancer from Apache with Plack via mod_perl.
I installed mod_perl from Debian Jessie.
Using https://metacpan.org/pod/Plack::Handler::Apache2 I modified
the ledgersmb-httpd-2.4.conf and created a startup.pl to preload
the application.

What is "the application" to you? Do you preload the same modules as LedgerSMB/PSGI.pm? Or more? All modules *not* preloaded in LedgerSMB/PSGI.pm aren't expected to be "preloading compatible".
 
After some troubleshooting I managed to get Apache running and
the application preloading without any errors in the Apache 
error.log file.
 
Very nice. Once it's working, could you share your setup, so we can include it in our 1.4 and 1.5 configuration examples?

However when I try to login the application fails:

2016/05/16 17:22:14 - ERROR - LedgerSMB::_error /opt/ledgersmb/1.4.27/LedgerSMB.pm (639) -- Not a HASH reference at /opt/ledgersmb/1.4.27/LedgerSMB/Template/HTML.pm line 90.

What's going wrong here? 
Looks if something isn't properly initialized.

Could be. Without your startup.pl, it's a bit hard to tell what exactly might have gone wrong. Can you send your startup.pl? That way we can have a look at what might be the cause. On a Starman-hosted setup, I'm definitely not seeing that error.



--
Bye,

Erik.

http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Ledger-smb-users mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-users