Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

Load balancing


Go to End


11 Posts   8885 Views

Avatar
Fuzz10

Community Member, 791 Posts

22 April 2008 at 10:21pm

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 ?

Avatar
Sam

Administrator, 690 Posts

23 April 2008 at 1:52pm

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?

Avatar
Fuzz10

Community Member, 791 Posts

23 April 2008 at 9:10pm

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

Avatar
Matt

Community Member, 86 Posts

23 April 2008 at 9:53pm

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?

Avatar
Fuzz10

Community Member, 791 Posts

24 April 2008 at 12:36am

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 ? ;-)

Avatar
Matt

Community Member, 86 Posts

24 April 2008 at 1:16am

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?

Avatar
Fuzz10

Community Member, 791 Posts

24 April 2008 at 7:13am

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...

Avatar
dashiel

Community Member, 13 Posts

12 May 2008 at 1:00pm

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.

Go to Top