What is a better approach for enabling thread-safe servlets and JSPs? SingleThreadModel Interface or Synchronization?
Although the SingleThreadModel technique is easy to use, and works well for low volume sites, it does not scale well. If you anticipate your users to increase in the future, you may be better off implementing explicit synchronization for your shared data. The key however, is to effectively minimize the amount of code that is synchronzied so that you take maximum advantage of multithreading.Also, note that SingleThreadModel is pretty resource intensive from the server's perspective. The most serious issue however is when the number of concurrent requests exhaust the servlet instance pool. In that case, all the unserviced requests are queued until something becomes free - which results in poor performance. Since the usage is non-deterministic, it may not help much even if you did add more memory and increased the size of the instance pool.
-
Interview Candidate
- Aug 27th, 2005
- 1
- 3437
Showing Answers 1 - 1 of 1 Answers
Related Answered Questions
Related Open Questions
What is a better approach for enabling thread-safe servlets and JSPs? SingleThreadModel Interface or Synchronization?
Related Answered Questions
Related Open Questions