V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
zktz
V2EX  ›  Docker

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

  •  
  •   zktz · 2019-04-26 11:45:22 +08:00 · 4375 次点击
    这是一个创建于 1798 天前的主题,其中的信息可能已经有所发展或是发生改变。
    # 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 条回复    2019-05-14 15:20:25 +08:00
    julyclyde
        1
    julyclyde  
       2019-04-26 18:18:54 +08:00
    那如果没用 docker、甚至没用 nginx,同样的 tomcat 会怎样呢?
    kingfsen
        2
    kingfsen  
       2019-04-26 18:23:08 +08:00
    docker-proxy 代理进程处理太慢?
    还是 docker 容器内部应用处理能力不行?
    服务器资源不足?
    zktz
        3
    zktz  
    OP
       2019-04-28 10:41:07 +08:00
    从容器内部来看,响应不慢啊。
    kkxxxxxxx
        4
    kkxxxxxxx  
       2019-05-14 15:20:25 +08:00
    上次碰到这种情况是在这个镜像上 nimmis/alpine-apache-php5,至今也没搞懂
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2118 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 16:14 · PVG 00:14 · LAX 09:14 · JFK 12:14
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.