Serverless

Updated at: 2025-02-25 03:46

Serverless is a dynamic, elastic scaling capability of PolarDB clusters. Each node in a PolarDB cluster can elastically scale up within seconds to handle sudden workload surges without affecting ongoing operations and automatically scale down during periods of low business loads to optimize cost efficiency.

The serverless feature allows you to create and use databases without worrying about the resource configuration of your cluster. The following figure shows the resource specification changes of common and serverless clusters in scenarios in which the business workloads fluctuate.

p550765.png

The preceding figure provides the following information:

  • Common cluster: Low resource utilization during low-demand periods translates into wasted costs, whereas insufficient resources during high-demand periods affect service performance.

  • Serverless cluster:

    • Dynamically adjusts resource specifications based on workloads. This improves resource utilization and reduces resource waste.

    • Quickly scales up or down resources based on changing workloads. This ensures performance and service stability even during peak hours.

    • Breaks away from the traditional fixed-resource pricing model by using the pay-as-you-go billing method. Users are charged based on actual resource usage, which results in substantial cost savings.

    • Specifically optimized for high-throughput write scenarios and high-concurrency scenarios. These optimizations combined with elastic scaling capabilities make serverless clusters suitable for businesses that handle large amounts of data and experience fluctuating traffic patterns.

    • Automatically adjusts configurations without the need for manual intervention, which increases operational efficiency and saves time and labor costs.

Overview

The serverless feature provides real-time scaling elasticity for CPU, memory, storage, and network resources. The feature provides vertical resource isolation for network resources, namespaces, and storage space, and on-demand billing for computing and storage resources. This enables the flexible allocation of compute and storage resources based on actual business requirements. This capability enables the cluster to quickly and independently adjust computing and storage capacities in response to fluctuations in workload such as peaks and troughs. As a result, businesses can rapidly respond to changes in workload while optimizing cost efficiency.

Item

Description

Item

Description

Implementation model

Serverless feature of a cluster with defined specifications: Serverless-enabled cluster whose billing method is subscription or pay-as-you-go.

Defined specifications refer to the fixed compute node specifications of the cluster whose billing method is subscription or pay-as-you-go.

Scaling method

  • Scale-up/down: the change of the CPU and memory of compute nodes in a cluster.

  • Scale-in/out: the change of the number of read-only nodes in a cluster.

PolarDB Capacity Unit (PCU)

The serverless feature uses PCU as the unit of measurement for billing and resource elasticity on a per-second basis. One PCU is approximately equal to 1 CPU core and 2 GB of memory. The PCUs of a node are dynamically adjusted within the specified range based on the workloads. The minimum granularity for scaling is 0.5 PCUs.

Architecture

Serverless feature of a cluster with defined specifications

Serverless feature of a cluster with defined specifications

image
  • PolarProxy

    • PolarProxy includes resources with defined specifications and serverless resources. The serverless resources are scaled based on the workloads.

    • The serverless 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 include the resources with defined specifications and the serverless resources. The resources with defined specifications cannot be scaled, whereas the serverless resources can be scaled based on the 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 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 Storage.

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.

Auto Scaling

Trigger conditions for resource scale-up and scale-out

  • Trigger conditions for resource scale-up

    PolarDB monitors the CPU utilization, memory utilization, and other kernel metrics of the primary 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 node exceeds 85%, a resource scale-up is triggered for the node.

    • When the memory utilization of a node exceeds 85%, a resource scale-up is triggered for the node.

    • 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 to no less than 5 PCUs.

  • Trigger conditions for resource scale-out

    If the resources of read-only nodes of a cluster are scaled up to the specified upper limit, but the CPU utilization or memory utilization of the nodes still meets the trigger conditions for a resource scale-up (higher than 85%), a scale-out of read-only nodes is triggered.

Trigger conditions for resource scale-down

When the CPU utilization of a node is lower than 55% and the memory utilization is lower than 40%, a resource scale-down is triggered for the node.

Note

The preceding thresholds are default values. The thresholds vary based on the kernel parameters and serverless configurations of clusters.

Benefits

The serverless feature can dynamically scale cluster resources in seconds based on real-time business loads. The serverless feature provides the following benefits:

  • High availability

    The multi-node architecture ensures high availability and stability of serverless clusters.

  • High scalability

    • Wide scaling range: Automatic vertical scaling and horizontal scaling are supported.

    • Scaling within seconds: When your workloads increase, workload detection is completed in 5 seconds and cluster resources are scaled out within 1 second. If your workloads decrease, cluster resources are automatically released by tier.

  • Strong data consistency

    The serverless feature supports global consistency and ensures strong data consistency within the cluster. Data written to the cluster is immediately available for reading on read-only nodes with performance almost the same as the performance in weak consistency mode.

    Note

    By default, the global consistency feature is disabled. You can manually enable the feature on the cluster endpoint. For more information, see Global consistency.

  • Cost-effectiveness

    Serverless clusters are billed in PCUs based on the pay-as-you-go billing method. Costs can be reduced 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

  • Scenarios in which workloads dramatically fluctuate

  • 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.

Supported versions

Your PolarDB for PostgreSQL (Compatible with Oracle) cluster runs the following database engine version:

PolarDB for PostgreSQL (Compatible with Oracle) 2.0 whose revision version is 2.0.14.27.0 or later

Billing

The fees of a serverless-enabled cluster with defined specifications consists of the fees for the cluster with defined specifications and the fees related to the serverless feature. For information about the fees of the cluster with defined specifications, see Billable items. For information about the fees related to the serverless feature, see Billing.

  • On this page (1, M)
  • Overview
  • Architecture
  • Auto Scaling
  • Benefits
  • Scenarios
  • Supported versions
  • Billing
Feedback