in reply to Tomcat, CGI scripts and DBI connection persistence

One option: write a standalone Perl program that runs as a daemon/service; that program maintains the database connection and answers requests from the cgi-bin/<scriptname>.pl programs. (Communication to the standalone program via socket, pipe, etc.)

  • Comment on Re: Tomcat, CGI scripts and DBI connection persistence

Replies are listed 'Best First'.
Re^2: Tomcat, CGI scripts and DBI connection persistence
by spx2 (Deacon) on Oct 30, 2011 at 11:06 UTC
    That's a good idea, but wouldn't that induce additional overhead ? opening the socket, passing data through, receiving it .. ?

      There would be overhead, but how do the cgi-bin/<scriptname>.pl programs communicate with the DB? That has all the same overhead, plus the database's authentication.

      If the individual programs typically run a small number of queries per invocation then the overhead of DB authentication is relatively more significant.

      Also, if the website is heavily used the DB might be "happier" with a small number of connections making many queries vs many connections making few queries each.