# 负载均衡计费

## 前提条件

* 负载均衡资源全部为[**按需付费**](/welcome/cn/pricing/general-pricing-rules/pay-as-you-go.md)资源，按小时计费，最低计费单位为一小时。请先参阅[**通用定价规则**](/welcome/cn/pricing/general-pricing-rules.md)和[**通用生命周期规则**](/welcome/cn/pricing/general-lifecycle-rules.md)，了解按需付费资源的基本计费方式。
* 负载均衡目前包括以下计费项：实例费用、LCU 费用、弹性 IP 费用和公网数据流量包费用。

{% hint style="info" %} <mark style="color:blue;">**注意**</mark>

<mark style="color:blue;">实际价格因不同地区和可用区而异，因此请以订单页面显示的价格为准。</mark>
{% endhint %}

## 计费项

### 负载均衡实例

负载均衡的计费方式为[**按需付费**](/welcome/cn/pricing/general-pricing-rules/pay-as-you-go.md)。按小时后付费。

### LCU

LCU（负载均衡容量单位）是衡量负载均衡资源消耗的最小单位。LCU 的数量由每分钟最高并发连接数、每秒新建连接数（CPS）或每小时数据流量中的最大值决定，并受 LCU 系数的影响。LCU 数量还因监听协议的不同而有所变化。

**指标**

* **并发连接数**\
  并发连接数指在某个时间点（每分钟）负载均衡实例同时处理的活动连接数。
* **CPS**\
  每秒新建连接数（CPS）指负载均衡实例在一秒钟内可以处理的新连接数。
* **流量包计费**\
  流量包计费指负载均衡实例在一小时内处理的数据量，以千兆字节（GB）为单位。

**协议**

* **TCP**\
  TCP，传输控制协议，可靠且确保所有数据按顺序正确到达，适用于网页浏览、电子邮件和文件传输。
* **UDP**\
  UDP，用户数据报协议，速度快但不可靠，不保证数据的传输或顺序—适用于对速度要求高于准确性的流媒体、在线游戏和实时通信。

**LCU 系数**

计算 LCU 数量时，将每分钟最高并发连接数、CPS 或每小时数据流量中的最大值除以对应协议类型的 LCU 系数。

<table><thead><tr><th width="281.70703125">指标</th><th>TCP</th><th>UDP</th></tr></thead><tbody><tr><td>并发连接数</td><td>100,000</td><td>50,000</td></tr><tr><td>CPS</td><td>800</td><td>400</td></tr><tr><td>流量包计费</td><td>1 GB</td><td>1 GB</td></tr></tbody></table>

#### **LCU 费用公式**

> * LCU 费用 = LCU 单价（美元/LCU） × 每小时 LCU 数量 × 时长（小时）
>
> * 每小时 LCU 数量 = max {并发连接 LCU 数量, CPS LCU 数量, 流量包计费 LCU 数量}
>
> > 并发连接 LCU 数量 = 最高并发连接数/LCU 系数
> >
> > CPS LCU 数量 = 最高 CPS 数值/LCU 系数
> >
> > 流量包计费 LCU 数量 = 总流量/LCU 系数

#### LCU 计费示例

您创建了一个包含 TCP 监听器和 UDP 监听器的按需付费负载均衡器，并在一小时后释放。下表描述了在此期间的最高并发连接数、最高 CPS 数值和总流量。

<table><thead><tr><th width="164.15625">指标</th><th>TCP 监听器</th><th>UDP 监听器</th></tr></thead><tbody><tr><td>并发连接数</td><td><p>每小时内最高值为 550,000。</p><p>LCU 数量 = 550,000/100,000 = 5.5</p></td><td><p>每小时内最高值为 350,000。</p><p>LCU 数量 = 350,000/100,000 = 3.5</p></td></tr><tr><td>CPS</td><td><p>每小时内最高值为 2,400。</p><p>LCU 数量 = 2,400/800 = 3.0</p></td><td><p>每小时内最高值为 1,600。</p><p>LCU 数量 = 1,600/800 = 2.0</p></td></tr><tr><td>流量包计费</td><td><p>每小时内通过 TCP 的数据传输量为 7 GB。</p><p>LCU 数量 = 7/1 = 7.0</p></td><td><p>每小时内通过 UDP 的数据传输量为 3 GB。</p><p>LCU 数量 = 3/1 = 3.0</p></td></tr></tbody></table>

LCU 数量：

* 对于每小时的 TCP 监听器\
  \= max {并发连接数的 LCU 数量, CPS 的 LCU 数量, 流量包计费的 LCU 数量}\
  \= 流量包计费的 LCU 数量\
  \= 7
* 对于每小时的 UDP 监听器\
  \= max {并发连接数的 LCU 数量, CPS 的 LCU 数量, 流量包计费的 LCU 数量}\
  \= 并发连接数的 LCU 数量\
  \= 3.5

假设 LCU 单价为 $0.02/h，则 LCU 费用为：

* LCU 费用\
  \= LCU 单价 (USD/LCU) × 每小时的 LCU 数量 × 时长 (小时)\
  \= $0.02/LCU/h × (7 LCU + 3.5 LCU) × 1 h\
  \= $0.21

### 弹性公网 IP

弹性公网 IP 的计费基于使用时间（按小时）和 IP 数量。具体价格请参阅订单页面。

### 公网流量包计费

公网费用可以按流量包计费或固定带宽计费。请查看 [流量包计费](/welcome/cn/pricing/network-billing/data-transfer.md) 和 [固定带宽计费](/welcome/cn/pricing/network-billing/flat-rate.md) 以了解更多信息。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/welcome/cn/pricing/elastic-compute-billing/load-balancer-billing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
