By Francis Ndungu, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud's incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.
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.
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.
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 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.
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:
Self-managed MySQL databases deployed on Alibaba ECS instance can be used in the following cases:
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.
2,626 posts | 711 followersFollow
Alibaba Clouder - July 22, 2020
Alibaba Clouder - August 14, 2018
Alibaba Clouder - December 5, 2017
Alibaba Clouder - December 8, 2017
Alibaba Clouder - January 27, 2021
Alibaba Clouder - February 21, 2020
2,626 posts | 711 followersFollow
An online computing service that offers elastic and secure virtual cloud servers to cater all your cloud hosting needs.Learn More
An on-demand database hosting service for MySQL, SQL Server and PostgreSQL with automated monitoring, backup and disaster recovery capabilitiesLearn More
An encrypted and secure cloud storage service which stores, processes and accesses massive amounts of data from anywhere in the worldLearn More
More Posts by Alibaba Clouder