All Products
Search
Document Center

PolarDB:Serverless overview

Last Updated:Nov 08, 2024

The serverless feature offers dynamic scaling capabilities to PolarDB clusters. Each node in a cluster can be scaled up within seconds to copy with sudden increases in workloads without affecting business operations. When workloads decrease, nodes can be scaled down to save costs.

Background information

Databases are an important part of the IT system of modern enterprises. When you create a database cluster, a conservative approach is adopted to configure resources, such as CPU, memory, storage, and connections, to ensure that the cluster can run smoothly even during peak hours. However, the traditional way of resource allocation may result in idle resources during off-peak hours and insufficient resources during peak hours. The serverless cluster can solve this problem. It can dynamically scale database resources based on workloads and eliminate the need for complex resource evaluation and management.

The following figure shows the resource usage and specifications of common clusters and serverless clusters in scenarios with high business fluctuations.

普通集群和Serverless集群对比图

  • Common clusters: Resources are wasted during off-peak hours. Resources are insufficient and business cannot be processed during peak hours.

  • Serverless clusters:

    • Resources are dynamically scaled based on workloads. This enhances resource usage and reduces resource waste.

    • Resources are scaled within one second without interrupting business. Sufficient resources are provided during peak hours. This ensures business performance and system stability.

    • The pay-as-you-go billing method is supported. This reduces costs and ensures that resources are dynamically allocated based on workloads.

    • No manual configuration changes are required. This improves O&M efficiency.

Features

Serverless clusters support real-time scaling of CPU, memory, storage, and network resources. PolarDB uses a new architecture in which computing and storage are separated. Serverless clusters also allow you to isolate network resources and storage resources and support the pay-as-you-go billing method for computing resources. Serverless clusters provide the following benefits: high resource usage, ease of use, flexibility, and low price. Serverless clusters can help you quickly and independently scale computing resources to adapt to fluctuating workloads, reduce costs, and improve efficiency.

Term

Description

Serverless cluster

A cluster for which you set Billing Method to Serverless when you create it.

Serverless cluster with defined specifications

A cluster for which you set Billing Method to Subscription or Pay-as-you-go when create it and later manually enable the serverless feature. The defined specifications refer to the specifications of computing nodes you select after you set Billing Method to Subscription or Pay-as-you-go.

Note

For more information about billing methods, see Billing methods.

Scale-up/scale-down

CPU and memory specifications of compute nodes are changed.

Scale-in/scale-out

The number of read-only nodes is changed.

PCU

PCU stands for PolarDB Capacity Unit. One PCU is approximately equal to the capacity of 1 core and 2 GB of memory. In a PolarDB serverless cluster, resources are scaled in units of 0.5 PCUs.

Scaling of key components

Serverless clusters

image
  • PolarProxy

    • The PolarProxy of a serverless cluster uses a serverless architecture. PolarProxy resources are independent of compute nodes and automatically scaled. You do not need to define PolarProxy resources.

    • Resources are scaled in units of 0.5 PCUs. The number of PCUs added or removed in a scaling activity is positively correlated with the number of PCUs used.

  • Compute nodes

    • The primary node and read-only nodes of a serverless cluster adopt a serverless architecture. The nodes can scale with workloads and share storage within a single zone.

    • The number of PCUs increases or decreases based on the scaling of the primary node or read-only nodes.

    • Resources are scaled in units of 0.5 PCUs. The number of PCUs added or removed in a scaling activity is positively correlated with the number of PCUs used.

    • You can set the scaling range of a single node in PCUs. The system monitors the PCUs of a compute node every second.

  • Storage

    The storage of a serverless cluster uses the pay-as-you-go billing method. You do not need to specify the storage capacity when you purchase the cluster. The storage capacity is automatically increased when the amount of data increases. You are charged only for the storage space that you use. You can view Database Storage Usage on the Basic Information page of the cluster. For more information, see View the database storage usage.

Note

The maximum number of connections to a serverless cluster is 100,000, and the maximum IOPS of a serverless cluster is 84,000.

Serverless clusters with defined specifications

image
  • PolarProxy

    • The PolarProxy includes the resources with defined specifications and the serverless resources. The PolarProxy resources with defined specifications are specified when the common cluster is created depending on PolarProxy versions. Serverless PolarProxy resources are automatically scaled based on workloads.

    • Resources are scaled in units of 0.5 PCUs. The number of PCUs added or removed in a scaling activity is positively correlated with the number of PCUs used.

  • Compute nodes

    • The primary node and read-only nodes includes the resources with defined specifications and the serverless resources. The resources with defined specifications cannot be scaled, while the serverless resources can be scaled based on workloads.

    • The number of PCUs increases or decreases based on the scaling of the primary node or read-only nodes.

    • Resources are scaled in units of 0.5 PCUs. The number of PCUs added or removed in a scaling activity is positively correlated with the number of PCUs used.

    • You can set the scaling range of a single node in PCUs. The system monitors the PCUs of a compute node every second.

  • Storage

    The storage of the common cluster with defined specifications is used. For more information, see Overview.

Note

After you enable the serverless feature for an existing cluster with defined specifications, the maximum number of connections to the cluster and the maximum IOPS of the cluster are proportional to the specified value of the Maximum Resources for Single Node parameter.

Scaling

Note

The metrics for triggering scaling vary based on cluster parameter configurations and serverless configurations. You can specify thresholds for CPU scaling, but cannot change thresholds for other metrics.

Trigger conditions for scaling

  • Scale-up

    PolarDB monitors the CPU utilization, memory usage, and other kernel metrics of the primary node and read-only nodes. During a monitoring cycle, the scale-up of serverless resources is triggered when one of the following conditions is met:

    • When the CPU utilization of a single node is higher than the default scale-up threshold 80% or a custom threshold, the scale-up of the CPU specifications of the node is triggered.

    • When the memory usage of a single node is higher than 90%, the scale-up of the memory specifications of the node is triggered.

    • When the specifications of a read-only node are less than half of the specifications of the primary node, the scale-up of the specifications of the read-only node is triggered. For example, if the specifications of a read-only node are 4 PCUs and the specifications of the primary node are 10 PCUs, the specifications of the read-only node are scaled up to at least 5 PCUs.

  • Scale-in

    When a read-only node of a cluster is scaled in to the maximum specifications and the business workloads are still higher than the threshold for a scale-in (CPU utilization is higher than the default threshold 80% or the specified threshold), the scale-out of read-only nodes is triggered.

Trigger conditions for scale-down

When the CPU utilization of a single node is lower than the default scale-down threshold 50% or a custom threshold and the memory usage is lower than 80%, the scale-down of the node is triggered.

Automatic start and stop

By default, the automatic start and stop feature is disabled. If your serverless cluster does not receive requests within specific periods of time, you can configure the automatic start and stop feature for the instance. After you enable this feature and if no service is connected to the cluster within the period defined by the No Activity Suspended Detection Duration parameter, the cluster automatically enters the suspended state. If any service is connected to the cluster, the cluster immediately starts.

Note

The automatic start and stop feature is not supported for a serverless cluster with defined specifications.

Benefits

The serverless feature can dynamically scale cluster resources in seconds based on workloads. The serverless feature provides the following benefits:

  • High availability

    The multi-node architecture ensures the high availability of serverless clusters. Serverless clusters offer the same service level agreement (SLA) as common clusters to ensure stability.

  • High scalability

    • Wide scaling range

      A single cluster can be scaled between 0 and 1,000 CPU cores without interrupting business.

    • Scalability in seconds

      Workload detection is accomplished in five seconds and cluster resources are scaled up within a second when your workloads increase. If your workloads decrease, cluster resources are automatically scaled down in a tiered manner.

    • No business interruption

      The scaling process has no impact on business.

  • Strong data consistency

    Global consistency (high-performance mode) is provided. Clusters support strong data consistency. Data can be read immediately after it is written to read-only nodes, while the performance is almost the same as in weak consistency mode.

  • Cost-effectiveness

    Serverless clusters are billed in PCUs in the pay-as-you-go billing method. This reduces costs by up to 80%.

  • Zero O&M

    The PolarDB serverless team is responsible for all operations and maintenance work, such as system upgrades, system deployment, scaling, and alert processing. These operations are performed in the background and do not affect the services that are running in the system. This ensures continuous service delivery and allows you to focus on developing your business.

Scenarios

Serverless clusters

  • Scenarios in which workloads fluctuate dramatically

  • Scenarios that require infrequent access to databases, such as databases in development and testing environments

  • Scenarios in which intermittent scheduled tasks are involved, such as teaching and student experiments

  • Scenarios that handle inconsistent and unpredictable workloads, such as IoT and edge computing

  • Scenarios that need to reduce O&M costs and improve O&M efficiency

Serverless clusters with defined specifications

  • Scenarios in which workloads fluctuate dramatically

  • Scenarios that handle inconsistent and unpredictable workloads, such as IoT and edge computing

  • Scenarios that need to reduce O&M costs and improve O&M efficiency

  • Scenarios that need to satisfy fluctuation requirements based on existing PolarDB clusters.

Prerequisites

Serverless clusters

The serverless feature is unavailable for PolarDB for MySQL 5.6 clusters.

Serverless clusters with defined specifications

  • The clusters must meet the following requirements:

    • Database engine:

      • PolarDB for MySQL 5.7 whose revision version is 5.7.1.0.29 or later.

      • PolarDB for MySQL 8.0.1 whose revision version is 8.0.1.1.30.1 or later.

      • PolarDB for MySQL 8.0.2 whose revision version is 8.0.2.2.19 or later.

    • PolarProxy must be 2.4.30 or later.

  • The serverless feature is unavailable for Product Version Standard Edition clusters.

  • The serverless feature is unavailable for PolarDB for MySQL 5.6 clusters. Clusters with a database engine version of MySQL 5.6 are not supported.

Limits

Serverless clusters

Serverless clusters with defined specifications

  • You cannot enable the serverless feature for a single-node cluster for which PolarProxy is not configured. To enable the serverless feature for such a cluster, add read-only nodes to the cluster. For more information, see Add a read-only node. You can enable the serverless feature for a new single-node cluster that meets the version requirements.

  • The following features are not supported:

    • The serverless feature is available for X-Engine Edition clusters that meet the following requirements:

      • PolarDB for MySQL 8.0.1 whose revision version is 8.0.1.1.41 or later.

      • PolarDB for MySQL 8.0.2 whose revision version is 8.0.2.2.23 or later.

    • Global Database Network (GDN) is supported, but is subject to the following limits:

      • Automatic start and stop cannot be enabled on all serverless clusters in a GDN.

      • Each serverless cluster in the GDN must have at least one read-only node if the cluster meets the following requirements:

        • PolarDB for MySQL 8.0.1 whose revision version is 8.0.1.1.42 or later.

        • PolarDB for MySQL 8.0.2 whose revision version is 8.0.2.2.23 or later.

  • Auto scaling of local resources and Auto scaling for clusters that do not support serverless. If the Serverless feature is enabled on a cluster with defined specifications, you cannot enable these features. Similarly, after you enable these features on a cluster with defined specifications, you cannot enable the serverless feature.

Pricing

  • Serverless clusters

    The fees include compute node fees, storage capacity fees, backup storage fees (only for the part exceeding the free quota), and SQL Explorer fees (optional). For more information, see Billing.

  • Serverless clusters with defined specifications

    The fees include the fees of the resources with defined specifications and the fees of the serverless resources. For information about the fees of the resources with defined specifications, see Billable items. For information about the fees of the serverless resources, see Billing.