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 !

Mutahir
  • 2,357
  • 2
  • 32
  • 42

7 Answers7

5

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

Matt Simmons
  • 20,396
  • 10
  • 68
  • 116
  • 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 '10 at 09:40
  • 2
    A SAN is *not* the same thing as NFS. – chris Jun 17 '10 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. – Tom O'Connor Jun 30 '10 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. – Artem Russakovskii Oct 10 '11 at 09: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.

CarpeNoctem
  • 2,437
  • 4
  • 23
  • 32
  • +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. – WheresAlice Jun 30 '10 at 14:04
  • 5
    Load balancing isn't *just* about performance, its also about adding redundancy. – Mike P Jun 29 '12 at 23:26
  • When you mention WP Super Cache you should also mention W3 Total Cache – david Nov 29 '12 at 00: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!

shennyg
  • 51
  • 2
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.

sntg
  • 1,450
  • 11
  • 15
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.

cagenut
  • 4,848
  • 2
  • 24
  • 29
0

sessions are better shared via memcache then on the filesystem.

Mike
  • 22,310
  • 7
  • 56
  • 79
-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

Terence Johnson
  • 111
  • 1
  • 1
  • 6
  • ...except that DRBD provides a block device, which hardly is equivalent to a file system. – andol Jun 30 '10 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 ;) – Terence Johnson Jul 03 '10 at 05:31