|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: Re: using single Sybase connection for parallel processes ?
Date: Nov 6 1997 3:41PM
Vaclav Ovsik wrote:
>
> I'm using Sybperl + Open Market FastCGI + Apache WEB server.
> My application create one connection to SQL server when start.
> Behavior FastCGI interface is as server when accepting requests
> from WEB server.
>
> Fragment of code:
> ######
> use FCGI;
>
> $syb = Sybase::CTlib->ct_connect(...)
> while(FCGI::accept() >= 0) {
> ....
> }
> ######
>
> or (when using functionality of package CGI.pm)
>
> ######
> use CGI::Fast;
>
> $syb = Sybase::CTlib->ct_connect(...)
> while( $q = new CGI::Fast ) {
> .....
> }
> ######
> I do'not know if this construction is ok. Aplication seems to work ok,
> but I tested it only with small load on webserver (one web browser only).
> It is clear, that when load on server will be increased, then aplication
> will go to fork to more parallel processes.
>
> Q: Can be used single connection to SQL server for more
> simultanously running processes (in while loop) ?
If you make sure that the ct_connect call happens after the
fork() then you should be fine - calls to sybase within one
instance of the FastCGI server should be serialized.
If the fork() happens after the call to ct_connect then you're going
to have problems because each instance of the FastCGI server use
the same copy of the connection which can't work.
Michael
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@datamig.com -||- http://www.mbay.net/~mpeppler
|