searchusermenu
  • 发布文章
  • 消息中心
点赞
收藏
评论
分享
原创

ELB的7层监听器请求响应超时时间的测试方法

2023-11-14 03:26:08
18
0

监听器请求响应超时时间简介

       监听器的请求响应超时时间特指后端主机的响应超时,即client端向ELB发起HTTP/HTTPS请求,然后ELB将请求转发到后端服务器,设定一个响应超时时间,如果在超时时间内接收请求的后端服务器无响应,负载均衡会向所有其它后端服务器重试请求。如果重试所有后端服务器都一直没有响应,则负载均衡会给客户端返回HTTP 504错误码.请求乡音超时时间取值范围[1,300],默认值60s.

 

HTTP监听器的请求响应超时时间的测试方法

 

HTTP 类型的监听器配置信息如下:

监听器类型 对应的LB实例IP 监听器端口 后端主机IP 后端主机端口
HTTP 10.1.4.7 35001

10.1.1.6

10.1.3.16

45001

45002

 

后端服务器上配置

在后端服务器上配置以下服务:

(1)配置nginx,起对应的port的tcp监听,具体配置如下:

user root root;
#error_log /var/log/nginx/nginx-fan-vm1.log debug;
#pid /var/log/nginx/nginx-fan-vm1.pid;
worker_rlimit_nofile 4096;

events {
    use epoll;
    worker_connections 4096;
}

http{
     keepalive_timeout  1200;        //配置的数值要长一些
     map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }
server {
    listen       45001;
    listen      [::]:45001;
    server_name  localhost;

    location / {
        root   /root/;
        index  index.html;
        add_header Set-Cookie 'test1 = aabbccddee1111';
        add_header Set-Cookie 'test2 = aabbccddee2222';
        add_header Set-Cookie 'test3 = aabbccddee3333';
        expires 5s;
        add_header    Cache-Control 10;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
        proxy_read_timeout 600s;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

    }
}
}

(2)配置iptable,目的是使后端服务器与LB建立tcp 建立连接后,不响应LB的http get请求,具体命令如下:

iptables -A INPUT -p tcp --tcp-flags PSH PSH --dport<后端监听的端口> -j DROP

配套命令:

iptables -L --line-numbers   //查看规则的行数

iptables -D INPUT <行数>   //删除上面的规则,比如iptables -D INPUT 1

 

打流验证

 

在client端打流:curl 10.1.4.7:35001 -w "code:"%{http_code}" ""time:"%{time_total}" "

在后端抓包观察:

(1)L7xgw先向后端1发送了http 请求:

[root@lbtest-vm-az1-2 ldy]# tcpdump -eevvnn tcp and not host 169.254.169.254
[2529647.172951] device eth0 entered promiscuous mode
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes

===========================三次握手====================================================================
21:54:14.326471 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 74: (tos 0x0, ttl 64, id 1803, offset 0, flags [DF], proto TCP (6), length 60)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [S], cksum 0x94b9 (correct), seq 2341658571, win 42300, options [mss 1410,sackOK,TS val 3049533367 ecr 0,nop,wscale 11], length 0
21:54:14.326515 fa:16:3e:11:2f:e7 > fa:16:3e:5e:3a:ea, ethertype IPv4 (0x0800), length 74: (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
    10.1.1.6.45001 > 100.125.15.18.36606: Flags [S.], cksum 0x7ec4 (incorrect -> 0xb4c7), seq 2474004941, ack 2341658572, win 28960, options [mss 1460,sackOK,TS val 2529400775 ecr 3049533367,nop,wscale 7], length 0
21:54:14.334770 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 64, id 1804, offset 0, flags [DF], proto TCP (6), length 52)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [.], cksum 0x549e (correct), seq 1, ack 1, win 21, options [nop,nop,TS val 3049533368 ecr 2529400775], length 0

===========================三次握手结束,tcp连接建立========================================================
21:54:14.334811 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1805, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xcb6f (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049533368 ecr 2529400775], length 99   //L7xg开始向后端发送 http get,计时为T1

21:54:14.536897 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1806, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xca9e (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049533577 ecr 2529400775], length 99
21:54:14.744806 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1807, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xc9ce (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049533785 ecr 2529400775], length 99
21:54:15.152973 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1808, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xc836 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049534193 ecr 2529400775], length 99
21:54:15.976832 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1809, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xc4fe (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049535017 ecr 2529400775], length 99
21:54:17.640956 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1810, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xbe7e (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049536681 ecr 2529400775], length 99
21:54:20.905119 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1811, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xb1bd (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049539946 ecr 2529400775], length 99
21:54:27.817340 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1812, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x96bd (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049546858 ecr 2529400775], length 99
21:54:29.328128 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 64, id 1813, offset 0, flags [DF], proto TCP (6), length 52)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [F.], cksum 0x19a1 (correct), seq 100, ack 1, win 21, options [nop,nop,TS val 3049548369 ecr 2529400775], length 0   //后端无回应,L7xgw向后端发送第一个FIN,关闭连接,计时T2
21:54:29.328157 fa:16:3e:11:2f:e7 > fa:16:3e:5e:3a:ea, ethertype IPv4 (0x0800), length 78: (tos 0x0, ttl 64, id 50689, offset 0, flags [DF], proto TCP (6), length 64)
    10.1.1.6.45001 > 100.125.15.18.36606: Flags [.], cksum 0x7ec8 (incorrect -> 0x0b9a), seq 1, ack 1, win 227, options [nop,nop,TS val 2529415776 ecr 3049533368,nop,nop,sack 1 {100:101}], length 0
21:54:29.330755 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1814, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x563d (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049548369 ecr 2529415776], length 99
21:54:29.537324 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1815, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x556c (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049548578 ecr 2529415776], length 99
21:54:29.945377 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1816, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x53d4 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049548986 ecr 2529415776], length 99
21:54:30.761406 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1817, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x50a4 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049549802 ecr 2529415776], length 99
21:54:32.425491 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1818, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x4a24 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049551466 ecr 2529415776], length 99
21:54:35.689584 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1819, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x3d64 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049554730 ecr 2529415776], length 99
21:54:42.666877 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1820, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x2223 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049561707 ecr 2529415776], length 99
21:54:55.978676 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1821, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xee23 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049575018 ecr 2529415776], length 99
21:55:14.385540 fa:16:3e:11:2f:e7 > fa:16:3e:5e:3a:ea, ethertype IPv4 (0x0800), length 78: (tos 0x0, ttl 64, id 50690, offset 0, flags [DF], proto TCP (6), length 64)
    10.1.1.6.45001 > 100.125.15.18.36606: Flags [F.], cksum 0x7ec8 (incorrect -> 0x5b96), seq 1, ack 1, win 227, options [nop,nop,TS val 2529460834 ecr 3049533368,nop,nop,sack 1 {100:101}], length 0
21:55:14.390295 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 64, id 1822, offset 0, flags [DF], proto TCP (6), length 52)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [.], cksum 0x7f02 (correct), seq 101, ack 2, win 21, options [nop,nop,TS val 3049593426 ecr 2529460834], length 0
21:55:22.091277 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1823, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xd81e (correct), seq 1:100, ack 2, win 21, options [nop,nop,TS val 3049601131 ecr 2529460834], length 99

T1=21:54:14

T2=21:54:29

请求响应超时时间为T2-T1=15s

(2)后端无响应后,紧接着L7xgw再次向后端2发送http请求:

================================三次握手开始====================================

22:09:09.529213 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 74: (tos 0x0, ttl 64, id 29922, offset 0, flags [DF], proto TCP (6), length 60)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [S], cksum 0x4447 (correct), seq 1898704025, win 42300, options [mss 1410,sackOK,TS val 4249099637 ecr 0,nop,wscale 11], length 0
22:09:09.529274 fa:16:3e:98:66:b8 > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 74: (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
    10.1.3.16.45002 > 100.125.15.18.46528: Flags [S.], cksum 0x80ce (incorrect -> 0x2987), seq 4113680959, ack 1898704026, win 28960, options [mss 1460,sackOK,TS val 2309424516 ecr 4249099637,nop,wscale 7], length 0
22:09:09.537588 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 64, id 29923, offset 0, flags [DF], proto TCP (6), length 52)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [.], cksum 0xc95d (correct), seq 1, ack 1, win 21, options [nop,nop,TS val 4249099638 ecr 2309424516], length 0

==============================三次握手结束,tcp连接建立==============================
22:09:09.537628 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29924, offset 0, flags [DF], proto TCP (6), length 151)     //L7xg开始向后端发送 http get,计时为T1

    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x402f (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249099638 ecr 2309424516], length 99
22:09:09.738025 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29925, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x3f5f (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249099846 ecr 2309424516], length 99
22:09:09.945962 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29926, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x3e8f (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249100054 ecr 2309424516], length 99
22:09:10.354001 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29927, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x3cf7 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249100462 ecr 2309424516], length 99
22:09:11.218125 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29928, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x3997 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249101326 ecr 2309424516], length 99
22:09:12.882095 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29929, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x3317 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249102990 ecr 2309424516], length 99
22:09:16.146273 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29930, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x2657 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249106254 ecr 2309424516], length 99
22:09:22.866499 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29931, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x0c17 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249112974 ecr 2309424516], length 99
22:09:24.528788 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 64, id 29932, offset 0, flags [DF], proto TCP (6), length 52)       //后端无回应,L7xgw向后端发送第一个FIN,关闭连接,计时T2
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [F.], cksum 0x8e63 (correct), seq 100, ack 1, win 21, options [nop,nop,TS val 4249114636 ecr 2309424516], length 0
22:09:24.528823 fa:16:3e:98:66:b8 > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 78: (tos 0x0, ttl 64, id 53196, offset 0, flags [DF], proto TCP (6), length 64)
    10.1.3.16.45002 > 100.125.15.18.46528: Flags [.], cksum 0x80d2 (incorrect -> 0x9b8d), seq 1, ack 1, win 227, options [nop,nop,TS val 2309439515 ecr 4249099638,nop,nop,sack 1 {100:101}], length 0
22:09:24.536642 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29933, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0xcb00 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249114637 ecr 2309439515], length 99
22:09:24.738647 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29934, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0xca2f (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249114846 ecr 2309439515], length 99
22:09:25.146668 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29935, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0xc897 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249115254 ecr 2309439515], length 99
22:09:26.002655 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29936, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0xc53f (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249116110 ecr 2309439515], length 99
22:09:27.666684 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29937, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0xbebf (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249117774 ecr 2309439515], length 99
22:09:30.930858 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29938, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0xb1ff (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249121038 ecr 2309439515], length 99
22:09:37.715114 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29939, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x977f (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249127822 ecr 2309439515], length 99
22:09:51.028047 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29940, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x637e (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249141135 ecr 2309439515], length 99
22:10:09.564963 fa:16:3e:98:66:b8 > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 78: (tos 0x0, ttl 64, id 53197, offset 0, flags [DF], proto TCP (6), length 64)
    10.1.3.16.45002 > 100.125.15.18.46528: Flags [F.], cksum 0x80d2 (incorrect -> 0xeb9f), seq 1, ack 1, win 227, options [nop,nop,TS val 2309484551 ecr 4249099638,nop,nop,sack 1 {100:101}], length 0
22:10:09.567130 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 64, id 29941, offset 0, flags [DF], proto TCP (6), length 52)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [.], cksum 0xf3f0 (correct), seq 101, ack 2, win 21, options [nop,nop,TS val 4249159673 ecr 2309484551], length 0
22:10:17.140699 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29942, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x4d90 (correct), seq 1:100, ack 2, win 21, options [nop,nop,TS val 4249167247 ecr 2309484551], length 99

T1=22:09:09

T2=22:09:24

请求响应超时时间为T2-T1=15s

所有后端都没有响应,此时LB向前端应该发送 http_504

(3)在client端观察

21:56:48.397516 fa:16:3e:5c:2c:9d > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 58: (tos 0x0, ttl 64, id 59915, offset 0, flags [DF], proto TCP (6), length 44)
    10.1.3.26.49838 > 10.1.4.7.35001: Flags [S], cksum 0x1b41 (incorrect -> 0x5d1b), seq 751646115, win 29200, options [mss 1460], length 0
21:56:48.401319 fa:16:3e:27:e1:bd > fa:16:3e:5c:2c:9d, ethertype IPv4 (0x0800), length 58: (tos 0x0, ttl 62, id 0, offset 0, flags [DF], proto TCP (6), length 44)
    10.1.4.7.35001 > 10.1.3.26.49838: Flags [S.], cksum 0xd642 (correct), seq 994317391, ack 751646116, win 35840, options [mss 8952], length 0
