Balance of Load in WordPress

There will be cases in which we have a platform Web mounted on a WordPress system and our servant lodges very heavy videos or contents for our users, possibly the server is a little overloaded and we need to distribute to the weight or the balance of load and the traffic of the visits between two or more servers. For it I am going to you to realise a basic tutorial of how all this without complicating to us could be organized too much, that is to say, creating a balance of load in WordPress.

distribute-of-load-WordPress

An alternative somewhat €œchapuzilla€ (in my opinion), can be, contract to a service of external video streaming, where to be able to lodge our videos (as for example amazons3), but in my opinion as system adiniatrator that I am and defending the my best profession€¦ and the most professional thing it is to lodge the videos in our own servers. Although if the Web is administered by a person without knowledge in Systems I in this way understand that it resorts to Amazon, this informing to him indirectly to the user who does not have personal budget nor behind this platform Web.

First of all a explanation: With this method that I propose we will have two or more servers in those than this running WordPress (in a same name of domain) under an only external data base, in this method we are distributing the weight of the videos, but not them requests to the data base wp. If teneis a neck of bottle in yours wordpress due to requests Web and is not problem of the content multimedia€¦.this solution will not serve to you as much. (we are only distributing the weight of the video here)

BALANCE OF LOAD IN SERVERS WITH WORDPRESS

    • to 1.Crear a Round Robin DNS
      The first step is to make a Round Robin DNS of our name of domain, under which our WordPress is working. For more information of how to create this simple passage in your DNS I recommend to you to read this article: Distribution of load with Robin Round

      round-robin-dns

    • to 2.Clonar the content of the directory FTP /httpdocs in all the servers
      The second step will be to copy the content of our /httpdocs directory of the first servant and to clone it to the rest of servers where we want that WordPress works.
    • to 3.Crear an only data base
      We will mount an external data base where we want. If it were already running WordPress in the most logical servant€¦ is to cause than that data base is used for the rest. Although we can export it and also use in another server (to taste of each).
    • 4. Dar Acceso to the data base for external requests
      In this servant where you of wordpress lodge, it will be important to give to access to external requests mysql, for it we will look for the file normally my.conf that this available one in /etc/my.cnf, (if the servant is linux), next we will modify the line that puts €œbind-address= 127.0.0.1€ and we will replace it by €œbind-address = 0.0.0.0 €œ, later will be necessary to do restart of mysql €œservice mysql restart€.
      With this what we are doing he is to say to daemon mysqld to him that he listens to external requests.
      my-conf
      my-conf
    • to 5.Modificar the configuration files of WP
      Now we go to the root of the directories of both servers where he is wordpress and looked for the file wp-config.php.
      We modify the line where it indicates the place of the data base WordPress:
      it defines (€˜DB_HOST€™, €˜localhost€™);
      and we replaced it by:
      it defines (€˜DB_HOST€™, €˜laipdelserverconlabasededatos€™);

Now we have two servers with WordPress under the same name of domain, and the requests Web will be distributed equitably between both.

It remembers to always raise to the files multimedia both servers by FTP.

CREATING A SYSTEM OF VIDEO STREAMING IN WORDPRESS

These are the steps that I realise:

  • I raise to the videos for example a-> www.tudominio.com/HDvideos in both servers. As one assumes that already you have fact the Round Robin DNS€¦ that resource some times will be seen in a server€¦ and others in another one.
  • Later to see them in streaming I install in the servant the WowzaMediaServer and create one app called €œvod€ that it aims at the directory:
    /var/www/vhosts/eldominio/HDvideos
  • In order to finalize inside already of the Control Panel WordPress when you create an entrance€¦ in the section of the reproducer to jwplayer I point the new video at this direction:
    http://www.tudominio.com/vod
    and as name of the video: video1-class-of-html.mp4

Much luck and a greeting

I hope that this article serves to you as help,
A greeting,
Oscar/Devservice.es

By “scar Carrillo