-
Notifications
You must be signed in to change notification settings - Fork 702
tiproxy: add tiproxy usage in the tidb cloud doc #21483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
djshow832
wants to merge
11
commits into
pingcap:release-8.5
Choose a base branch
from
djshow832:tiproxy_ga
base: release-8.5
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+178
−0
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
75d1e29
add tiproxy
djshow832 97e7da8
Apply suggestions from code review
djshow832 c4bfb65
update quota
djshow832 d879984
address comments
djshow832 b553f3a
rephrase
djshow832 c538b2f
update modify page
djshow832 350d29f
update quota
djshow832 ab07969
remove performance
djshow832 b1e5230
Rename TiProxy overview doc and update TOC reference
hfxsd 0f3b317
Update TiProxy docs with external links and minor fixes
hfxsd 60c2f82
refined wording
hfxsd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
--- | ||
title: Manage TiProxy | ||
summary: Learn about how to enable, disable, view and modify TiProxy.. | ||
--- | ||
|
||
# Manage TiProxy | ||
|
||
This document describes how to enable, disable, view and modify TiProxy. | ||
|
||
## Enable TiProxy | ||
|
||
You can enable TiProxy for either a new cluster or an existing cluster in any TiDB node group. | ||
|
||
### Decide size and number of TiProxy instances | ||
|
||
The size and number of TiProxy instances depend on both the QPS and network bandwidth of your cluster. Network bandwidth is the sum of the client request and TiDB response bandwidth. | ||
|
||
The following tables shows the maximum QPS and network bandwidth of each TiProxy size. | ||
|
||
| Size | Maximum QPS | Maximum network bandwidth | | ||
| :--| :--| | ||
| Small | 30K | 93 MiB/s | | ||
| Large | 120K | 312 MiB/s | | ||
|
||
The optional TiProxy sizes are `small` and `large`. The optional TiProxy instance numbers are 2, 3, 6, 9, 12, 15, 18, 21, and 24. The default two small-sized TiProxy instances can provide 60K QPS and 186 MiB/s network bandwidth. It is recommended that you reserve 20% of the QPS to prevent high latency. | ||
|
||
For example, if your cluster's maximum QPS is 100K and the maximum network bandwidth is 100 MiB/s, the size and number of TiProxy instances mainly depend on the QPS. In this case, you can select 6 small-sized TiProxy instances. | ||
|
||
### Enable TiProxy for a new cluster | ||
|
||
To enable TiProxy when creating a new cluster, click the TiProxy toggle and choose the TiProxy size and number. | ||
|
||
 | ||
