この記事ではデータベース(以下DB)サイズがJMeterのテスト(トークン移転の負荷テスト)中にどれだけ増加するかをまとめました。
Jmeterを実行する際に考えられるシナリオは以下の4点となります。
- Corda Nodeを起動したときのDBサイズ(トランザクションなし)
- 700アカウント作成時のDBサイズ
- 1つのFungible Tokenが700個のアカウントそれぞれから発行されたときのDBサイズ
- 1つのFungible Tokenが700個の各アカウントから100秒間で10回移動(計7,000回のトークンの移転、70TPS)されたときのDBサイズ
1.Corda Nodeが起動したときのDBサイズ
下の表はCorda Nodeが起動してすぐ(トランザクションはなし)のDBサイズの内訳です。
table_schema | table_name | total
--------------------+------------------------------+----------------
node01_schema | vault_transaction_notes | 16 kB
node01_schema | vault_states | 40 kB
node01_schema | vault_linear_states | 32 kB
node01_schema | vault_linear_states_parts | 0 bytes
node01_schema | vault_fungible_states | 16 kB
node01_schema | vault_fungible_states_parts | 0 bytes
node01_schema | state_party | 16 kB
node01_schema | pk_hash_to_ext_id_map | 24 kB
node01_schema | node_infos | 24 kB
node01_schema | node_link_nodeinfo_party | 8192 bytes
node01_schema | node_info_hosts | 24 kB
node01_schema | node_properties | 16 kB
node01_schema | node_mutual_exclusion | 16 kB
node01_schema | node_contract_upgrades | 8192 bytes
node01_schema | node_named_identities | 24 kB
node01_schema | node_scheduled_states | 8192 bytes
node01_schema | node_info_party_cert | 24 kB
node01_schema | node_message_ids | 137 MB
node01_schema | node_our_key_pairs | 187 MB
node01_schema | node_checkpoints | 8336 kB
node01_schema | node_transactions | 8192 bytes
node01_schema | node_identities | 64 kB
node01_schema | node_attachments | 48 kB
node01_schema | node_network_parameters | 24 kB
node01_schema | node_identities_no_cert | 202 MB
node01_schema | node_hash_to_key | 16 kB
node01_schema | node_rpc_audit_data | 16 kB
node01_schema | node_metering_data | 42 MB
node01_schema | node_metering_cordapps | 48 kB
node01_schema | node_metering_commands | 48 kB
node01_schema | node_attachments_contracts | 16 kB
node01_schema | node_attachments_signers | 16 kB
node01_schema | node_cordapp_metadata | 32 kB
node01_schema | node_cordapp_signers | 32 kB
node01_schema | non_fungible_token | 24 kB
node01_schema | account_to_state_refs | 16 kB
node01_schema | distribution_record | 24 kB
node01_schema | fungible_token | 40 kB
node01_schema | accounts | 48 kB
2.700アカウント作成時のCorda Node DBサイズ
700アカウント作成時のCorda Node DBサイズの内訳は以下のようになりました。
table_schema | table_name | total
--------------------+------------------------------+------------
node01_schema | databasechangelog | 72 kB
node01_schema | databasechangeloglock | 56 kB
node01_schema | vault_transaction_notes | 16 kB
node01_schema | vault_states | 440 kB
node01_schema | vault_linear_states | 320 kB
node01_schema | vault_linear_states_parts | 0 bytes
node01_schema | vault_fungible_states | 16 kB
node01_schema | vault_fungible_states_parts | 0 bytes
node01_schema | state_party | 216 kB
node01_schema | pk_hash_to_ext_id_map | 24 kB
node01_schema | node_infos | 24 kB
node01_schema | node_link_nodeinfo_party | 8192 bytes
node01_schema | node_info_hosts | 24 kB
node01_schema | node_properties | 16 kB
node01_schema | node_mutual_exclusion | 16 kB
node01_schema | node_contract_upgrades | 8192 bytes
node01_schema | node_named_identities | 24 kB
node01_schema | node_scheduled_states | 8192 bytes
node01_schema | node_info_party_cert | 24 kB
node01_schema | node_message_ids | 137 MB
node01_schema | node_our_key_pairs | 187 MB
node01_schema | node_checkpoints | 8352 kB
node01_schema | node_transactions | 216 kB
node01_schema | node_identities | 64 kB
node01_schema | node_attachments | 48 kB
node01_schema | node_network_parameters | 24 kB
node01_schema | node_identities_no_cert | 202 MB
node01_schema | node_hash_to_key | 16 kB
node01_schema | node_rpc_audit_data | 16 kB
node01_schema | node_metering_data | 42 MB
node01_schema | node_metering_cordapps | 48 kB
node01_schema | node_metering_commands | 48 kB
node01_schema | node_attachments_contracts | 16 kB
node01_schema | node_attachments_signers | 16 kB
node01_schema | node_cordapp_metadata | 32 kB
node01_schema | node_cordapp_signers | 32 kB
node01_schema | non_fungible_token | 24 kB
node01_schema | account_to_state_refs | 16 kB
node01_schema | distribution_record | 24 kB
node01_schema | fungible_token | 40 kB
node01_schema | accounts | 448 kB
このデータと「1.Corda Nodeが起動したときのDBサイズ」を比較してみます。
以下の項目において目立った増加をしていることがわかります。
- vault_states
- vault_linear_states
- state_party
- accounts
大まかにいうと、アカウントが作成されたときに、1アカウントあたり約2kBほどの(全DBサイズに対して)メモリを要することを示しています。
3.700のFungible Tokenが発行されたときのDBサイズ
700のFungible Tokenが発行されたときのDBサイズの内訳は以下のようになりました。
table_schema | table_name | total
--------------------+------------------------------+------------
node01_schema | databasechangelog | 72 kB
node01_schema | databasechangeloglock | 56 kB
node01_schema | vault_transaction_notes | 16 kB
node01_schema | vault_states | 1624 kB
node01_schema | vault_linear_states | 320 kB
node01_schema | vault_linear_states_parts | 0 bytes
node01_schema | vault_fungible_states | 656 kB
node01_schema | vault_fungible_states_parts | 0 bytes
node01_schema | state_party | 984 kB
node01_schema | pk_hash_to_ext_id_map | 704 kB
node01_schema | node_infos | 24 kB
node01_schema | node_link_nodeinfo_party | 8192 bytes
node01_schema | node_info_hosts | 24 kB
node01_schema | node_properties | 16 kB
node01_schema | node_mutual_exclusion | 16 kB
node01_schema | node_contract_upgrades | 8192 bytes
node01_schema | node_named_identities | 24 kB
node01_schema | node_scheduled_states | 8192 bytes
node01_schema | node_info_party_cert | 24 kB
node01_schema | node_message_ids | 137 MB
node01_schema | node_our_key_pairs | 187 MB
node01_schema | node_checkpoints | 8336 kB
node01_schema | node_transactions | 840 kB
node01_schema | node_identities | 64 kB
node01_schema | node_attachments | 48 kB
node01_schema | node_network_parameters | 24 kB
node01_schema | node_identities_no_cert | 203 MB
node01_schema | node_hash_to_key | 16 kB
node01_schema | node_rpc_audit_data | 16 kB
node01_schema | node_metering_data | 42 MB
node01_schema | node_metering_cordapps | 48 kB
node01_schema | node_metering_commands | 48 kB
node01_schema | node_attachments_contracts | 16 kB
node01_schema | node_attachments_signers | 16 kB
node01_schema | node_cordapp_metadata | 32 kB
node01_schema | node_cordapp_signers | 32 kB
node01_schema | non_fungible_token | 24 kB
node01_schema | account_to_state_refs | 16 kB
node01_schema | distribution_record | 24 kB
node01_schema | fungible_token | 880 kB
node01_schema | accounts | 448 kB
このデータと「2.700アカウント作成時のCorda Node DBサイズ」を比較したものが以下になります。
以下の項目において目立った増加をしていることがわかります。
- vault_states:
- vault_fungible_states
- state_party(約1kB / Account)
- pk_hash_to_ext_id_map (約1kB / Account)
- fungible_tokens(約1kB / Fungible Token)
メモ
- 大まかに、1つのFungible Tokenを作成するのに1アカウントあたり約7 kB(全DBサイズに対して)必要ということを意味します。
- 表の
pk_hash_to_ext_id_map
はCordapp内のアカウントがどのように管理されているかによって変わります。
4.7000のFungible Tokenを移転させたときのDBサイズ
7000のFungible Tokenを移転させたときのDBサイズは以下になります。
table_schema | table_name | total
---------------------+------------------------------+------------
node01_schema | databasechangelog | 72 kB
node01_schema | databasechangeloglock | 56 kB
node01_schema | vault_transaction_notes | 16 kB
node01_schema | vault_states | 17 MB
node01_schema | vault_linear_states | 320 kB
node01_schema | vault_linear_states_parts | 0 bytes
node01_schema | vault_fungible_states | 4336 kB
node01_schema | vault_fungible_states_parts | 0 bytes
node01_schema | state_party | 8536 kB
node01_schema | pk_hash_to_ext_id_map | 4848 kB
node01_schema | node_infos | 24 kB
node01_schema | node_link_nodeinfo_party | 8192 bytes
node01_schema | node_info_hosts | 24 kB
node01_schema | node_properties | 16 kB
node01_schema | node_mutual_exclusion | 16 kB
node01_schema | node_contract_upgrades | 8192 bytes
node01_schema | node_named_identities | 24 kB
node01_schema | node_scheduled_states | 8192 bytes
node01_schema | node_info_party_cert | 24 kB
node01_schema | node_message_ids | 137 MB
node01_schema | node_our_key_pairs | 189 MB
node01_schema | node_checkpoints | 8336 kB
node01_schema | node_transactions | 3128 kB
node01_schema | node_identities | 64 kB
node01_schema | node_attachments | 48 kB
node01_schema | node_network_parameters | 24 kB
node01_schema | node_identities_no_cert | 205 MB
node01_schema | node_hash_to_key | 16 kB
node01_schema | node_rpc_audit_data | 16 kB
node01_schema | node_metering_data | 42 MB
node01_schema | node_metering_cordapps | 48 kB
node01_schema | node_metering_commands | 48 kB
node01_schema | node_attachments_contracts | 16 kB
node01_schema | node_attachments_signers | 16 kB
node01_schema | node_cordapp_metadata | 32 kB
node01_schema | node_cordapp_signers | 32 kB
node01_schema | non_fungible_token | 24 kB
node01_schema | account_to_state_refs | 16 kB
node01_schema | distribution_record | 24 kB
node01_schema | fungible_token | 9728 kB
node01_schema | accounts | 448 kB
これを「3.700のFungible Tokenが発行されたときのDBサイズ」と比較したものが以下になります。
以下の項目において目立った増加をしていることがわかります。
- vault_states
- vault_fungible_states
- state_party
- pk_hash_to_ext_id_map
- fungible_token (1kB / Fungible Token)
メモ
- DBサイズは7000のトークンを移転させるのに42 MB増加しました。
- 大まかに、Fungible Tokenを1つのアカウントから別のアカウントに移動するのに必要なメモリは1アカウントあたり約6kB(全DBサイズに対して)となります。
fungible_Token
の項目は新しいトークンが記録(例:トークンの発行または移動)されると1 kBの増加が確認できました。
結論
- 1つのFungible Tokenを発行するのに約7 kB使用します。
- 1アカウントを作成するのに約2kBを使用します。
- 7000のトークンを移転させると42MBのDBサイズの増加がみられましたが、Cordappがどのように実行されるかに大きく依存しています。
VAULT_STATES
項目のDBサイズは急激に上昇するが、大きくなりすぎたときにDBAによってアーカイブされるかもしれません(参考資料)。- Stateの実際の内容は
NODE_TRANSACTIONS
項目からバイナリ表現の逆シリアル化をすることで取得できます(参考資料)。そのためVAULT_STATES
項目のDBサイズは実際には問題になりません。 NODE_TRANSACTIONS
項目は非常に大きなDBサイズになりえます。この項目は増える一方であり、データは変更できず、DBマネージャーを利用してもアーカイブできません。