diff --git a/util/rich-indexer/src/tests/stress_test_scripts/get_cells.lua b/util/rich-indexer/src/tests/stress_test_scripts/get_cells.lua new file mode 100644 index 00000000000..954892cbaba --- /dev/null +++ b/util/rich-indexer/src/tests/stress_test_scripts/get_cells.lua @@ -0,0 +1,34 @@ +wrk.method = "POST" +wrk.headers["Content-Type"] = "application/json" + +wrk.body = [[ +{ + "id": 2, + "jsonrpc": "2.0", + "method": "get_cells", + "params": [ + { + "script": { + "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8", + "hash_type": "type", + "args": "0x5989ae415bb667931a99896e5fbbfad9ba53a223" + }, + "script_type": "lock", + "script_search_mode": "exact" + }, + "asc", + "0x64" + ] +} +]] + + +function response(status, headers, body) + if (string.find(body, '"error"')) then + print('error, resp: ', body) + wrk.thread:stop() + end +end + +-- This command is run under the condition that the CPU has 4 cores +-- wrk -t4 -c100 -d60s -s ./util/rich-indexer/src/tests/stress_test_scripts/get_cells.lua --latency http://127.0.0.1:8114 diff --git a/util/rich-indexer/src/tests/stress_test_scripts/get_cells_capacity.lua b/util/rich-indexer/src/tests/stress_test_scripts/get_cells_capacity.lua new file mode 100644 index 00000000000..672d80159fc --- /dev/null +++ b/util/rich-indexer/src/tests/stress_test_scripts/get_cells_capacity.lua @@ -0,0 +1,32 @@ +wrk.method = "POST" +wrk.headers["Content-Type"] = "application/json" + +wrk.body = [[ +{ + "id": 2, + "jsonrpc": "2.0", + "method": "get_cells_capacity", + "params": [ + { + "script": { + "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8", + "hash_type": "type", + "args": "0x5989ae415bb667931a99896e5fbbfad9ba53a223" + }, + "script_type": "lock", + "script_search_mode": "exact" + } + ] +} +]] + + +function response(status, headers, body) + if (string.find(body, '"error"')) then + print('error, resp: ', body) + wrk.thread:stop() + end +end + +-- This command is run under the condition that the CPU has 4 cores +-- wrk -t4 -c100 -d60s -s ./util/rich-indexer/src/tests/stress_test_scripts/get_cells_capacity.lua --latency http://127.0.0.1:8114 diff --git a/util/rich-indexer/src/tests/stress_test_scripts/get_cells_capacity_partial_mode.lua b/util/rich-indexer/src/tests/stress_test_scripts/get_cells_capacity_partial_mode.lua new file mode 100644 index 00000000000..acbf3705788 --- /dev/null +++ b/util/rich-indexer/src/tests/stress_test_scripts/get_cells_capacity_partial_mode.lua @@ -0,0 +1,36 @@ +wrk.method = "POST" +wrk.headers["Content-Type"] = "application/json" + +wrk.body = [[ +{ + "id": 2, + "jsonrpc": "2.0", + "method": "get_cells_capacity", + "params": [ + { + "script": { + "code_hash": "0xbbad126377d45f90a8ee120da988a2d7332c78ba8fd679aab478a19d6c133494", + "hash_type": "type", + "args": "0x" + }, + "script_type": "type", + "script_search_mode": "partial", + "filter": { + "output_data": "0x0000", + "output_data_filter_mode": "partial" + } + } + ] +} +]] + + +function response(status, headers, body) + if (string.find(body, '"error"')) then + print('error, resp: ', body) + wrk.thread:stop() + end +end + +-- This command is run under the condition that the CPU has 4 cores +-- wrk -t4 -c100 -d60s -s ./util/rich-indexer/src/tests/stress_test_scripts/get_cells_capacity_partial_mode.lua --latency http://127.0.0.1:8114 diff --git a/util/rich-indexer/src/tests/stress_test_scripts/get_cells_partial_mode.lua b/util/rich-indexer/src/tests/stress_test_scripts/get_cells_partial_mode.lua new file mode 100644 index 00000000000..891c0c05d0d --- /dev/null +++ b/util/rich-indexer/src/tests/stress_test_scripts/get_cells_partial_mode.lua @@ -0,0 +1,38 @@ +wrk.method = "POST" +wrk.headers["Content-Type"] = "application/json" + +wrk.body = [[ +{ + "id": 2, + "jsonrpc": "2.0", + "method": "get_cells", + "params": [ + { + "script": { + "code_hash": "0xbbad126377d45f90a8ee120da988a2d7332c78ba8fd679aab478a19d6c133494", + "hash_type": "type", + "args": "0x" + }, + "script_type": "type", + "script_search_mode": "partial", + "filter": { + "output_data": "0x0000", + "output_data_filter_mode": "partial" + } + }, + "asc", + "0x64" + ] +} +]] + + +function response(status, headers, body) + if (string.find(body, '"error"')) then + print('error, resp: ', body) + wrk.thread:stop() + end +end + +-- This command is run under the condition that the CPU has 4 cores +-- wrk -t4 -c100 -d60s -s ./util/rich-indexer/src/tests/stress_test_scripts/get_cells_partial_mode.lua --latency http://127.0.0.1:8114 \ No newline at end of file diff --git a/util/rich-indexer/src/tests/stress_test_scripts/get_transactions.lua b/util/rich-indexer/src/tests/stress_test_scripts/get_transactions.lua new file mode 100644 index 00000000000..a6478a484d5 --- /dev/null +++ b/util/rich-indexer/src/tests/stress_test_scripts/get_transactions.lua @@ -0,0 +1,34 @@ +wrk.method = "POST" +wrk.headers["Content-Type"] = "application/json" + +wrk.body = [[ +{ + "id": 2, + "jsonrpc": "2.0", + "method": "get_transactions", + "params": [ + { + "script": { + "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8", + "hash_type": "type", + "args": "0x5989ae415bb667931a99896e5fbbfad9ba53a223" + }, + "script_type": "lock", + "script_search_mode": "exact", + "group_by_transaction": true + }, + "asc", + "0x64" + ] +} +]] + +function response(status, headers, body) + if (string.find(body, '"error"')) then + print('error, resp: ', body) + wrk.thread:stop() + end +end + +-- This command is run under the condition that the CPU has 4 cores +-- wrk -t4 -c100 -d60s -s ./util/rich-indexer/src/tests/stress_test_scripts/get_transactions.lua --latency http://127.0.0.1:8114 diff --git a/util/rich-indexer/src/tests/stress_test_scripts/get_transactions_partial_mode.lua b/util/rich-indexer/src/tests/stress_test_scripts/get_transactions_partial_mode.lua new file mode 100644 index 00000000000..34c3db16f93 --- /dev/null +++ b/util/rich-indexer/src/tests/stress_test_scripts/get_transactions_partial_mode.lua @@ -0,0 +1,38 @@ +wrk.method = "POST" +wrk.headers["Content-Type"] = "application/json" + +wrk.body = [[ +{ + "id": 2, + "jsonrpc": "2.0", + "method": "get_transactions", + "params": [ + { + "script": { + "code_hash": "0xbbad126377d45f90a8ee120da988a2d7332c78ba8fd679aab478a19d6c133494", + "hash_type": "type", + "args": "0x" + }, + "script_type": "type", + "script_search_mode": "partial", + "group_by_transaction": true, + "filter": { + "output_data": "0x0000", + "output_data_filter_mode": "partial" + } + }, + "asc", + "0x64" + ] +} +]] + +function response(status, headers, body) + if (string.find(body, '"error"')) then + print('error, resp: ', body) + wrk.thread:stop() + end +end + +-- This command is run under the condition that the CPU has 4 cores +-- wrk -t4 -c100 -d60s -s ./util/rich-indexer/src/tests/stress_test_scripts/get_transactions_partial_mode.lua --latency http://127.0.0.1:8114