Skip to content

Commit

Permalink
perf: add additional high load benchmarks for /blocks (#1372)
Browse files Browse the repository at this point in the history
  • Loading branch information
TarikGul authored Jan 5, 2024
1 parent f51a28d commit c3d9d01
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 0 deletions.
2 changes: 2 additions & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ sudo cp wrk /usr/local/bin

In order to run each benchmark you should `cd` into the appropriate directory you want to run, set the `WRK_TIME_LENGTH` env var (ex: `export WRK_TIME_LENGTH=30s`) and then `sh init.sh`. You are required to have sidecar running, as well as a fully synced archive node.

NOTE: Some benchmarks might have multiple `sh` scripts with different names in order to run specific benchmarks.

### Running via Scripts (Root)

Below are flags, and examples on how to run these benchmarks from the root of the repository. See <root>/scripts/README.md for more information.
Expand Down
25 changes: 25 additions & 0 deletions benchmarks/blocksBlockId/benchHighLoadBlocks.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
-- Copyright 2017-2023 Parity Technologies (UK) Ltd.
-- This file is part of Substrate API Sidecar.
--
-- Substrate API Sidecar is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

package.path = package.path .. ";../util/util.lua"
local util = require('util')
local highLoadBlocks = require('highLoadBlocks')

request = util.request(highLoadBlocks, '/blocks/%s')

delay = util.delay

done = util.done()
3 changes: 3 additions & 0 deletions benchmarks/blocksBlockId/blocks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local highLoadBlocks = require('highLoadBlocks')

local blocks = {
'28831', -- Sudo setKey(0, -> 1)
'29258', -- sudo.sudo(forceTransfer)
Expand Down Expand Up @@ -58,6 +60,7 @@ local blocks = {
'1603025', -- staking.withdrawUnbonded
'6800002', -- blocks.transfer
'11873016', -- vesting.vest
unpack(highLoadBlocks)
}

return blocks
50 changes: 50 additions & 0 deletions benchmarks/blocksBlockId/highLoadBlocks.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
-- Copyright 2017-2023 Parity Technologies (UK) Ltd.
-- This file is part of Substrate API Sidecar.
--
-- Substrate API Sidecar is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local highLoadBlocks = {
'18687076', -- 414 extrinsics
'18687064', -- 404 extrinsics
'18687053', -- 402 extrinsics
'18687063', -- 435 extrinsics
'18687111', -- 460 extrinsics
'18687104', -- 274 extrinsics
'18687099', -- 288 extrinsics
'18687162', -- 436 extrinsics
'18687150', -- 409 extrinsics
'18687146', -- 358 extrinsics
'18687186', -- 416 extrinsics
'18687181', -- 306 extrinsics
'18687219', -- 458 extrinsics
'18687214', -- 292 extrinsics
'18687212', -- 341 extrinsics
'18687264', -- 401 extrinsics
'18687255', -- 437 extrinsics
'18687246', -- 276 extrinsics
'18687338', -- 488 extrinsics
'18687370', -- 512 extrinsics
'18687387', -- 484 extrinsics
'18687436', -- 352 extrinsics
'18687425', -- 372 extrinsics
'18687507', -- 402 extrinsics
'18687526', -- 266 extrinsics
'18687604', -- 348 extrinsics
'18687639', -- 489 extrinsics
'18687630', -- 524 extrinsics
'18687692', -- 377 extrinsics
'18687712', -- 349 extrinsics
}

return highLoadBlocks
3 changes: 3 additions & 0 deletions benchmarks/blocksBlockId/highLoadInit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

wrk -d$WRK_TIME_LENGTH -t4 -c6 --timeout 120s --latency -s ./benchHighLoadBlocks.lua http://127.0.0.1:8080

0 comments on commit c3d9d01

Please sign in to comment.