What is design principle behind Servlets being Singleton
- by Sandeep Jindal
A servlet container "generally" create one instance of a servlet and different threads of the same instance to serve multiple requests. (I know this can be changed using deprecated SingleThreadModel and other features, but this is the usual way).
I thought, the simple reason behind this is performance gain, as creating threads is better than creating instances. But it seems this is not the reason.
On the other hand, creating instances have little advantage that developers never have to worry about thread safety.
I am trying to understand the reason for this decision over the trade-off of thread-safety.