Comparing Alibaba Cloud ApsaraDB for RDS and MySQL Database Hosted On ECS Instances
MySQL is the one of the most widely used Open-source database management systems. It is secure, flexible and easy to implement on websites and software applications.
MySQL comprehensive set of features makes it a good choice for storing data even for big companies like Youtube, Google and Facebook. Alibaba Cloud has continuously contributed and supported the development of MySQL and they won the 2018 MySQL Community Corporate Contributor Awards.
There are two ways to provision a MySQL database on Alibaba Cloud. The first method involves creating an ApsaraDB instance. This is an on-demand hosted database services.
The other option requires setting up an ECS (Elastic Compute Service) and installing MySQL server on top of an operating system like Linux.
In this guide we will compare Alibaba Cloud ApsaraDB for RDS to a MySQL database server hosted on Alibaba Cloud Elastic Compute Service (ECS). This will help you evaluate the best and suitable MySQL service for deploying your application on the cloud.
Setup and Maintenance
ApsaraDB for RDS is a fully-managed database service that requires a few mouse clicks to provision. This service frees you from administrative tasks for setting up, patching, recovering, detecting and repairing MySQL databases.
ApsaraDB for MySQL is a ready-to-use service that can be setup in less than 5 minutes. After setup, you can connect to the database and start using it as a backend for your application or website. Normally, you will just require the internet address, port, username and password created on the service console to use the database.
A MySQL database deployed on an ECS instance requires knowledge in both system and database administration. Installing and implementing MySQL database in this way takes a steep learning curve. To use the database, you must provision an operating system like Ubuntu 16.04 on Alibaba Cloud and install the software using package management tools like APT.
If a problem occurs on the MySQL database hosted on the ECS instance, you will have to personally troubleshoot the error to restore the database service. Remember the error can range from operating system failures, hardware problems, and memory issues. So unless you have in-depth knowledge in both system and database administration, ApsaraDB is a safer choice.
Backup and Security
A database holds valuable information that must be safeguarded at all times. ApsaraDB for RDS makes your life easier by integrating security in the database solution. One of the worst enemies of MySQL database is SQL injection — a technique used by hackers to steal information from your database through malicious codes.
Alibaba Cloud ApsaraDB can intercept such attacks. On top of this, the service is built to withstand brute-force attacks — a method that tries to gain access to a database system by guessing login credentials.
When it comes to backup ApsaraDB has advanced disaster capabilities that live-copies data using Object Storage Service (OSS) for easy recovery process.
On the other hand, if you provision a MySQL server on Alibaba Cloud ECS, you must install and maintain the appropriate backup tools and applications. There are different approaches that you can take to create backups. For instance, you can use automatic backup scripts or copy data on different servers and this can increase the overall cost of running the service.
To safeguard the data on the ECS instances, you must ensure that both the operating system and the database server are protected. This involves setting up firewalls, anti-brute force tools like Fail2Ban.
If you don’t have knowledge in such technologies, ensuring the security of your MySQL server can be overwhelming. ApsaraDB takes the pain away and incorporates security features by default. Hence, you can concentrate on your core business functions while Alibaba Cloud safeguards the database for you.
ApsaraDB utilizes latest technologies to ensure that the service is highly available. Different nodes synchronize data at real-time. A shared-nothing architecture ensures that there is no single-point of failure due to redundant database server and hardware. The reliability offered by this kind of setup guarantees an uptime of 99.9999%.
ApsaraDB can withstand adverse conditions because it is built on top of the world’s most secure and record-breaking network architecture provided by Alibaba Cloud.
If you deploy a MySQL database on the ECS instance, you must incorporate a fault-tolerance solution from scratch. This requires deploying your MySQL database on clustered environment.
You may use the master-master database replication model or probably configure MySQL Group replication plugin to achieve this. In most cases, you would require at least 3 ECS servers to achieve this and this can be somehow expensive
You have quite a few options when deploying ApsaraDB for RDS. Although you can choose the MySQL version, data center, RAM, CPU and disk space, you can’t access the database configuration files if you have special needs.
On the contrary, a MySQL database deployed on Alibaba Cloud ECS instances gives you the flexibility that you need when it comes to system configuration. You get full access to the core MySQL configuration files, and you can change different parameters to suit your needs. In other words, you are not stuck by the default settings.
For instance, you can turn on or turn off MySQL caching, add new storage engines, change the buffer size and alter the maximum number of connections.
So, in case you have a dire need for changing the default MySQL settings and you have good knowledge in this, you can deploy MySQL on the ECS instance.
However, if you are comfortable with the default and well optimized MySQL settings that come with ApsaraDB then, this is the best option.
Scalability and Elasticity
Scalability helps the database to scale up or down depending on the workload subjected to it. Both ApsaraDB and MySQL database deployed on the ECS instances are scalable. You can provision an instance that can comfortably handle your database needs.
This requires you to choose the correct system resources including vCPUs, RAM, disk space and traffic. However, deploying MySQL database on the ECS subjects some of your server resources to other applications running on the operating system hence the performance in both cases will differ and ApsaraDB will take the lead.
Both ApsaraDB and ECS are elastic in nature and can adapt to workload changes. In both services, you will be able to scale up resources to match your current database demands.
ApsaraDB uses a flexible data model with clustering capabilities and you can scale up an instance up to 2TB. On an ECS instance, database size is limited to the disk capacity assigned to an ECS instance which may be up to 500GB.
Also, remember you cannot utilize the full space due to operating system and other application overheads. So, if you want to deploy very large databases with a data size greater than 500MB, ApsaraDB would be more suitable.
Both ApsaraDB and Alibaba Cloud ECS instances have simple and transparent pricing with no upfront fees. You can choose a pay-as-go pricing model to ensure that you are only paying for the resources that you need.
The price of an ECS instance starts from as low as $4.5 per month for a 1 vCPU, 1GB RAM, 40GB disk space and 1TB data transfer plan. An ApsaraDB with the same specifications may start from around $15 per month.
However as discussed above, you may require deploying up to 3 ECS instances if you want to create a fault-tolerant MySQL database architecture if you go with the self-managed solution. Also, most of the disk space on the ECS instance will be consumed by the core operating system and applications running on the server.
So unless you have a special need that requires running MySQL on a single ECS instance with offline backups, deploying MySQL using this method may be more expensive in the long run than ApsaraDB.
Other Factors to Consider When Choosing Between ApsaraDB and Self-Managed MySQL Database
We have compared ApsaraDB for RDS to self-managed MySQL databases deployed on Alibaba Cloud ECS. We will now list a few more tips that can help you to choose between the two different types of MySQL databases:
ApsaraDB can be used in the below scenarios:
- ApsaraDB is suitable for applications that connect directly to a database server without requiring any middleware like PHP. For instance, you can connect your desktop application written in Java, Vb.net or C# to the ApsaraDB directly.
- If you want to isolate the database from the rest of your application, you can use ApsaraDB as the backend database. For instance, you can have a WordPress site running on a different server but the application can connect to ApsaraDB as the backend database.
- Backup for your application. To enhance the security of your application, you can backup your database on ApsaraDB. In such a setup, you may even run advanced data analysis on the ApsaraDB data without affecting your primary database.
- You can use ApsaraDB if your application database requires a large disk space for storing data. ApsaraDB can scale up to 2TB.
- Use ApsaraDB in mission critical applications that require automatic failover and second level data recovery when a database server fails.
Self-managed MySQL databases deployed on Alibaba ECS instance can be used in the following cases:
- To run content management systems that requires a full operating system for hosting other applications like web servers, scripting languages, email servers e.t.c. For instance, the MySQL database can be setup in the same server hosting Apache, PHP and an e-commerce software like Magento.
- Where performance of the entire server is not an issue. If you don’t want to isolate your database from the rest of the application, you can create the database on the same Alibaba ECS instance hosting your other applications.
- You might also run Alibaba cloud ECS MySQL database in scenario where you want complete control over the database server. For instance, if you want to change some settings, this might be a good choice but you must have strong MySQL administrative skills to run the server.
- You can also use Alibaba ECS instances in case you want to run different database management systems on a single Virtual Private Server. However, if you need more stability, you can deploy different instances of ApsaraDB with each instance running a separate database engine e.g. MySQL, PostgreSQL and Ms SQL server.
In this article, we have gone through a comparison of Alibaba Cloud ApsaraDB for RDS and a MySQL database hosted on Alibaba Cloud ECS instance. We have also listed some tips that can help you choose between the two approaches for deploying a cloud database on Alibaba Cloud.
We believe this guide will help you to choose the right service for provisioning your MySQL server depending on your application needs.