爱意满满的作品展示区。
sajesemuy

高性能 Web 缓存服务器 nuster 1.7.9.4 发布

  •  
  •   sajesemuy ·
    jiangwenyuan · Feb 5, 2018 · 4912 views
    This topic created in 3205 days ago, the information mentioned may be changed or developed.

    nuster 1.7.9.4 已发布,本次更新主要修复了一个 url 中?位置不一样而 key 一样的 bug。

    nuster 是一个基于 HAProxy 的高性能缓存服务器。nuster 完全兼容 HAProxy,并且利用 HAProxy 的 ACL 功能来提供非常细致的缓存规则。特性包括

    • 完全兼容 HAProxy,支持所有 HAProxy 的特性和功能

    • 强大的动态缓存功能

      • 根据 HTTP method, uri, path, query, header, cookie 等等进行缓存
      • 根据 HTTP 请求和响应内容等等进行缓存
      • 根据环境变量服务器状态等等进行缓存
      • 根据 SSL 版本, SNI 等等进行缓存
      • 根据连接数量,请求速率等等进行缓存
      • 等等
    • 非常快

    • 删除缓存

    • 前后端 HTTPS

    • HTTP 压缩

    • HTTP 重写重定向

    性能:

    非常快, 单进程模式下是 nginx 的 3 倍,多进程下 nginx 的 2 倍,varnish 的 3 倍。详见性能比较

    本次更新

    • 增加

      • 新增了 uri 和 delimiter 关键字
    • 更新

      • query 长度未初始化
      • 不同请求可能产生一样的 key 的 bug
    Supplement 1  ·  Feb 5, 2018
    19 replies  •  2018-02-05 19:53:17 +08:00
    est
    est
    Feb 5, 2018 via Android
    1
    nginx 没开启 proxy 的 http/1.1。。。性能很低。。。。
    shuizhengqi
    shuizhengqi
    Feb 5, 2018
    2
    ...这 是当成 了发布平台吗
    sajesemuy
    sajesemuy
    OP
    Feb 5, 2018
    3
    @est 没开启 proxy 是指?
    sajesemuy
    sajesemuy
    OP
    Feb 5, 2018
    4
    @shuizhengqi 不好意思,请多担待:)
    suconghou
    suconghou
    Feb 5, 2018❤️1
    5
    @sajesemuy 你没发现 release 的代码编译后,-v 查看 版本写的还是老版本吗
    sajesemuy
    sajesemuy
    OP
    Feb 5, 2018
    6
    @suconghou 感谢
    est
    est
    Feb 5, 2018
    7
    @sajesemuy

    proxy_http_version 1.1;
    proxy_set_header Connection "";
    sajesemuy
    sajesemuy
    OP
    Feb 5, 2018
    8
    @est 这个是设置 nginx 和 upstream 的,因为 cache 已经在 nginx 里,所以并不会有区别。
    nginx 和客户端之间是 1.1,keep-alive。
    est
    est
    Feb 5, 2018
    9
    @sajesemuy 你先改下试试呢?
    sajesemuy
    sajesemuy
    OP
    Feb 5, 2018
    10
    @est 不需要啊,这个参数就是这个意思
    sajesemuy
    sajesemuy
    OP
    Feb 5, 2018❤️2
    11
    好吧,实践检验一下

    不设置
    =======
    ```
    #proxy_http_version 1.1;
    #proxy_set_header Connection "";
    ```
    curl -i http://10.0.10.13:8083/INSTALL
    ```
    HTTP/1.1 200 OK
    Server: nginx
    Connection: keep-alive
    ```
    可见 nginx 发给后端的请求为 http1.0
    ```
    10.0.10.13 - - [05/Feb/2018:12:50:18 JST] "GET /INSTALL HTTP/1.0" 200 916
    - -> /INSTALL
    ```
    设置
    ===
    ```
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    ```
    nginx 发给后端的请求为 http1.1
    ```
    10.0.10.13 - - [05/Feb/2018:12:51:14 JST] "GET /INSTALL HTTP/1.1" 200 916
    - -> /INSTALL
    ```
    wrk 比较
    ======
    ```
    wrk -c 1000 -d 30 -t 100 http://10.0.10.13:8083/INSTALL
    Running 30s test @ http://10.0.10.13:8083/INSTALL
    100 threads and 1000 connections
    Thread Stats Avg Stdev Max +/- Stdev
    Latency 11.34ms 10.90ms 225.76ms 92.30%
    Req/Sec 1.04k 446.52 6.22k 61.21%
    3069181 requests in 30.10s, 3.28GB read
    Requests/sec: 101967.40
    Transfer/sec: 111.44MB

    wrk -c 1000 -d 30 -t 100 http://10.0.10.13:8083/INSTALL
    Running 30s test @ http://10.0.10.13:8083/INSTALL
    100 threads and 1000 connections
    Thread Stats Avg Stdev Max +/- Stdev
    Latency 12.97ms 15.53ms 363.39ms 90.47%
    Req/Sec 1.06k 614.42 14.93k 63.68%
    3042735 requests in 30.10s, 3.25GB read
    Requests/sec: 101089.02
    Transfer/sec: 110.48MB
    ```

    可见并无明显差别
    est
    est
    Feb 5, 2018
    12
    @sajesemuy 赞实践!
    sajesemuy
    sajesemuy
    OP
    Feb 5, 2018
    13
    @est 见上一条:)

    回复不能用 markdown 么^^
    Showfom
    Showfom
    PRO
    Feb 5, 2018 via iPhone
    14
    @sajesemuy 不能
    yytsjq
    yytsjq
    Feb 5, 2018
    15
    不知道楼主对比测试过 OpenResty 的 srcache 缓存模块吗?

    我现在用的是 srcache+lua-resty-redis+redis 做的 WordPress 页面缓存

    https://github.com/openresty/srcache-nginx-module
    https://github.com/openresty/lua-resty-redis
    sajesemuy
    sajesemuy
    OP
    Feb 5, 2018
    16
    @Showfom 什么不能
    sajesemuy
    sajesemuy
    OP
    Feb 5, 2018
    17
    @yytsjq 没有测试过,srcache 是存在外部 memcache 或者 redis,应该会有消耗。我是内置了一个性能差不多和 redis 相当的 hashtable,估计会比 srcache 快。
    sajesemuy
    sajesemuy
    OP
    Feb 5, 2018
    18
    @Showfom 哦,markdown 啊,谢谢:)
    sajesemuy
    sajesemuy
    OP
    Feb 5, 2018❤️1
    19
    @yytsjq 做了一下测试,性能上 nuster 是 srcache+memcached 的三倍

    测试环境,软件硬件,内核参数,配置文件见
    https://www.v2ex.com/t/427703
    或者
    https://github.com/jiangwenyuan/nuster/wiki/Performance-benchmark:-nuster-vs-nginx-vs-varnish

    srcache 的配置和官网一致。


    openresty+srcache 结果

    wrk -c 1000 -d 30 -t 100 http://10.0.10.13:8083/helloworld
    Running 30s test @ http://10.0.10.13:8083/helloworld
    100 threads and 1000 connections
    Thread Stats Avg Stdev Max +/- Stdev
    Latency 9.52ms 8.42ms 239.68ms 85.90%
    Req/Sec 1.24k 152.67 2.72k 71.13%
    3725352 requests in 30.10s, 859.77MB read
    Requests/sec: 123765.07
    Transfer/sec: 28.56MB


    nuster 结果

    wrk -c 1000 -d 30 -t 100 http://10.0.10.13:8081/helloworld
    Running 30s test @ http://10.0.10.13:8081/helloworld
    100 threads and 1000 connections
    Thread Stats Avg Stdev Max +/- Stdev
    Latency 3.33ms 1.95ms 205.90ms 79.42%
    Req/Sec 3.04k 330.76 5.29k 69.99%
    9101575 requests in 30.10s, 2.09GB read
    Requests/sec: 302383.66
    Transfer/sec: 71.23MB

    nuster 的 RPS 差不多是 openresty+srcache 的三倍
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2110 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 13:57 · PVG 21:57 · LAX 05:57 · JFK 08:57
    ♥ Do have faith in what you're doing.