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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.