What Is a Serverless Instance?
Context
The stability and reliability of databases are crucial in modern enterprise-level IT systems. If a database is not stable, the entire system cannot run properly. To solve such an issue, users typically configure various parameters and redundant resources (such as compute, memory, and storage).
However, during off-peak hours, those redundant resources are often left idle, resulting in wasted costs. Even with those configurations, there is still a risk of temporary resource shortages in the face of unexpected surges in workloads, which can compromise the overall system.
In addition to typical enterprise scenarios, there are also many low-frequency, small-scale database usage scenarios in the cloud, such as development and testing environments, mini-program development, and school laboratory teaching environments. In these scenarios, users often have minimal specification requirements but demand workload continuity. Constantly creating or deleting pay-per-use instances is not feasible, and buying low-spec yearly/monthly instances results in a significant waste of money when there are no workloads to process.
To address those concerns, GaussDB(for MySQL) has introduced serverless instances. These instances can dynamically adjust resources based on workloads and are billed on a pay-per-use basis, which reduces costs and improves efficiency. Additionally, serverless instances make it easier for small- and medium-sized enterprises to use cloud databases.
The following figure shows the resource usage and specification changes of regular and serverless instances during significant workload fluctuations.
As seen in the figure, regular and serverless instances perform differently during significant workload fluctuations.
- Regular instances: Resources are wasted during off-peak hours and insufficient during peak hours, which will affect workloads.
- Serverless instances: The specifications are adjusted based on workload demands to achieve minimal resource wastes. Even during peak hours, workload demands can still be met, ensuring workload continuity and improving system stability.
How a Serverless Instance Works
GaussDB(for MySQL) serverless instances use a write once read many (WORM) architecture and shared storage. They provide the ability to dynamically scale with system workloads. Each instance node can achieve vertical scaling of vCPUs and memory in seconds and horizontal scaling of read replicas, allowing you to quickly and independently change compute capabilities during peak and off-peak hours. This helps you quickly respond to workload changes less expensively and more efficiently.
- Both the primary node and read replicas are serverless. They use distributed shared storage and can be scaled based on workload changes.
- The billing unit is TCU. 1 TCU is approximately equal to 1 vCPU and 2 GB of memory. When the primary node or a read replica is scaled, its TCU increases or decreases accordingly.
- When creating a serverless instance, you can specify a TCU range, instead of configuring specific specifications. Then the instance can be scaled based on the CPU usage and memory usage.
Vertical scaling: The node performance (CPU and memory specifications) changes.
Cloud Eye monitors the CPU usage and memory usage of serverless instances. If any of the following conditions is met, a scale-up is automatically triggered:
- The CPU usage is greater than 80% for 5 seconds and it has been at least 5 seconds since the last scale-up.
- The memory usage is greater than 80% for 5 seconds and it has been at least 5 seconds since the last scale-up.
- The CPU usage is greater than 60% for 20 seconds and it has been at least 10 seconds since the last scale-up.
If the following condition is met, a scale-down is automatically triggered:
The CPU usage is less than 30% for 15 seconds and it has been at least 15 seconds since the last scale-down.
Horizontal scaling: The number of read replicas changes.
If the compute has already been scaled up as much as possible but the CPU or memory usage still meets a compute scale-up condition, read replicas will be added.
If the compute has already been scaled down as much as possible but the CPU or memory usage still meets a compute scale-down condition, read replicas will be removed.
Billing
For details, see Serverless Billing.
Advantages
- Lower cost: GaussDB(for MySQL) serverless instances do not depend on other infrastructure or related services. They can be used right out of the box and provide stable and efficient data access services. You are only billed for the resources you use.
- Larger storage space: The storage space of a serverless instance can reach up to 32,000 GB. It is automatically scaled up based on the data volume of the instance to avoid any impacts on workloads due to insufficient storage resources.
- Auto scaling of compute resources: Compute resources required for read and write operations can be scaled automatically, greatly reducing O&M costs and system risks.
- Fully managed and O&M-free experience: All O&M work, such as specification scaling, storage autoscaling, monitoring and alarms, and intelligent O&M, is completed by Huawei Cloud professional teams. Users will not even notice, and their workloads will not be affected, ensuring continuous availability and a truly O&M-free experience.
Application Scenarios
- Infrequently-used databases in enterprise testing environments and personal development
- Intermittent scheduled tasks, such as data statistics and archiving, school teaching, and R&D
- Unpredictable fluctuations in workloads, such as check-in and edge computing
- O&M-free or fully managed databases
- Lower database usage costs during off-peak hours
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot