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

Dietrich Streifert dietrich.streifert at visionet.de
Mon Jul 19 11:29:31 EDT 2010



Am 19.07.2010 17:20, schrieb Mark Fuller:
> On Mon, Jul 19, 2010 at 4:16 AM, Dietrich Streifert
> <dietrich.streifert at visionet.de>  wrote:
>> I'm currently using speedy_cgi as a persistent perl process and wanted
>> to test if fcgi would be an option for me.
> Is speedy_cgi safe to use for a larger, longer-term application?
> (I.e., widely used, still maintained?). The last time I looked at it,
> I got the impression it was a niche tool. (It hadn't been updated
> since 2003, wasn't part of CPAN.). It looked like something that
> served a purpose a few years ago and fell into disuse(?).

 From my experience yes. I'm running four webapps, the oldest since 
nearly 6 years now without any problems. As soon as you get the compile 
and test managed by finding patches for perl 5.10 and some other bugs it 
is rock solid.

> Regarding your DB connections, all DB connections should be wrapped in
> an eval so you can catch failures. What I do is lazy connecting. I let
> the first DB operation die (in the eval), and perform the connection
> at that part (as part of an error-recovery routine to retry failures
> 3-4 times with increased waits between tries). Therefore, I'm just
> passing around a class variable (a reference to it) which requires no
> initialization at instantiation.

That is what I'm actually doing. I use dbh->ping() to test if the 
connection is still active and reconnect to the db if needed. The 
db-handles are stored within an instance variable of my cgiapp derived 
class.

> It's just a matter of turning around how you think of your DB
> connection. An initialization process? Or, a reference to a handle
> that can be initialized when necessary (after the first try which
> fails, or any subsequent try that fails).
>

-- 
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