What were the main disadvantages of CGI-BIN based web development?

…衆ロ難τιáo~ 提交于 2019-12-03 15:42:13

The fundamental architectural issue with CGI-BIN based systems is that each HTTP request requires the server to start a new process. This affects performance in a number of ways:

  • It's expensive to start the process, as the OS pages in the program, sets up the process, etc.
  • Resources can not be shared across requests, so that any DB connections, etc. have to be set up with each request
  • User session state can not be preserved in memory, so it has to be persisted with each request

For me the biggest pain with CGI is that my CGI programs have to "learn" everything each time they start up. If they were running constantly that wouldn't be the case, of course...

The main disadvantage, IMHO, was the same disadvantage that all lower-level coding has - instead of programming in the problem domain, you had to program in the implementation domain. The end result was, at its core, identical - an HTTP response was sent to a client based on an HTTP request. However, getting to that point was a lot trickier from a programming perspective.

Apache has several solutions to this for various languages (e.g. mod_perl) so that a script is only invoked once, then held in memory for fast retrieval. There are still plenty of GCI-protocol driven sites out there, many of which run with reasonably low latency, if well-coded and set up.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!