15

I have to install wordpress (One Blog, one domain, for e.g. mycompany.com/blog) on two servers sharing one database on a different server, these two servers are behind a loadbalancer and the db would be on another server. We are planning this way due to high traffic.

I have done standalone wordpress installations on a single server, on windows 2003, 2008 with IIS6, 7 etc

I am just researching as to how would I implement this.

What would be the steps to achieve this and upon searching I saw some posts regarding the wp-content/uploads directory to be synced at regular intervals ?

your help much appreciated Thanks for reading


What we did :

a) We have two web servers connected to a san cluster b) created a blog directory on the san c) Mapped that blog directory as a virtual directory on both webservers d) Installed wordpress on any one of them (as the domain and IIS virtual directories is the same for both servers - for e.g. www.abc.com) e) Database for this blog is located on two MySQL Boxes

as Wordpress is sitting on the san, so no conflicts with uploads or anything like that, Blog url is www.abc.com/blog and that's how it is configured on both.

Hope that helps someone !

3
  • 1
    +1 for the "I never thought of doing that" effect. Feb 2, 2010 at 13:36
  • 1
    +1 for "I hope someone provides a really great answer with step-by-step instructions on the best way to implement this and why it is the best way". Jun 17, 2010 at 17:09
  • just added on what we end up doing - hope this helps
    – Mutahir
    Jun 30, 2010 at 15:27

7 Answers 7

5

If those directories need to be identical, could you put them on another server and mount them remotely via NFS?

4
  • We have a SAN ; so we installed wordpress onto the SAN and added that directory in IIS as the wordpress/blog directory. Thanks everyone for the comments ;
    – Mutahir
    Feb 26, 2010 at 9:40
  • 2
    A SAN is not the same thing as NFS.
    – chris
    Jun 17, 2010 at 17:10
  • 4
    Share sessions with Memcache, share files with NFS or GlusterFS. Share traffic with HAProxy or Varnish (caches too!), and share databases with circular replication. Jun 30, 2010 at 14:03
  • GlusterFS is a fascinating suggestion - thank you for that. I'm exploring that as a solution to my Wordpress scaling of static stuff. Oct 10, 2011 at 9:37
3

There are so so so many ways to improve wordpress performance that don't require a second server and load balancing. In two words: "cache everything".

  • Use a php opcode cacher (APC). You can easily achieve 90% cache hit rates with wordpress in under 64MB of mem.

  • Enable mysql query cache. You can easily achieve 65% or > cache hit rates with very little mem (site dependent, but never too high).

Most importantly:

Wordpress is a heavy "read" site (vs. write) with most requests limited to a few hundred pages (blog posts). You can increase the requests per second 10 fold by serving static versions of your most popular posts. The best plugin for that is: wp-super-cache. I am not positive if that particular plug-in is compatible with 2k3, but the general idea of automatically creating static versions of your pages and periodically updating them to include new comments, edits, etc is going to be your best bet.

I truly doubt you're site will be doing enough traffic to require two web/app servers if the above common enhancements are implemented(the above can easily handle the slashdot effect). However, two web servers would add a level of fault tolerance. Since performance can be achieved with one web server, then fault tolerance can be achieved using an active/passive setup. This would be simpler and require no sharing of session information.

3
  • +1 WordPress also has caching plugins which can do a really good job. There's no reason to run WordPress across two servers like this with a decent amount of caching enabled. Jun 30, 2010 at 14:04
  • 5
    Load balancing isn't just about performance, its also about adding redundancy.
    – Mike P
    Jun 29, 2012 at 23:26
  • When you mention WP Super Cache you should also mention W3 Total Cache
    – david
    Nov 29, 2012 at 0:33
3

We ran into the same situation, ended up installing an s3 plugin that hosts your wp uploads directory so you don't have to deal with the syncing.

This is the one we used: http://tantannoodles.com/toolkit/wordpress-s3/

It has been working great so far!

4
  • 1
    I would advise against using a plugin that hasn't been updated since 2009 - it's unmaintained and you may regret it in the future (S3 changes, security, etc). Oct 10, 2011 at 10:05
  • FYI, we are still running fine with this plugin.
    – shennyg
    Oct 12, 2011 at 23:13
  • @shennyg - still going strong?
    – Ben
    Jul 3, 2014 at 17:18
  • @Steve wordpress-s3 is unmaintained. I'd go with w3 total cache, it can sync your Media Libraries.
    – shennyg
    Jul 30, 2014 at 19:29
0

You must share between servers the uploads/dir, and the sessions dir , usually in /tmp

Change it in php.ini and share the fs for sessions and uploaded files between servers via samba, nfs or what you prefer.

0

First up, answered a very related question over here you will probably find helpful: SAN + MySQL replication- is that what I want for my load-balanced Drupal cluster?

Web clustering can go really far down the rabbit hole, so its important to keep your business goals in mind and not get lost in engineer one-upsmanship. For instance, you're planning on having two webservers and one database server... but what if the database server is your bottleneck? Then your second webserver is wasted. On modern hardware with one webserver and one database server and a well configured wordpress you can handle a couple hundred requests per second. Are you expecting that? If not, there's probably no point in loadbalancing.

0

sessions are better shared via memcache then on the filesystem.

-1

On a Linux pair, I would use DRBD. The Windows equivalent is the Distributed File Service.

http://technet.microsoft.com/en-us/library/cc753479%28WS.10%29.aspx

2
  • ...except that DRBD provides a block device, which hardly is equivalent to a file system.
    – andol
    Jun 30, 2010 at 15:52
  • ...and I can then choose which file system to format it with, which provides far more scope for indecision than being stuck with NTFS ;) Jul 3, 2010 at 5:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .