Ratelimit callbacks suppressed

最近在查一个问题的时候看了看系统的messages,然后无意中注意到好多这样的错误,贴一点日志片段:

Jan  6 10:07:06 yq155 kernel: __ratelimit: 1957 callbacks suppressed
Jan  6 10:07:06 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:06 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:06 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:06 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:06 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:06 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:06 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:06 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:06 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:06 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:11 yq155 kernel: __ratelimit: 2023 callbacks suppressed
Jan  6 10:07:11 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:11 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:11 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:11 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:11 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:11 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:11 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:11 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:11 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:11 yq155 kernel: TCP: time wait bucket table overflow
Jan  6 10:07:17 yq155 kernel: __ratelimit: 194 callbacks suppressed

google了一把,搜到了 http://zszsit.blogspot.com.br/2012/10/ratelimit-callbacks-suppressed.html 这篇牛逼的文章,我看了一下服务器的配置,还真是这样的设置:

[root@yq155.webinternal /var/log]#  cat /proc/sys/kernel/printk_ratelimit
5
[root@yq155.webinternal /var/log]#  cat /proc/sys/kernel/printk_ratelimit_burst
10

这也正好迎合了上面的日志为什么间隔都是5S了,原因是因为这个10条/5秒的配额干掉了其他的系统日志。怎么解决这个问题呢?那首先肯定还是要优化产生这么多问题的原因了,例如TCP的time wait,这么多的wait肯定是有问题的;其次还可以稍微调大这个坑爹的10条/5S的配额值。设置/etc/sysctl.conf:

kernel.printk_ratelimit = 30
kernel.printk_ratelimit_burst = 200