[cgiapp] use persisten instance of cgiapp with cgi::fast?

Dietrich Streifert dietrich.streifert at visionet.de
Mon Jul 19 10:09:26 EDT 2010


  Thank you for your answer Michael!

I think most of the performance penalty comes from the DBI-handles which 
are not kept open between the requests. Every instance opens two 
DBI-handles which are used frequently during runmodes.

There are also some big hashes being initialised as well as more than 50 
runmodes being setup each time. Additionally there is a reopen of STDERR 
into a file in cgiapp_init which is called on every new instance but 
only once if the instance is reused.

Fact is that using speedy_cgi is a lot more responsive compared to 
cgi::fcgi.

So it seems to me that using cgi::fcgi with a new instance of cgiapp on 
every request is half the way between normal CGI and speedy_cgi 
regarding responsivenes (performance).



Am 19.07.2010 15:42, schrieb Michael Peters:
> On 07/19/2010 07:16 AM, Dietrich Streifert wrote:
>
>> As the method implies a new instance of my cgiapp is created for every
>> request. With speedy_cgi I used to only create a cgiapp instance once
>> and reuse it on request. I consider my cgiapp to be a big one and it
>> would benefit a lot from being instantiated once and  the instance
>> reused often.
>
> Are you sure? Have you benchmarked it? It doesn't matter how much code 
> is in your application or how many modules you are pulling in since 
> that's a one time compilation hit at startup.
>
> The only thing I can think of one reason to not want to call new() on 
> every request and that is if you are doing something intensive at init 
> or setup time.
>

-- 
Mit freundlichen Grüßen
Dietrich Streifert
--
Visionet GmbH
Firmensitz: Am Weichselgarten 7, 91058 Erlangen
Registergericht: Handelsregister Fürth, HRB 6573
Geschäftsführer: Stefan Lindner





More information about the cgiapp mailing list