我基本上想尝试像这样并行运行具有 10000 个连接的 httperf [httperf --uri / --server 192.168.1.2 --port 8080 --num-conns=500000 --rate 10000]
我在 Ubuntu 14.04 上运行它。
首先,我提高了系统文件描述符限制,这是我现在 SO 中配置的内容:
$ ulimit -a -S
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31348
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 65530
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 31348
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
$ulimit -a -H
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31348
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 65530
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 31348
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
我试图从 github 存储库编译 HEAD 版本,但它似乎完全不稳定。
我还尝试了 0.9.0 版本修改限制(更改 /usr/include/x86_64-linux-gnu/bits/typesizes.h 以解锁 FD_SETSIZE 1024),就像其他问题答案建议做的那样。重新编译 httperf 后,它一直返回相同的错误:
*** buffer overflow detected ***: ./httperf terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x73f1f)[0x7fdca440ef1f]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7fdca44a682c]
/lib/x86_64-linux-gnu/libc.so.6(+0x10a6f0)[0x7fdca44a56f0]
/lib/x86_64-linux-gnu/libc.so.6(+0x10b777)[0x7fdca44a6777]
./httperf[0x403c69]
./httperf[0x4047e7]
./httperf[0x4088df]
./httperf[0x408d2e]
./httperf[0x4071df]
./httperf[0x40730b]
./httperf[0x406791]
./httperf[0x405e0e]
./httperf[0x409afd]
./httperf[0x406022]
./httperf[0x404c1f]
./httperf[0x4024ac]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7fdca43bcec5]
./httperf[0x40358b]
======= Memory map: ========
00400000-00410000 r-xp 00000000 08:05 265276
0060f000-00610000 r--p 0000f000 08:05 265276
00610000-00611000 rw-p 00010000 08:05 265276
00611000-0068a000 rw-p 00000000 00:00 0
019da000-01c8f000 rw-p 00000000 00:00 0 [heap]
7fdca4185000-7fdca419b000 r-xp 00000000 08:06 3277773 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fdca419b000-7fdca439a000 ---p 00016000 08:06 3277773 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fdca439a000-7fdca439b000 rw-p 00015000 08:06 3277773 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fdca439b000-7fdca4556000 r-xp 00000000 08:06 3279540 /lib/x86_64-linux-gnu/libc-2.19.so
7fdca4556000-7fdca4756000 ---p 001bb000 08:06 3279540 /lib/x86_64-linux-gnu/libc-2.19.so
7fdca4756000-7fdca475a000 r--p 001bb000 08:06 3279540 /lib/x86_64-linux-gnu/libc-2.19.so
7fdca475a000-7fdca475c000 rw-p 001bf000 08:06 3279540 /lib/x86_64-linux-gnu/libc-2.19.so
7fdca475c000-7fdca4761000 rw-p 00000000 00:00 0
7fdca4761000-7fdca4866000 r-xp 00000000 08:06 3279556 /lib/x86_64-linux-gnu/libm-2.19.so
7fdca4866000-7fdca4a65000 ---p 00105000 08:06 3279556 /lib/x86_64-linux-gnu/libm-2.19.so
7fdca4a65000-7fdca4a66000 r--p 00104000 08:06 3279556 /lib/x86_64-linux-gnu/libm-2.19.so
7fdca4a66000-7fdca4a67000 rw-p 00105000 08:06 3279556 /lib/x86_64-linux-gnu/libm-2.19.so
7fdca4a67000-7fdca4a8a000 r-xp 00000000 08:06 3279536 /lib/x86_64-linux-gnu/ld-2.19.so
7fdca4c63000-7fdca4c66000 rw-p 00000000 00:00 0
7fdca4c85000-7fdca4c89000 rw-p 00000000 00:00 0
7fdca4c89000-7fdca4c8a000 r--p 00022000 08:06 3279536 /lib/x86_64-linux-gnu/ld-2.19.so
7fdca4c8a000-7fdca4c8b000 rw-p 00023000 08:06 3279536 /lib/x86_64-linux-gnu/ld-2.19.so
7fdca4c8b000-7fdca4c8c000 rw-p 00000000 00:00 0
7ffff050b000-7ffff052c000 rw-p 00000000 00:00 0 [stack]
7ffff05fe000-7ffff0600000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
我对诸如 select 之类的低级系统调用并不熟悉,但据我所知,htperf 0.9.0 使用 select 来处理套接字事件,并且此系统调用受硬编码的 1024 大小的文件描述符限制的限制。所以你们知道我做错了什么吗?如何解锁 1024 限制?