Forum Discussion

Daniel_Reznicek's avatar
Daniel_Reznicek
Icon for Nimbostratus rankNimbostratus
Aug 20, 2012

Direct hundreds of clients to 10's of pools by URI

We have hundreds of customers, each with their own website. These websites are on pools of servers with approx 50 sites per pool. The customers are redirected via a website doing a sql query to find their "pool" URL. These pools consist of 2 or more So a customer hits:

 

 

www.website.com/customer1

 

 

 

They get redirected to:

 

 

 

pool1.website.com/customer1

 

 

 

Customer 2 hits:

 

 

 

www.website.com/customer2

 

 

 

They get redirected to

 

 

 

pool13.website.com/customer2

 

 

 

I would like to handle all of this within the F5 is possible instead of handing them off to individual VIP's mapped to pools. Is it possible to do this:

 

 

 

1) Have the customer hit a single URL (example):

 

 

www.website.com/customer2

 

 

 

2) Lookup their pool association from a "routing" table that is populated from an external datastore (example):

 

 

 

customer1 pool1

 

customer2 pool13

 

customer3 pool4

 

.

 

.

 

.

 

 

 

3) Direct traffic to the pool based on decision in 2)

 

 

 

If this IS possible, is it better to "cache" the customer routing data in a table locally on the F5? How would I poison that data if I move a customer to a new pool?

 

 

 

I know this is kind of an architecture question, but I figured I'd start at what the iRule is capable of doing before going any farther.

 

 

 

4 Replies

  • Richard__Harlan's avatar
    Richard__Harlan
    Historic F5 Account
    You could do the following create a table in the LTM. When a customer come in and requests there website you could first do a look up in the table and see if the table has a result. If the table does not have the result then you can do a sideband connection to a web application and pull the data from the database. Once the data is back from the sideband you can update the table with a timeout to age out the data to keep it from getting stale.

     

     

    Now when you do the lookup of the data in the table you can set the query so it does not update the timer and allow the data to age out. Now this could cause times where you more the location of the website and the LTM getting it data updated. There could be way around this but would need to know more about your systems to give you a better idea.

     

     

    Hope that helps.
  • in case of using data group.

    e.g.

    [root@ve10:Active] config  b virtual bar list
    virtual bar {
       destination 172.28.19.79:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve10:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
       if {[string tolower [HTTP::host]] equals "www.website.com"} {
          scan [HTTP::uri] {/%s} cust
          set pl [class match -value $cust equals redirect_class]
          if {$pl ne ""} {
             HTTP::redirect "http://[string map "www $pl" [string tolower [HTTP::host]]][HTTP::uri]"
          }
       }
    }
    }
    [root@ve10:Active] config  b class redirect_class list
    class redirect_class {
       {
          "customer1" { "pool1" }
          "customer2" { "pool13" }
          "customer3" { "pool4" }
       }
    }
    
    [root@ve10:Active] config  curl -I http://172.28.19.79/customer1 -H "Host: www.website.com"
    HTTP/1.0 302 Found
    Location: http://pool1.website.com/customer1
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve10:Active] config  curl -I http://172.28.19.79/customer2 -H "Host: www.website.com"
    HTTP/1.0 302 Found
    Location: http://pool13.website.com/customer2
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve10:Active] config  curl -I http://172.28.19.79/customer3 -H "Host: www.website.com"
    HTTP/1.0 302 Found
    Location: http://pool4.website.com/customer3
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    
  • Hi nitass,

     

     

    Do you know what the performance would be with ~2000 entries in that datagroup? I'm concerned about the lookup time with so many entries.

     

     

    Thanks for the script!
  • Do you know what the performance would be with ~2000 entries in that datagroup? I'm concerned about the lookup time with so many entries.i do not have performance data but i think ~2k entries is not too many.

     

     

    sol12112: The maximum size for a single string in a class or data group is 65,520 characters

     

    http://support.f5.com/kb/en-us/solutions/public/12000/100/sol12112.html

     

     

    just my 2 cents.