日期:2014-05-16  浏览次数:20831 次

90条线程同时跑, 线程池设置最小90,最大100..Xeon 四核心.Mysql出错
90条线程同时跑, 线程池设置最小90,最大100..Xeon 四核心.Mysql出错
我猜想是因为CPU达到了400%,MYSQL没响应造成了.  四核心就能达到400.OS 是 CentOS5.2

开始我是把程序设置到180个并发.频繁出现 以下情况.并且CPU占用高的,时间长. 但是没有死锁.
所以我就调小一半了.基本上还好.就是程序运行开始的几分钟出现CPU达400%.
我准备调小到45个并发
top
.
23460 james     18   0 1479m 259m 9068 S  399  6.6  50:27.97 java                                                  


==========INSERT into shopproduct is Ok===========
=========insert=======Price================
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Last packet sent to the server was 0 ms ago.
        at sun.reflect.GeneratedConstructorAccessor31.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
        at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2103)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:718)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
        at sun.reflect.GeneratedConstructorAccessor6.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
        at java.sql.DriverManager.getConnection(DriverManager.java:582)
        at java.sql.DriverManager.getConnection(DriverManager.java:185)
        at java_sql_DriverManager$getConnection.call(Unknown Source)
        at CategoryThread.insertPrice(PriceThread-v2.groovy:453)
        at CategoryThread$insertPrice.call(Unknown Source)
        at CategoryThread.run(PriceThread-v2.groovy:253)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Last packet sent to the server was 0 ms ago.
        at sun.reflect.GeneratedConstructorAccessor31.newInstance(Unknown Source)
     &