Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Problems with load balanced site

  • 13-04-2007 10:48am
    #1
    Moderators, Category Moderators, Motoring & Transport Moderators Posts: 21,238 CMod ✭✭✭✭


    Hi Folks,

    I hope someone may be able to shed some light on this, it's been driving me mad for a while now. I wrote an internal web app in C# that uses Session variables on all pages to check if the user is logged in. It worked fine until it was put in a load balanced environment.

    Since then, the application does not "stick" to one webserver, so session variables are lost periodically. These are regained if the user is sent back to the original webserver. The Session.SessionID does remain constant across the two webservers, but that is set in a cookie.

    I don't know much about the load balancer side of things, but it's a "Cisco CSS11503". It is set up to look for a specific cookie that I set on each page, that identifies the webserver. This does not work however; I can see the cookie value changing as the webserver changes.

    It's a long shot, but if someone has had similar problems, it would be great to get some insight into this.

    thanks,

    Eoin


Comments

  • Closed Accounts Posts: 522 ✭✭✭comer_97


    don't store your session information in process, you can store it in a database which is the handiest way but there is an overhead connecting to the database and returning the information.


  • Registered Users Posts: 1,982 ✭✭✭lynchie


    Another possible solution to this issue?


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    The Application State variables are related to exactly that, the Application State, and aren't suitable for storing user information. I'd look into comer_97's suggestion.


  • Moderators, Category Moderators, Motoring & Transport Moderators Posts: 21,238 CMod ✭✭✭✭Eoin


    comer_97 wrote:
    don't store your session information in process, you can store it in a database which is the handiest way but there is an overhead connecting to the database and returning the information.

    I don't know if changing the architecture of the application is a runner at the moment.

    lynchie - thanks for the link. I've tried the cookieless Session state, where the URL is used, and no joy either. Really not too sure if we can introduce a State or SQL server into the equation, now we're in support mode :(


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    We tried cookieless session state too, briefly, as it only took us a few minutes to hijack the session.


  • Advertisement
  • Moderators, Category Moderators, Motoring & Transport Moderators Posts: 21,238 CMod ✭✭✭✭Eoin


    Evil Phil wrote:
    We tried cookieless session state too, briefly, as it only took us a few minutes to hijack the session.

    It just plain didn't work for me, so even more reason not to go for it!

    If the SqlServer solution uses the ASP Session ID cookie to indentify the browser (it's the only Session variable that is sticking across the two webservers), I'd imagine it's not that secure either?

    Edit: Also, if each webserver accesses a SQL DB installed locally on it, then it may not address the initial problem.


  • Registered Users Posts: 9,920 ✭✭✭trout


    The load balancer platform should have the ability to support session persistence, for exactly the reasons you've described... not sure what the Cisco terminology is, but I'd look there first.

    i wouldn't look at changing the application ... get the load balancer to manage the sessions ... that's what they are supposed to do.

    good luck


  • Moderators, Category Moderators, Motoring & Transport Moderators Posts: 21,238 CMod ✭✭✭✭Eoin


    trout wrote:
    The load balancer platform should have the ability to support session persistence, for exactly the reasons you've described... not sure what the Cisco terminology is, but I'd look there first.

    i wouldn't look at changing the application ... get the load balancer to manage the sessions ... that's what they are supposed to do.

    good luck

    Trout - I completely agree, all it should have to do is find out which webserver it's on and stick to it for the duration of the Session.

    It's just that the comms side of it is outside of my control and expertise, so I'm just trying to make sure that I've done everything I can to my side of it. It's one of those really annoying things that should just work, but won't.


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    In your WebConfig change from Session from InProc to StateServer or SQLServer. You will need to RegSQL to create the neccessary tables within the SQL Server.

    After that you can use StickyIPs and StickySessions to allow you to use your current system. You will need to talk to your Network Admins about this. We had a similar problem with an ASP.NET system that we wrote that got moved to a 5 server cluster. Just implemented StickyIPs on the load balancer to get it working straight again.

    HTH

    Edit: Have a look at this http://www.eggheadcafe.com/articles/20021016.asp to give you an idea of OOP state sessions.


  • Moderators, Category Moderators, Motoring & Transport Moderators Posts: 21,238 CMod ✭✭✭✭Eoin


    Thanks Ginger, changing the architecture is not an option at the moment; as we are in support mode, not development. A dedicated session server would also create a single point of failure from what I can tell.


  • Advertisement
  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Very true, If you havent sorted this by Monday morning, PM me, I will back in the country and i will whip upstairs to the network lads and ask them what needs to be done.


  • Moderators, Category Moderators, Motoring & Transport Moderators Posts: 21,238 CMod ✭✭✭✭Eoin


    Ginger wrote:
    Very true, If you havent sorted this by Monday morning, PM me, I will back in the country and i will whip upstairs to the network lads and ask them what needs to be done.

    That's very much appreciated - thank you. For what it's worth, the load balancer has got "sticky" rules set up somehow, but that's really all I know about it.


  • Closed Accounts Posts: 884 ✭✭✭NutJob


    Most load balancers have options to direct a single ip to the same server unless the server fails.

    Id be failure with using apache for this and as you can see it has many options and some are for dealing with this king of problem.
    http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html

    e.g BALANCER_SESSION_STICKY solves this exact problem.

    My bet is this can be solved at the load balancer. Sorry i cant give an exact answer as i dont know your load balancer.

    Edit: because i can't spell


  • Moderators, Category Moderators, Motoring & Transport Moderators Posts: 21,238 CMod ✭✭✭✭Eoin


    NutJob wrote:
    My bet is this can be solved at the load balancer. Sorry i cant give an exact answer as i dont know your load balancer.

    I'm definitely inclined to agree, just doing what I can at my end!


  • Registered Users Posts: 9,920 ✭✭✭trout


    just a thought ... your query is more to do with network appliances / load balancers than programming ... what about posting your query again in a forum where beards & sandals types hang out ?

    the load balancer kit I am familiar with is F5 content switches ... and the solution on that platform would be a pool of real IP addresses (your actual servers) behind a single virtual IP address (or VIP).

    One of the VIP properties would be session persistence, and the content switch manages all of the sessions, making sure everything is consistent.

    this should be really simple to solve, if you can get someone who knows the CISCO platform. this should be bread & butter stuff ... for the network guys.

    good luck :)


  • Moderators, Category Moderators, Motoring & Transport Moderators Posts: 21,238 CMod ✭✭✭✭Eoin


    trout wrote:
    just a thought ... your query is more to do with network appliances / load balancers than programming ... what about posting your query again in a forum where beards & sandals types hang out ?

    the load balancer kit I am familiar with is F5 content switches ... and the solution on that platform would be a pool of real IP addresses (your actual servers) behind a single virtual IP address (or VIP).

    One of the VIP properties would be session persistence, and the content switch manages all of the sessions, making sure everything is consistent.

    this should be really simple to solve, if you can get someone who knows the CISCO platform. this should be bread & butter stuff ... for the network guys.

    good luck :)

    That's my next port of call alright - was just wondering if there were any simple things I could be missing at my end. Also, I just don't know enough about the comms side of things to be able to provide much details for the BOFH type fellas!


Advertisement