区块链之解读group.X.ini文件

[consensus]
    ; the ttl for broadcasting pbft message
    ttl=2 //PBFT共识算法为了保证共识过程最大网络容错性,每个共识节点收到有效的共识消息后,会向其他节点广播该消息,在网络较好的环境下,共识消息转发机制会造成额外的网络带宽浪费,因此在群组可变配置项中引入了ttl来控制消息最大转发次数,消息最大转发次数为ttl-1


    ; min block generation time(ms)
    min_block_generation_time=500 //默认为500ms共识节点最长打包时间为1000ms,若超过1000ms新区块中打包到的交易数仍为0,共识模块会进入出空块逻辑,空块并不落盘;不可超过出空块时间1000ms,若设置值超过1000ms,系统默认min_block_generation_time为500ms


    enable_dynamic_block_size=true //考虑到CPU负载和网络延迟对系统处理能力的影响,PBFT提供了动态调整一个区块内可打包最大交易数的算法,该算法会根据历史交易处理情况动态调整区块内可打包的最大交易数,默认开启


    enable_ttl_optimization=true //打开PBFT消息转发优化策略\关闭PBFT消息转发优化策略


    enable_prepare_with_txsHash=true //打开Prepare包结构优化,Prepare消息包内区块仅包含交易哈希列表\关闭Prepare包结构优化,Prepare消息包内区块包含全量的交易


    ; The following is the relevant configuration of rpbft
    ; set true to enable broadcast prepare request by tree
    broadcast_prepare_by_tree=true //Prepare包树状广播策略开启/关闭开关,设置为true,开启Prepare包树状广播策略;设置为false,关闭Prepare包树状广播策略,默认为true


    ; percent of nodes that broadcast prepare status to, must be between 25 and 100
    prepare_status_broadcast_percent=33 //Prepare状态包随机广播的节点占共识节点总数的百分比,取值在25到100之间,默认为33


    ; max wait time before request missed transactions, ms, must be between 5ms and 1000ms
    max_request_missedTxs_waitTime=100 //节点Prepare缓存缺失时,等待父节点发送Prepare包的最长时延,默认为100ms,超过这个时延后,节点会向其他拥有该Prepare包的节点请求


    ; maximum wait time before requesting a prepare, ms, must be between 10ms and 1000ms
    max_request_prepare_waitTime=100 //节点Prepare包内交易缺失后,等待父节点或其他非leader节点同步Prepare包状态的最长时延,默认为100ms,若在等待时延窗口内同步到父节点或非leader节点Prepare包状态,则会随机选取一个节点请求缺失交易;若等待超时,直接向leader请求缺失交易

公共配置项

[storage]
    ; storage db type, rocksdb / mysql / scalable, rocksdb is recommended
    type=rocksdb //存储的DB类型,支持RocksDB、MySQL和Scalable,不区分大小写。DB类型为RocksDB时,区块链系统所有数据存储于RocksDB本地数据库中;type为MySQL时,节点根据配置访问MySQL数据库;type为Scalable时,需要设置binary_log=true,此时状态数据和区块数据分别存储在不同的RocksDB实例中,存储区块数据的RocksDB实例根据配置项


    ; set true to turn on binary log
    binary_log=false //当设置为true时打开binary_log,此时关闭RocksDB的WAL
    ; scroll_threshold=scroll_threshold_multiple*1000, only for scalable
    scroll_threshold_multiple=2 //切换实例,实例以存储的起始区块高度命名


    ; set fasle to disable CachedStorage
    cached_storage=true //控制是否使用缓存,默认true


    ; max cache memeory, MB
    max_capacity=32 //配置允许节点用于内存缓存的空间大小


    max_forward_block=10 //配置允许节点用于内存区块的大小,当节点出的区块超出该数值时,节点停止共识等待区块写入数据库


    ; only for external, deprecated in v2.3.0
    max_retry=60 //数据库连接失败后的最大重试次数,可以理解为连接的可靠性保障


    topic=DB
    ; only for mysql
    db_ip=127.0.0.1 //MySQL的IP地址
    db_port=3306 //MySQL的端口号
    db_username= //MySQL的用户名
    db_passwd= //MySQL的用户对应的密码
    db_name= //MySQL中使用的数据库名

交易池容量配置

[tx_pool]
    limit=150000 //限制交易池内可以容纳的最大交易数目,默认为150000,超过该限制后,客户端发到节点的交易会被拒绝


    ; transaction pool memory size limit, MB
    memory_limit=512 //交易池内交易占用的内存大小限制,默认为512MB,超过该限制后,客户端发到节点的交易会被拒绝


    ; number of threads responsible for transaction notification,
    ; default is 2, not recommended for more than 8
    notify_worker_num=2 //配置项来配置异步推送线程数目,异步推送线程数目,默认为2,建议该值不超过8

区块同步优化配置,增强区块链系统在网络带宽受限情况下的可扩展性

[sync]
    ; max memory size used for block sync, must >= 32MB
    max_block_sync_memory_size=512 //最大块同步内存大小


    idle_wait_ms=200 //空闲等待毫秒


    ; send block status by tree-topology, only supported when use pbft
    sync_block_by_tree=true //打开区块同步优化策略


    ; send transaction by tree-topology, only supported when use pbft
    ; recommend to use when deploy many consensus nodes
    send_txs_by_tree=true //打开交易树状广播策略


    ; must between 1000 to 3000
    ; only enabled when sync_by_tree is true
    gossip_interval_ms=1000 //gossip协议同步区块状态周期,默认为1000ms
    gossip_peers_number=3 //节点每次同步区块状态时,随机选取的邻居节点数目,默认为3


    ; max number of nodes that broadcast txs status to, recommended less than 5
    txs_max_gossip_peers_num=5 //配置交易状态最多转发节点数目,默认为5。为保障交易到达每个节点的同时,尽量降低交易状态转发引入的流量开销,不建议将将 txs_max_gossip_peers_num 设置太小或太大,直接使用默认配置即可

群组级别的SDK请求速率限制以及流量限制

[flow_control]
    ; restrict QPS of the group
    ;limit_req=1000 //用于限制SDK每秒到群组的最大请求数目,当每秒到节点的请求超过配置项的值时,请求会被拒绝,SDK到群组请求速率限制默认关闭,若要开启该功能,需要将limit_req配置项前面的;去掉


    ; restrict the outgoing bandwidth of the group
    ; Mb, can be a decimal
    ; when the outgoing bandwidth exceeds the limit, the block synchronization operation will not proceed
    ;outgoing_bandwidth_limit=2 //群组出带宽限制,单位为Mbit/s,当群组出带宽超过该值时,会暂缓发送区块,但不会限制区块共识和交易广播的流量,该配置项默认关闭,若要打开流量限制功能,请将outgoing_bandwidth_limit配置项前面的;去掉

群组级的SDK白名单访问控制机制,实现sdk到群组的访问控制,默认关闭

[sdk_allowlist]
    ; When sdk_allowlist is empty, all SDKs can connect to this node
    ; when sdk_allowlist is not empty, only the SDK in the allowlist can connect to this node
    ; public_key.0 should be nodeid, nodeid's length is 128
    ;public_key.0= //配置允许与该群组进行通信的SDK公钥公钥列表

猜你喜欢

转载自blog.csdn.net/LforikQ/article/details/130985924