-
Notifications
You must be signed in to change notification settings - Fork 12
Add load tests as env + pod #62
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
6l20
wants to merge
5
commits into
master
Choose a base branch
from
performance_tests
base: master
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 all 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ drop: | |
enabled: false | ||
qkm: | ||
url: https://qa-qkm.ops.consensys.net | ||
nodeSelector: | ||
enabled: false |
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,39 @@ | ||
orchestrate: | ||
replicaCount: 3 | ||
global: | ||
environment: | ||
MULTI_TENANCY_ENABLED: true | ||
DB_DATABASE: orchestrate_load | ||
DB_POOLSIZE: 750 | ||
environmentSecrets: | ||
AUTH_API_KEY: with-key | ||
|
||
observability: | ||
enabled: true | ||
|
||
drop: | ||
enabled: false | ||
|
||
kafka: | ||
enabled: false | ||
|
||
postgresql: | ||
enabled: false | ||
tls: | ||
enabled: true | ||
postgresqlHA: | ||
enabled: false | ||
|
||
vault: | ||
enabled: false | ||
replicaCount: 0 | ||
|
||
qkm: | ||
url: https://staging-qkm.ops.consensys.net | ||
vault: | ||
agents: {} | ||
|
||
nodeSelector: | ||
enabled: true | ||
value: | ||
benchmark-orchestrate: "true" |
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,41 @@ | ||
{ | ||
"abi": [ | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ | ||
"indexed": false, | ||
"internalType": "address", | ||
"name": "from", | ||
"type": "address" | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "uint256", | ||
"name": "by", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "Incremented", | ||
"type": "event" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "value", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "increment", | ||
"contractTag": "v1.1.0", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
} | ||
], | ||
"name": "increment", | ||
"bytecode": "0x608060405234801561001057600080fd5b5061023c806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80637cf5dab014610030575b600080fd5b61004a600480360381019061004591906100b5565b61004c565b005b8060008082825461005d9190610129565b925050819055507f38ac789ed44572701765277c4d0970f2db1c1a571ed39e84358095ae4eaa54203382604051610095929190610100565b60405180910390a150565b6000813590506100af816101ef565b92915050565b6000602082840312156100cb576100ca6101ea565b5b60006100d9848285016100a0565b91505092915050565b6100eb8161017f565b82525050565b6100fa816101b1565b82525050565b600060408201905061011560008301856100e2565b61012260208301846100f1565b9392505050565b6000610134826101b1565b915061013f836101b1565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610174576101736101bb565b5b828201905092915050565b600061018a82610191565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b6101f8816101b1565b811461020357600080fd5b5056fea2646970667358221220c60e80c05b07a4cdf0613322321a43f5f630166032ec9b866ffe52ddff573c1264736f6c63430008070033", | ||
"deployedBytecode": "0x608060405234801561001057600080fd5b5061023c806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80637cf5dab014610030575b600080fd5b61004a600480360381019061004591906100b5565b61004c565b005b8060008082825461005d9190610129565b925050819055507f38ac789ed44572701765277c4d0970f2db1c1a571ed39e84358095ae4eaa54203382604051610095929190610100565b60405180910390a150565b6000813590506100af816101ef565b92915050565b6000602082840312156100cb576100ca6101ea565b5b60006100d9848285016100a0565b91505092915050565b6100eb8161017f565b82525050565b6100fa816101b1565b82525050565b600060408201905061011560008301856100e2565b61012260208301846100f1565b9392505050565b6000610134826101b1565b915061013f836101b1565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610174576101736101bb565b5b828201905092915050565b600061018a82610191565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b6101f8816101b1565b811461020357600080fd5b5056fea2646970667358221220c60e80c05b07a4cdf0613322321a43f5f630166032ec9b866ffe52ddff573c1264736f6c63430008070033", | ||
"tag": "v1.0.0" | ||
} |
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,19 @@ | ||
pragma solidity ^0.6.0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you don't need solidity source code |
||
|
||
/** | ||
* @dev Counter contract for demo purposes | ||
* | ||
*/ | ||
contract Counter { | ||
uint256 counter; | ||
|
||
event Incremented(address from, uint256 by); | ||
|
||
/** | ||
* @dev increment counter of `value` | ||
*/ | ||
function increment(uint256 value) public { | ||
counter += value; | ||
emit Incremented(msg.sender, value); | ||
} | ||
} |
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,34 @@ | ||
# Performance testing | ||
|
||
In order to run relevant perfomance tests it is recommended to run API pods on AWS `m5.xlarge`instances (4vCpus / 16Gio), at least. Or equivalent on other platforms. | ||
|
||
These instances are targeted using the k8s node selector technique, as you may see in both the load profile and orchestrate values file. Respectively located in `environments/load.yaml` and `values/orchestrate.yaml.gotmpl` | ||
|
||
## Deployment | ||
|
||
### orchestrate | ||
|
||
Define a load test namespace within you k8s cluster and set the `ORCHESTRATE_NAMESPACE` accordingly, one good choice could be : | ||
`export ORCHESTRATE_NAMESPACE=benchmark` | ||
|
||
The following command will deploy orchestrate in performance testing mode within the defined namespace | ||
|
||
`helmfile apply -e load --suppress-secrets` | ||
|
||
### Test smart contract | ||
|
||
The provided `Counter.sol` smart contract must be deployed into a test blockchain, in the given test we have been using a Besu node. This might be changed at line 32 of the `vegeta-pod.yaml`file, accordingly with your registered/targeted chains. | ||
|
||
The `Counter-formatted-abi.json` file will help you deploy that contract quicker using orchestrate contract registration API. | ||
|
||
## Run test | ||
|
||
Current test is proposed as a Pod that enables running the vegeta tool against the deployed version of orchestrate. You should be careful to run the test within the same namespace as you load instances. Using the following command : | ||
|
||
`kubectl apply -f vegeta-pod.yaml -n $ORCHESTRATE_NAMESPACE` | ||
|
||
If you are not using default API-KEY, the value must be changed before running at line 27 of the `vegeta-pod.yaml`file. | ||
|
||
## Note | ||
|
||
Current version of the test has run successfully (100% success) with the given configuration. |
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,44 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: vegeta | ||
spec: | ||
restartPolicy: Never | ||
volumes: | ||
- name: config-volume | ||
configMap: | ||
name: vegeta-configmap | ||
containers: | ||
- name: vegeta1 | ||
image: peterevans/vegeta:6.9.1 | ||
command: ["/bin/sh", "-c"] | ||
volumeMounts: | ||
- name: config-volume | ||
mountPath: /vegeta | ||
args: ["cd /vegeta; cat test | vegeta attack -format=http -duration=1m30s -rate=500/s -connections 75 | vegeta report"] | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: vegeta-configmap | ||
data: | ||
test: | | ||
POST http://orchestrate-api:8081/transactions/send | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why url is hard coded? |
||
x-api-key: with-key | ||
Content-Type: application/json | ||
@body.json | ||
body.json: | | ||
{ | ||
"chain": "besu", | ||
"params": { | ||
"methodSignature": "increment(uint256)", | ||
"args": [1], | ||
"to": "0x42699a7612a82f1d9c36148af9c77354759b210b", | ||
"gasPrice": "0x0", | ||
"gas": 25000, | ||
"oneTimeKey": true, | ||
"contractName": "increment", | ||
"contractTag": "v1.0.0" | ||
} | ||
} | ||
--- |
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
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.
shouldn't this value being customizable?