The cloud service database is a PaaS full-managed relational database, while the IaaS relational database is also available. This article introduces Alibaba Cloud ApsaraDB for MyBase, which is an IaaS relational database service.
The databases provided by major cloud service providers are mainly PaaS-type relational databases. However, since these are deployed as fully managed PaaS-type services, users may encounter difficulties when it comes to adjusting specific MySQL parameters, modifying the OS and software in the cloud, or deploying PostgreSQL pg extension plug-ins.
Furthermore, within a cloud service, multiple users create and use instances while sharing physical servers within a limited resource group. As a result of the inefficient utilization of these shared physical servers, performance can occasionally become unstable.
To start with, there are three types of databases: On-premises databases built using an on-premises cloud, Cloud-based databases built in the cloud, and PaaS-type databases provided by cloud services. The mentioned PaaS-type databases are fully managed databases, relieving users from complex operations that are taken care of by the cloud. However, in return, users have limited freedom to make detailed adjustments such as precise database settings, OS modifications, and extensions.
IaaS-type relational databases is proposed to address this issue. IaaS-type relational databases follow the concept of creating a self-managed and controlled Internet Data Center (IDC) in the cloud. In this article, we introduce Alibaba Cloud ApsaraDB for MyBase, which is an IaaS-type relational database service.
Before introducing Alibaba Cloud ApsaraDB for MyBase, let's provide a brief explanation of the background in which IaaS-type relational databases were developed.
As mentioned earlier, there are three types of databases: Databases you build on-premises, PaaS-type databases built by cloud services, and Databases you build in the cloud. Each type has its own advantages and disadvantages.
Databases you build on-premises require you to procure data centers and hardware, and then perform tasks such as OS installation, RDBMS installation, parameter setting, and operation monitoring on your own. This approach allows for independent operation and customization, which enhances overall data security. However, it also comes with high operating costs, a heavy maintenance load, and limited scalability due to inflexible storage expansion.
PaaS-type databases built by cloud services are fully managed databases deployed as a service in the cloud by major cloud service providers. With just a few clicks on the console screen in a web browser, users can easily build and operate their databases. Scaling can also be easily done on the cloud side, and a high SLA is guaranteed. However, these PaaS-type databases have limited operational capabilities. Performance may become unstable if the shared resources are depleted, and manual management aspects, such as data security and extension, cannot be directly controlled.
Databases you build in the cloud is an approach that combines the advantages of both "databases you build on-premises" and "PaaS-type databases built by cloud services." Users only need to purchase physical servers in the cloud, and the cloud service provider will handle hardware procurement and OS installation, allowing for quick deployment of database services. As long as it is within the resource range of the purchased physical server, scaling is also flexible. However, this approach does not come with an SLA, and there is a learning cost associated with manually operating the database management system (DBMS).
To address the aforementioned issues, Alibaba Cloud has launched the ApsaraDB for MyBase service, which follows the concept of IDC database in the cloud.
ApsaraDB for MyBase consists of dedicated physical servers called hosts and serves as a dedicated database cluster in the cloud. When purchasing ApsaraDB for MyBase resources, users can utilize multiple instance clusters on a dedicated host (physical server). The host refers to a physical server.
Users can use a cloud database service that is based on a dedicated host, ensuring that they do not need to compete with other users for resources. It is possible to purchase MySQL and SQL Server databases as a cloud database service in the form of a host. Additionally, multiple types of databases can coexist on a single physical machine as long as the resources of the physical server allow it. A dedicated custom scheduling mode is provided for ApsaraDB for MyBase, which allows for resource scheduling and scaling operations based on user workloads, similar to PaaS-type relational databases.
The physical servers used in ApsaraDB for MyBase provide users with OS-level permissions, allowing them to perform manual settings, install extensions, and add their own software. Users can also view logs and related directories. This provides enhanced security measures such as data encryption and the ability to introduce their own monitoring infrastructure and perform cross-replication operations with two databases, which cannot be achieved with PaaS-type databases.
ApsaraDB for MyBase operates at the physical resource level, which sets it apart from fully managed PaaS-type relational databases.
As mentioned earlier, ApsaraDB for MyBase is purchased with a dedicated storage layer, ensuring that service performance instability due to resource conflicts among multiple users under the host is prevented. Additionally, resources are efficiently distributed among dedicated hosts, making full use of CPU, memory, storage capacity, IOPS, and network traffic.
Dedicated hosts are essential for governing ApsaraDB for MyBase. The management of dedicated hosts includes adding hosts, switching hosts, connecting hosts, and setting the allocation status of hosts.
Four types of database service instances, namely primary, secondary, read-only, and logging, can be built and managed on dedicated hosts.
Unlike fully managed PaaS-type relational databases, ApsaraDB for MyBase allows users to freely choose the resources required for the database instance, such as CPU, memory, and storage. While PaaS-type databases also support vertical scaling (changes in specifications), moving the instance can result in a long downtime of about 3 to 5 minutes. On the other hand, ApsaraDB for MyBase is based on instances under dedicated hosts, allowing scaling to be performed without any downtime. This capability has been proven during the Double 11 (Nov. 11) event.
Related Document
ApsaraDB for MyBase offers automatic backup and recovery features to ensure the durability and reliability of your data.
ApsaraDB for MyBase also allows you to deploy different databases concurrently or utilize different resource utilization characteristics within a dedicated host. Additionally, as mentioned earlier, resources are allocated at the physical layer for dedicated hosts, resulting in a higher resource utilization rate. By reasonably overallocating resources, you can reduce costs compared to PaaS-type databases.
ApsaraDB for MyBase supports various relational databases, including ApsaraDB RDS for MySQL and ApsaraDB RDS for SQL Server. It is worth noting that SQL Server, which relies on HW and NW specifications, is also supported as an IaaS-type relational database service.
Depending on your workload, you can easily scale up or down resources as long as the dedicated host's resources allow it.
Similar to fully managed PaaS-type relational databases, ApsaraDB for MyBase can monitor database performance and send alerts in case of any issues.
Although ApsaraDB for MyBase is an IaaS-type database service, its usage and operation are very similar to that of a PaaS-type database. Therefore, it can help solve some of the following problems that are not easily solvable with a PaaS-type database.
For PaaS-type relational databases like ApsaraDB for RDS, Amazon RDS, Google Cloud SQL, and Azure Database, there is sometimes an issue where the instance resource usage remains low while the load stays high, regardless of changing the specifications. Even if you log CPU usage 24x7, it is difficult to obtain consistent records due to the nature of the cloud. This problem occurs when the cluster usage of other users under the same resource is high, as a cluster is created under the shared resource as a cloud service.
One solution to this problem is to use ApsaraDB for MyBase. ApsaraDB for MyBase allows users to configure hyperallocation, such as allocation and quota, of resources on their side. This improves the CPU usage of the host and suppresses cluster usage. As a result, it achieves performance levels twice as high as those of a PaaS-type relational database.
When user workloads increase, horizontal scaling is often used to increase process performance by adding replicas and read nodes to a database. However, vertical scaling is typically avoided because it involves physically changing the specifications and causes momentary interruptions.
With ApsaraDB for MyBase, specifications can be freely changed under the resource pool. As user workloads increase, the usage of the instance, such as memory and CPU, can be temporarily increased without interruption. This allows for performance improvements. Additionally, automatic restoration of the instance specifications at a designated time can be set up.
For a PaaS-type relational database, configuring and managing database instances requires moving to the respective database instance screens in the management screen on the console. This means that if you have 5, 10, or 20 database instances, you cannot centrally manage them, resulting in increased operation costs and man-hours.
On the other hand, ApsaraDB for MyBase supports logging on to the host with OS permissions. This allows users to log in to and manage the host where the database instance resides using Gatekeeper. Customized scripts can be installed on the host to collect system information and implement customization requirements.
ApsaraDB for MyBase only charges for the dedicated hosts. There are no fees for related features such as clusters, instances, memory, or local disks built on a dedicated host. If you use cloud storage, separate fees for cloud storage fees are charged.
To maintain the primary/secondary architecture of a database, ApsaraDB for MyBase requires at least two dedicated hosts, both of which are billed through a subscription. Cloud storage fees are based on the PAYG (Pay-As-You-Go) billing method, which depends on the usage.
Billing items | Billing based on host and storage |
Billing methods | Host: subscription Storage: PAYG and storage packages |
ApsaraDB for MyBase is different from the PaaS-type relational database, including the deployment method. To use the ApsaraDB for MyBase service, you can perform the following steps:
1. Activate the ApsaraDB for MyBase service and create clusters
Use your Alibaba Cloud account to activate the ApsaraDB for MyBase service and create dedicated clusters.
When you use ApsaraDB for MyBase for the first time, the AliyunRDSDedicatedHostGroupRole permission is required.
Select a database engine, a VPC, and configure other parameters. In this example, MySQL is selected as the database engine.
An ApsaraDB for MyBase cluster has been created. With just a few clicks of a button in the console, you can now attach a physical server.
2. Create a host and an instance
Create a host by clicking the Add Host button on the Host page of the ApsaraDB for MyBase cluster.
On the host, create an instance. In this example, a database of 8 CPU cores and 32 GB of memory is selected.
3. Create ApsaraDB RDS for MySQL instances
After you have created a host and an instance, create ApsaraDB RDS for MySQL instances on the Instances page in the console.
ApsaraDB for MyBase has primary/secondary instances.
This structure keeps all of the primary databases in secondary instances. Auto-recover supports basic backups such as snapshots, full data backups, and incremental backups.
Related Document
https://www.alibabacloud.com/help/en/apsaradb-for-mybase/latest/faq-faq
4. Create an account, add a whitelist, and configure an endpoint
You can create an account, add a whitelist, configure an endpoint, and connect the instance in the same way as a PaaS-type relational database.
Set up the database account.
Create a whitelist and add IP addresses allowed to access ApsaraDB for MyBase.
Configure an endpoint.
You can now access ApsaraDB for MyBase from an Elastic Compute Service (ECS) instance by using CLI commands.
5. Configure MySQL parameters
In this example, MySQL is selected as the database type of the cluster. Parameters that can be operated with MySQL are as good as the original.
Parameters that cannot be changed in ApsaraDB RDS for MySQL can also be changed.
To confirm whether the performance of ApsaraDB for MyBase is actually better than PaaS-type relational databases, you can conduct a benchmark comparison using Sysbench.
1. Prepare an ECS instance for benchmarking. In this example, CentOS will be used.
2. On the ECS instance to be benchmarked, install Sysbench.
sudo yum -y install sysbench
sysbench --version
3. Prepare an ApsaraDB for MyBase cluster and create ApsaraDB RDS for MySQL instances in the cluster. The preceding section describes how to create a dedicated cluster and ApsaraDB RDS for MySQL instances in the cluster.
4. Create an account, database, and whitelist in the ApsaraDB RDS for MySQL instance in the ApsaraDB for MyBase cluster, and configure the endpoint. Omitting the how-to here as well it has been described above.
5. Prepare four benchmark scripts by Sysbench in the ECS instance to be benchmarked. Create the sysbenchprepare and sysbenchrun folders. Place prepare.sh and sysbench.sh in sysbenchprepare. Place sysbench.sh and test.sh in sysbenchrun. The following is the directory tree:
├─sysbenchprepare
│ prepare.sh
│ sysbench.sh
│
└─sysbenchrun
sysbench.sh
test.sh
The following are the scripts for prepare.sh, sysbench.sh, sysbench.sh, and test.sh:
./sysbenchprepare/prepare.sh
#!/bin/sh
mkdir -p logs
thread=100
echo "prepare data using default settings, ref sysbench SIZE" >> logs/sysbench_read_write_0_prepare.log
./sysbench.sh prepare ${thread} >> logs/sysbench_read_write_0_prepare.log
echo "data had been successfully initialized." >> logs/sysbench_read_write_0_prepare.log
./sysbenchprepare/sysbench.sh
#!/bin/sh
LUA=/usr/share/sysbench/oltp_read_write.lua
SIZE=50000
DB=mysql
HOST=rm-gs51k83m21ievm452eo.mysql.singapore.rds.aliyuncs.com
PORT=3306
USER=sbtest
PASSWORD=Test1234
DBNAME=sbdb
usage()
{
echo "Usage: ./sysbench.sh <prepare|run|cleanup> <num of threads>"
exit "${1}"
}
#chack argumets
if [ "${1}" = "" -o $# -gt 3 ]; then
usage 1
elif [ "${2}" = "" ]; then
THREADS=1
else
THREADS=${2}
fi
echo "Running command: sysbench ${LUA} --db-driver=${DB} --mysql-host=${HOST} --mysql-port=${PORT} --mysql-user=${USER} --mysql-password=${PASSWORD} --mysql-db=${DBNAME} --table-size=${SIZE} --tables=100 --events=0 --time=120 --db-ps-mode=disable --percentile=95 --report-interval=1 --threads=${THREADS} ${1}"
sysbench ${LUA} --db-driver=${DB} --mysql-host=${HOST} --mysql-port=${PORT} --mysql-user=${USER} --mysql-password=${PASSWORD} --mysql-db=${DBNAME} --table-size=${SIZE} --tables=100 --events=0 --time=120 --db-ps-mode=disable --percentile=95 --report-interval=1 --threads=${THREADS} ${1}
./sysbenchrun/test.sh
#!/bin/sh
DATE=`date '+%Y%m%d%H%M'`
mkdir $DATE
# thread=1000
# echo "prepare data using default settings, ref sysbench SIZE" >> ${DATE}/sysbench_read_write_main.log
# ./sysbench.sh prepare ${thread} >> ${DATE}/sysbench_read_write_main.log
for thread in 1000
do
echo "Time: $(date +"%Y%m%d%H%M%S"), now running sysbench with thread of: " + ${thread} >> ${DATE}/sysbench_read_write_${thread}.log
./sysbench.sh run ${thread} >> ${DATE}/sysbench_read_write_${thread}.log
done
# echo "cleaning data up." >> ${DATE}/sysbench_read_write_main.log
# ./sysbench.sh cleanup ${thread} >> ${DATE}/sysbench_read_write_main.log
./sysbenchrun/sysbench.sh
#!/bin/sh
LUA=/usr/share/sysbench/oltp_read_write.lua
SIZE=50000
DB=mysql
HOST=rm-gs51k83m21ievm452eo.mysql.singapore.rds.aliyuncs.com
PORT=3306
USER=sbtest
PASSWORD=Test1234
DBNAME=sbdb
usage()
{
echo "Usage: ./sysbench.sh <prepare|run|cleanup> <num of threads>"
exit "${1}"
}
#chack argumets
if [ "${1}" = "" -o $# -gt 3 ]; then
usage 1
elif [ "${2}" = "" ]; then
THREADS=1
else
THREADS=${2}
fi
echo "Running command: sysbench ${LUA} --db-driver=${DB} --mysql-host=${HOST} --mysql-port=${PORT} --mysql-user=${USER} --mysql-password=${PASSWORD} --mysql-db=${DBNAME} --table-size=${SIZE} --tables=100 --events=0 --time=120 --mysql-ignore-errors=1062 --db-ps-mode=disable --percentile=95 --report-interval=1 --threads=${THREADS} ${1}"
sysbench ${LUA} --db-driver=${DB} --mysql-host=${HOST} --mysql-port=${PORT} --mysql-user=${USER} --mysql-password=${PASSWORD} --mysql-db=${DBNAME} --table-size=${SIZE} --tables=100 --events=0 --time=120 --mysql-ignore-errors=1062 --db-ps-mode=disable --percentile=95 --report-interval=1 --threads=${THREADS} ${1}
After the scripts are configured, grant execution permissions to all scripts by using the chmod command.
chmod u+x *.sh
6. Prepare data for benchmarking in Sysbench.
sh prepare.sh
7. Run benchmark test in Sysbench.
sh test.sh
View the benchmark results by running the cat sysbench_read_write_1000.log command in the respective dated directories.
Obtain the data for read, write, queries, Latency: min, avg, max from the benchmark results.
8. Perform the benchmark using the same approach on an ApsaraDB RDS for MySQL instance. Use an ApsaraDB RDS for MySQL instance with the same specifications as the one in the ApsaraDB for MyBase cluster, which has 8 CPU cores and 32 GB of memory.
9. Run the benchmark five times and summarize the average results. The comparison results are as follows: ApsaraDB for MyBase outperforms ApsaraDB RDS for MySQL in the benchmark.
Of particular interest is the latency result. Although it is not possible to directly confirm the cause or determine if it is related to the IaaS-type database securing dedicated resources like physical servers, the IaaS-type latency shows an improvement of more than twice that of the PaaS type.
When you hear cloud-based IaaS relational databases, you typically think of relational databases built on virtual computing. However, as highlighted in this article, Alibaba Cloud's ApsaraDB for MyBase stands out as an IaaS-type relational database service with an exceptional design philosophy..
One of its attractive features is that ApsaraDB for MyBase allows users to configure parameters and network settings that are not possible to control in PaaS-type relational databases. Additionally, users can manage resources on a dedicated host in a cloud-based environment without the need for direct management of physical hardware resources. What's more appealing is that it offers the same pricing level as PaaS-type relational databases while outperforming them in terms of benchmark scores.
However, it is worth noting that the fully managed service aspect found in PaaS-type relational databases, where the database software does not require manual management, is lacking in ApsaraDB for MyBase, an IaaS-type relational database. From this perspective, it is evident that the scenarios and needs for IaaS-type and PaaS-type relational databases can be quite different.
This article is a translated piece of work from SoftBank.
Disclaimer: The views expressed herein are for reference only and don't necessarily represent the official views of Alibaba Cloud.
Introducing Alibaba Cloud Quota Center and Permissions on API Operations
Alibaba Clouder - September 28, 2020
Alibaba Clouder - January 11, 2021
ApsaraDB - June 18, 2021
ApsaraDB - March 4, 2021
digoal - September 28, 2022
Alibaba Clouder - January 7, 2021
Alibaba Cloud PolarDB for MySQL is a cloud-native relational database service 100% compatible with MySQL.
Learn MoreAlibaba Cloud PolarDB for PostgreSQL is an in-house relational database service 100% compatible with PostgreSQL and highly compatible with the Oracle syntax.
Learn MoreA financial-grade distributed relational database that features high stability, high scalability, and high performance.
Learn MoreA database engine fully compatible with Apache Cassandra with enterprise-level SLA assurance.
Learn MoreMore Posts by H Ohara