Skip to content

Instantly share code, notes, and snippets.

@hexfusion
Created March 16, 2022 18:27
Show Gist options
  • Save hexfusion/6a5d5ca9b5874d261a97f4d8ce313ef8 to your computer and use it in GitHub Desktop.
Save hexfusion/6a5d5ca9b5874d261a97f4d8ce313ef8 to your computer and use it in GitHub Desktop.
import http from 'k6/http';
import { check } from 'k6';
export const options = {
scenarios: {
constant_request_rate: {
executor: 'constant-arrival-rate',
rate: 10000,
timeUnit: '1s', // 10000 iterations per second, i.e. 10000 RPS
duration: '120s',
preAllocatedVUs: 15000, // how large the initial pool of VUs would be
maxVUs: 15000, // if the preAllocatedVUs are not enough, we can initialize more
},
},
};
export default function () {
const url = 'https://1.2.3.4:9650/ext/bc/2ebCneCbwthjQ1rYT41nhd7M76Hc6YmosMAQrTFhBq8qeqh6tt/rpc';
const payload = '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}'
const params = {
headers: {
'Content-Type': 'application/json',
},
};
const res = http.post(url, payload, params);
check(res, {
'is status 200': (r) => r.status === 200,
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment