1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Multi Server - Load Balancing - Session Affinity Control?

Discussion in 'Server Configuration and Hosting' started by Bill.D, Mar 26, 2013.

  1. Bill.D

    Bill.D Active Member

    Hey All,

    This may have been discussed before and if so please direct me.

    I am currently running a Xenforo System over 2 EC2 instances in Amazons AWS. Both instances are located in the same zone and are load balanced with "sticky sessions".

    (This prevent's the problem of being logged out by going to a different server in the network. It does this by ensuring you consistently go to the same server past the Load Balancer via a cookie)

    Problem: If that zone goes down; our site is down.

    I am trying to develop a more redundant and fault tolerant system.

    Problem: in a multi zone installation the "sticky session" option in the load balancer does not work.. It is hidden in the background that each zone will have a load balancer that is subsequently Load Balanced which messes up the sticky sessions.

    Is there a way with-in Xenforo to Manage Session affinity for multi server installations?

    Thanks,
    -Bill
     
  2. Mic

    Mic Member

    Hi Bill,

    Did you find something? I have the same problem here.

    Mic
     
  3. Bill.D

    Bill.D Active Member

    Sadly, No :-\
     
  4. Slavik

    Slavik XenForo Moderator Staff Member

    Could you not store the session in memcached cluster?
     
  5. Bill.D

    Bill.D Active Member

    Ok, I did some research and this is looking like a great solution.. One question though.. 1st a am a bit of a n00b to this.. But just to make sure.. PHP sessions to which this solution works with; is this also what manages people staying logged into xenforo while there usage trafic hopes between load balanced servers? If so you have made my day!

    Thanks,
    -Bill
     
    Last edited: Jun 14, 2013
  6. Bill.D

    Bill.D Active Member

    LMAO.. So memcached was the catalyst word for me.. I found this in Xenforo Help: http://xenforo.com/help/cache/
    Here is the section to solve all of my problems :D with the use of MemCached :D
     
    Slavik likes this.
  7. MattW

    MattW Well-Known Member

    So you have memcache installed on both servers, and have both of them in the array set in config.php?
     
  8. Bill.D

    Bill.D Active Member

    I haven't done a test set up yet but, from what I have been seeing it seems you want a single memcached server so all load balanced servers have a single point for session control that way it wont matter what server your on. I was thinking of using an AWS ElasticCache Server which from what I can find out: is Memcached, but we'll see ;-P
     
  9. MattW

    MattW Well-Known Member

    I know you can have the cache replicated across your memcache servers. I had 3 running at one point (just because I had 3 VPS to mess about with), so you'd have redundancy in them if you were to loose the memcache server

    PHP:
    $config['cache']['backendOptions']=array(
            
    'compression'=>false,
            
    'servers' => array(
                    array(
                            
    'host'=>'localhost',
                            
    'port'=>'11211'
                    
    ),
                    array(
                            
    'host'=>'95.154.207.118',
                            
    'port'=>'11211'
                    
    ),
                    array(
                            
    'host'=>'109.169.51.105',
                            
    'port'=>'11211'
                    
    )
            )
    );
     
  10. Bill.D

    Bill.D Active Member

    Nice! I didn't that that would have been a feature within the code.
     

Share This Page