Help Center/ GaussDB(for MySQL)/ User Guide/ Serverless Instances/ What Is a Serverless Instance?
Updated on 2024-09-24 GMT+08:00

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's operation will be affected. To ensure stable database operations during peak hours, users typically configure various parameters and redundant resources (such as compute resources, 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 when facing 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 and deleting pay-per-use instances is not a feasible solution. Buying low-spec yearly/monthly instances wastes a lot of money during periods when there are no workloads to process.

To solve those problems, GaussDB(for MySQL) has introduced serverless instances. These instances can dynamically adjust database resources based on workloads and are available on a pay-per-use basis, to help you reduce costs and improve efficiency. Additionally, serverless makes 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 periods of significant workload fluctuations.

Figure 1 Resource usage and specification changes of regular and serverless instances

The figure shows some differences between regular and serverless instances during periods of 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, resulting in minimal resource waste. Even during peak hours, workload demands can still be met, ensuring workload continuity and improving system stability.

How It Works

GaussDB(for MySQL) serverless is a new kind of product based on shared storage. It uses a write once read many (WORM) architecture. It offers auto scaling to adapt to system workload demands, allowing for vertical scaling of vCPUs and memory within seconds and horizontal scaling of read replicas. This enables quick and independent scaling of compute power during peak and off-peak hours, responding rapidly to changes in workload demands while optimizing costs and improving efficiency for enterprises.

Figure 2 Serverless architecture
  • 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 read replicas are scaled, the TCU of the node increases or decreases accordingly.
  • When creating a serverless instance, you can specify a TCU range. You do not need to configure 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 power has already been scaled up as much as possible and the CPU or memory usage still meets a compute power scale-up condition, read replicas will be scaled out.

    If the compute power has already been scaled down as much as possible and the CPU or memory usage still meets a compute power scale-down condition, read replicas will be scaled in.

Billing

For details, see Serverless Billing.

Advantages

  • Lower cost: GaussDB(for MySQL) serverless does not depend on other infrastructure or related services. It is easy to use and provides stable and efficient data access services. You are only billed for the resources you use while using a serverless instance.
  • 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, alarm monitoring, 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

  • Scenarios where database usage is infrequent, such as enterprise testing environments and personal development
  • Scenarios with intermittent scheduled tasks, such as data statistics and archiving, school teaching, and R&D
  • Scenarios with unpredictable fluctuations in workloads, such as check-in and edge computing
  • Users who want O&M-free or fully managed databases
  • Users who want to reduce database usage costs during off-peak hours