网站closures…由于睡眠MySQL连接?

我刚刚inheritance了一个网站的pipe理,我发现一些问题:

当网站stream量达到峰值时(发生在某些分发列表/ RSS提要中),服务器变忙,然后被冻结(错误502)。

它是AWS托pipe的,通过Cloudwatch,我可以看到,在1-1:30小时(正常情况下,不会超过20%)的CPU使用率保持100%…在高stream量高峰(高达100倍非高峰时段的平均stream量)。

  • Apache请求每分钟,不PEAK:大约300
  • Apache请求每分钟,PEAK:大约3000

Tomcat和Grails的日志并不多说,“只是”这个,一遍又一遍:

[http-bio-8080-exec-299] ERROR util.JDBCExceptionReporter – [http-bio-8080-exec-299] Timeout:Pool empty。 无法在30秒内获取连接,没有可用[size:100; 忙:100; 空闲:0; lastwait:30000]。

所以我想问题是,如果有这么多的stream量,30秒的时间就变成了“敌人”,因为有太多的用户在等待服务。

数据库configuration,在应用程序级别是:

pooled = true

properties { maxActive = 100 maxIdle = 25 minIdle = 5 initialSize = 5 minEvictableIdleTimeMillis=300000 timeBetweenEvictionRunsMillis=300000 numTestsPerEvictionRun=3 testOnBorrow=true testWhileIdle=true testOnReturn=true validationQuery="SELECT 1" } 

有关如何调整这些值的任何build议?

谢谢!

更新:网站再次下降,我已经能够运行“顶部”的命令,这就是我所看到的:

 top - 18:46:33 up 2:42, 2 users, load average: 1.04, 1.56, 1.78 Tasks: 136 total, 1 running, 135 sleeping, 0 stopped, 0 zombie Cpu(s): 25.0%us, 0.2%sy, 0.0%ni, 0.0%id, 0.0%wa, 28.6%hi, 0.0%si, 46.1%st Mem: 3843124k total, 3385800k used, 457324k free, 42800k buffers Swap: 0k total, 0k used, 0k free, 681368k cached 1340 tomcat 20 0 3611m 2.3g 11m S 61.3 64.0 51:18.60 java 2609 root 20 0 15140 1252 916 R 0.3 0.0 0:00.14 top 1 root 20 0 19488 1600 1284 S 0.0 0.0 0:00.88 init 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:00.23 ksoftirqd/0 4 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0 ...