gpt4 book ai didi

caching - g-wan - 再现性能声明

转载 作者:行者123 更新时间:2023-11-28 19:48:47 27 4
gpt4 key购买 nike

在Ubuntu 12.04 LTS下使用gwan_linux64-bit.tar.bz2解压运行gwan

然后将 wrk 指向它(使用空文件 null.html)

wrk --timeout 10 -t 2 -c 100 -d20s http://127.0.0.1:8080/null.html
Running 20s test @ http://127.0.0.1:8080/null.html
2 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 11.65s 5.10s 13.89s 83.91%
Req/Sec 3.33k 3.65k 12.33k 75.19%
125067 requests in 20.01s, 32.08MB read
Socket errors: connect 0, read 37, write 0, timeout 49
Requests/sec: 6251.46
Transfer/sec: 1.60MB

.. 性能很差,实际上似乎存在某种巨大的延迟问题。在测试期间,gwan 忙于 200%,而 wrk 忙于 67%。

指向nginx,wrk忙200%,nginx忙45%:

wrk --timeout 10 -t 2 -c 100 -d20s http://127.0.0.1/null.html
Thread Stats Avg Stdev Max +/- Stdev
Latency 371.81us 134.05us 24.04ms 91.26%
Req/Sec 72.75k 7.38k 109.22k 68.21%
2740883 requests in 20.00s, 540.95MB read
Requests/sec: 137046.70
Transfer/sec: 27.05MB

将 weighttpd 指向 nginx 会得到更快的结果:

/usr/local/bin/weighttp -k -n 2000000 -c 500 -t 3 http://127.0.0.1/null.html
weighttp - a lightweight and simple webserver benchmarking tool

starting benchmark...
spawning thread #1: 167 concurrent requests, 666667 total requests
spawning thread #2: 167 concurrent requests, 666667 total requests
spawning thread #3: 166 concurrent requests, 666666 total requests
progress: 9% done
progress: 19% done
progress: 29% done
progress: 39% done
progress: 49% done
progress: 59% done
progress: 69% done
progress: 79% done
progress: 89% done
progress: 99% done

finished in 7 sec, 13 millisec and 293 microsec, 285172 req/s, 57633 kbyte/s
requests: 2000000 total, 2000000 started, 2000000 done, 2000000 succeeded, 0 failed, 0 errored
status codes: 2000000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 413901205 bytes total, 413901205 bytes http, 0 bytes data

服务器是一个虚拟的8核专用服务器(裸机),在KVM下

我从哪里着手确定 gwan 在这个平台上遇到的问题?

我已经在同一操作系统上测试了 lighttpd、nginx 和 node.js,结果都符合预期。服务器已经以通常的方式进行了调整,包括扩展的临时端口、增加的 ulimits、调整的时间等待回收等。

最佳答案

十一月7 更新:我们已经修复了 G-WAN v4.11.7 中的空文件问题,并且 G-WAN 现在在这场比赛中比 Nginx 快两倍(禁用 www 缓存)。

G-WAN 的最新版本比 Nginx 更快,具有小大文件,默认情况下禁用 G-WAN 缓存,以便人们更容易将 G-WAN 与其他服务器,如 Nginx。

Nginx 有一些缓存功能(跳过 stat() 调用的 fd cahe 和基于 memcached 的模块)但两者都必然比 G-WAN 的本地缓存慢得多。

禁用缓存对于某些应用程序(如 CDN)也是可取的。 AJAX 应用程序等其他应用程序极大地受益于 G-WAN 缓存功能,因此可以随意重新启用缓存,甚至可以根据每个请求重新启用。

希望这能澄清这个问题。


"reproducing the performance claims"

首先,标题具有误导性,因为上面记录不完整*的测试没有使用相同的工具,也没有使用 G-WAN 测试获取的 HTTP 资源。

[*] 你的 nginx.conf 文件在哪里?两台服务器的 HTTP 响应 header 是什么?您的“裸机” 8 核 CPU 是什么?

G-WAN 测试基于 ab.c ,由 G-WAN 团队为 weighttp 编写的包装器(Lighttpd server Team做的测试工具)因为ab.c泄露的信息是much more informative .

其次,被测试的文件“null.html”是……一个空文件。

我们不会浪费时间讨论此类测试的无关紧要(您的网站正在提供多少空 HTML 文件?),但这很可能是观察到的原因 “表现不佳”

G-WAN 不是为空文件服务而创建的(我们从未尝试过也没有人要求这样做)。但我们肯定会添加此功能以避免此类测试造成的困惑。

如果您想“检查声明”,我建议您使用 weighttp(测试中最快的 HTTP 加载工具)和 100。 bin 文件(一个 100 字节的文件,具有不可压缩的 MIME 类型:这里不会涉及 Gzip)。

使用非空文件 Nginx is massively slower than G-WAN ,即使在独立测试中也是如此。

到目前为止,我们还不知道wrk,但它似乎是由Nginx team 制作的工具。 :

“wrk 是专门为尝试将 nginx 推向极限而编写的,并在第一轮测试中被推高至 0.5Mr/s。”


更新(一天后)

既然你们懒得发布更多数据,我们就这样做了:

                    wrk                  weighttp
----------------------- -----------------------
Web Server 0.html RPS 100.html RPS 0.html RPS 100.html RPS
---------- ---------- ------------ ---------- ------------
G-WAN 80,783.03 649,367.11 175,515 717,813
Nginx 198,800.93 179,939.40 184,046 199,075

