$uname -a
Linux debian-11-34 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-3~deb8u1 (2015-04-24) x86_64 GNU/Linux
 
经过测试Debina 8.0 已经解决了Aceept thundering herd 
 
 
# 1) run this script with either "accept" or "select-accept" as the argument
# (the script listens to 127.0.0.1:12345)
# 2) telnet localhost 12345
# 3) if you see "accept failed", there is the thundering herd problem
#
#
use strict;
use warnings;
use IO::Socket::INET;

my $mode = $ARGV[0] || '';
if ($mode !~ /^(accept|select-accept)$/) {
    die "Usage: $0 <accept|select-accept>\n";
}
my $listener = IO::Socket::INET->new(
                                     Listen => 5,
                                     LocalPort => 12345,
                                     LocalAddr => '127.0.0.1',
                                     Proto => 'tcp',
                                     ReuseAddr => 1,
                                     ) or die "failed to listen to port 127.0.0.1:12345:$!";

if ($mode eq 'select-accept') {
    $listener->blocking(0)
    or die "failed to set listening socket to non-blocking mode:$!";
}
my $pid = fork;
die "fork failed:$!"
unless defined $pid;
while (1) {
    if ($mode eq 'select-accept') {
        while (1) {
            my $rfds = '';
            vec($rfds, fileno($listener), 1) = 1;
            if (select($rfds, undef, undef, undef) >= 1) {
                last;
            }
        }
    }
    my $conn = $listener->accept;
    if ($conn) {
        warn "connected!";
        $conn->close;
    } else {
        warn "accept failed:$!";
    }

}

最新文章

  1. Docker Container 配置独立IP
  2. IT求职中,笔试、面试的算法准备
  3. Mockito自定义verify参数Matcher
  4. 第4章 jQuery的事件和动画(1)——事件篇
  5. linux下软件安装的方法
  6. AOP在 .NET中的七种实现方法
  7. [译]LINT TO SQL 介绍(数据库查询) - Part.3
  8. hdu 3646
  9. Exercise: Rot13 Reader
  10. 第七篇、CSS3新增属性
  11. 【iOS知识学习】_如何判断手机是否为静音模式
  12. javascript中的__proto__和prototype
  13. 一款好用的软件easyUI
  14. Linux命令行增强版
  15. Linux LVM扩容和缩容
  16. 没有 iOS 开发者账号的情况下部署到真机的方法
  17. 详解如何在 Linux 中安装最新的 Python 3.6 版本
  18. 远程图片转化为base64
  19. Java - 26 Java 数据结构
  20. Solr系列五:solr搜索详解(solr搜索流程介绍、查询语法及解析器详解)

热门文章

  1. 2018.10.10 Java的The superclass &quot;javax.servlet.http.HttpServlet&quot; was not found on the Java Build Path 错误
  2. SqlSugar之SqlQueryDynamic返回值处理
  3. EF执行SQL语句
  4. c语言描述的直接插入排序法
  5. svg了解一下
  6. CSS&amp;JS定位器
  7. CentOS 7安装Oracle (CentOS Linux release 7.5.1804)
  8. javascript跳转页面
  9. window.location.href 跳转无历史记录
  10. c c++面试----c工程开发之链接