zoukankan      html  css  js  c++  java
  • nginx-upstream-keepalive;accept_mutex-proxy_http_version-1.1-proxy_set_header-connection

    nginx+resin+redis+mysql的架构;

    有外部模拟用户请求的大量攻击;它尝试请求了80就断开;看到的现象是在跑有nginx80的主机上TCP连接数少

    :

    ESTABLISHED少; 在后端resin的主机上有大量的TIME_WAIT,然后resin所在主机的内核会报flood攻击信息

    而在nginx80的主机上SYN_RECV 少;有大量的SYN_SENT

    ================

    尝试通过nginx-upstream模块的keepalive机制来容纳该种攻击;

    需要配置如下:

    events {
    use epoll;
    worker_connections 65535;
    accept_mutex off;--------------------------->新加;多线程需要
    }

    keepalive_timeout  100;--------------------->默认是65;设置更长的时间,形成连接池;让响应用户请求并转发给resin的TCP连接保持可复用。

    proxy_http_version 1.1;--------------------->新指定,默认是1.0;1.0不适用
    proxy_set_header Connection "";----------->1.1不需要,所以清空

    upstream name_server {
    server ip:port;
    keepalive 32;------------------------------------->个数,总共保持长连接的个数
    }

  • 相关阅读:
    二分查找经典题型
    部队侦察
    取随机数函数的使用
    猜拳游戏
    Learning C Struct
    Linux shell get random number
    Linux Bash shell one practice : array if else
    Linux shell misc
    Bash Shell read file line by line and substring
    storm的并发和消息保障性
  • 原文地址:https://www.cnblogs.com/taosim/p/4182426.html
Copyright © 2011-2022 走看看