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

[PH] Use EOSMechanics contract with Performance Test #713

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 24 additions & 20 deletions tests/TestHarness/Cluster.py
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ def __init__(self, walletd=False, localCluster=True, host="localhost", port=8888
defproduceraPrvtKey: Defproducera account private key
defproducerbPrvtKey: Defproducerb account private key
"""
self.accounts={}
self.accounts=[]
self.nodes=[]
self.unstartedNodes=[]
self.localCluster=localCluster
@@ -705,7 +705,9 @@ def createAccountKeys(count):

# create account keys and import into wallet. Wallet initialization will be user responsibility
# also imports defproducera and defproducerb accounts
def populateWallet(self, accountsCount, wallet, accountNames: list=None):
def populateWallet(self, accountsCount, wallet, accountNames: list=None, createProducerAccounts: bool=True):
if accountsCount == 0 and len(accountNames) == 0:
return True
if self.walletMgr is None:
Utils.Print("ERROR: WalletMgr hasn't been initialized.")
return False
@@ -718,15 +720,16 @@ def populateWallet(self, accountsCount, wallet, accountNames: list=None):
Utils.Print("Account keys creation failed.")
return False

Utils.Print("Importing keys for account %s into wallet %s." % (self.defproduceraAccount.name, wallet.name))
if not self.walletMgr.importKey(self.defproduceraAccount, wallet):
Utils.Print("ERROR: Failed to import key for account %s" % (self.defproduceraAccount.name))
return False
if createProducerAccounts:
Utils.Print("Importing keys for account %s into wallet %s." % (self.defproduceraAccount.name, wallet.name))
if not self.walletMgr.importKey(self.defproduceraAccount, wallet):
Utils.Print("ERROR: Failed to import key for account %s" % (self.defproduceraAccount.name))
return False

Utils.Print("Importing keys for account %s into wallet %s." % (self.defproducerbAccount.name, wallet.name))
if not self.walletMgr.importKey(self.defproducerbAccount, wallet):
Utils.Print("ERROR: Failed to import key for account %s" % (self.defproducerbAccount.name))
return False
Utils.Print("Importing keys for account %s into wallet %s." % (self.defproducerbAccount.name, wallet.name))
if not self.walletMgr.importKey(self.defproducerbAccount, wallet):
Utils.Print("ERROR: Failed to import key for account %s" % (self.defproducerbAccount.name))
return False

if accountNames is not None:
for idx, name in enumerate(accountNames):
@@ -737,8 +740,8 @@ def populateWallet(self, accountsCount, wallet, accountNames: list=None):
if not self.walletMgr.importKey(account, wallet):
Utils.Print("ERROR: Failed to import key for account %s" % (account.name))
return False
self.accounts.append(account)

self.accounts=accounts
return True

def getNodeP2pPort(self, nodeId: int):
@@ -1595,17 +1598,18 @@ def cleanup(self):
def createAccounts(self, creator, waitForTransBlock=True, stakedDeposit=1000, validationNodeIndex=0):
if self.accounts is None:
return True

transId=None
for account in self.accounts:
if Utils.Debug: Utils.Print("Create account %s." % (account.name))
if Utils.Debug: Utils.Print("Validation node %s" % validationNodeIndex)
trans=self.createAccountAndVerify(account, creator, stakedDeposit, validationNodeIndex=validationNodeIndex)
if trans is None:
Utils.Print("ERROR: Failed to create account %s." % (account.name))
return False
if Utils.Debug: Utils.Print("Account %s created." % (account.name))
transId=Node.getTransId(trans)
ret = self.biosNode.getEosAccount(account.name)
if ret is None:
if Utils.Debug: Utils.Print("Create account %s." % (account.name))
if Utils.Debug: Utils.Print("Validation node %s" % validationNodeIndex)
trans=self.createAccountAndVerify(account, creator, stakedDeposit, validationNodeIndex=validationNodeIndex)
if trans is None:
Utils.Print("ERROR: Failed to create account %s." % (account.name))
return False
if Utils.Debug: Utils.Print("Account %s created." % (account.name))
transId=Node.getTransId(trans)

if waitForTransBlock and transId is not None:
node=self.nodes[validationNodeIndex]
6 changes: 6 additions & 0 deletions tests/performance_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -7,16 +7,22 @@ configure_file(nodeos_log_2_0_14.txt.gz nodeos_log_2_0_14.txt.gz COPYONLY)
configure_file(nodeos_log_3_2.txt.gz nodeos_log_3_2.txt.gz COPYONLY)
configure_file(genesis.json genesis.json COPYONLY)
configure_file(validate_nodeos_plugin_args.py validate_nodeos_plugin_args.py COPYONLY)
configure_file(cpuTrxData.json cpuTrxData.json COPYONLY)
configure_file(ramTrxData.json ramTrxData.json COPYONLY)
configure_file(userTrxDataTransfer.json userTrxDataTransfer.json COPYONLY)
configure_file(userTrxDataNewAccount.json userTrxDataNewAccount.json COPYONLY)

add_test(NAME performance_test_basic COMMAND tests/performance_tests/performance_test_basic.py -v -p 1 -n 1 --target-tps 20 --tps-limit-per-generator 10 --test-duration-sec 5 --clean-run WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME performance_test_basic_ex_transfer_trx_spec COMMAND tests/performance_tests/performance_test_basic.py -v -p 1 -n 1 --target-tps 20 --tps-limit-per-generator 10 --test-duration-sec 5 --clean-run --user-trx-data-file tests/performance_tests/userTrxDataTransfer.json WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME performance_test_basic_ex_new_acct_trx_spec COMMAND tests/performance_tests/performance_test_basic.py -v -p 1 -n 1 --target-tps 20 --tps-limit-per-generator 10 --test-duration-sec 5 --clean-run --user-trx-data-file tests/performance_tests/userTrxDataNewAccount.json WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME performance_test_basic_ex_cpu_trx_spec COMMAND tests/performance_tests/performance_test_basic.py -v -p 1 -n 1 --target-tps 20 --tps-limit-per-generator 10 --test-duration-sec 5 --clean-run --account-name "c" --abi-file eosmechanics.abi --wasm-file eosmechanics.wasm --contract-dir unittests/contracts/eosio.mechanics --user-trx-data-file tests/performance_tests/cpuTrxData.json WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME performance_test_basic_ex_ram_trx_spec COMMAND tests/performance_tests/performance_test_basic.py -v -p 1 -n 1 --target-tps 20 --tps-limit-per-generator 10 --test-duration-sec 5 --clean-run --account-name "r" --abi-file eosmechanics.abi --wasm-file eosmechanics.wasm --contract-dir unittests/contracts/eosio.mechanics --user-trx-data-file tests/performance_tests/ramTrxData.json WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME log_reader_tests COMMAND tests/performance_tests/log_reader_tests.py WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME validate_nodeos_plugin_args COMMAND tests/performance_tests/validate_nodeos_plugin_args.py WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_property(TEST performance_test_basic PROPERTY LABELS nonparallelizable_tests)
set_property(TEST performance_test_basic_ex_transfer_trx_spec PROPERTY LABELS nonparallelizable_tests)
set_property(TEST performance_test_basic_ex_new_acct_trx_spec PROPERTY LABELS nonparallelizable_tests)
set_property(TEST performance_test_basic_ex_cpu_trx_spec PROPERTY LABELS nonparallelizable_tests)
set_property(TEST performance_test_basic_ex_ram_trx_spec PROPERTY LABELS nonparallelizable_tests)

add_subdirectory( NodeosPluginArgs )
76 changes: 34 additions & 42 deletions tests/performance_tests/README.md
Original file line number Diff line number Diff line change
@@ -274,8 +274,6 @@ The Performance Harness main script `performance_test.py` can be configured usin
In "lmax" mode, producer threads will incrementally be tested until the performance rate ceases to increase with the addition of additional threads.
In "full" mode producer threads will incrementally be tested from 2..num logical processors, recording each performance and choosing the local max performance (same value as would be discovered in "lmax" mode). Useful for graphing the full performance impact of each available thread. (default: none)
* `--account-name` Name of the account to create and assign a contract to
* `--owner-public-key` Owner public key to use with specified account name
* `--active-public-key` Active public key to use with specified account name
* `--contract-dir` Path to contract dir
* `--wasm-file` WASM file name for contract
* `--abi-file` ABI file name for contract
@@ -347,8 +345,6 @@ The following scripts are typically used by the Performance Harness main script
* `--print-missing-transactions`
Toggles if missing transactions are be printed upon test completion. (default: False)
* `--account-name` Name of the account to create and assign a contract to
* `--owner-public-key` Owner public key to use with specified account name
* `--active-public-key` Active public key to use with specified account name
* `--contract-dir` Path to contract dir
* `--wasm-file` WASM file name for contract
* `--abi-file` ABI file name for contract
@@ -832,37 +828,37 @@ The Performance Test Basic generates, by default, a report that details results
``` json
{
"completedRun": true,
"testStart": "2023-02-17T22:00:41.305618",
"testFinish": "2023-02-17T22:02:21.597430",
"testStart": "2023-02-22T21:28:58.867999",
"testFinish": "2023-02-22T21:30:39.932852",
"Analysis": {
"BlockSize": {
"min": 925248,
"max": 1551936,
"avg": 1332244.3636363635,
"sigma": 144713.34505483133,
"min": 1069248,
"max": 1521216,
"avg": 1335995.7333333334,
"sigma": 107425.6639278012,
"emptyBlocks": 0,
"numBlocks": 44
"numBlocks": 45
},
"BlocksGuide": {
"firstBlockNum": 2,
"lastBlockNum": 193,
"totalBlocks": 192,
"lastBlockNum": 194,
"totalBlocks": 193,
"testStartBlockNum": 112,
"testEndBlockNum": 160,
"testEndBlockNum": 161,
"setupBlocksCnt": 110,
"tearDownBlocksCnt": 33,
"leadingEmptyBlocksCnt": 1,
"trailingEmptyBlocksCnt": 0,
"configAddlDropCnt": 2,
"testAnalysisBlockCnt": 44
"testAnalysisBlockCnt": 45
},
"TPS": {
"min": 10265,
"max": 15774,
"avg": 13882.232558139534,
"sigma": 1454.0837894863364,
"min": 11982,
"max": 15496,
"avg": 13922.954545454546,
"sigma": 1026.4435279720471,
"emptyBlocks": 0,
"numBlocks": 44,
"numBlocks": 45,
"configTps": 50000,
"configTestDuration": 10,
"tpsPerGenerator": [
@@ -883,29 +879,29 @@ The Performance Test Basic generates, by default, a report that details results
"generatorCount": 13
},
"TrxCPU": {
"min": 6.0,
"max": 15292.0,
"avg": 25.024962251222377,
"sigma": 49.9778703823556,
"samples": 322527
"min": 7.0,
"max": 8186.0,
"avg": 24.41423694803685,
"sigma": 32.88703511468667,
"samples": 326924
},
"TrxLatency": {
"min": 0.11500000953674316,
"max": 16.91100001335144,
"avg": 8.950405516519615,
"sigma": 4.844012708597167,
"samples": 322527
"min": 0.023999929428100586,
"max": 17.144999980926514,
"avg": 9.035915723544147,
"sigma": 4.873430717683421,
"samples": 326924
},
"TrxNet": {
"min": 24.0,
"max": 24.0,
"avg": 24.0,
"sigma": 0.0,
"samples": 322527
"samples": 326924
},
"DroppedBlocks": {},
"DroppedBlocksCount": 0,
"DroppedTransactions": 177473,
"DroppedTransactions": 173076,
"ProductionWindowsTotal": 0,
"ProductionWindowsAverageSize": 0,
"ProductionWindowsMissed": 0,
@@ -1385,14 +1381,10 @@ The Performance Test Basic generates, by default, a report that details results
}
},
"specifiedContract": {
"accountName": "eosio",
"ownerPrivateKey": "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3",
"ownerPublicKey": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"activePrivateKey": "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3",
"activePublicKey": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"contractDir": "unittests/contracts/eosio.system",
"wasmFile": "eosio.system.wasm",
"abiFile": "eosio.system.abi"
"abiFile": "eosio.system.abi",
"account": "Name: eosio"
},
"useBiosBootFile": false,
"genesisPath": "tests/performance_tests/genesis.json",
@@ -1412,17 +1404,17 @@ The Performance Test Basic generates, by default, a report that details results
"testTrxGenDurationSec": 10,
"tpsLimitPerGenerator": 4000,
"numAddlBlocksToPrune": 2,
"logDirRoot": "p/2023-02-17_22-00-41/pluginThreadOptRunLogs",
"logDirRoot": "p/2023-02-22_21-28-58/pluginThreadOptRunLogs",
"delReport": true,
"quiet": false,
"delPerfLogs": true,
"expectedTransactionsSent": 500000,
"printMissingTransactions": false,
"userTrxDataFile": null,
"logDirBase": "p/2023-02-17_22-00-41/pluginThreadOptRunLogs/p",
"logDirTimestamp": "2023-02-17_22-00-41",
"logDirBase": "p/2023-02-22_21-28-58/pluginThreadOptRunLogs/p",
"logDirTimestamp": "2023-02-22_21-28-58",
"logDirTimestampedOptSuffix": "-50000",
"logDirPath": "p/2023-02-17_22-00-41/pluginThreadOptRunLogs/p/2023-02-17_22-00-41-50000"
"logDirPath": "p/2023-02-22_21-28-58/pluginThreadOptRunLogs/p/2023-02-22_21-28-58-50000"
},
"env": {
"system": "Linux",
16 changes: 16 additions & 0 deletions tests/performance_tests/cpuTrxData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"initAccounts": ["c"],
"abiFile": "unittests/contracts/eosio.mechanics/eosmechanics.abi",
"actions": [
{
"actionName": "cpu",
"actionData": {
},
"actionAuthAcct": "c",
"authorization": {
"actor": "c",
"permission": "active"
}
}
]
}
11 changes: 9 additions & 2 deletions tests/performance_tests/log_reader.py
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
from pathlib import Path, PurePath
sys.path.append(str(PurePath(PurePath(Path(__file__).absolute()).parent).parent))

from TestHarness import Utils
from TestHarness import Utils, Account
from dataclasses import dataclass, asdict, field
from platform import release, system
from datetime import datetime
@@ -474,7 +474,14 @@ def default(self, obj):
return "Unknown"
if isinstance(obj, Path):
return str(obj)
return json.JSONEncoder.default(self, obj)
if isinstance(obj, Account):
return str(obj)
defaultStr = ""
try:
defaultStr = json.JSONEncoder.default(self, obj)
except TypeError as err:
defaultStr = f"ERROR: {str(err)}"
return defaultStr

def reportAsJSON(report: dict) -> json:
return json.dumps(report, indent=2, cls=LogReaderEncoder)
5 changes: 2 additions & 3 deletions tests/performance_tests/performance_test.py
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
sys.path.append(str(PurePath(PurePath(Path(__file__).absolute()).parent).parent))

from NodeosPluginArgs import ChainPluginArgs, HttpPluginArgs, NetPluginArgs, ProducerPluginArgs
from TestHarness import TestHelper, Utils
from TestHarness import TestHelper, Utils, Account
from performance_test_basic import PerformanceTestBasic, PtbArgumentsHandler
from platform import release, system
from dataclasses import dataclass, asdict, field
@@ -509,8 +509,7 @@ def main():
extraNodeosArgs = ENA(chainPluginArgs=chainPluginArgs, httpPluginArgs=httpPluginArgs, producerPluginArgs=producerPluginArgs, netPluginArgs=netPluginArgs)
testClusterConfig = PerformanceTestBasic.ClusterConfig(pnodes=args.p, totalNodes=args.n, topo=args.s, genesisPath=args.genesis,
prodsEnableTraceApi=args.prods_enable_trace_api, extraNodeosArgs=extraNodeosArgs,
specifiedContract=PerformanceTestBasic.ClusterConfig.SpecifiedContract(accountName=args.account_name,
ownerPublicKey=args.owner_public_key, activePublicKey=args.active_public_key,
specifiedContract=PerformanceTestBasic.ClusterConfig.SpecifiedContract(account=Account(args.account_name),
contractDir=args.contract_dir, wasmFile=args.wasm_file, abiFile=args.abi_file),
nodeosVers=Utils.getNodeosVersion().split('.')[0])

Loading