轉:Servlets vs CGI

Advantages of servlets over CGI processes

 

  • have significantly less overhead
  • can inherit processing state between invocations
  • can use concurrency control in Java to share state at server

Servlets compared to CGI programs

 

  • are slower only when being initially loaded
  • are rather faster to run when loaded

Servlets can

 

  • open a database connection when initially loaded

     

  • share open DB connection with successive invocations

CGI programs have to renew DB connection each time they're run.

Servlets can

 

  • store state information in static variables in servlet

     

  • share access to state data each time servlet is run

     

  • control concurrent access to shared state easily

CGI programs lack common address space to share state easily.

Disadvantages of servlets over CGI processes

 

  • cruder model of concurrency (thread vs process scheduling)

     

  • less robust - share common address space in JVM process

     

  • more complex to write, handle and configure
地址:http://www.macs.hw.ac.uk/cs/online/3ni3/4/11.htm
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章