Version: 0.2.0-beta.4

Node Configuration

In this section we will understand how to customize node running parameters in devtools/chain/config.toml which only affect individual nodes in a network. Different nodes can set their own parameters depending on their operation environment.


Let's take a look at devtools/chain/config.toml.

# crypto
privkey = "0x5ec982173d54d830b6789cbbbe43eaa2853a5ff752d1ebc1b266cf9790314f8a"
# db config
data_path = "./devtools/chain/data"
listening_address = ""
graphql_uri = "/graphql"
graphiql_uri = "/graphiql"
workers = 0 # if 0, uses number of available logical cpu as threads count.
maxconn = 25000
max_payload_size = 1048576
listening_address = ""
rpc_timeout = 10
sync_txs_chunk_size = 5000
peer_id = "QmTEJkB5QKWsEq37huryZZfVvqBKb54sHnKn9TQcA6j3n9"
address = ""
pool_size = 20000
broadcast_txs_size = 200
broadcast_txs_interval = 200
light = false
triedb_cache_size = 2000
filter = "info"
log_to_console = true
console_show_file_and_line = false
log_path = "logs/"
log_to_file = true
metrics = true
# you can specify log level for modules with config below
# modules_level = { "overlord::state::process" = "debug", core_consensus = "error" }
max_open_files = 64
# [apm]
# service_name = "muta"
# tracing_address = ""
# tracing_batch_size = 50

Let’s go line-by-line and understand what each parameter means.

Full list of node running parameters

Local parameters

privkeyPrivate key of the node, also the only identifier of the node, used when bootstraps the node. In order for other nodes to connect, it needs to expose address and corresponding public key. If it's a block producing node, its address needs to be included in consensus verifier_list
data_pathwhere chain data is stored

GraphQL parameters

listening_addresslistening address of GraphQL127.0.0.1:8000
graphql_uriURL to access GraphQL service/graphql
graphiql_uriURL to access GraphiQL/graphiql
workersnumber of thread to handle http request. If 0 is entered, will default use number of CPU core0
maxconnmax number of connection25000
max_payload_sizeSize of request after serialization, maximum limit in bytes1048576
tlsenable tlsnone
tls.private_key_file_pathTLS private key
tls.certificate_chain_file_pathTLS certificate

Network parameters

listening_addresslistening address of the chain
rpc_timeouttimeout of RPC call (Ex: pull transaction from other nodes), measured in second10
inbound_conn_limitThe maximum number of connections allowed for incoming connections and the maximum number of outgoing connections is the maximum number of connections minus the value of this configuration item.20

Consensus parameters

sync_txs_chunk_sizeGet transactions from the remote end in batches during synchronization, number of transactions per batch

Network bootstraps node parameters

peer_idnode id, calculated from the public key
addressnetwork address

Mempool parameters

pool_sizesize of mempool2000
broadcast_txs_sizenumber of transaction in one broadcast200
broadcast_txs_intervalinterval between each broadcast, measured in millisecond200

Executor parameters

lightwhen set to true, node will only keep the state of latest block hightfalse
triedb_cache_sizeTrieDB 的缓存大小无默认值,推荐2000

Logger parameters

filterlog level globally"info"
log_to_consolewhether output the log to console, it's recommended to set to false in productiontrue
console_show_file_and_linewhen log_to_console and console_show_file_and_line are both true, log will include file and number of linesfalse
log_to_filewhether output log to filetrue
metricswhether output metrics. There are metric functions which is independent from global log level in logger module, and if it's needed, it can be used to output metrics to specific files.true
log_path2 files will be created in the dir: muta.log which contain logs and metrics.log which contains only metrics logs

Rocksdb parameters

max_open_files The maximum value of file descriptors (FD) allowed to be opened by rocksdb.64

APM parameters

Application Performace Monitor, used to monitor the system performance.

service_nameservice that need to be monitored"muta"
tracing_addressthe address of the server receiving the monitoring data""
tracing_batch_sizebatch push, size of each batch50

Log sample

All logs are in json format, each message is a nested json structure.

$ tail logs/muta.log -n 1
{"time":"2020-02-12T17:11:04.187149+08:00","message":"update_after_exec cache: height 2, exec height 0, prev_hash 0x039d2f399864dba72c5b0f26ec989cba9bdcb9fca23ce48c8bc8c4398cb2ad0b,latest_state_root 0xde37f62c1121e283ad52fe5b3e260c899f03d42da29fdfe08e82655185d9b772 state root [0xde37f62c1121e283ad52fe5b3e260c899f03d42da29fdfe08e82655185d9b772], receipt root [], confirm root [], cycle used []","module_path":"core_consensus::status","file":"/Users/huwenchao/.cargo/git/checkouts/muta-cad92efdb84944c1/34d052a/core/consensus/src/","line":114,"level":"INFO","target":"core_consensus::status","thread":"main","thread_id":4576796096,"mdc":{}}
$ tail logs/metrics.log -n 1