OS X 10.7.1上的httperf分段错误错误

Mik*_*erg 36 testing load httperf

当我尝试使用具有高请求率的httperf执行负载测试时,我收到以下错误:

» httperf --client=0/1 --server=www.xxxxx.com --port=80 --uri=/ --send-buffer=4096 --recv-buffer=16384 --num-conns=200 --rate=30
httperf --client=0/1 --server=staging.truecar.com --port=80 --uri=/ --rate=30 --send-buffer=4096 --recv-buffer=16384 --num-conns=200 --num-calls=1
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
**Segmentation fault: 11**
Run Code Online (Sandbox Code Playgroud)

当"rate"> 15时,错误会增加

版本:

httperf 0.9.0

OS X 10.7.1

ben*_*ier 6

如警告所述,http服务器的连接数超过了允许的打开文件描述符的最大数量.即使httperf将值限制为FD_SETSIZE,您也可能超出该限制.

您可以使用以下方式检查限制值 ulimit -a

$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 256
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 709
virtual memory          (kbytes, -v) unlimited
Run Code Online (Sandbox Code Playgroud)

尝试增加限制 ulimit -n <n>

$ ulimit -n 2048
$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 2048
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 709
virtual memory          (kbytes, -v) unlimited
Run Code Online (Sandbox Code Playgroud)

这是大型Web服务器之类的常见做法,因为套接字本质上只是一个开放的文件描述符.

  • 感谢您的小费.但这并不能解决分段错误,而且很可能不是问题的根本原因.阅读httperf文档,它实际上知道可用的文件描述符.它将记录不可用的文件描述符,并在一次运行后输出它们.如果用完文件描述符,程序不会崩溃. (2认同)

Til*_*ill 0

尝试使用gdb和使用类似的东西:

$ gdb httperf --client=0/1 --server=staging.truecar.com \
--port=80 --uri=/ --rate=30 --send-buffer=4096 \
--recv-buffer=16384 --num-conns=200 --num-calls=1
Run Code Online (Sandbox Code Playgroud)

这将调用gdb,您应该会看到(gdb)提示。

然后:run然后输入。

如果它崩溃,请输入bt(backtrace)。在此处进行调查和/或分享。