The MU forums have moved to WordPress.org

Run WPMU in a cluster under load balancer? + MU Domain Mapping (20 posts)

  1. webmaestro
    Member
    Posted 15 years ago #

    Any tips on running WordPressMU in a cluster, under a load balancer?

    We run WordPressMU in a cluster of a few httpd Web servers + a few MySQL Database servers behind a load balancer (VIP).

    WPMU's method of making internal HTTP requests (used by wp-cron, RSS, etc.) caused issues, so we implemented a round-robin for internal HTTP GET requests.

    Can RSS, wp-cron and other 'jobs' be scripted to be use the command line interface-style PHP 'exec' scripts instead of over HTTP using GETs? Those GET requests go internally to the load balancer and back to WPMU, which the VIP/load balancer doesn't support.

    If those can be accomplished via CLI (assuming there are no other internal calls), then we can put the VIP address in for the Server IP Address (the external address).

    We're hoping to use Donncha's WordPress MU Domain Mapping plugin, but I don't have a single IP address, but we're concerned about the potential problems caused by internal requests to the VIP.

  2. WilliamTully
    Member
    Posted 15 years ago #

    WPMU's method of making internal HTTP requests (used by wp-cron, RSS, etc.) caused issues, so we implemented a round-robin for internal HTTP GET requests.

    Wait. I have these issues! I don't want to sidetrack you post (we have a load balancer enroute to us and I'm going to need the information you get too) - can you explain a bit about the round-robin you did to get things working?

  3. webmaestro
    Member
    Posted 15 years ago #

    All WEB servers in the cluster use the internal IP address for the load balancer in the /etc/hosts file for http://www.myblogdomain.com and mydomain.com:

    xxx.xxx.xxx.xxx   http://www.myblogdomain.com mydomain.com

    ...and also have the following in their httpd CONF file:

    <VirtualHost *>
            ServerName http://www.myblogdomain.com
            ServerAlias myblogdomain.com
    ...
  4. webmaestro
    Member
    Posted 15 years ago #

    Sorry for the delay... We entered our blog domain in internal DNS pointing to each IP available on the cluster:

    blogdomain.com   127.xx.x.1
    blogdomain.com   127.xx.x.2
    blogdomain.com   127.xx.x.3

    NOTE: blogdomain.com is the same on each line... What's different is the IP address.

  5. Klark0
    Member
    Posted 15 years ago #

    mmmm..when i was testing the Domain Mapping plugin, I remember being able to map a domain by just changing the DNS of the domain-to-be-mapped to ns1.mublogs.com & ns2.mublogs.com

    I think that's how Wordpress.com does it.

  6. honewatson
    Member
    Posted 15 years ago #

    My tip would be to consider Nginx because it has wild card domains (not just subdomains).

    You have wild card domains as long as the mu wordpress installation is set up with the server_name as:

    server_name localhost;

    Just point the domain at the ip address of your server then create a new blog for that domain under your wordpress mu.

    Round robin load balancing is also very easy with Nginx although you may find you don't need as many httpd servers.

    The potential downside of this is you have additional site_id etc info added to your mysql tables.

  7. andrea_r
    Moderator
    Posted 15 years ago #

    You can tweak Apache so it will answer to any domain as well. :)

  8. honewatson
    Member
    Posted 15 years ago #

    @andrea_r

    Yes but you still have the Apache Ram/CPU overhead problems that you don't have with Nginx.

  9. webmaestro
    Member
    Posted 15 years ago #

    We run a rather large collection of SAMP servers (Solaris, Apache, MySQL, PHP), and I don't believe we plan on switching away from Apache, but that's an interesting approach...

    Thanks for the input!

  10. honewatson
    Member
    Posted 15 years ago #

    Nginx is worth looking into.

    A Debian, Nginx, php-fpm fastcgi, xcache can mean saving of up to 75% in hardware costs compared to some other setups I've used like Cent OS Apache etc.

  11. andrea_r
    Moderator
    Posted 15 years ago #

    I haven't had a chance to play with it yet, but I want to. :) That counts, right? :D

  12. webmaestro
    Member
    Posted 15 years ago #

    Nginx sounds interesting (and is certainly something I may consider for personal stuff--I see it's available for my favorite platform), but is not an option for our WPMU installation at this time...

  13. VentureMaker
    Member
    Posted 15 years ago #

    Well, nginx and apache can work together.

  14. honewatson
    Member
    Posted 15 years ago #

    andrea_r, webmaestro, I found a nice explanation post for a set up:

    http://www.yawn.it/2008/04/30/nginx-php-php-fpm-on-debian-etch-40/

    I would also compile nginx for gzip support and I've added some additional php options for my own needs. I added suhosin which hardens php for additional security.

    apt-get update
    apt-get upgrade
    apt-get install build-essential subversion libxml2 libxml2-dev python2.5-dev libxslt-dev libssl-dev libpcre3-dev php5-dev tidy libtidy-dev curl libbz2-dev libcurl3-dev libjpeg62-dev libpng3-dev libfreetype6-dev libfreetype6-dev libfreetype6 libmagick9-dev mcrypt libmcrypt-dev libmcrypt4 libmhash-dev libmhash2 mysql-server mysql-client libmysqlclient15-dev -y
    cd /tmp
    wget http://sysoev.ru/nginx/nginx-0.7.22.tar.gz
    tar xvfz nginx-0.7.22.tar.gz
    cd nginx-0.7.22
    ./configure --with-http_gzip_static_module --with-http_ssl_module
    make
    make install
    mkdir /etc/phpcompiled
    cd /etc/phpcompiled
    wget http://au.php.net/get/php-5.2.6.tar.bz2/from/www.php.net/mirror
    wget http://php-fpm.anight.org/downloads/head/php-5.2.6-fpm-0.5.9.diff.gz
    wget http://download.suhosin.org/suhosin-patch-5.2.6-0.9.6.2.patch.gz
    bzip2 -cd php-5.2.6.tar.bz2 | tar xf -
    gzip -cd php-5.2.6-fpm-0.5.9.diff.gz | patch -d php-5.2.6 -p1
    gzip -cd suhosin-patch-5.2.6-0.9.6.2.patch.gz | patch -d php-5.2.6 -p1
    cd php-5.2.6 && ./configure --enable-fastcgi --enable-fpm  --enable-cli --with-mysql --with-pdo-mysql --with-zlib --with-bz2 --enable-zip --with-openssl --with-mcrypt --with-mhash --with-curl --with-gd --with-jpeg-dir --with-png-dir --with-ttf --enable-ftp --enable-exif --with-freetype-dir --enable-calendar --enable-soap --enable-mbstring --with-xsl --with-xmlrpc --with-mysqli --enable-bcmath --with-gettext --with-mime-magic --enable-dba --enable-shmop --enable-sockets --enable-sysvmsg --enable-wddx  --with-tidy --with-pcre-dir  --enable-gd-native-ttf --with-kerberos --with-pear
    make all install
    make install
    cd /etc/init.d/
    wget --output-document=nginx http://images.honewatson.com/random_files/nginx.txt
    chmod +x nginx
    /etc/init.d/nginx start
    wget --output-document=php-fpm http://images.honewatson.com/random_files/php-fpm.txt
    chmod +x php-fpm
    /etc/init.d/php-fpm start
  15. honewatson
    Member
    Posted 15 years ago #

    Here is a nginx conf file which replaces /usr/local/nginx/conf/nginx.conf

    http://images.honewatson.com/random_files/nginx.conf

    A few key points about this config:

    1. Assumes you have Super Cache on with Gzip off (This conf is set for Nginx to Gzip instead)
    2. Assumes you have a script to transfer your user uploaded files to s3 daily then delete them from your server
  16. deafnation
    Member
    Posted 15 years ago #

    My company would like to hire a WPMU Guru with scalability experience such like this to operate with WPMU/Buddypress together. I know buddypress is still in beta but I would like to prepare our capability to handle WPMU growth with our members.

    Please contact jed@deafnation.com for more information. Thanks!

  17. PerS
    Member
    Posted 15 years ago #

    @honewatson

    Thank you, exactly what I was looking for (especially your ngingx.cnf).

    Do you have a link to a document explaining why I should use php-fpm? Today I'm using the native php fastcgi (php5-cgi).

    also, are you using xcache / eaccelerator ?

    btw/fyi,there's a nice build script at http://groups.google.com/group/highload-php-en/msg/83393e77af827f1c

  18. PerS
    Member
    Posted 15 years ago #

  19. webmaestro
    Member
    Posted 15 years ago #

    Any ideas about this:

    Can RSS, wp-cron and other 'jobs' be scripted to use the command line interface-style PHP 'exec' scripts instead of over HTTP using GETs? Those GET requests go internally to the load balancer and back to WPMU, which the VIP/load balancer doesn't support.

    If those can be accomplished via CLI (assuming there are no other internal calls), then we can put the VIP address in for the Server IP Address (the external address).

  20. webmaestro
    Member
    Posted 15 years ago #

    Just a bump... Any ideas about how to encourage WPMU to execute PHP directly (for RSS and wp-cron at least--perhaps other functions...), instead of via HTTP calls?

About this Topic

  • Started 15 years ago by webmaestro
  • Latest reply from webmaestro