Wordpress is a big deal right now. It is because nearly 30% of the websites run on WordPress. Some of the huge sites and blogs like Techcrunch, BBC America, and Facebook Newsroom are running on WordPress.
It is because WordPress is easy to use and has a massive repository of paid and free plugins. Not only blogs but you can also create an E-commerce store using WordPress. WordPress also has a vast repository of themes to select from. There are thousands of free themes and plugins that can be used to modify your WordPress website however you want.
In conclusion, we can say that WordPress is the most flexible content management system world has ever seen. That's the reason why 30% of the website owners chose WordPress to run their sites. This 30% of the websites include small websites that get less than 20 visitors a day (like this blog) and also the websites that get tons of visitor on a daily basis (We are talking in millions here!).
When you have a website that gets thousands of visitors on a daily basis, you want to optimize your website for speed so that you can serve those visitors your rich content as fast as possible. That's what we are going to do.
In this article, We will cover the following topics in-depth.
- Importance of using a remote database server
- How to setup a Database server using ServerAvatar (Click here for the in-depth article)
- How to set up WordPress with a remote database
Table of Contents
ToggleImportance of using a remote database server
When you are getting a lot of traffic, the first thing you do to scale your website is to host your database on another server. Initially, your database and your website files are hosted on the same server. When you keep your database and website files on the same server, your database management system will also use the resources your server has. When your website grows up, you will have to move your database to a separate database server so that a web server can serve pageviews faster and utilize the resources that are freed by a database server. With the remote database server, your web server will be able to handle more traffic because it will get extra 20-30% of the computing power that it doesn't get when a database is hosted on the same system because database management system also needs some resources to process queries. So, why not create our website with a separate database server from the start? It won't cost you a lot, and it's not even a hard thing to do with ServerAvatar (Yes, it's hard if you are just getting started with system administration and doing everything by yourself for the first time). With ServerAvatar, you can create a WordPress website with the database hosted on an entirely different machine as easy as regular WordPress installation. The only thing extra you have to do is to select the server on which you want to host your database. So, Let's first set up our database server. It's straightforward, and it usually takes less than 5 minutes to setup database server using ServerAvatar.How to set up a database server using ServerAvatar
It's not as hard as it sounds. Considering you have an empty Ubuntu server with nothing installed on it, connect it with ServerAvatar by clicking on the Add -> Server on the top-right corner of the dashboard. You will see a form containing three fields. You have to enter the name of your server, IP address of your server and the root password of your server just like the following image.If you want to know how to connect your server with ServerAvatar in-depth, click here.Don't get confused on what to enter in the Server name field. It's just a nickname for your server. Enter anything you want. After filling the necessary information, click on the Add Server button and you will get notification within 3 minutes that your server is configured and you can now access the server panel. The first thing you have to do is to turn on the firewall because it is very much crucial for security. Without turning on the firewall, you are allowing anyone to attempt to connect to your server no matter if the person/computer is authorized or not. Turn on the firewall by clicking on the firewall switch given on the server panel. Now, as it's our database server, we are going to stop the services that we are not going to use. It is because we want all of our resources to be used by our database management system which is MySQL in this case. We are going to turn off Apache2 because we are not going to serve HTTP/HTTPS traffic on this website, php7.0-fpm because we are not going to process php code on this server either and also, we will turn off postfix because we are not going to send e-mails from this server. To turn off the unwanted services to get 100% out of our server, Click on the Services section given on the sidebar and you will see something like the following image. Click on the Stop buttons corresponding to Apache2, php7.0-fpm, and postfix. Once done, Our database server is ready to handle database queries! Now, it's time to install WordPress on a regular server.