• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 20. Server Performance > Use Servlets or Server APIs

20.8. Use Servlets or Server APIs

If you have to generate dynamic content, user your server API or Java servlets rather than slow CGI. CGI depends on forking user processes for each request. This works well with light loads, but becomes a bottleneck as the load gets heavier, for the same reason that inetd-spawned servers don't scale well. Servlets and server API's scale better.

20.8.1. CGI Internals and Performance Problems

Though the CGI mechanism for generating dynamic web content is very versatile, the basic structure of CGI limits its performance. The main performance penalty is that a new instance of the program is executed for each user's request. This process exits immediately after sending its output back to the web server for forwarding to the browser. If the CGI program opens a database connection, the database connection must be reopened for the next instance of the CGI. This load on the operating system severely limits the number of CGI requests that can be serviced per second. CGI execution time is likely to be the bottleneck under any but the lightest loads. CGIs typically take far more CPU and other resources than serving HTML pages.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint