2010-07-27 08:26 PM
ACE の rserver に conn-limit の設定を行うことで、rserver との connection 数を制限することができます。 今回紹介する事例は、conn-limit で設定した connection の上限に達していないにもかかわらず、ACE が packet を drop し始めるという事象です。
試しに、各 rserver の max-conn を 4 に設定し、8 connection 張ってみます。
# 構成
# ACE 設定
ACE20/Admin# sh run Generating configuration.... hostname ACE20 boot system image:c6ace-t1k9-mz.A2_3_1.bin access-list all line 8 extended permit ip any any rserver host sv1 ip address 192.168.72.11 conn-limit max 4 min 4 inservice rserver host sv2 ip address 192.168.72.12 conn-limit max 4 min 4 inservice serverfarm host sf rserver sv1 inservice rserver sv2 inservice class-map match-all vip 2 match virtual-address 192.168.71.100 tcp eq ftp policy-map type loadbalance first-match lb class class-default serverfarm sf policy-map multi-match client-vips class vip loadbalance vip inservice loadbalance policy lb loadbalance vip icmp-reply access-group input all interface vlan 771 ip address 192.168.71.250 255.255.255.0 service-policy input client-vips no shutdown interface vlan 772 ip address 192.168.72.250 255.255.255.0 no shutdown |
# client (src port に 10000 - 10007 を使用)
client:/# for i in `seq 10000 10007`;do nc -p $i 192.168.71.100 80&date;done |
# ACE 出力 (src port に 10000 - 10007 を使用)
ACE20/Admin# sh serverfarm detail serverfarm : sf, type: HOST total rservers : 2 active rservers: 0 description : - state : INACTIVE predictor : ROUNDROBIN failaction : - back-inservice : 0 partial-threshold : 0 num times failover : 0 num times back inservice : 0 total conn-dropcount : 0 --------------------------------- ----------connections----------- real weight state current total failures ---+---------------------+------+------------+----------+----------+--------- rserver: sv1 192.168.72.11:0 8 MAXCONNS 4 4 0 description : - max-conns : 4 , out-of-rotation count : 1 min-conns : 4 conn-rate-limit : - , out-of-rotation count : - bandwidth-rate-limit : - , out-of-rotation count : - retcode out-of-rotation count : - load value : 0 rserver: sv2 192.168.72.12:0 8 MAXCONNS 4 4 0 description : - max-conns : 4 , out-of-rotation count : 1 min-conns : 4 conn-rate-limit : - , out-of-rotation count : - bandwidth-rate-limit : - , out-of-rotation count : - retcode out-of-rotation count : - load value : 0 ACE20/Admin# sh conn total current connections : 16 conn-id np dir proto vlan source destination state ----------+--+---+-----+----+---------------------+---------------------+------+ 497 1 in TCP 771 192.168.71.11:10000 192.168.71.100:80 ESTAB 498 1 out TCP 772 192.168.72.12:80 192.168.71.11:10000 ESTAB 499 1 in TCP 771 192.168.71.11:10002 192.168.71.100:80 ESTAB 500 1 out TCP 772 192.168.72.11:80 192.168.71.11:10002 ESTAB 501 1 in TCP 771 192.168.71.11:10004 192.168.71.100:80 ESTAB 502 1 out TCP 772 192.168.72.12:80 192.168.71.11:10004 ESTAB 503 1 in TCP 771 192.168.71.11:10006 192.168.71.100:80 ESTAB 504 1 out TCP 772 192.168.72.11:80 192.168.71.11:10006 ESTAB 513 2 in TCP 771 192.168.71.11:10001 192.168.71.100:80 ESTAB 514 2 out TCP 772 192.168.72.11:80 192.168.71.11:10001 ESTAB 515 2 in TCP 771 192.168.71.11:10003 192.168.71.100:80 ESTAB 516 2 out TCP 772 192.168.72.12:80 192.168.71.11:10003 ESTAB 517 2 in TCP 771 192.168.71.11:10005 192.168.71.100:80 ESTAB 518 2 out TCP 772 192.168.72.11:80 192.168.71.11:10005 ESTAB 519 2 in TCP 771 192.168.71.11:10007 192.168.71.100:80 ESTAB 520 2 out TCP 772 192.168.72.12:80 192.168.71.11:10007 ESTAB ACE20/Admin# |
# client (src port に 10001 - 10008 を使用)
client:/# for i in `seq 10001 10008`;do nc -p $i 192.168.71.100 80&date;done client:/# (UNKNOWN) [192.168.71.100] 80 (www) : Connection refused !___ 1 connection 失敗 |
# ACE 出力 (src port に 10001 - 10008 を使用)
ACE20/Admin# sh serverfarm detail serverfarm : sf, type: HOST total rservers : 2 active rservers: 1 description : - state : ACTIVE predictor : ROUNDROBIN failaction : - back-inservice : 0 partial-threshold : 0 num times failover : 0 num times back inservice : 0 total conn-dropcount : 1 --------------------------------- ----------connections----------- real weight state current total failures ---+---------------------+------+------------+----------+----------+--------- rserver: sv1 192.168.72.11:0 8 OPERATIONAL 3 3 2 description : - max-conns : 4 , out-of-rotation count : 1 min-conns : 4 conn-rate-limit : - , out-of-rotation count : - bandwidth-rate-limit : - , out-of-rotation count : - retcode out-of-rotation count : - load value : 0 rserver: sv2 192.168.72.12:0 8 MAXCONNS 4 4 1 description : - max-conns : 4 , out-of-rotation count : 1 min-conns : 4 conn-rate-limit : - , out-of-rotation count : - bandwidth-rate-limit : - , out-of-rotation count : - retcode out-of-rotation count : - load value : 0 ACE20/Admin# sh conn total current connections : 14 conn-id np dir proto vlan source destination state ----------+--+---+-----+----+---------------------+---------------------+------+ 505 1 in TCP 771 192.168.71.11:10002 192.168.71.100:80 ESTAB 506 1 out TCP 772 192.168.72.12:80 192.168.71.11:10002 ESTAB 507 1 in TCP 771 192.168.71.11:10004 192.168.71.100:80 ESTAB 508 1 out TCP 772 192.168.72.11:80 192.168.71.11:10004 ESTAB 509 1 in TCP 771 192.168.71.11:10006 192.168.71.100:80 ESTAB 510 1 out TCP 772 192.168.72.12:80 192.168.71.11:10006 ESTAB 527 2 in TCP 771 192.168.71.11:10007 192.168.71.100:80 ESTAB 528 2 out TCP 772 192.168.72.12:80 192.168.71.11:10007 ESTAB 529 2 in TCP 771 192.168.71.11:10008 192.168.71.100:80 ESTAB 530 2 out TCP 772 192.168.72.11:80 192.168.71.11:10008 ESTAB 531 2 in TCP 771 192.168.71.11:10001 192.168.71.100:80 ESTAB 532 2 out TCP 772 192.168.72.12:80 192.168.71.11:10001 ESTAB 533 2 in TCP 771 192.168.71.11:10003 192.168.71.100:80 ESTAB 534 2 out TCP 772 192.168.72.11:80 192.168.71.11:10003 ESTAB ACE20/Admin# |
src port#10000-10007 を使用した場合、8 connection 張ることに成功しましたが、src port#10001-10008 を使用した場合、7 connection しか張れませんでした(port#10005 が失敗)。
client, server, ACE の connection を clear し、port#10005 のみ connection を張ると下記のようになります。
# client port#10005
client:/# nc -p 10005 192.168.71.100 80 |
# ACE port#1005
ACE20/Admin# sh conn total current connections : 2 conn-id np dir proto vlan source destination state ----------+--+---+-----+----+---------------------+---------------------+------+ 536 2 in TCP 771 192.168.71.11:10005 192.168.71.100:80 ESTAB 537 2 out TCP 772 192.168.72.12:80 192.168.71.11:10005 ESTAB ACE20/Admin# |
8 connection 張れた方は、show conn の出力の np が 1, 2 共に均等であるのに対し、7 connection しか張れなかった方は、np1 に 3 connection, np2 に 5 connection 張ろうとしていたことが、この結果から確認できます。
ACE: Hardware architecture から見た L3/L4 と L7 の違い でも紹介しているように ACE module は np が 2 つあります。 conn-limit を設定した場合、np1, 2 の合計が設定した値になるのではなく、設定値/2 が各 np の limit になります。 そのため、CDE が traffic を、各 np に均等に割り振った場合、設定した max-conn に達しますが、不均等に割り振った場合、max-conn に達する前に drop し始めてしまいます。
上記結果から、port#10001, 10003, 10005, 10007, 10008 は np2 を使用するので、この traffic を流してみます。 (どちらの np を使用するかは CDE の hash 計算結果に依存しますが、同じ traffic であれば同じ結果になります。)
すると、結果は下記のように、sv1, sv2 共に 2 connection 張った状態で max-conn に達しています。 max-conn に達した場合、下記のように out-of rotation count が上昇します。 show serverfarm や show rserver の出力結果は、OPERATIONAL のままのため、一見接続可能のように見えますが、今回の場合、CDE によって np2 が選択される connection は、drop してしまいます。
ACE20/Admin# sh serverfarm detail serverfarm : sf, type: HOST total rservers : 2 active rservers: 2 description : - state : ACTIVE predictor : ROUNDROBIN failaction : - back-inservice : 0 partial-threshold : 0 num times failover : 0 num times back inservice : 0 total conn-dropcount : 1 --------------------------------- ----------connections----------- real weight state current total failures ---+---------------------+------+------------+----------+----------+--------- rserver: sv1 192.168.72.11:0 8 OPERATIONAL 2 2 0 description : - max-conns : 4 , out-of-rotation count : 1 min-conns : 4 conn-rate-limit : - , out-of-rotation count : - bandwidth-rate-limit : - , out-of-rotation count : - retcode out-of-rotation count : - load value : 0 rserver: sv2 192.168.72.12:0 8 OPERATIONAL 2 2 0 description : - max-conns : 4 , out-of-rotation count : 1 min-conns : 4 conn-rate-limit : - , out-of-rotation count : - bandwidth-rate-limit : - , out-of-rotation count : - retcode out-of-rotation count : - load value : 0 ACE20/Admin# sh service-policy detail Policy-map : client-vips Status : ACTIVE Description: ----------------------------------------- Interface: vlan 771 service-policy: client-vips class: vip VIP Address: Protocol: Port: 192.168.71.100 any loadbalance: L7 loadbalance policy: lb VIP Route Metric : 77 VIP Route Advertise : DISABLED VIP ICMP Reply : ENABLED VIP State: INSERVICE curr conns : 4 , hit count : 5 dropped conns : 1 !___ max-conn に達しているため drop client pkt count : 1 , client byte count: 60 server pkt count : 0 , server byte count: 0 conn-rate-limit : 0 , drop-count : 0 bandwidth-rate-limit : 0 , drop-count : 0 L7 Loadbalance policy : lb class/match : class-default LB action: : primary serverfarm: sf state: UP backup serverfarm : - hit count : 4 dropped conns : 1 ACE20/Admin# |
また、logging を enable にしている場合、rserver の state が MAXCONNS になった時点で下記のような message が出力されます。 (片方の np が max-conn に達した場合ではなく、両方の np が max-conn に達し、MAXCONNS になった場合のみ出力されるのでご注意ください。)
%ACE-4-442003: Real Server sv1 in serverfarm sf changed state to outOfService since max connection reached
%ACE-4-442003: Real Server sv2 in serverfarm sf changed state to outOfService since max connection reached
全ての rserver が max-conn に達した場合、show service-policy detail の state が DOWN になります。 (どちらかの np に 1 connection でも張れる場合、UP 状態を維持します。)
ACE20/Admin# sh service-policy detail Policy-map : client-vips Status : ACTIVE Description: ----------------------------------------- Interface: vlan 771 service-policy: client-vips class: vip VIP Address: Protocol: Port: 192.168.71.100 any loadbalance: L7 loadbalance policy: lb VIP Route Metric : 77 VIP Route Advertise : DISABLED VIP ICMP Reply : ENABLED VIP State: INSERVICE curr conns : 8 , hit count : 12 dropped conns : 4 client pkt count : 4 , client byte count: 240 server pkt count : 0 , server byte count: 0 conn-rate-limit : 0 , drop-count : 0 bandwidth-rate-limit : 0 , drop-count : 0 L7 Loadbalance policy : lb class/match : class-default LB action: : primary serverfarm: sf state: DOWN backup serverfarm : - hit count : 8 dropped conns : 4 |
検索バーにキーワード、フレーズ、または質問を入力し、お探しのものを見つけましょう
シスコ コミュニティをいち早く使いこなしていただけるよう役立つリンクをまとめました。みなさんのジャーニーがより良いものとなるようお手伝いします