O'Reilly logo

Web Performance Tuning by Patrick Killelea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CGI Database Access Performance

The principal performance concern with CGI database access is in eliminating the overhead of opening the database connection for each instance of the CGI. Opening a database connection can be very time-consuming and may require the loading of large libraries. It is worthwhile to buy or write a connection manager that opens the connection only once and brokers CGI requests to it, rather like FastCGI, but for database connections. RDBMS makers have realized this need for a fast or persistent connection and are now releasing products to fill the gap.

Another performance trick is to use one complex SQL query rather than multiple smaller queries, the results of which must be integrated by the CGI process before presentation to the user. Not only is the time spent in the SQL engine shorter overall, but the CGI does less work. Make the database do the work. See Chapter 17, for more tips.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required