在您的测试中,我们可以看到 wrkweighttp 稍慢。

我们还可以看到 G-WAN 比使用两种 HTTP 加载工具的 Nginx 更快。

详细结果如下:


广域网

./wrk -c300 -d3 -t6 "http://127.0.0.1:8080/0.html"
Running 3s test @ http://127.0.0.1:8080/0.html
6 threads and 300 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 3.87ms 5.30ms 80.97ms 99.53%
Req/Sec 14.73k 1.60k 16.33k 94.67%
248455 requests in 3.08s, 55.68MB read
Socket errors: connect 0, read 248448, write 0, timeout 0
Requests/sec: 80783.03
Transfer/sec: 18.10MB

./wrk -c300 -d3 -t6 "http://127.0.0.1:8080/100.html"
Running 3s test @ http://127.0.0.1:8080/100.html
6 threads and 300 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 263.15us 381.82us 16.50ms 99.60%
Req/Sec 115.55k 14.38k 154.55k 82.70%
1946700 requests in 3.00s, 655.35MB read
Requests/sec: 649367.11
Transfer/sec: 218.61MB


weighttp -kn300000 -c300 -t6 "http://127.0.0.1:8080/0.html"
progress: 100% done
finished in 1 sec, 709 millisec and 252 microsec, 175515 req/s, 20159 kbyte/s
requests: 300000 total, 300000 started, 300000 done, 150147 succeeded, 149853 failed, 0 errored
status codes: 150147 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 35284545 bytes total, 35284545 bytes http, 0 bytes data

weighttp -kn300000 -c300 -t6 "http://127.0.0.1:8080/100.html"
progress: 100% done
finished in 0 sec, 417 millisec and 935 microsec, 717813 req/s, 247449 kbyte/s
requests: 300000 total, 300000 started, 300000 done, 300000 succeeded, 0 failed, 0 errored
status codes: 300000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 105900000 bytes total, 75900000 bytes http, 30000000 bytes data

Nginx

./wrk -c300 -d3 -t6 "http://127.0.0.1:8080/100.html"
Running 3s test @ http://127.0.0.1:8080/100.html
6 threads and 300 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.54ms 1.16ms 11.67ms 72.91%
Req/Sec 34.47k 6.02k 56.31k 70.65%
539743 requests in 3.00s, 180.42MB read
Requests/sec: 179939.40
Transfer/sec: 60.15MB

./wrk -c300 -d3 -t6 "http://127.0.0.1:8080/0.html"
Running 3s test @ http://127.0.0.1:8080/0.html
6 threads and 300 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.44ms 1.15ms 9.37ms 75.93%
Req/Sec 38.16k 8.57k 62.20k 69.98%
596070 requests in 3.00s, 140.69MB read
Requests/sec: 198800.93
Transfer/sec: 46.92MB


weighttp -kn300000 -c300 -t6 "http://127.0.0.1:8080/0.html"
progress: 100% done
finished in 1 sec, 630 millisec and 19 microsec, 184046 req/s, 44484 kbyte/s
requests: 300000 total, 300000 started, 300000 done, 300000 succeeded, 0 failed, 0 errored
status codes: 300000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 74250375 bytes total, 74250375 bytes http, 0 bytes data

weighttp -kn300000 -c300 -t6 "http://127.0.0.1:8080/100.html"
progress: 100% done
finished in 1 sec, 506 millisec and 968 microsec, 199075 req/s, 68140 kbyte/s
requests: 300000 total, 300000 started, 300000 done, 300000 succeeded, 0 failed, 0 errored
status codes: 300000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 105150400 bytes total, 75150400 bytes http, 30000000 bytes data

Nginx 配置文件试图匹配 G-WAN 的行为

# ./configure --without-http_charset_module --without-http_ssi_module 
# --without-http_userid_module --without-http_rewrite_module
# --without-http_limit_zone_module --without-http_limit_req_module

user www-data;
worker_processes 6;
worker_rlimit_nofile 500000;
pid /var/run/nginx.pid;

events {
# tried other values up to 100000 without better results
worker_connections 4096;
# multi_accept on; seems to be slower
multi_accept off;
use epoll;
}

http {
charset utf-8; # HTTP "Content-Type:" header
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10;
keepalive_requests 10; # 1000+ slows-down nginx enormously...

types_hash_max_size 2048;
include /usr/local/nginx/conf/mime.types;
default_type application/octet-stream;

gzip off; # adjust for your tests
gzip_min_length 500;

gzip_vary on; # HTTP "Vary: Accept-Encoding" header
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

# cache metadata (file time, size, existence, etc) to prevent syscalls
# this does not cache file contents. It should helps in benchmarks where
# a limited number of files is accessed more often than others (this is
# our case as we serve one single file fetched repeatedly)
# THIS IS ACTUALY SLOWING-DOWN THE TEST...
#
# open_file_cache max=1000 inactive=20s;
# open_file_cache_errors on;
# open_file_cache_min_uses 2;
# open_file_cache_valid 300s;

server {
listen 127.0.0.1:8080;

access_log off;

# only log critical errors
#error_log /usr/local/nginx/logs/error.log crit;
error_log /dev/null crit;

location / {
root /usr/local/nginx/html;
index index.html;
}
location = /nop.gif {
empty_gif;
}
location /imgs {
autoindex on;
}
}
}

欢迎发表评论,尤其是来自 Nginx 专家的评论,以便基于这个完整记录的测试进行讨论。

关于caching - g-wan - 再现性能声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19784753/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com