Skip to content

Stress test your RPC by creating n users subscribed to receive new blocks then fetch block with transactions using ethers library

License

Notifications You must be signed in to change notification settings

swiiny/rpc-stress-testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RPC stress testing 📈

Introduction

This project will help you test your RPC by creating n users subscribed to receive the new blocks and then fetch each block with its transactions using ethers library

function startWebsocket() {
	let wsProvider = new ethers.providers.WebSocketProvider(PROVIDER_URL);

	wsProvider.on('block', async (blockNumber) => {
		fetchEVMBlockFor(wsProvider, blockNumber);
	});
}

Working configuration ✅

  • Docker engine v20.10.17
  • Docker compose v2.6.1

Setup 🔨

1. Clone the repo

git clone https://github.com/JeremyTheintz/rpc-stress-testing
cd ./rpc-stress-testing

2. Start n instances connected to your RPC

sh start.sh n your_rpc_url

Not on mac ? then replace sh by bash from the shebang line of the script

Example of command to run 100 instances simultaneously

sh start.sh 100 wss://your_rpc_url

4. Stop all instances

sh stop.sh

Not on mac ? then replace sh by bash from the shebang line of the script

Warning 🚨

Running too many instances will consume a lot of RAM and CPU, use at your own risk

About

Stress test your RPC by creating n users subscribed to receive new blocks then fetch block with transactions using ethers library

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published