CGI Database development
Posted in 1999
Topics: Performance & Tuning, Connectivity: ESQL/C, 4GL & Embedded SQL, Networking & sqlhosts Configuration
I would appreciate your help: I'm building a lot of CGI's to access the Informix Dynamic Server 7.3 Database, I'm using Unix C and ESQL/C and I want the best performance. Every CGI has to connect once it is run and disconnect once it has finhished running, since CGI is stateless. The problem is that every esqlc "connect" statement or "disconnect" takes up to 2 seconds to connect. I have tried to see if it was DNS by using the IP address in the sqlhosts file but it was still slow. I have also made some performance tests, running several connect's/disconnect's in sequence, I have noticed that it takes up to two second to do the first connect and all the others are imediate. any ideias how I can fix this? I really want to avoid having to make a daemon (that connect's in the beginning) with a protocol I have to establish, since that will take too much of my time. However I wont mind making a daemon that "emulates" the database server, in a way that I dont have to change the CGI's I have already made. thanx in advance, duarte
Hello, Look at FastCGI (http://www.fastcgi.com). Its C-interface is very similar to CGI, but FastCGI processes are persistent. It will allow you to use one open connection for several requests. You will not have to change your CGI-scripts significantly, just implement connection pool management.This protocol is supported by many Web-servers. Ilia. "Duarte Carlos" <Duarte.Carlos@tmn.pt> writes: > I would appreciate your help: > I'm building a lot of CGI's to access the Informix Dynamic Server 7.3 > Database, I'm using Unix C and ESQL/C and I want the best performance. > > Every CGI has to connect once it is run and disconnect once it has > finhished running, since CGI is stateless. > > The problem is that every esqlc "connect" statement or "disconnect" takes > up to 2 seconds to connect. > I have tried to see if it was DNS by using the IP address in the sqlhosts > file but it was still slow. > I have also made some performance tests, running several > connect's/disconnect's in sequence, I have noticed that it takes up to two > second to do the first connect and all the others are imediate. > > any ideias how I can fix this? > > > I really want to avoid having to make a daemon (that connect's in the > beginning) with a protocol I have to establish, since that will take too > much of my time. > However I wont mind making a daemon that "emulates" the database server, in > a way that I dont have to change the CGI's I have already made. > > thanx in advance, duarte