Spring MVC Rest Services-线程数(控制器实例) [英] Spring MVC Rest Services - Number of Threads (Controller Instances)

查看:224
本文介绍了Spring MVC Rest Services-线程数(控制器实例)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的应用程序中,我们希望实现更高的吞吐量,所以我只想知道Spring MVC控制器中的线程工作原理.

In our application we want to achieve higher throughput so I just want to know how threading works in Spring MVC controllers.

预先感谢您的帮助.

这对我有帮助

http://community.jaspersoft.com/wiki/如何增加最大线程数-tomcat级

推荐答案

在应用程序服务器(例如tomcat)中托管了一个Web应用程序.通常,应用程序服务器管理线程池,每个请求都由线程处理.

A web application is hosted in an application server (like tomcat). Usually the application server manage a thread pool and every request is handled by a thread.

Web应用程序不必担心此线程池.线程池的大小是应用程序服务器的参数.

The web application don't have to worry about this thread pool. The size of the thread pool is a parameter of the application server.

实现更高的吞吐量,您确实需要确定瓶颈.

To achieve higher throughput you really need to identify the bottleneck.

(根据我的经验,应用程序服务器的线程池的大小很少是性能问题的根本原因.)

(According my experience, the size of the thread pool of the application server is rarely the root cause of performance problem.)

请注意,控制器实例数"通常为一.即控制器通常是所有线程共享/使用的单例,因此控制器必须是线程安全的.

Note that the "number of controller instances" is normally one. i.e. a controller is usually a singleton shared/used by all threads, and therefore a controller must be thread-safe.

这篇关于Spring MVC Rest Services-线程数(控制器实例)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