Containerized RDS｜The Future is Here
Author Xiong Zhongzhe
Co-Founder/Director of Product Development Team, VaTech
“You're not not good enough., You're just out of date.” This phrase is used in IT The industry is particularly well suited, Every once in a while there will be a new of Technology emerges, Overwhelming the coders. By way of review DBA at work of Several periods, Share with you our view of the next generation database operations and maintenance architecture of understandable harmony currently in the process of doing of work.
When I first joined Ali, I heard a saying that I still remember, " To know the database you manage as well as you know your wife”, Back in the day I was not have get married, To that statement of Understanding is not deep.
This should be @ Fung Chun Pui That's right, one of the interviewers for Ali back then, everyone was convinced to call him the master.
There is a background implied behind it. Compared to today, applications were slow to iterate and architecturally focused, especially at the database level. To use the more popular name of a boulder type"monolithic "Application .
In the number of databases, capacity harmony Business needs are not have erupt of circumstances, more necessary DBA The ultimate in optimization, with more emphasis on mastering the database kernel, 10I did it years ago. ITPUB As you know, DBAs at the time took pride in writing extremely complex SQL and mastering the Lock, Pin, Latch runtime mechanism.
Remember, back in the day, every SQL that went online needed to be reviewed by the DBA, and that was the DBA show The best opportunity for muscle
The megalithic application highlights the DBA of value, That's a celebrity DBA A time of endless activity.
Then I had the opportunity to go to Baidu, as a DBA, it gave me a big impact, summarizing a few differences:
● Database to MySQL The absolute majority, and most of them are run and maintained by the developers themselves.
●DBA The team has just been formed, and the goal is to centralize all of the group's databases. The whole team was less than 15 people, and the online operation MySQL Examples 1000+.
● No SQL Review
1000+ an actual example harmony15 size DBA I had just gotten married at this time, not for long but I realized right away " To know the database you manage as well as you know your wife " I'm afraid that's not going to happen.
The work is no longer focused on learning the database kernel andSQL Review , but instead scripted and automated (actually human + semi-automated) a lot of the day-to-day operations and maintenance work. Not at the time. Puppet / Ansible You have to do it all yourself. I had to, but I picked up my programming skills again. At this point, I started by focusing on the performance of a small number of libraries (Load, TPS, QPS ), to focus on the availability of a large number of libraries, including mainly :
● monitor of configure harmony validity
● Adequacy of space
:: Normalization of the recovery of the reserve bank
● Availability of backups, validity of backups
● Whether the hardware is faulty
not haveSQL Review How does such a nanny-like personal service solve the performance problem? To sum it up:
● Splitting complex SQL into multiple simple SQL, leaving the complexity to the application
● Scale out architecture in advance, expand nodes if performance is insufficient
A few more words:
●Scale Out : To support the Scale Out architecture, the application needs some modification. Say a common question, how can each slice of MySQL cluster efficiently fetch self-incrementing sequences as PK or UK of a table without duplication? In Oracle Rac, sequence makes everything easy, and the DBA is only concerned with optimizing the efficiency of getting the sequence. But at Baidu, I learned for the first time that you can use zookeeper to solve this problem.
Monitoring : At that time, Noah (Baidu's internal alerting platform) had a feature that would send alerts to the relevant people when the load on a server running online fell below a specified threshold, indicating that resources were being wasted. This alarm tracks the use of resources and effectively prevents wasted resources.
●SQL Review : From Alibaba Group Researcher @ Rui Zhang (the other of the two interviewers) published article entitled Reflections on a Future-oriented Database Architecture A similar description can be seen
I'm also becoming aware of the importance of DBA of Requirements have changed. From fine-grained to clustered O&M, From focusing on individual libraries of Performance to Focus Cluster of usability, From relying on individual of Ability to leverage monitoring platforms harmony mass of Operations and Maintenance Scripts.
This is a period of transition, for DBA The requirements are more integrated and comprehensive. A tailor who can't be a cook doesn't make a good driver.
2017, WoquTech Now in its 6th year, Monolithic "monolithic " Applications are still widely available. At the same time, users are increasingly demanding for database operation and maintenance automation, Database as a Service (DBaaS or RDS ) There is a growing demand for, AWS RDS There's a very concise summary:
To sum up :
● Automation of all routine operations and maintenance tasks
The need for high performance, zero data loss and security is still an immediate need
● Pursuing higher resource utilization through elastic scaling (in the familiar language of Efficiency from operations and maintenance)
● No longer looking for extreme performance
How can you meet these enterprise level functional requirements? It's not easy, one has to be familiar or even proficient with databases, hardware, virtualization, distributed storage and other technologies.
With this goal in mind, WoquTech The first is a private database service platform based on virtualization technology, which is called QFusion, currently iterated to version 2.0 . At the same time, we are faced with some tough questions:
● Computational density is difficult to increase :
Virtualization has its own high overhead, resulting in poor utilization of computing resources, which leads to customers requiring more hardware
● Higher storage overhead :
Stored in hardware (SSD,Optane ), network (25Gb,Infiniband ), protocol level (NVMEoF) of It's happening. of variations, But virtualization technology has always supported of no good, Overheads are high, Although it is possible to pass (a bill or inspection) penetrating technology(passthrough) Reduce overhead, But at great cost to platform management.
● Iteration costs :
still with OS The system is built from the perspective of the business, resulting in higher costs of business development.
In the face of virtualization technology's role in achieving RDS We have been exploring ways to implement RDS with better resource utilization and more efficient integration.
That's why we started to identify the technical direction of containerization very early on. Container technology and MySQL Originally no stranger to the world, Ali was an early convert to cgroup apply to MySQL Production environment (Google Very similar to Ali's usage). Oracle The dominant commercial database, 12C Enterprise Edition is also available on github.com Docker image.
Of course, using containers in a production environment is not easy, we need to solve two problems :
● How to run relational databases (Oracle, MySQL) efficiently in containers
● How to manage container clusters
Take Docker + Oracle as an example.
In response to the first question, We've been doing this for a long time. of exploration harmony test (machinery etc). The expectation is that when using the same Oracle version, hardware configuration, and load model in the case of the businessTPS harmony QPS as an indicator for Oracle in KVM harmony Oracle in Docker For comparison.
Debugged for a long time to make sure KVM harmony Docker They all play to their strengths. IBM's 2014 article "An Updated Performance Comparison of Virtual Machines and Linux Containers" has given us a lot of insight
The data are as follows:
pass (a bill or inspection) Oracle of AWR The report, which can be seen very clearly. compareKVM, Oracle in Docker The number of executions was increased by a factor of 2.47, while the running time was reduced by 55.25%. This means that based on Docker, you can not only double the quality of business services, but also increase the business throughput by 2.47 times, which is a very obvious advantage.
In response to question 2, how to manage large-scale What about Docker? ? Just like virtualization and OpenStack. We need "OpenStack" in the age of containerization, and even more, with scheduling policies as an example :
● Finer-grained resource scheduling units, more elastic resource requests for higher deployment density
● Identification of different levels of storage services (QoS). For example, the primary library is scheduled to the PCIe Flash node, the backup library is scheduled to the SATA SSD node, and the backup is scheduled to the Hard Disk node
● Identifying business needs of unrelated. for example, After the resources are all met of prerequisite, master library harmony Backup libraries cannot be scheduled to the same physical node
Standing on Giants (Google ) on the shoulders, we find the answer : Kubernetes
Simply put, Kubernetes is an automated container orchestration platform (https://kubernetes.io/ ). It is part of the CNCF Foundation (Cloud Native Computing Foundation) https://www.cncf.io/ ), CNCF is backed by the mighty Google. Kubernetes Once it was launched, it was accepted much faster than expected.
Oracle The cloud service integrates with the Kubenretes The orchestration structure of the
Microsoft Cloud Services Azure has taken its own container orchestration engine from ACS turn into (sth. else) AKS
pass (a bill or inspection) integrate Docker harmony Kubernetes research and development WoquTech next generation RDS architecture that is QFusion 3.0 , become our new goal.
currently Kubernetes Support for persistent applications is still in its infancy, and the following diagram shows a persistence service built on Kubernetes :
As you can see, not yet Oracle and MySQL As you can imagine, building a relational database business based on Kubernetes can be difficult.
The following will showQFusion 3.0 (All in MySQL For example) Several functions:
Instance high availability is essential, and it is important to note that this feature must include zero data loss. This process will be demonstrated below.
We simulated four failures, such as kill, restart nodes and so on, and on average, access was restored within 35 seconds
(Time consumed vs. AWS Aurora harmony Ali cloud PolarDB (flat)
Simulating the application with continuous data update operation, we can see that the database service can always ensure the update order after several failover, so that there is no data loss.
Most applications are read more than they write, and read-write clusters are well suited to support such business scenarios. When read capacity is insufficient, elastic scaling is DBA A frequently encountered problem, the following will demonstrate the process of reading the horizontal expansion of the library.
pass (a bill or inspection) YAML file, create read-write clusters in a single click by asserting
Unrelated content has been omitted kind: MysqlCluster masterdbspec: replicas: "1" -- Number of master banks, In a read-write separated cluster, The value can only be1 role: Master -- Master library role proxyspec: role: RW -- database middleware type slavedbspec: replicas: "2" -- Number of library readings role: Slave -- read library role strategy: MySQLRWCluster -- Cluster Type
Simulate pressure on 3 backups via sysbench + Proxy
pass (a bill or inspection) we of Platform one-click additions1 Storage, You can see that the reading pressure is more average of disperse4 Of the total number of databases
These clusters provide Scale Out capability, which is more powerful than read-write clusters, but also brings complexity to operations and maintenance. The following demonstrates the one-click creation of a cluster and the high availability of cluster sharding.
pass (a bill or inspection) YAML file, to create a split-table cluster with a single click in a declarative manner
Unrelated content has been omitted kind: MysqlCluster masterdbspec: replicas: "8" -- Number of master banks, Specify the cluster of Number of slices role: Master -- Master library role proxyspec: role: Sharding -- database middleware type strategy: MySQLShardCluster -- Cluster Type
One-click creation of 8-slice clusters.
Simulate a slice 0 failure, the slice is restored and service is available within 30 seconds.
Clustering brings powerful features and increases the complexity of operations and maintenance. For example, it is common for the DBA to make changes to the database configuration, replacing the new database version, node by node. The following will demonstrate the fully automatic rolling upgrade function
Modifying the parameter "innodb_buffer_pool_size" for all instances of the cluster, rolling upgrades will :
● Descending order from c7 to c0
● Proceed in sequence: select node, modify parameter file, restart node, wait for node to resume service
● Rolling upgrade process ensures that even if an exception occurs, it is still possible to "break and continue", and upgraded nodes will not be repeated
5.Starting from 7.5, innodb_buffer_pool_size can be dynamically adjusted by the set command without restarting the database instance
You can see the rolling upgrade process in the image below.
The cluster is upgraded on a rolling basis by means of versioning, which can be seen in the cluster information
status: currentReplicas: 8 -- the number of current version splits currentVersion: clustershard-c-559586746c -- the current version of the cluster updateVersion: clustershard-c-559586746c -- Cluster pending upgrade version
currentVersion equals updateVersion , end of rolling upgrade
Docker, Kubernetes, RDS, The Future is Here
Every once in a while, a revolutionary product comes along that changes everything. This is the second quote from Joe at the launch of the first generation Iphone.
Indeed, the future has arrived.