zktz
V2EX  ›  Docker

请教一下,有人知道 docker 转发的端口时好时坏的咋回事么?

  •  
  •   zktz · Apr 26, 2019 · 5466 views
    This topic created in 2603 days ago, the information mentioned may be changed or developed.
    # curl http://10.2.176.14:30980/h5/intro
    curl: (7) Failed connect to 10.2.176.14:30980; 连接超时
    
    # curl http://10.2.176.14:30980/h5/intro
    <!DOCTYPE html>
    <html lang="zh-cn">
    
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
      <meta name="format-detection" content="telephone=no">
    

    虽然是偶发现象,但是本身访问量就不大,所以出现的概率还挺高的。 docker 容器内是一个 nginx+tomcat。 观察了 1 天了,不知道啥毛病。 ipv4 的 tcp 的连接参数已经改了。

    /etc/sysctl.conf

    net.ipv4.ip_local_port_range = 1024 65535
    net.core.rmem_max=16777216
    net.core.wmem_max=16777216
    net.ipv4.tcp_rmem=4096 87380 16777216
    net.ipv4.tcp_wmem=4096 65536 16777216
    net.ipv4.tcp_fin_timeout = 10
    net.ipv4.tcp_tw_recycle = 1
    net.ipv4.tcp_timestamps = 1
    net.ipv4.tcp_window_scaling = 0
    net.ipv4.tcp_sack = 0
    net.core.netdev_max_backlog = 30000
    net.ipv4.tcp_no_metrics_save=1
    net.core.somaxconn = 26214
    net.ipv4.tcp_syncookies = 0
    net.ipv4.tcp_max_orphans = 262144
    net.ipv4.tcp_max_syn_backlog = 262144
    net.ipv4.tcp_synack_retries = 2
    net.ipv4.tcp_syn_retries = 2
    vm.overcommit_memory = 1
    
    
    4 replies    2019-05-14 15:20:25 +08:00
    julyclyde
        1
    julyclyde  
       Apr 26, 2019
    那如果没用 docker、甚至没用 nginx,同样的 tomcat 会怎样呢?
    kingfsen
        2
    kingfsen  
       Apr 26, 2019
    docker-proxy 代理进程处理太慢?
    还是 docker 容器内部应用处理能力不行?
    服务器资源不足?
    zktz
        3
    zktz  
    OP
       Apr 28, 2019
    从容器内部来看,响应不慢啊。
    kkxxxxxxx
        4
    kkxxxxxxx  
       May 14, 2019
    上次碰到这种情况是在这个镜像上 nimmis/alpine-apache-php5,至今也没搞懂
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3742 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 04:59 · PVG 12:59 · LAX 21:59 · JFK 00:59
    ♥ Do have faith in what you're doing.