21:56:48.401348 fa:16:3e:5c:2c:9d > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 64, id 59916, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.3.26.49838 > 10.1.4.7.35001: Flags [.], cksum 0x1b3d (incorrect -> 0x2534), seq 1, ack 1, win 29200, length 0
21:56:48.401409 fa:16:3e:5c:2c:9d > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 132: (tos 0x0, ttl 64, id 59917, offset 0, flags [DF], proto TCP (6), length 118)  //client开始向LB发送 http get,计时为T1
    10.1.3.26.49838 > 10.1.4.7.35001: Flags [P.], cksum 0x1b8b (incorrect -> 0xb472), seq 1:79, ack 1, win 29200, length 78
21:56:48.411507 fa:16:3e:27:e1:bd > fa:16:3e:5c:2c:9d, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 62, id 42090, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.4.7.35001 > 10.1.3.26.49838: Flags [.], cksum 0x0b76 (correct), seq 1, ack 1, win 35790, length 0
21:56:48.411520 fa:16:3e:27:e1:bd > fa:16:3e:5c:2c:9d, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 62, id 42091, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.4.7.35001 > 10.1.3.26.49838: Flags [.], cksum 0x0b76 (correct), seq 1, ack 1, win 35790, length 0
21:56:48.411522 fa:16:3e:27:e1:bd > fa:16:3e:5c:2c:9d, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 62, id 42092, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.4.7.35001 > 10.1.3.26.49838: Flags [.], cksum 0x0b76 (correct), seq 1, ack 79, win 35712, length 0


21:57:18.404790 fa:16:3e:27:e1:bd > fa:16:3e:5c:2c:9d, ethertype IPv4 (0x0800), length 450: (tos 0x0, ttl 62, id 42093, offset 0, flags [DF], proto TCP (6), length 436)  //client 收到LB返回的P报文,为http 504报文,计时为T2
    10.1.4.7.35001 > 10.1.3.26.49838: Flags [P.], cksum 0xd3c2 (correct), seq 1:397, ack 79, win 35712, length 396
21:57:18.404832 fa:16:3e:5c:2c:9d > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 64, id 59918, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.3.26.49838 > 10.1.4.7.35001: Flags [.], cksum 0x1b3d (incorrect -> 0x202a), seq 79, ack 397, win 30016, length 0
21:57:18.413086 fa:16:3e:5c:2c:9d > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 64, id 59919, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.3.26.49838 > 10.1.4.7.35001: Flags [F.], cksum 0x1b3d (incorrect -> 0x2029), seq 79, ack 397, win 30016, length 0
21:57:18.416980 fa:16:3e:27:e1:bd > fa:16:3e:5c:2c:9d, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 62, id 42094, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.4.7.35001 > 10.1.3.26.49838: Flags [F.], cksum 0x09e9 (correct), seq 397, ack 80, win 35711, length 0
21:57:18.416999 fa:16:3e:5c:2c:9d > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 64, id 59920, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.3.26.49838 > 10.1.4.7.35001: Flags [.], cksum 0x1b3d (incorrect -> 0x2028), seq 80, ack 398, win 30016, length 0

T1=21:56:48

T2=21:57:18

观察到的时间=T2-T2=30s,即client端从发出http get报文到收到 http_504报文的时间为(后端数量) *(请求响应超时时间)

[root@lbtest-vm-az3-12 ~]# curl 10.1.4.7:35001 -w "code:"%{http_code}" ""time:"%{time_total}" "
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head><title>504 Gateway Time-out</title></head>
<body>
<center><h1>504 Gateway Time-out</h1></center>
<hr/>Powered by CTYun LB<hr><center>tengine</center>
</body>
</html>
code:504
time:30.015545

 

 

0条评论
0 / 1000
l****n
2文章数
0粉丝数
l****n
2 文章 | 0 粉丝
l****n
2文章数
0粉丝数
l****n
2 文章 | 0 粉丝
原创

ELB的7层监听器请求响应超时时间的测试方法

2023-11-14 03:26:08
18
0

监听器请求响应超时时间简介

       监听器的请求响应超时时间特指后端主机的响应超时,即client端向ELB发起HTTP/HTTPS请求,然后ELB将请求转发到后端服务器,设定一个响应超时时间,如果在超时时间内接收请求的后端服务器无响应,负载均衡会向所有其它后端服务器重试请求。如果重试所有后端服务器都一直没有响应,则负载均衡会给客户端返回HTTP 504错误码.请求乡音超时时间取值范围[1,300],默认值60s.

 

HTTP监听器的请求响应超时时间的测试方法

 

HTTP 类型的监听器配置信息如下:

监听器类型 对应的LB实例IP 监听器端口 后端主机IP 后端主机端口
HTTP 10.1.4.7 35001

10.1.1.6

10.1.3.16

45001

45002

 

后端服务器上配置

在后端服务器上配置以下服务:

(1)配置nginx,起对应的port的tcp监听,具体配置如下:

user root root;
#error_log /var/log/nginx/nginx-fan-vm1.log debug;
#pid /var/log/nginx/nginx-fan-vm1.pid;
worker_rlimit_nofile 4096;

events {
    use epoll;
    worker_connections 4096;
}

http{
     keepalive_timeout  1200;        //配置的数值要长一些
     map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }
server {
    listen       45001;
    listen      [::]:45001;
    server_name  localhost;

    location / {
        root   /root/;
        index  index.html;
        add_header Set-Cookie 'test1 = aabbccddee1111';
        add_header Set-Cookie 'test2 = aabbccddee2222';
        add_header Set-Cookie 'test3 = aabbccddee3333';
        expires 5s;
        add_header    Cache-Control 10;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
        proxy_read_timeout 600s;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

    }
}
}

(2)配置iptable,目的是使后端服务器与LB建立tcp 建立连接后,不响应LB的http get请求,具体命令如下:

iptables -A INPUT -p tcp --tcp-flags PSH PSH --dport<后端监听的端口> -j DROP

配套命令:

iptables -L --line-numbers   //查看规则的行数

iptables -D INPUT <行数>   //删除上面的规则,比如iptables -D INPUT 1

 

打流验证

 

在client端打流:curl 10.1.4.7:35001 -w "code:"%{http_code}" ""time:"%{time_total}" "

在后端抓包观察:

(1)L7xgw先向后端1发送了http 请求:

[root@lbtest-vm-az1-2 ldy]# tcpdump -eevvnn tcp and not host 169.254.169.254
[2529647.172951] device eth0 entered promiscuous mode
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes

===========================三次握手====================================================================
21:54:14.326471 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 74: (tos 0x0, ttl 64, id 1803, offset 0, flags [DF], proto TCP (6), length 60)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [S], cksum 0x94b9 (correct), seq 2341658571, win 42300, options [mss 1410,sackOK,TS val 3049533367 ecr 0,nop,wscale 11], length 0
21:54:14.326515 fa:16:3e:11:2f:e7 > fa:16:3e:5e:3a:ea, ethertype IPv4 (0x0800), length 74: (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
    10.1.1.6.45001 > 100.125.15.18.36606: Flags [S.], cksum 0x7ec4 (incorrect -> 0xb4c7), seq 2474004941, ack 2341658572, win 28960, options [mss 1460,sackOK,TS val 2529400775 ecr 3049533367,nop,wscale 7], length 0
21:54:14.334770 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 64, id 1804, offset 0, flags [DF], proto TCP (6), length 52)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [.], cksum 0x549e (correct), seq 1, ack 1, win 21, options [nop,nop,TS val 3049533368 ecr 2529400775], length 0

===========================三次握手结束,tcp连接建立========================================================
21:54:14.334811 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1805, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xcb6f (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049533368 ecr 2529400775], length 99   //L7xg开始向后端发送 http get,计时为T1

