Forum Discussion

cjbarr1234's avatar
cjbarr1234
Icon for Altostratus rankAltostratus
Mar 24, 2016

One Virtual Server, Two Pools - different persistence profiles

Hello,

 

I have one virtual server that has two pools behind it. These pools are different applications. I use URI logic to redirect to each pool.

 

(i.e. URI eq "/" pool A else URI eq "/123" pool B"

 

The problem I am having is Pool A needs least balanced connections to equally distribute traffic.

 

Pool B on the other hand demands source address affinity.

 

I need help with an iRule that does this. Any tips?

 

2 Replies

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    Cjbarr1234,

     

    Least connections is a load balancing algorithm and source address persistence deals with returning clients. Persistence will override load balancing. So they are distinct.

     

    That being said. You can use the persist command to select a persistence method in an irule. See the following DC article Enabling Session Persistence with iRules

     

    Hope this helps,

     

    N

     

  • Thanks Nathan. Would you have an example of how you would do this? This is something I came up with, but I don't fully know if it will work. Hopefully you can help me hash this out...

    when HTTP_REQUEST {

    log local0. "[IP::client_addr][TCP::client_port]: New HTTP request to [HTTP::host][HTTP::uri]" 
     Select pool and persistence based on URI 
    switch -glob [HTTP::uri] { 
        FV 
       "/*" { 
           Select fv pool and no persistence 
          pool fv_pool 
      persist none
          log local0. "[IP::client_addr][TCP::client_port]: fv request" 
       } 
        PV
       "/pv*" { 
           Select pv pool and simple persistence 
          pool pv_pool 
      persist srcaddr 300
          log local0. "[IP::client_addr][TCP::client_port]: pv request" 
       } 
        PV
       "/pv/*" { 
           Select pv pool and simple persistence 
          pool pv_pool 
      persist srcaddr 300
          log local0. "[IP::client_addr][TCP::client_port]: pv request" 
       } 
        RFM
    "/rfm/" {
       Select rfm pool and simple persistence
          pool rfm_pool 
      persist srcaddr 300
          log local0. "[IP::client_addr][TCP::client_port]: no match for [HTTP::host][HTTP::uri]" 
       } 
    } 
    

    }