Tomcat 7性能问题(WIN 7 x64)

时间:2021-05-04 04:07:01

I have Apache Tomcat 7 running on Win 7 x64 (using jdk_1.8.), running web application which corporate with MYSQL database. When size of devices which needs to be requested (TCP/IP) increase - some of devices do not respond promptly - Apache starts to have issues with performance. I've read that changing settings of database doesn't really matter, although it is already prepared to deal with huge projects. So assuming that it is not database fault, I have still troubles with tomcat settings. In server.xml ( ~\apache\conf\server.xml) I have followng settings:

我让Apache Tomcat 7运行在win7 x64(使用jdk_1.8)上,运行与MYSQL数据库兼容的web应用程序。当需要请求的设备(TCP/IP)的大小增加时(有些设备不能及时响应),Apache就开始出现性能问题。我读到过,更改数据库设置并不重要,尽管它已经准备好处理大型项目。因此,假设这不是数据库错误,我仍然对tomcat设置有问题。在服务器上。我有以下设置:

<Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" 
           maxThreads="1000" minSpareThreads="100"
           connectionTimeout="20000" 
           acceptCount="500"
           redirectPort="8443"
           compression="on"  
           compressionMinSize="2048"  
           noCompressionUserAgents="gozilla, traviata"  
           compressableMimeType="text/html,text/xml,text/javascript,application/x-javascript,application/javascript"
           />

Java JRE settings: -Xms8192m -Xms16384 -Xss512k

Java JRE设置:-Xms8192m -Xms16384 -Xss512k

In Tomcat I have following settings: http://fotoo.pl/show.php?img=899435_1.png.html

在Tomcat中,我有以下设置:http://fotoo.pl/show.php?

Print screen from Apache Tomcat 7 generating many exceptions and warning because pool size is still to small and some requests must be refused http://fotoo.pl/show.php?img=899437_bezntytu-u.png.html

从Apache Tomcat 7中打印屏幕,生成许多异常和警告,因为池大小仍然很小,必须拒绝一些请求(http://fotoo.pl/show.php?img=899437_bezntytu-u.png.html)

My question is how to set those settings ( in server.xml and in Apache Tomcat Properties ) if I have machine dedicated to run only this server and I have 32GB CACHE memory, Proccessor Intel Core i7-4930K 3.30 GHz and SSD disks to improve preformance of my Tomcat.

我的问题是如何设置这些设置(在服务器中)。如果我有专门用于运行此服务器的机器,并且我有32GB的缓存内存,Proccessor Intel Core i7-4930K 3.30 GHz和SSD磁盘,以改进Tomcat的性能。

If you need to get any additional information to answer my question do not afraid to ask.

如果你需要更多的信息来回答我的问题,不要害怕问。

1 个解决方案

#1


0  

Take it: Windows is not the best OS for serving WebApps. Quite the contrary. The file systems are outright horrible ( both NTFS and ReFS are around 20% slower than an untuned ext4 or xfs). Then you have the RAM overhead for the GUI. And the crazy memory management based on the idea that unused RAM is good RAM (because processes might request some in the future) and therefor it actively pages out to keep as much physical RAM as possible free.

这么说吧:Windows并不是为WebApps服务的最佳操作系统。恰恰相反。文件系统非常糟糕(NTFS和ReFS都比未调优的ext4或xfs慢20%左右)。然后有GUI的RAM开销。基于未使用的RAM是很好的RAM(因为进程将来可能会请求一些内存)的想法的疯狂内存管理,因此它会主动地进行分页,以保持尽可能多的物理RAM是空闲的。

The acceptcount value does not make sense, too: putting a lot of requests into a queue does not help increasing the performance. It just hides the actual problems. Set it to a low value, as this is only meant to give a small buffer for peaks. Plus, it eats up RAM for the processes doing the jobs.

acceptcount的值也没有意义:将大量的请求放到队列中无助于提高性能。它只是隐藏了实际的问题。将它设置为一个低值,因为这只意味着为峰值提供一个小的缓冲区。另外,它会占用执行任务的进程的RAM。

Maxthreads means that up to 1k connections might be opened to your DB, too. I assume here is the bottleneck. Plus: if you have 1k concurrent users, that means that there are only 16MB of RAM for each user available (yeah, rough calculation, but it makes the point obvious). Depending on your application, expect a concurrent user to need much more. I have seen applications where the RAM / concurrent user was exceeding 200MB.

Maxthreads意味着多达1k的连接也可能被打开到您的DB。我假设这是瓶颈。另外:如果有1k个并发用户,这意味着每个可用用户只有16MB的RAM(是的,粗略的计算,但这一点很明显)。根据应用程序的不同,可以预期并发用户需要更多。我见过内存/并发用户超过200MB的应用程序。

So all in all I'd say that you have to both scale up and out.

所以总的来说,我要说的是你必须同时扩大和缩小。

Totally biased note: If the machine is dedicated, use GNU/Linux or Unix.

完全有偏见的注意:如果机器是专用的,使用GNU/Linux或Unix。

#1


0  

Take it: Windows is not the best OS for serving WebApps. Quite the contrary. The file systems are outright horrible ( both NTFS and ReFS are around 20% slower than an untuned ext4 or xfs). Then you have the RAM overhead for the GUI. And the crazy memory management based on the idea that unused RAM is good RAM (because processes might request some in the future) and therefor it actively pages out to keep as much physical RAM as possible free.

这么说吧:Windows并不是为WebApps服务的最佳操作系统。恰恰相反。文件系统非常糟糕(NTFS和ReFS都比未调优的ext4或xfs慢20%左右)。然后有GUI的RAM开销。基于未使用的RAM是很好的RAM(因为进程将来可能会请求一些内存)的想法的疯狂内存管理,因此它会主动地进行分页,以保持尽可能多的物理RAM是空闲的。

The acceptcount value does not make sense, too: putting a lot of requests into a queue does not help increasing the performance. It just hides the actual problems. Set it to a low value, as this is only meant to give a small buffer for peaks. Plus, it eats up RAM for the processes doing the jobs.

acceptcount的值也没有意义:将大量的请求放到队列中无助于提高性能。它只是隐藏了实际的问题。将它设置为一个低值,因为这只意味着为峰值提供一个小的缓冲区。另外,它会占用执行任务的进程的RAM。

Maxthreads means that up to 1k connections might be opened to your DB, too. I assume here is the bottleneck. Plus: if you have 1k concurrent users, that means that there are only 16MB of RAM for each user available (yeah, rough calculation, but it makes the point obvious). Depending on your application, expect a concurrent user to need much more. I have seen applications where the RAM / concurrent user was exceeding 200MB.

Maxthreads意味着多达1k的连接也可能被打开到您的DB。我假设这是瓶颈。另外:如果有1k个并发用户,这意味着每个可用用户只有16MB的RAM(是的,粗略的计算,但这一点很明显)。根据应用程序的不同,可以预期并发用户需要更多。我见过内存/并发用户超过200MB的应用程序。

So all in all I'd say that you have to both scale up and out.

所以总的来说,我要说的是你必须同时扩大和缩小。

Totally biased note: If the machine is dedicated, use GNU/Linux or Unix.

完全有偏见的注意:如果机器是专用的,使用GNU/Linux或Unix。