配置Load类型监视器

配置Load类型监视器

https://support.citrix.com/article/CTX201045

Objective

This article describes how to configure custom Load Monitor on NetScaler.

Custom Load Monitors

When you have a scenario where you have to perform load balancing based on the load then you can use the CUSTOMLOAD method and load monitors. Load monitors use SNMP polled OIDs to calculate the load. The load monitor uses the IP address of the service to which it is bound (the destination IP address) for polling. It sends an SNMP query to the service, specifying the OID for a metric. The metrics can be CPU, memory, or the number of server connections. The server responds to the query with a metric value. The metric value in the response is compared with the threshold value. The NetScaler appliance considers the service for load balancing only if the metric is less than the threshold value. The service with the lowest load value is considered first.

Use Case Scenarios

The GSLB load balancing method does not understand the actual load on the server but understands the load on the load balancer. So if you need to perform a GSLB load balancing based on the load on the server then you can use this method. The other scenario would be when you have to perform load balancing based on the memory or CPU of the server.

Lab Method

  • Load balancing on the NetScaler

  • Service 1 is the NS1

  • Service 2 is the NS2

  • Method is based on the number of client connection on the NS1 and NS2


Instructions

Complete the following procedure to configure custom Load Monitor on NetScaler:

  1. Create a Metric Table for the SNMP. In this scenario inbuilt NetScaler Metric Table is used.

    User-added image
  2. Create a Load Monitor and provide the destination IP as the IP of the server.

    User-added image
  3. Under the Special Parameters tab select the Metric Table and provide the Type (in this scenario client connection is used) and the Threshold ( in this scenario 50 is used).
    SNMP Community Name should be based on the name used for SNMP. In this scenario public is used hence the server SNMP Community Name should also be "public".

    User-added image
  4. Similarly, create the other Load Monitor for the second server.

    User-added image
  5. Create the Services. Create the first service as NS1 and bind the Load Monitor 1.

    User-added image
  6. Create the Second Service NS2 and bind the Load Monitor 2.

    User-added image
  7. Now on the load balancing virtual server bind the two services.

    User-added image
  8. Select the Method as Custom Load.

    User-added image

These scenarios work based on the SNMP Value received. This should be an Integer Value. So make sure that the back end servers are providing proper response to the SNMP Query.