21:54:14.536897 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1806, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xca9e (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049533577 ecr 2529400775], length 99
21:54:14.744806 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1807, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xc9ce (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049533785 ecr 2529400775], length 99
21:54:15.152973 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1808, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xc836 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049534193 ecr 2529400775], length 99
21:54:15.976832 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1809, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xc4fe (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049535017 ecr 2529400775], length 99
21:54:17.640956 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1810, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xbe7e (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049536681 ecr 2529400775], length 99
21:54:20.905119 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1811, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xb1bd (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049539946 ecr 2529400775], length 99
21:54:27.817340 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1812, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x96bd (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049546858 ecr 2529400775], length 99
21:54:29.328128 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 64, id 1813, offset 0, flags [DF], proto TCP (6), length 52)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [F.], cksum 0x19a1 (correct), seq 100, ack 1, win 21, options [nop,nop,TS val 3049548369 ecr 2529400775], length 0   //后端无回应,L7xgw向后端发送第一个FIN,关闭连接,计时T2
21:54:29.328157 fa:16:3e:11:2f:e7 > fa:16:3e:5e:3a:ea, ethertype IPv4 (0x0800), length 78: (tos 0x0, ttl 64, id 50689, offset 0, flags [DF], proto TCP (6), length 64)
    10.1.1.6.45001 > 100.125.15.18.36606: Flags [.], cksum 0x7ec8 (incorrect -> 0x0b9a), seq 1, ack 1, win 227, options [nop,nop,TS val 2529415776 ecr 3049533368,nop,nop,sack 1 {100:101}], length 0
21:54:29.330755 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1814, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x563d (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049548369 ecr 2529415776], length 99
21:54:29.537324 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1815, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x556c (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049548578 ecr 2529415776], length 99
21:54:29.945377 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1816, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x53d4 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049548986 ecr 2529415776], length 99
21:54:30.761406 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1817, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x50a4 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049549802 ecr 2529415776], length 99
21:54:32.425491 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1818, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x4a24 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049551466 ecr 2529415776], length 99
21:54:35.689584 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1819, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x3d64 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049554730 ecr 2529415776], length 99
21:54:42.666877 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1820, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0x2223 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049561707 ecr 2529415776], length 99
21:54:55.978676 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1821, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xee23 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 3049575018 ecr 2529415776], length 99
21:55:14.385540 fa:16:3e:11:2f:e7 > fa:16:3e:5e:3a:ea, ethertype IPv4 (0x0800), length 78: (tos 0x0, ttl 64, id 50690, offset 0, flags [DF], proto TCP (6), length 64)
    10.1.1.6.45001 > 100.125.15.18.36606: Flags [F.], cksum 0x7ec8 (incorrect -> 0x5b96), seq 1, ack 1, win 227, options [nop,nop,TS val 2529460834 ecr 3049533368,nop,nop,sack 1 {100:101}], length 0
21:55:14.390295 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 64, id 1822, offset 0, flags [DF], proto TCP (6), length 52)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [.], cksum 0x7f02 (correct), seq 101, ack 2, win 21, options [nop,nop,TS val 3049593426 ecr 2529460834], length 0
21:55:22.091277 02:01:01:01:01:01 > fa:16:3e:11:2f:e7, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 1823, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.36606 > 10.1.1.6.45001: Flags [P.], cksum 0xd81e (correct), seq 1:100, ack 2, win 21, options [nop,nop,TS val 3049601131 ecr 2529460834], length 99

T1=21:54:14

T2=21:54:29

请求响应超时时间为T2-T1=15s

(2)后端无响应后,紧接着L7xgw再次向后端2发送http请求:

================================三次握手开始====================================

22:09:09.529213 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 74: (tos 0x0, ttl 64, id 29922, offset 0, flags [DF], proto TCP (6), length 60)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [S], cksum 0x4447 (correct), seq 1898704025, win 42300, options [mss 1410,sackOK,TS val 4249099637 ecr 0,nop,wscale 11], length 0
22:09:09.529274 fa:16:3e:98:66:b8 > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 74: (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
    10.1.3.16.45002 > 100.125.15.18.46528: Flags [S.], cksum 0x80ce (incorrect -> 0x2987), seq 4113680959, ack 1898704026, win 28960, options [mss 1460,sackOK,TS val 2309424516 ecr 4249099637,nop,wscale 7], length 0
22:09:09.537588 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 64, id 29923, offset 0, flags [DF], proto TCP (6), length 52)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [.], cksum 0xc95d (correct), seq 1, ack 1, win 21, options [nop,nop,TS val 4249099638 ecr 2309424516], length 0

==============================三次握手结束,tcp连接建立==============================
22:09:09.537628 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29924, offset 0, flags [DF], proto TCP (6), length 151)     //L7xg开始向后端发送 http get,计时为T1

    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x402f (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249099638 ecr 2309424516], length 99
