Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Load balancing

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1 2
Go to End
Author Topic: 7281 Views
  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Load balancing Link to this post

    Hi,

    Has anyone got any experience with load balancers in combination with Silverstripe ?

    I've currently got a live site which behaves quite weird behind a load-balancer (once someone is logged in into Silverstripe the system gets very very slow for that user) and I'm wondering if the caching system is acting up if there are 2 machines writing / reading to the same silverstripe-cache directory.

    Is there a way to switch the entire caching system off so I can test this ?

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: Load balancing Link to this post

    I know that Matt set up a site on Mediatemple's grid hosting and had to deal with a few issues surrounding this.

    Matt - care to elaborate?

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Load balancing Link to this post

    Thanks. I'd be really interested in hearing about this....

  • Matt
    Avatar
    Core Development Team
    84 Posts

    Re: Load balancing Link to this post

    Hey there,

    www.demconvention.com runs on (mt) Media Temple's (gs) Grid Service - which means that many servers share a common set of directories via something like a SAN (Storage Area Network). It did involve some challenges - the biggest one was that because of the specific way the Grid servers are setup, not all directories are shared - basically only the /home directories (where all the site files are stored) was shared. So therefore, whenever you accessed a page, you would get one of (potentially) 100 servers, and the likelihood that this particular server had already cached the templates needed to generate this page was quite unlikely. I ended up hacking sapphire/core/Core.php to change the TEMP_FOLDER definition to be something that was shared across all servers, thus all servers looked in a common place for the template cache.

    This might be something that could help you also - I added some notes to this wiki page on content delivery network issues which might help you. I had to contact Media Temple to confirm this with them first, but it might be a similar problem to you... or maybe it's the opposite.

    Can't be entirely sure without a little more info - are the cache directories shared? How are they shared? Do you have stats on the load balancer - is it one or other of the servers that is slow?

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Load balancing Link to this post

    Hi Matt,

    Thanks for the information.

    Silly thing is that in my situation , the servers do have their webroot shared, so the silverstripe-cache directory is the same for both. But it just slows down to a near halt once you are logged in and start working in the CMS. The anonymous front-end works perfect.

    Do you guys have any other ideas I could try ? ;-)

  • Matt
    Avatar
    Core Development Team
    84 Posts

    Re: Load balancing Link to this post

    Ah, so it's the CMS itself that's slow. I'm not really sure what's going on - the CMS does load a lot of very small files, rather than a few big ones, so it's possible that the servers are tuned to not answer requests for lots of files at once for one IP address or something, or the load balancer is slow for many requests at once (unlikely, but it could also be slowing the requests to a more manageable level for the web server)?

    I won't be any real help I'm afraid, are you running a custom load balanced solution? If not, what host are you with?

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Load balancing Link to this post

    Hi Matt,

    It is a custom solution. Funny thing is , the system works perfectly for a couple of minutes before collapsing.... ;-)

    I'm suspicious about the cache and the cookies (I had to use some dirty hacks to get SS working in a subdirectory while having it think it was running in the root, don't ask why ... ;-)

    THanks for your help though ! If I ever get it fixed, I'll let you guys know...

  • dashiel
    Avatar
    Community Member
    13 Posts

    Re: Load balancing Link to this post

    could you elaborate some more on the lines of code that need hacking. i'm not much of php guy, but after convincing a client to ditch their current host (really bad) for media temple i'm looking a bit red in the face.

    i assumed that all instances of $ssTmp need to be modified and tried both:

    $ssTmp = "domains/mydomain.com/silverstripe-cache";

    and

    $ssTmp = dirname(dirname($_SERVER['SCRIPT_FILENAME'])) . "domains/easeinc.d-xi.com/silverstripe-cache";

    neither seem to be working, or at least i should say neither seem to be adding cached versions of the files to the directory.

    7281 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.