Reputation: 273
I am using Spring MVC for a web app
The response time is around 250ms and speed is everything with this app
So when it comes to defining the Controller classes I have made then prototype so many can be running at the same time. The app is stateless
I hope to do some performance test soon but wanted to get opinions if making controller classes prototype would improve performance over singleton?
Upvotes: 0
Views: 684
Reputation: 1419
Unless your controller methods are not thread-safe it is better to use "singleton" option. As otherwise any a new instance is created for each request.
But actually I don't think you will notice a great difference in performance for a single request as an overhead of new instance creation should be very small.
Upvotes: 3