Flow and Design

  • Initially when you configure this method, the present method you will notice is Round Robin.

    > sh lb vserver lb
            lb (10.104.23.72:80) - HTTP     Type: ADDRESS
            State: UP
            Port Rewrite : DISABLED
            No. of Bound Services :  2 (Total)       2 (Active)
            Configured Method: CUSTOMLOAD
            Current Method: Round Robin, Reason: A new service is bound
            Mode: IP
            Persistence: NONE
            rement Interval: 0
            TD: 0
            Mac mode Retain Vlan: DISABLED
            DBS_LB: DISABLED
            DNS64 Synth: DISABLED   Bypass AAAA: NO
     
    1) NS1 (10.104.23.131: 80) - HTTP State: UP     Weight: 1
    2) NS2 (10.104.40.43: 80) - HTTP State: UP      Weight: 1
  • In the stat lb connection you can notice the number of Hits to the site and connection.

    > stat lb vserver lb
     
    Virtual Server Summary
                          vsvrIP  port     Protocol        State   Health  actSvcs
    lb              10.104.23.72    80         HTTP           UP      100        2
     
               inactSvcs
    lb                 0
    
    Bound Service(s) Summary
                              IP  port         Type        State     Hits   Hits/s
    NS1            10.104.23.131    80         HTTP           UP        0      0/s
    NS2             10.104.40.43    80         HTTP           UP        0      0/s
     
                     Req    Req/s      Rsp    Rsp/s Throughp ClntConn   SurgeQ
    NS1                0      0/s        0      0/s        0        0        0
    NS2                0      0/s        0      0/s        0        0        0
     
                 SvrConn   ReuseP  MaxConn ActvTran  SvrTTFB     Load
    NS1                9        0        0        0        0       42
    NS2                9        0        0        0        0       82
  • In the Wireshark network capture you can see the number of connections based on SNMP of the service.

    User-added image
    User-added image
  • The Initial Method will show Round Robin unless the server receives enough number of requests. The Custom Load method will start when the number of hits exceeds the threshold value (50) for both the values.

  • You can notice in the lab setup that the number of hits reached 102/103 but still the Method is Round Robin. From this example you can know that it takes a few number of request which should be greater then threshold when it triggers the Custom Load.

    > stat lb vserver lb
     
    Bound Service(s) Summary
                              IP  port         Type        State     Hits   Hits/s
    NS1            10.104.23.131    80         HTTP           UP      138      5/s
    NS2             10.104.40.43    80         HTTP           UP      137      5/s
    Done
     
    > sh lb vserver lb
            lb (10.104.23.72:80) - HTTP     Type: ADDRESS
            State: UP
            Last state change was at Sat Apr  4 10:36:35 2015
            Time since last state change: 0 days, 00:15:17.800
            Effective State: UP
            Configured Method: CUSTOMLOAD
            Current Method: Round Robin, Reason: A new service is bound
            Mode: IP
            Persistence: NONE
  • You can see that when the Requests reached enough number like 265 the CUSTOM Load is triggered.

    > stat lb vserver lb
     
    Virtual Server Summary
                          vsvrIP  port     Protocol        State   Health  actSvcs
    lb              10.104.23.72    80         HTTP           UP      100        2
     
               inactSvcs
    lb                 0
     
    Virtual Server Statistics
                                              Rate (/s)                Total
     
    Bound Service(s) Summary
                              IP  port         Type        State     Hits   Hits/s
    NS1            10.104.23.131    80         HTTP           UP      265     10/s
    NS2             10.104.40.43    80         HTTP           UP      150      0/s
     
    > sh lb vserver lb
            lb (10.104.23.72:80) - HTTP     Type: ADDRESS
            State: UP
            No. of Bound Services :  2 (Total)       2 (Active)
            Configured Method: CUSTOMLOAD
            Mode: IP
    Startup Request Rate: 0 PER_SECOND, Increment Interval: 0
            TD: 0
            Mac mode Retain Vlan: DISABLED
            DBS_LB: DISABLED
            DNS64 Synth: DISABLED   Bypass AAAA: NO
     
    1) NS1 (10.104.23.131: 80) - HTTP State: UP     Weight: 1
    2) NS2 (10.104.40.43: 80) - HTTP State: UP      Weight: 1
  • Now the NetScaler sees the SNMP response returned by both the service and the load is shared based on the low value.

    User-added image
    User-added image
  • As you can notice, the NS1 service is providing a response as 30 and NS2 is providing a response as 23. So more load will be passed to NS2. You can confirm this in stat lb.

    > stat lb vserver lb
     
    Virtual Server Summary
                          vsvrIP  port     Protocol        State   Health  actSvcs
    lb              10.104.23.72    80         HTTP           UP      100        2
     
    Bound Service(s) Summary
                              IP  port         Type                   State     Hits   Hits/s
    NS1            10.104.23.131    80         HTTP           UP      850     45/s
    NS2             10.104.40.43    80         HTTP           UP      200      7/s
     
                     Req    Req/s      Rsp    Rsp/s Throughp ClntConn   SurgeQ
    NS1              850     45/s      849     45/s        6        1        0
    NS2              200      7/s      199      7/s        1        1        0
     
                 SvrConn   ReuseP  MaxConn ActvTran  SvrTTFB     Load
    NS1                4        3        0        1       18       54
    NS2                8        1        0        1       59      102
  • This will continue until it does not reach the Threshold of 50 provided in the load balancing Monitor.

  • If any of the back end server reaches the Threshold of 50 and replies with a value of more than 50 then load balancing will skip that service.

  • As you can see if there are more connections on the server then the following Response is received from the back end servers on SNMP which is exceeding the Threshold that is configured.

    User-added image

    Then the NetScaler will skip that service.

    > sh lb vserver lb
            lb (10.104.23.72:80) - HTTP     Type: ADDRESS
            State: UP
            Last state change was at Sat Apr  4 10:36:35 2015
            Time since last state change: 0 days, 00:17:25.590
            Effective State: UP
            No. of Bound Services :  2 (Total)       2 (Active)
            Configured Method: CUSTOMLOAD
            Mode: IP
                    Mac mode Retain Vlan: DISABLED
            DBS_LB: DISABLED
            DNS64 Synth: DISABLED   Bypass AAAA: NO
     
    1) NS1 (10.104.23.131: 80) - HTTP State: UP     Weight: 1
                    Warning: Service will be skipped in LB as it has reached threshold
    2) NS2 (10.104.40.43: 80) - HTTP State: UP      Weight: 1
                    Warning: Service will be skipped in LB as it has reached threshold
     
    1)      Policy : appfw Priority:100     GotoPriority Expression: END
     
    Done

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

猜你喜欢

转载自www.cnblogs.com/lsgxeva/p/9221417.html