【線上等】關於tomcat最大執行緒數滿導致服務停止

hawkingadmin發表於2006-08-17
我們伺服器的配置情況如下
P4 3.6
記憶體 1G
硬碟 SCSI 140 G 分割槽情況 /boot(500M) /SWAP (2048M) /(剩餘全部磁碟空間)
伺服器是新的HP全新配置
伺服器的WEB配置情況:紅旗LINUX5.0服務亞洲版+TOMCAT5.5.17+MYSQL5.0.22+JDK1.5.0.6
TOMCAT和 MYSQL以及JD的安配置過程我就不說了

現在的問題是:開發組十幾個人點選,頻繁重新整理(遨遊瀏覽器有個自動重新整理的功能^_^,我們每臺機器開了網站上15個左右視窗,設定成每隔10秒自動重新整理),結果不到十分鐘就TOMCAT就當機了
終端顯示錯誤如下:

嚴重:All threads (150) are currently busy, waiting. Increase maxThreads (150) or check the servlet status


程式是用的hibernate + spring

Connector port="80"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" />

我試圖把maxThreads改為999

Connector port="80"
maxThreads="999" minSpareThreads="25" maxSpareThreads="999"
enableLookups="false" redirectPort="8443" acceptCount="999"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" />

再測試 ,十多分鐘後問題依舊 報錯如下:
嚴重:All threads (999) are currently busy, waiting. Increase maxThreads (999) or check the servlet status
這個已經最大了 web server允許的最大連線數還受制於作業系統的核心引數設定,通常Windows是2000個左右,Linux是1000個左右。也就是說maxThreads最大連線數,不能高於一千。

並且我在catalina.sh中配置了JAVA_OPTS='-Xms256m -Xmx512m'最大記憶體




MYSQL的配置檔案 /etc/my.cnf

# The following options will be passed to all MySQL clients

[client]
password = your_password
port = 3306
socket = /tmp/mysql.sock

# Here follows entries for some specific programs

# The MySQL server

[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 384M
max_allowed_packet = 1M
table_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
back_log = 500
max_connections = 1024
default-character-set = gb2312
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
safe-updates

[isamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout


問題 :大家看是什麼問題,是TOMCAT的配置問題,還是MYSQL的問題
還是程式的問題,我們好象是用的tomcat自己帶的資料庫連線池,沒有用到
MYSQL官方網站上的連線池的jar檔案,不知道是不是這個的問題。




相關文章