0

试用 Cowboy (Erlang) http 库,helloworld 示例:https ://github.com/extend/cowboy/tree/master/examples/hello_world

以这种方式使用 Apache 的“ab”测试工具时,我得到“连接重置”:

d7 ~/cb/cowboy/examples/hello_world % !564
ab -n 30000 -c 5000 http://127.0.0.1:8080/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 3000 requests
Completed 6000 requests
Completed 9000 requests
Completed 12000 requests
Completed 15000 requests
Completed 18000 requests
Completed 21000 requests
Completed 24000 requests
Completed 27000 requests
apr_socket_recv: Connection reset by peer (104)

使用较小的值(例如 -n 5000 -c 1000)进行测试可以正常工作。

崩溃或重置 erl/Cowboy 进程可能是什么问题?我观察到Beam在顶部的内存使用情况,它增长到120MB,没有什么淫秽的(我在那个vm上有3G的RAM)。

ulimit 设置也相当慷慨:

% ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 24088
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65535
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 16000
cpu time               (seconds, -t) unlimited
max user processes              (-u) 24088
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

erl/cowboy 可能有什么问题?

操作系统:Debian 7 x64。

4

1 回答 1

1

您应该尝试禁用 SYN cookie 发送。net.ipv4.tcp_syncookies = 0/etc/sysctl.conf中搜索此行。

于 2013-07-24T08:59:46.473 回答