This plugin provides a way to generate a given amount of transactions per second against the currency contract. It runs internally to eosd to reduce overhead.
This general procedure was used when doing Dawn 3.0 performance testing as mentioned in EOSIO/eos#2078.
The following instructions describe how to use the txn_test_gen_plugin
plugin to generate 1,000 transaction per second load on a simple EOSIO node.
Make an empty directory for our configs and data, mkdir ~/eos.data
, and define a logging.json that doesn't print debug information (which occurs for each txn) to the console:
cat << EOF > ~/eos.data/logging.json
{
"includes": [],
"appenders": [{
"name": "consoleout",
"type": "console",
"args": {
"stream": "std_out",
"level_colors": [{
"level": "debug",
"color": "green"
},{
"level": "warn",
"color": "brown"
},{
"level": "error",
"color": "red"
}
]
},
"enabled": true
}
],
"loggers": [{
"name": "default",
"level": "info",
"enabled": true,
"additivity": false,
"appenders": [
"consoleout"
]
}
]
}
EOF
$ ./nodeos -d ~/eos.data/producer_node --config-dir ~/eos.data/producer_node -l ~/eos.data/logging.json --http-server-address "" -p eosio -e
$ ./nodeos -d ~/eos.data/generator_node --config-dir ~/eos.data/generator_node -l ~/eos.data/logging.json --plugin eosio::txn_test_gen_plugin --plugin eosio::chain_api_plugin --p2p-peer-address localhost:9876 --p2p-listen-endpoint localhost:5555
$ ./cleos wallet create --to-console
$ ./cleos wallet import --private-key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
$ ./cleos set contract eosio ~/eos/build.release/contracts/eosio.bios/
$ curl --data-binary '[<creator>, <creator's private key>, <core_symbol>]' http://127.0.0.1:8888/v1/txn_test_gen/create_test_accounts
example:
$ curl --data-binary '["eosio", "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3", "EOS"]' http://127.0.0.1:8888/v1/txn_test_gen/create_test_accounts
make sure there are more than 4000,0000 <core_symbol> in creator
This api does:
-
creates following accounts:
aaaaaaaaaaaa
bbbbbbbbbbbb
cccccccccccc -
delegate 1000,0000 cpu, 100 net, and 100 ram to above accounts using
-
deploy a token contract to account cccccccccccc and issue a large number of tokens to cccccccccccc, then transfer some tokens to aaaaaaaaaaaa and bbbbbbbbbbbb
-
subsequent trx will be generated using deployed token contract
- aaaaaaaaaaaa transfer to bbbbbbbbbbbb
- bbbbbbbbbbbb transfer to aaaaaaaaaaaa
$ curl --data-binary '["", 20, 20]' http://127.0.0.1:8888/v1/txn_test_gen/start_generation
eosio generated block 9b8b851d... #3219 @ 2018-04-25T16:07:47.000 with 500 trxs, lib: 3218
eosio generated block e5b3cd5d... #3220 @ 2018-04-25T16:07:47.500 with 500 trxs, lib: 3219
eosio generated block b243aeaa... #3221 @ 2018-04-25T16:07:48.000 with 500 trxs, lib: 3220
Note in the console output there are 500 transactions in each of the blocks which are produced every 500 ms yielding 1,000 transactions / second.
The following video provides a demo: https://vimeo.com/266585781