RE: Moving ExecCGI to mod_perl - performance and custom 'modules' [EXT]

2021-02-07 Thread James Smith
As welsey said – try Registry, that was the standard way of using mod_perl to cache perl in the server – but your problem might be due to the note in PerlRun… https://perl.apache.org/docs/2.0/api/ModPerl/PerlRun.html#Description META: document that for now we don't chdir() into the script's dir

RE: Moving ExecCGI to mod_perl - performance and custom 'modules' [EXT]

2021-02-07 Thread Steven Haigh
Interestingly, I did get things working with ModPerl::PerlRegistry. What I couldn't find *anywhere* is that the data I was loading in Template Toolkit was included in the file in the __DATA__ area - which causes mod_perl to fall over! The only way I managed to find this was the following erro

RE: Moving ExecCGI to mod_perl - performance and custom 'modules' [EXT]

2021-02-07 Thread Steven Haigh
In fact, I just realised that 'ab' test is rather restrictive So here's a bit more of an extended test: # ab -k -n 1000 -c 32 Apache + ExecCGI: Requests per second:14.26 [#/sec] (mean) Time per request: 2244.181 [ms] (mean) Time per request: 70.131 [ms] (mea

Re: Moving ExecCGI to mod_perl - performance and custom'modules'[EXT]

2021-02-07 Thread Wesley Peng
If you can take time to rewrite all codes with modPerl handlers, that will improve performance a lot. On Sun, Feb 7, 2021, at 9:14 PM, Steven Haigh wrote: > In fact, I just realised that 'ab' test is rather restrictive So here's a > bit more of an extended test: > > # ab -k -n 1000 -c 32 >

Re:

2021-02-07 Thread Adam Prime
There is one other thing you can do relatively easily that may get you a marginal gain when Apache spins up new children. Load some or all of your Perl dependencies before Apache forks. There is also an opportunity to load other static resources at this time, but that can get a little more invol

RE: [EXT]

2021-02-07 Thread James Smith
This can be a bigger gain if you are limited with memory as multiple processes will share the same block of physical memory { so limiting swap } – this is one of the advantages of the mod_perl approach over the app approach in things like dancer. You have the flexibility to include what you want

Re: Moving ExecCGI to mod_perl - performance and custom 'modules' [EXT]

2021-02-07 Thread Vincent Veyron
On Sun, 07 Feb 2021 23:58:17 +1100 Steven Haigh wrote: > > I haven't gotten into the preload or DBI sharing yet - as that'll end > up needing a bit of a rewrite of code to take advantage of. I'd be open > to suggestions here from those who have done it in the past to save me > going down some

RE: Moving ExecCGI to mod_perl - performance and custom 'modules' [EXT]

2021-02-07 Thread James Smith
DBI sharing doesn't really gain you much - and can actually lead you into a whole world of pain. It isn't actually worth turning it on at all. We use dedicated DB caching in the cases where we benefit from it as and when you need it (low level caching database)... Although milage may vary - our

Re: Moving ExecCGI to mod_perl - performance and custom 'modules' [EXT]

2021-02-07 Thread John Dunlap
We're in a similar situation with 20-40 databases per server. We use PGBouncer for connection pooling. On Sun, Feb 7, 2021 at 2:23 PM James Smith wrote: > DBI sharing doesn't really gain you much - and can actually lead you into > a whole world of pain. It isn't actually worth turning it on at a

Re: Moving ExecCGI to mod_perl - performance and custom 'modules' [EXT]

2021-02-07 Thread Mithun Bhattacharya
DBI sharing has it's own issues but in most use cases it does a pretty good job and keeps the DBA's happy - that is very important ;) On Sun, Feb 7, 2021 at 2:23 PM James Smith wrote: > DBI sharing doesn't really gain you much - and can actually lead you into > a whole world of pain. It isn't ac

Re: Moving ExecCGI to mod_perl - performance and custom'modules'[EXT]

2021-02-07 Thread Chris
On Sun, Feb 07, 2021 at 09:21:41PM +0800, Wesley Peng wrote: > If you can take time to rewrite all codes with modPerl handlers, that will > improve performance a lot. I've never used Template, but I just eventually wrote all handlers. I moved from Registry to all handlers, bit by bit. You can mix

RE: Moving ExecCGI to mod_perl - performance and custom 'modules' [EXT]

2021-02-07 Thread James Smith
No it was one of our DBAs who told us to take if off…! It causes them all sorts of problems – the main one being it keeps connections open, which is the best way to completely foobar the database servers! We make them happy by turning it off. We’ve even had Oracle developers (sorry not people de

RE: Moving ExecCGI to mod_perl - performance and custom'modules'[EXT]

2021-02-07 Thread James Smith
Agree in this - you need to always think that a mod_perl app is running in a loop where each loop is an iteration, so if you don't initialise something at the start of the script - it can have the value at the end of it's last call Use Perl critic it is a good one to find your gotchas... Tr

Re: Moving ExecCGI to mod_perl - performance and custom 'modules' [EXT]

2021-02-07 Thread Wesley Peng
what's DBI sharing? do you mean Apache::DBI? Does perl has Java similar DB connection pool? Thanks. On Mon, Feb 8, 2021, at 4:21 AM, James Smith wrote: > DBI sharing doesn't really gain you much - and can actually lead you into a > whole world of pain. It isn't actually worth turning it on at al