Forum Discussion

Ahmed_Mahmood_1's avatar
Ahmed_Mahmood_1
Icon for Nimbostratus rankNimbostratus
Feb 27, 2008

Election Hash Persistence on BIG-IP LTM

Hi,

 

I read the article about "Hash Load Balancing and Persistence on BIG-IP LTM" and am really interested in the Election Hash method.

 

 

The only thing I need to do different is to predefine which server or pool member to use for a limited number of requests.

 

 

i.e. I have 12 URI and 12 Pool members and need to know what URI to use so that each different URI request goes to a known pool member. A one-to-one mapping so to speak.

 

 

Is there any way I can prequalify 12 URIs and know which one will go to which server up front so I can define this in my application?

 

 

Any help on this would be appreciated...

 

 

thx,

 

  • You could embedd within the URI a unique number that represents a pool. Then when a request is made a made you can inspect the URI and sent to the pool member based on that.

     

     

    This can be done using a switch command. Here is an article

     

    http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=129.
  • One of the benefits of Election Hash is that it is completely deterministic. This is important because it allows you to prepopulate caches and know the LTM will send the request to the correct cache. Try out this simple variant of Election Hash. Instead of sending the request to a pool member, it sends the client a web page with the servers it would have load balanced to.

    - Nathan

    
    when HTTP_REQUEST {
       Determine where to prepopulate cached data by checking the LTM first.
       Apply this to a VS configured with the same pool as the production VS.
       Point your web browser or a perl script at the VS to facilitate
       automated cache prepopulation.
      set Score1 ""
      set Score2 ""
      set Winner1 ""
      set Winner2 ""
      foreach Node [active_members -list [LB::server pool]] {
        if { [md5 $Node[HTTP::uri]] > $Score1 } {
          set Winner2 $Winner1
          set Score2  $Score1
          set Score1 [md5 $Node[HTTP::uri]]
          set Winner1 $Node
        }
        elseif { [md5 $Node[HTTP::uri]] > $Score2 } {
          set Score2 [md5 $Node[HTTP::uri]]
          set Winner2 $Node
        }
      }
       log local0. "Content: [HTTP::uri] - Primary: Winner1 - Secondary: Winner2"
      HTTP::respond 200 content "
        Election Hash Selection
                  Election Hash will send requests to:        Content[HTTP::uri]        Primary Node[lindex $Winner1 0]:[lindex $Winner1 1]        Secondary Node[lindex $Winner2 0]:[lindex $Winner2 1]      "
    }