Forum Discussion

ItTim_39238's avatar
ItTim_39238
Icon for Nimbostratus rankNimbostratus
Apr 14, 2008

What to use

First, let me say that I'm a tech guy, not a coder. Second, I'm not looking for a final solution - just someone to point me in the right direction so I can pass on some basic info to my Dev team to work out the details...

 

 

I have a custom application which communicates outside of HTTP/HTTPS over fixed ports that communicates to a business tier. I would like to find a way to create a virtual server supporting two or more business tiers to help scale the app. However, the app requires some level of persistance between the client and the business server. Although source_addr does work if I set the timeouts high-enough, I need to go beyond that level due to NAT within my network. I have tried the other persistent options with no success. I'm sure that the iRules probably have enough power to create this, but when I look at the samples, I find reference to standard protocols like HTTP, FTP, etc. Where can I find true custom persistance options for non-standard applications? I would like to point my developers at something that they can either update our app generate tags to support custom iRules, or if possible find some identity in the app as it is and build an iRule around.

 

 

Thank you all in advance.

 

Tim

2 Replies

  • Hi Tim,

     

     

    If source address persistence doesn't meet your requirements and the application is built on a custom TCP-based protocol in which you can't insert a persistence token in the responses, you would most likely want to persist off of some component of the requests/responses. If the persistence token exists in the payload, you'd need to collect the TCP payload and parse the persistence token. You'd probably want to use the TMM persistence or session table to track the persistence token and which node the request went to. The collection can be done using TCP::collect (Click here). Adding a persistence record can be done using 'persist add uie $persist_token $timeout' (Click here). You can use an existing persistence record on subsequent requests using 'persist uie $persist_token $timeout'.

     

     

    Although it's based on HTTP, you can use the Codeshare entry for ASP Session ID persistence as a conceptual example:

     

     

    ASP Session ID persistence

     

    (Click here)

     

     

    Here are a few related tech tips:

     

     

    Deb's Tech Tip on persist versus persist add:

     

    (Click here)

     

     

    Colin's Tech Tip on the session command:

     

    (Click here)

     

     

    Hopefully this gets you started. Let us know if you want clarification on anything.

     

     

    Thanks,

     

    Aaron
  • Hi,

    The basic command you'll need will be :

    TCP::collect and TCP::payload: they will give you the capability to analize network packets: Click here, Click here

    persist uit to create persistency on the string you want to make persistency on: Click here

    
    when CLIENT_ACCEPTED {
        TCP::collect 44   
    }
    when CLIENT_DATA {
       set ConStr [TCP::payload 44]
       set SessionID [substr [getfield $ConStr "@" 2] 0 " CHID" ]
       log local0.info $SessionID
       if { $SessionID equals "" } {
           No SessionID, just load balance as usual
          log local0.info "No session ID, load balancing the connection."  
          pool YOUR_DEFAULT_POOL_NAME
       } else {
           All clients with this SessionID go to this server
           timeout is 120 seconds
          persist uie $SessionID 120
       }
    }