简体   繁体   English

Httperf文件描述符限制

[英]Httperf file descriptor limit

My problem is the same as this question and this question 我的问题与这个问题这个问题相同

I basicly want trying to run httperf with 10000 connection in parallel like this [httperf --uri / --server 192.168.1.2 --port 8080 --num-conns=500000 --rate 10000] 我基本上想尝试使用10000连接并行运行httperf,例如[httperf --uri / --server 192.168.1.2 --port 8080 --num-conns = 500000 --rate 10000]

I'm running it on Ubuntu 14.04. 我在Ubuntu 14.04上运行它。

First I raised the system file descriptor limit, this is what is configured in my SO now: 首先,我提高了系统文件描述符的限制,这是现在在我的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        

I tried to compile the HEAD version from github repository, but it seems like completly unstable. 我试图从github仓库中编译HEAD版本,但似乎完全不稳定。

I try also the 0.9.0 version modified limit(changed /usr/include/x86_64-linux-gnu/bits/typesizes.h to unlock the FD_SETSIZE 1024) like others questions answers suggest to do. 我也尝试使用0.9.0版本修改的限制(更改了/usr/include/x86_64-linux-gnu/bits/typesizes.h来解锁FD_SETSIZE 1024),就像答案建议的其他问题一样。 After recompile the httperf it keeps returning the same error: 重新编译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]

I'm not that familliar with low level syscall such as select, but as far as I can tell htperf 0.9.0 use select to handle socket events and this syscall is limited by a hardcoded 1024 size of file descriptor limit. 我并不熟悉select之类的低级系统调用,但据我所知htperf 0.9.0使用select处理套接字事件,并且此系统调用受到文件描述符限制的硬编码1024大小的限制。 So you guys have any idea what am I doing wrong? 你们知道我在做什么错吗? How can I unlock the 1024 limit? 如何解锁1024个限制?

You may not want to use 10K descriptors in a single process. 您可能不想在单个进程中使用10K描述符。 If you decide to do it, you will probably want to split the handling up so that a single call to select() is not handling all 10K descriptors (or performance will, to use a descriptive technical term, suck ). 如果您决定这样做,则可能需要分拆处理,以便对select()的单个调用不会处理所有10K描述符(或者,使用描述性的技术术语,性能将是“ suck” )。 See Wikipedia on the C10K Problem or the SO tag — which this question is already tagged with, so you are at least aware of the classification. 请参阅有关C10K问题的 Wikipedia或SO 标签(已对此问题进行了标签),因此您至少了解分类。

You need to look at ulimit -a -H vs ulimit -a -S to see how much of various resources you have (or replace -a with -n to get 'open files' aka 'file descriptors'). 您需要查看ulimit -a -Hulimit -a -S来了解您拥有多少各种资源(或将-a替换为-n以获取“打开文件”或“文件描述符”)。 If you have a hard limit less than 10K, you are into kernel recompilation, or at least finding the source of that upper limit in the configuration. 如果硬限制小于10K,则说明您正在重新编译内核,或者至少在配置中找到该上限的来源。 If the hard limit is bigger, you can override the limit with ulimit at the command line, or with the POSIX getrlimit() and setrlimit() functions and RLIMIT_NOFILE . 如果硬限制更大,则可以在命令行使用ulimit或POSIX getrlimit()setrlimit()函数以及RLIMIT_NOFILE覆盖该限制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM