-
Notifications
You must be signed in to change notification settings - Fork 4
add test example for network loss, reorder, duplicate and corrupt in TiDB #3
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
WangXiangUSTC
wants to merge
5
commits into
chaos-mesh:main
Choose a base branch
from
WangXiangUSTC:loss_reorder_duplicate_corrupt
base: main
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.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
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,102 @@ | ||
# Test Network Chaos on TiDB | ||
|
||
## Network Corrupt | ||
|
||
### Description | ||
|
||
Test the availability of the TiDB cluster in network package corrupt scenarios. | ||
|
||
### Hypothesis | ||
|
||
When the network package corruption occurs between TiDB and TiKV nodes, the QPS/TPS of TiDB will drop significantly, but it can still provide services normally. | ||
|
||
### Preparation | ||
|
||
1. Install chaos-mesh. | ||
2. A TiDB cluster on k8s with at least 3 TiKV Pods, deploy with [TiDB operator](https://docs.pingcap.com/tidb-in-kubernetes/stable/tidb-operator-overview). | ||
3. Running payload on TiDB cluster. | ||
|
||
### Quick start | ||
|
||
1. Chaos Mesh fault YAML configuration: | ||
|
||
```YAML | ||
kind: NetworkChaos | ||
apiVersion: chaos-mesh.org/v1alpha1 | ||
metadata: | ||
namespace: tidb-cluster | ||
name: network-corrupt | ||
spec: | ||
selector: | ||
namespaces: | ||
- tidb-cluster | ||
labelSelectors: | ||
app.kubernetes.io/component: tidb | ||
mode: all | ||
action: corrupt | ||
corrupt: | ||
corrupt: '50' | ||
correlation: '50' | ||
direction: both | ||
target: | ||
selector: | ||
namespaces: | ||
- tidb-cluster | ||
labelSelectors: | ||
app.kubernetes.io/component: tikv | ||
mode: all | ||
``` | ||
|
||
Saving the YAML configuration above into file network-corrupt.yaml. | ||
|
||
2. Using Kubectl to create the experiment: | ||
|
||
``` | ||
kubectl create -f network-corrupt.yaml | ||
``` | ||
|
||
3. Verifying TiDB's status: | ||
|
||
Check QPS & TPS of TiDB in Grafana. | ||
<!-- TODO: Add some Grafana picture --> | ||
|
||
4. Result: | ||
|
||
Judge whether the hypothesis is correct or not based on the results of the test process. | ||
|
||
### More example | ||
|
||
You can test more scenarios by using Chaos Mesh. For example: | ||
|
||
- Network package corruption occurs between TiDB and TiKV. | ||
- Network package corruption occurs between TiKV and PD. | ||
- Network package corruption occurs between TiKV nodes. | ||
- Network package corruption occurs between PD nodes. | ||
|
||
All you need to do is adjust the `selector` and `target` in the YAML configuration. To inject network package corrupt between TiKV nodes, the YAML configuration looks like the below: | ||
|
||
```YAML | ||
kind: NetworkChaos | ||
apiVersion: chaos-mesh.org/v1alpha1 | ||
metadata: | ||
namespace: tidb-cluster | ||
name: network-corrupt | ||
spec: | ||
selector: | ||
pods: | ||
tidb-cluster: | ||
- basic-tikv-0 | ||
mode: all | ||
action: corrupt | ||
corrupt: | ||
corrupt: '50' | ||
correlation: '50' | ||
direction: both | ||
target: | ||
selector: | ||
pods: | ||
tidb-cluster: | ||
- basic-tikv-1 | ||
- basic-tikv-2 | ||
mode: all | ||
``` |
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,102 @@ | ||
# Test Network Chaos on TiDB | ||
|
||
## Network Duplicate | ||
|
||
### Description | ||
|
||
Test the availability of the TiDB cluster in network package duplicate scenarios. | ||
|
||
### Hypothesis | ||
|
||
When the network package duplicate occurs between TiDB and TiKV nodes, the QPS/TPS of TiDB will drop significantly, but it can still provide services normally. | ||
|
||
### Preparation | ||
|
||
1. Install chaos-mesh. | ||
2. A TiDB cluster on k8s with at least 3 TiKV Pods, deploy with [TiDB operator](https://docs.pingcap.com/tidb-in-kubernetes/stable/tidb-operator-overview). | ||
3. Running payload on TiDB cluster. | ||
|
||
### Quick start | ||
|
||
1. Chaos Mesh fault YAML configuration: | ||
|
||
```YAML | ||
kind: NetworkChaos | ||
apiVersion: chaos-mesh.org/v1alpha1 | ||
metadata: | ||
namespace: tidb-cluster | ||
name: network-duplicate | ||
spec: | ||
selector: | ||
namespaces: | ||
- tidb-cluster | ||
labelSelectors: | ||
app.kubernetes.io/component: tidb | ||
mode: all | ||
action: duplicate | ||
duplicate: | ||
duplicate: '50' | ||
correlation: '50' | ||
direction: both | ||
target: | ||
selector: | ||
namespaces: | ||
- tidb-cluster | ||
labelSelectors: | ||
app.kubernetes.io/component: tikv | ||
mode: all | ||
``` | ||
|
||
Saving the YAML configuration above into file network-duplicate.yaml. | ||
|
||
2. Using Kubectl to create the experiment: | ||
|
||
``` | ||
kubectl create -f network-duplicate.yaml | ||
``` | ||
|
||
3. Verifying TiDB's status: | ||
|
||
Check QPS & TPS of TiDB in Grafana. | ||
<!-- TODO: Add some Grafana picture --> | ||
|
||
4. Result: | ||
|
||
Judge whether the hypothesis is correct or not based on the results of the test process. | ||
|
||
### More example | ||
|
||
You can test more scenarios by using Chaos Mesh. For example: | ||
|
||
- Network package duplicate occurs between TiDB and TiKV. | ||
- Network package duplicate occurs between TiKV and PD. | ||
- Network package duplicate occurs between TiKV nodes. | ||
- Network package duplicate occurs between PD nodes. | ||
|
||
All you need to do is adjust the `selector` and `target` in the YAML configuration. To inject network package duplicate between TiKV nodes, the YAML configuration looks like the below: | ||
|
||
```YAML | ||
kind: NetworkChaos | ||
apiVersion: chaos-mesh.org/v1alpha1 | ||
metadata: | ||
namespace: tidb-cluster | ||
name: network-duplicate | ||
spec: | ||
selector: | ||
pods: | ||
tidb-cluster: | ||
- basic-tikv-0 | ||
mode: all | ||
action: duplicate | ||
duplicate: | ||
duplicate: '50' | ||
correlation: '50' | ||
direction: both | ||
target: | ||
selector: | ||
pods: | ||
tidb-cluster: | ||
- basic-tikv-1 | ||
- basic-tikv-2 | ||
mode: all | ||
``` |
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,102 @@ | ||
# Test Network Chaos on TiDB | ||
|
||
## Network Loss | ||
|
||
### Description | ||
|
||
Test the availability of TiDB cluster in network package loss scenarios. | ||
|
||
### Hypothesis | ||
|
||
When the network package loss occurs between TiKV nodes, the QPS/TPS of TiDB will drop significantly, but it can still provide services normally. | ||
|
||
### Preparation | ||
|
||
1. Install chaos-mesh. | ||
2. A TiDB cluster on k8s with at least 3 TiKV Pods, deploy with [TiDB operator](https://docs.pingcap.com/tidb-in-kubernetes/stable/tidb-operator-overview). | ||
3. Running payload on TiDB cluster. | ||
|
||
### Quick start | ||
|
||
1. Chaos Mesh fault YAML configuration: | ||
|
||
```YAML | ||
kind: NetworkChaos | ||
apiVersion: chaos-mesh.org/v1alpha1 | ||
metadata: | ||
namespace: chaos-testing | ||
name: network-loss | ||
spec: | ||
selector: | ||
pods: | ||
tidb-cluster: | ||
- basic-tikv-0 | ||
mode: all | ||
action: loss | ||
loss: | ||
loss: '10' | ||
correlation: '50' | ||
direction: to | ||
target: | ||
selector: | ||
pods: | ||
tidb-cluster: | ||
- basic-tikv-1 | ||
- basic-tikv-2 | ||
mode: all | ||
``` | ||
|
||
Saving the YAML configuration above into file network-loss.yaml. | ||
|
||
2. Using Kubectl to create the experiment: | ||
|
||
``` | ||
kubectl create -f network-loss.yaml | ||
``` | ||
|
||
3. Verifying TiDB's status: | ||
|
||
Check QPS & TPS of TiDB in Grafana. | ||
<!-- TODO: Add some Grafana picture --> | ||
|
||
4. Result: | ||
|
||
Judge whether the hypothesis is correct or not based on the results of the test process. | ||
|
||
### More example | ||
|
||
You can test more scenarios by using Chaos Mesh. For example: | ||
|
||
- Network package loss occurs between TiDB and TiKV. | ||
- Network package loss occurs between TiKV and PD. | ||
- Network package loss occurs between TiDB nodes. | ||
- Network package loss occurs between PD nodes. | ||
|
||
All you need to do is adjust the `selector` and `target` in the YAML configuration. For injecting network package loss between TiDB and TiKV, the YAML configuration looks like below: | ||
|
||
```YAML | ||
kind: NetworkChaos | ||
apiVersion: chaos-mesh.org/v1alpha1 | ||
metadata: | ||
namespace: chaos-testing | ||
name: network-loss | ||
spec: | ||
selector: | ||
namespaces: | ||
- tidb-cluster | ||
labelSelectors: | ||
app.kubernetes.io/component: tidb | ||
mode: all | ||
action: loss | ||
loss: | ||
loss: '10' | ||
correlation: '50' | ||
direction: to | ||
target: | ||
selector: | ||
namespaces: | ||
- tidb-cluster | ||
labelSelectors: | ||
app.kubernetes.io/component: tikv | ||
mode: all | ||
``` |
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
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.
The above are all "the TiDB", and this should also be changed to be consistent with the above?
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.
done, PTAL again