22:09:09.738025 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29925, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x3f5f (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249099846 ecr 2309424516], length 99
22:09:09.945962 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29926, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x3e8f (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249100054 ecr 2309424516], length 99
22:09:10.354001 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29927, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x3cf7 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249100462 ecr 2309424516], length 99
22:09:11.218125 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29928, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x3997 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249101326 ecr 2309424516], length 99
22:09:12.882095 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29929, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x3317 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249102990 ecr 2309424516], length 99
22:09:16.146273 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29930, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x2657 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249106254 ecr 2309424516], length 99
22:09:22.866499 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29931, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x0c17 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249112974 ecr 2309424516], length 99
22:09:24.528788 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 64, id 29932, offset 0, flags [DF], proto TCP (6), length 52)       //后端无回应,L7xgw向后端发送第一个FIN,关闭连接,计时T2
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [F.], cksum 0x8e63 (correct), seq 100, ack 1, win 21, options [nop,nop,TS val 4249114636 ecr 2309424516], length 0
22:09:24.528823 fa:16:3e:98:66:b8 > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 78: (tos 0x0, ttl 64, id 53196, offset 0, flags [DF], proto TCP (6), length 64)
    10.1.3.16.45002 > 100.125.15.18.46528: Flags [.], cksum 0x80d2 (incorrect -> 0x9b8d), seq 1, ack 1, win 227, options [nop,nop,TS val 2309439515 ecr 4249099638,nop,nop,sack 1 {100:101}], length 0
22:09:24.536642 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29933, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0xcb00 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249114637 ecr 2309439515], length 99
22:09:24.738647 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29934, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0xca2f (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249114846 ecr 2309439515], length 99
22:09:25.146668 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29935, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0xc897 (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249115254 ecr 2309439515], length 99
22:09:26.002655 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29936, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0xc53f (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249116110 ecr 2309439515], length 99
22:09:27.666684 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29937, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0xbebf (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249117774 ecr 2309439515], length 99
22:09:30.930858 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29938, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0xb1ff (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249121038 ecr 2309439515], length 99
22:09:37.715114 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29939, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x977f (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249127822 ecr 2309439515], length 99
22:09:51.028047 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29940, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x637e (correct), seq 1:100, ack 1, win 21, options [nop,nop,TS val 4249141135 ecr 2309439515], length 99
22:10:09.564963 fa:16:3e:98:66:b8 > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 78: (tos 0x0, ttl 64, id 53197, offset 0, flags [DF], proto TCP (6), length 64)
    10.1.3.16.45002 > 100.125.15.18.46528: Flags [F.], cksum 0x80d2 (incorrect -> 0xeb9f), seq 1, ack 1, win 227, options [nop,nop,TS val 2309484551 ecr 4249099638,nop,nop,sack 1 {100:101}], length 0
22:10:09.567130 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 64, id 29941, offset 0, flags [DF], proto TCP (6), length 52)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [.], cksum 0xf3f0 (correct), seq 101, ack 2, win 21, options [nop,nop,TS val 4249159673 ecr 2309484551], length 0
22:10:17.140699 02:01:01:01:01:01 > fa:16:3e:98:66:b8, ethertype IPv4 (0x0800), length 165: (tos 0x0, ttl 64, id 29942, offset 0, flags [DF], proto TCP (6), length 151)
    100.125.15.18.46528 > 10.1.3.16.45002: Flags [P.], cksum 0x4d90 (correct), seq 1:100, ack 2, win 21, options [nop,nop,TS val 4249167247 ecr 2309484551], length 99

T1=22:09:09

T2=22:09:24

请求响应超时时间为T2-T1=15s

所有后端都没有响应,此时LB向前端应该发送 http_504

(3)在client端观察

21:56:48.397516 fa:16:3e:5c:2c:9d > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 58: (tos 0x0, ttl 64, id 59915, offset 0, flags [DF], proto TCP (6), length 44)
    10.1.3.26.49838 > 10.1.4.7.35001: Flags [S], cksum 0x1b41 (incorrect -> 0x5d1b), seq 751646115, win 29200, options [mss 1460], length 0