|
||
### Enable TiProxy for an existing cluster | ||
|
||
To enable TiProxy for an existing cluster, perform the following steps: | ||
|
||
1. In the [TiDB Cloud console](https://tidbcloud.com/), navigate to the [**Clusters**](https://tidbcloud.com/project/clusters) page of your project, and then click the name of your target cluster to go to its overview page. | ||
2. Click **...** in the upper-right corner, and click **Modify** in the drop-down menu. The **Modify Cluster** page is displayed. | ||
3. On the **Modify Cluster** page, click the TiProxy toggle and choose the TiProxy size and number. | ||
|
||
 | ||
|
||
> **Note:** | ||
> | ||
> Enabling TiProxy will cause a rolling restart of TiDB in this TiDB node group, which causes connections to disconnect. In addition, creating new connections might hang for up to 30 seconds. Make sure that you enable TiProxy in the maintenance window. | ||
|
||
### Limitations and quotas | ||
|
||
- There must be at least two TiDB instance number in a TiDB node group. | ||
- The TiDB instance size must be at least 4 vCPUs. | ||
- The default maximum TiProxy instance number of an organization is 10. For more information, see [Limitations and Quotas](/tidb-cloud/limitations-and-quotas.md). | ||
- The TiDB cluster version must be v6.5.0 or later. | ||
|
||
## Disable TiProxy | ||
|
||
To disable TiProxy, perform the following steps: | ||
|
||
1. In the [TiDB Cloud console](https://tidbcloud.com/), navigate to the [**Clusters**](https://tidbcloud.com/project/clusters) page of your project, and then click the name of your target cluster to go to its overview page. | ||
2. Click **...** in the upper-right corner, and click **Modify** in the drop-down menu. The **Modify Cluster** page is displayed. | ||
3. On the **Modify Cluster** page, click the TiProxy toggle to disable TiProxy. | ||
|
||
 | ||
|
||
> **Note:** | ||
> | ||
> Disabling TiProxy will cause connections to disconnect. In addition, creating new connections might hang for up to 10 seconds. Make sure that you disable TiProxy in the maintenance window. | ||
|
||
## View TiProxy | ||
|
||
### View TiProxy topology | ||
|
||
To view the TiProxy topology, perform the following steps: | ||
|
||
1. In the [TiDB Cloud console](https://tidbcloud.com/), navigate to the [**Clusters**](https://tidbcloud.com/project/clusters) page of your project, and then click the name of your target cluster to go to its overview page. | ||
2. In the left navigation pane, click **Monitoring > Nodes**. The **Node Map** page is displayed. | ||
3. In the **Node Map** page, TiProxy topology is displayed in the **TiDB** panel. | ||
|
||
 | ||
|
||
### View TiProxy metrics | ||
|
||
To view TiProxy metrics, perform the following steps: | ||
|
||
1. In the [TiDB Cloud console](https://tidbcloud.com/), navigate to the [**Clusters**](https://tidbcloud.com/project/clusters) page of your project, and then click the name of your target cluster to go to its overview page. | ||
2. In the left navigation pane, click **Monitoring > Metrics**. The **Metrics** page is displayed. | ||
3. On the **Metrics** page, click **Server** tab and scroll down to TiProxy-related metrics. To view TiProxy metrics in one TiDB node group, click **TiDB Node Group View** tab, select your TiDB node group, and scroll down to TiProxy-related metrics. | ||
|
||
The metrics include: | ||
|
||
- **TiProxy CPU Usage**: the CPU usage statistics of each TiProxy node. The upper limit is 100%. If the maximum CPU usage exceeds 80%, it is recommended that you scale out TiProxy. | ||
- **TiProxy Connections**: the connection number on each TiProxy node. | ||
- **TiProxy Throughput**: the transferred bytes per second on each TiProxy node. If the maximum throughput reaches the maximum network bandwidth, it is recommended that you scale out TiProxy. To learn about the maximum network bandwidth, see [Decide TiProxy instance size and number](#decide-tiproxy-instance-size-and-number). | ||
- **TiProxy Sessions Migration Reasons**: the number of session migrations that happen every minute and the reason for them. For example, when TiDB scales in and TiProxy migrates sessions to other TiDB instances, the reason is `status`. For more migration reasons, see [TiProxy Monitoring Metrics](https://docs.pingcap.com/tidb/stable/tiproxy-grafana#balance). | ||
|
||
### View TiProxy bills | ||
|
||
To view TiProxy bills, perform the following steps: | ||
|
||
1. In the [TiDB Cloud console](https://tidbcloud.com), switch to your target organization using the combo box in the upper-left corner. | ||
2. In the left navigation pane, click **Billing**. On the **Billing** page, the **Bills** tab is displayed by default. | ||
3. In the **Summary by Service** section, TiProxy node cost is displayed under **TiDB Dedicated**, while TiProxy data transfer cost is included in **Data Transfer > Same Region**. | ||
|
||
 | ||
|
||
## Modify TiProxy | ||
|
||
To scale in or scale out TiProxy, perform the following steps: | ||
|
||
1. In the [TiDB Cloud console](https://tidbcloud.com/), navigate to the [**Clusters**](https://tidbcloud.com/project/clusters) page of your project, and then click the name of your target cluster to go to its overview page. | ||
2. Click **...** in the upper-right corner, and click **Modify** in the drop-down menu. The **Modify Cluster** page is displayed. | ||
3. On the **Modify Cluster** page, modify the TiProxy number. | ||
|
||
 | ||
|
||
> **Note** | ||
> | ||
> - Modifying the TiProxy size directly is not supported. It is recommended that you modify the number of TiProxy instances. If you have to modify the TiProxy size, you need to disable TiProxy in all the TiDB node groups and then enable it again to choose a different size. | ||
> - Scaling in TiProxy will cause connections to disconnect. Make sure that you scale in TiProxy in the maintenance window. | ||
|
||
## Manage TiProxy in multiple TiDB node groups | ||
|
||
When you have multiple TiDB node groups, each TiDB node group has its dedicated TiProxy group. TiProxy routes traffic to the TiDB instances in the same TiDB node group to isolate computing resources. You can enable, disable, or modify TiProxy in each TiDB node group. However, the TiProxy size in all the TiDB node groups must be the same. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
title: Overview of TiProxy for TiDB Cloud | ||
summary: Learn about the usage scenarios of TiProxy for TiDB Cloud. | ||
--- | ||
|
||
# Overview of TiProxy for TiDB Cloud | ||
|
||
TiProxy is the official proxy component of PingCAP. It is placed between the client and the TiDB server to provide load balancing, connection persistence, and other features for TiDB. | ||
|
||
For more information, see [TiProxy Overview](https://docs.pingcap.com/tidb/stable/tiproxy-overview). | ||
|
||
## Scenarios | ||
|
||
TiProxy is suitable for the following scenarios: | ||
|
||
- Connection persistence: When a TiDB server performs scaling in, rolling upgrade, or rolling restart, the client connection breaks, resulting in an error. If the client does not have an idempotent error retry mechanism, you need to manually check and fix the error, which greatly increases the operational overhead. TiProxy can keep the client connection, so that the client does not report an error. | ||
- Frequent scaling in and scaling out: The workload of an application might change periodically. To save costs, you can deploy TiDB on the cloud and automatically scale in and scale out TiDB servers according to the workload. However, scaling in might cause the client to disconnect, and scaling out might result in an unbalanced load. TiProxy can keep the client connection and achieve load balancing. | ||
- CPU load imbalance: When background tasks consume a significant amount of CPU resources, or workloads across connections vary significantly, leading to an imbalanced CPU load, TiProxy can migrate connections based on CPU usage to achieve load balancing. For more details, see [CPU-based load balancing](https://docs.pingcap.com/tidb/stable/tiproxy-load-balance#cpu-based-load-balancing). | ||
|
||
For more scenarios, see [TiProxy User Scenarios](https://docs.pingcap.com/tidb/stable/tiproxy-overview#user-scenarios). | ||
|
||
## Limitations | ||
|
||
TiProxy cannot preserve client connections in the following scenarios: | ||
|
||
- Upgrading AWS EKS, Azure AKS, Google Cloud GKE, or Alibaba Cloud ACK. | ||
- Disabling, scaling in, upgrading, or restarting TiProxy. | ||
- A single statement or transaction that runs for more than 20 seconds. If your application needs a longer timeout, contact [TiDB Cloud Support](/tidb-cloud/tidb-cloud-support.md). | ||
|
||
For more scenarios, see [TiProxy Limitations](https://docs.pingcap.com/tidb/stable/tiproxy-overview#limitations). | ||
|
||
## Billing | ||
|
||
TiProxy introduces two types of costs: | ||
|
||
- Node costs. For more information, see [Node Cost](https://www.pingcap.com/tidb-dedicated-pricing-details/#node-cost) | ||
- Data transfer costs. For more information, see [Data Transfer Cost](https://www.pingcap.com/tidb-dedicated-pricing-details/#data-transfer-cost). TiProxy will prioritize routing traffic to the TiDB instances in the same availability zone (AZ). However, if the TiDB workloads are uneven, it will also route traffic to other AZs, resulting in additional data transfer costs. | ||
|
||
You can view the TiProxy bill on the billing page. For more information, see [View TiProxy bills](/tidb-cloud/tiproxy-management.md#view-tiproxy-bills). | ||
|
||
## SLA impact | ||
|
||
TiProxy has no impact on SLA. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need add description for tiproxy is charge free for the Private Preview stage @joey-yez
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc is public from the public preview. It won't be committed during private preview.