Skip to content
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

Load test clients #1806

Closed
wants to merge 37 commits into from
Closed

Load test clients #1806

wants to merge 37 commits into from

Conversation

tkporter
Copy link
Contributor

@tkporter tkporter commented Nov 20, 2019

Description

Load test clients!

This introduces two .env vars:

LOAD_TEST_CLIENTS:

The number of load test client accounts. These accounts (generated using the mnemonic) are given cGLD in the genesis & cUSD during contract migrations. This is the default number of load test clients that are deployed, but that can be overridden with a cmd flag

LOAD_TEST_TX_DELAY_MS:

The number of milliseconds a load test client will sleep between transaction sends.

Overview

Load test clients are ultralight clients that are deployed as a statefulset. Each pod has two containers that run simultaneously: an ultralight geth client, and a celotool container running the command celotool geth simulate-client. The client simulation uses contractkit to send transactions every LOAD_TEST_TX_DELAY_MS milliseconds (unless overridden). The currency and gas currency (cGLD/cUSD) for a transaction are chosen randomly. Transactions from a load test client at index i will be sent to the load test client at index (i + 1) % (total num of clients), so the funds will be circulated only amongst load-test accounts.

Here's the help for deploying load-test

celotooljs deploy initial load-test

deploy load-test

Options:
  --version                     Show version number                                                                                                    [boolean]
  --verbose                     Whether to show a bunch of debugging output like stdout and stderr of shell commands                  [boolean] [default: false]
  --yesreally                   Reply "yes" to prompts about changing staging/production (be careful!)                                [boolean] [default: false]
  --help                        Show help                                                                                                              [boolean]
  --celo-env, -e                the environment in which you want to execute this command                                                             [required]
  --blockscout-measure-percent  Percent of transactions to measure the time it takes for blockscout to process a transaction. Should be in the range of [0, 100]
                                                                                                                                          [number] [default: 30]
  --delay                       Number of ms a client waits between each transaction, defaults to LOAD_TEST_TX_DELAY_MS in the .env file  [number] [default: -1]
  --replicas                    Number of load test clients to create, defaults to LOAD_TEST_CLIENTS in the .env file                     [number] [default: -1]

Tested

Ran my own testnet, ensured that the genesis & contract migration set the correct account balances. Spun up load-clients, upgraded them, destroyed them, etc. Made sure transactions were succeeding by looking at the logs & by looking at blockscout. You can see it in action right now at https://trevor3-blockscout.celo-networks-dev.org/ (if it doesn't seem like it's happening I probably took down the light clients).

Other changes

  • I wanted to use some helm templates from the testnet chart in the load-test chart, so I created a common helm chart for shared templates called common.

  • I also finally moved the bootnode address to be generated with the bootnode account type, and not the load test account type

  • Removed a duplicate of the sleep function

  • I also saw that contractkit was only aware of the public variable gasPriceMinimum (which corresponds to the cGLD gas price, link) in GasPriceMinimum.sol, and not getGasPriceMinimum(address tokenAddress) (which will provide the gas price for any token, link), so I added that. I ended up not needing to use that function in this PR after all, but thought it'd be good to keep in.

Related issues

Backwards compatibility

Requires new genesis & contract deployments so that load test accounts are fauceted

@codecov
Copy link

codecov bot commented Nov 20, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@c42e938). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1806   +/-   ##
=========================================
  Coverage          ?   74.45%           
=========================================
  Files             ?      281           
  Lines             ?     7817           
  Branches          ?      973           
=========================================
  Hits              ?     5820           
  Misses            ?     1880           
  Partials          ?      117
Flag Coverage Δ
#mobile 74.45% <ø> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c42e938...191fe2c. Read the comment docs.

Copy link
Contributor

@nambrot nambrot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just minor arrangement questions that could also be solved in a different PR, looks great overall, thanks for reviving it!

@@ -0,0 +1,3 @@
# common

This contains common helper templates to be used across different helm charts.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

@@ -0,0 +1,30 @@
{{- define "common.init-genesis-container" -}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have the static nodes on GCP, should we just pull them into their own init container as well to share?

component: load-test
spec:
initContainers:
- name: generate-keys
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we are at it, i feel like we could pull this into common as well?

packages/celotool/src/lib/geth.ts Outdated Show resolved Hide resolved
packages/celotool/src/lib/geth.ts Outdated Show resolved Hide resolved
packages/celotool/src/lib/geth.ts Outdated Show resolved Hide resolved
packages/celotool/src/lib/geth.ts Outdated Show resolved Hide resolved
@nambrot nambrot assigned tkporter and unassigned nambrot Nov 20, 2019
@nambrot
Copy link
Contributor

nambrot commented Nov 20, 2019

I know we talked about how these clients should be able to connect to full nodes that are not the specified static nodes, but if we could somehow verify that, that would be great

@tkporter tkporter added the automerge Have PR merge automatically when checks pass label Nov 26, 2019
@tkporter
Copy link
Contributor Author

Update: hoping to merge this today, e2e sync test is failing so I will have to figure that out

This was referenced Dec 5, 2019
@tkporter
Copy link
Contributor Author

Closing in favor of #2073, which included this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Have PR merge automatically when checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLabs SBAT operate a fleet of light clients generating transactions
3 participants