Forum Discussion

Christer_377235's avatar
Christer_377235
Icon for Nimbostratus rankNimbostratus
Nov 19, 2018

Both iRule and Cookie persistence?

Is it possible to have a rule where you redirect to pool members depending on url (always has priority) but you also have some kind of persistence table so you can drain connections so users are not kicked out from stateful applications?

 

So /abc would always go to pool a but if I put it to maintenance it is not removed immediately but only when all sessions have timed out.

 

I wrote a much longer post describing the issue but could not get it through the spam filter.

 

3 Replies

  • Detailed description part 1:

     

    I have an application that holds a state in its session. The session itself is first created by another application and then the user navigates to a url with a specific id, so as an example:

     

    1. External application creates a new session in my application and we return id: a12345
    2. User navigates to my application with the id, i.e. /a12345

    As this is the first time the user access the application we need to ensure that the user ends up at the server that holds the session. We have solved this by the servers creating an id that points to the correct server. So "Server a" always creates an id that starts with a and "Server b" would create an id that starts with b.

     

  • Detailed description part 2:

     

    So we have an iRule that redirects /a to pool a and my-application/b* to pool b. If it does not have id at all and only have / then it is the first request from the external application and it can be load balanced to any server to create the initial session.

     

    This works well but as an extension to this I would like to be able to be able to perform application updates or maintenance without disturbing users. So I want to be able to put "server a" in maintenance mode and that would mean that:

     

    1. All new request from the external application to my-application/ would end up at "server b".
    2. Users who already have a session created on "server a" can finish working, this can take 30 minutes or more.
  • Detailed description part 3 of 3:

     

    We tried setting sticky sessions using cookie persistence in hopes that it would help draining the sessions properly. However that seems to override the iRule so if a customer first goes to /a12345 (and gets a cookie) and then goes to /b12345 they would still end up at "server a" and get an error as the session does not exist there.

     

    If we just use the iRule then the server is removed from the pool immediately and all users lose their work.

     

    Anyone have any suggestion how this can be fixed or have any suggestion of another approach we can take to solve this problem?