21:56:48.401319 fa:16:3e:27:e1:bd > fa:16:3e:5c:2c:9d, ethertype IPv4 (0x0800), length 58: (tos 0x0, ttl 62, id 0, offset 0, flags [DF], proto TCP (6), length 44)
    10.1.4.7.35001 > 10.1.3.26.49838: Flags [S.], cksum 0xd642 (correct), seq 994317391, ack 751646116, win 35840, options [mss 8952], length 0
21:56:48.401348 fa:16:3e:5c:2c:9d > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 64, id 59916, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.3.26.49838 > 10.1.4.7.35001: Flags [.], cksum 0x1b3d (incorrect -> 0x2534), seq 1, ack 1, win 29200, length 0
21:56:48.401409 fa:16:3e:5c:2c:9d > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 132: (tos 0x0, ttl 64, id 59917, offset 0, flags [DF], proto TCP (6), length 118)  //client开始向LB发送 http get,计时为T1
    10.1.3.26.49838 > 10.1.4.7.35001: Flags [P.], cksum 0x1b8b (incorrect -> 0xb472), seq 1:79, ack 1, win 29200, length 78
21:56:48.411507 fa:16:3e:27:e1:bd > fa:16:3e:5c:2c:9d, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 62, id 42090, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.4.7.35001 > 10.1.3.26.49838: Flags [.], cksum 0x0b76 (correct), seq 1, ack 1, win 35790, length 0
21:56:48.411520 fa:16:3e:27:e1:bd > fa:16:3e:5c:2c:9d, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 62, id 42091, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.4.7.35001 > 10.1.3.26.49838: Flags [.], cksum 0x0b76 (correct), seq 1, ack 1, win 35790, length 0
21:56:48.411522 fa:16:3e:27:e1:bd > fa:16:3e:5c:2c:9d, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 62, id 42092, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.4.7.35001 > 10.1.3.26.49838: Flags [.], cksum 0x0b76 (correct), seq 1, ack 79, win 35712, length 0


21:57:18.404790 fa:16:3e:27:e1:bd > fa:16:3e:5c:2c:9d, ethertype IPv4 (0x0800), length 450: (tos 0x0, ttl 62, id 42093, offset 0, flags [DF], proto TCP (6), length 436)  //client 收到LB返回的P报文,为http 504报文,计时为T2
    10.1.4.7.35001 > 10.1.3.26.49838: Flags [P.], cksum 0xd3c2 (correct), seq 1:397, ack 79, win 35712, length 396
21:57:18.404832 fa:16:3e:5c:2c:9d > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 64, id 59918, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.3.26.49838 > 10.1.4.7.35001: Flags [.], cksum 0x1b3d (incorrect -> 0x202a), seq 79, ack 397, win 30016, length 0
21:57:18.413086 fa:16:3e:5c:2c:9d > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 64, id 59919, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.3.26.49838 > 10.1.4.7.35001: Flags [F.], cksum 0x1b3d (incorrect -> 0x2029), seq 79, ack 397, win 30016, length 0
21:57:18.416980 fa:16:3e:27:e1:bd > fa:16:3e:5c:2c:9d, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 62, id 42094, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.4.7.35001 > 10.1.3.26.49838: Flags [F.], cksum 0x09e9 (correct), seq 397, ack 80, win 35711, length 0
21:57:18.416999 fa:16:3e:5c:2c:9d > fa:16:3e:27:e1:bd, ethertype IPv4 (0x0800), length 54: (tos 0x0, ttl 64, id 59920, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.3.26.49838 > 10.1.4.7.35001: Flags [.], cksum 0x1b3d (incorrect -> 0x2028), seq 80, ack 398, win 30016, length 0

T1=21:56:48

T2=21:57:18

观察到的时间=T2-T2=30s,即client端从发出http get报文到收到 http_504报文的时间为(后端数量) *(请求响应超时时间)

[root@lbtest-vm-az3-12 ~]# curl 10.1.4.7:35001 -w "code:"%{http_code}" ""time:"%{time_total}" "
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head><title>504 Gateway Time-out</title></head>
<body>
<center><h1>504 Gateway Time-out</h1></center>
<hr/>Powered by CTYun LB<hr><center>tengine</center>
</body>
</html>
code:504
time:30.015545

 

 

文章来自个人专栏
ELB技术
2 文章 | 1 订阅
0条评论
0 / 1000
请输入你的评论
0
0