ITeye博客

转:Servlets vs CGI

newand · 2008-04-01 10:06 · JAVA · Markdown

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。