Hyperledger Fabric的出块主要是Orderer节点负责,出块配置位于创世区块中,支持定时出块、达到一定交易数出块两种条件。出块配置位于configtx.yaml中,修改出块配置后需要重新生成创世区块。

相关参数

若需要修改fabric的出块机制,则需要调整以下配置参数:

  • BatchTimeout:出块超时时间,最长出块间隔(但缓存中必须含有数据才会出块,否则无法出块,即fabric不会强行产生空块)
  • MaxMessageCount:区块最大交易数量,当交易数量达到此参数后,会立即出块。
  • PreferredMaxBytes:区块首选字节数,正常情况下一个区块中的交易数据大小会小于此参数。
  • AbsoluteMaxBytes:区块最大字节数:所有情况下区块的最大允许字节数,超过此参数的交易将无法打包,直接退回。

出块机制和条件

基于上述指标,orderer会在两种条件下打包区块:

1.定时触发:维护以 BatchTimeout 为间隔的闹钟,定时检测缓存中是否还有未出块的交易,如果有则打包出块;

2.新交易触发:当满足条件的新交易与缓存中的交易大小之和与 PreferredMaxBytes 进行比较,超过此限制则将缓存中的交易进行打包,新交易进入缓存。或者交易数目超过MaxMessageCount,也会进行打包。

默认参数配置

fabric的reslease-2.0分支中默认出块配置如下:

    # Batch Timeout: The amount of time to wait before creating a batch.
BatchTimeout: 2s # Batch Size: Controls the number of messages batched into a block.
# The orderer views messages opaquely, but typically, messages may
# be considered to be Fabric transactions. The 'batch' is the group
# of messages in the 'data' field of the block. Blocks will be a few kb
# larger than the batch size, when signatures, hashes, and other metadata
# is applied.
BatchSize: # Max Message Count: The maximum number of messages to permit in a
# batch. No block will contain more than this number of messages.
MaxMessageCount: 500 # Absolute Max Bytes: The absolute maximum number of bytes allowed for
# the serialized messages in a batch. The maximum block size is this value
# plus the size of the associated metadata (usually a few KB depending
# upon the size of the signing identities). Any transaction larger than
# this value will be rejected by ordering. If the "kafka" OrdererType is
# selected, set 'message.max.bytes' and 'replica.fetch.max.bytes' on
# the Kafka brokers to a value that is larger than this one.
AbsoluteMaxBytes: 10 MB # Preferred Max Bytes: The preferred maximum number of bytes allowed
# for the serialized messages in a batch. Roughly, this field may be considered
# the best effort maximum size of a batch. A batch will fill with messages
# until this size is reached (or the max message count, or batch timeout is
# exceeded). If adding a new message to the batch would cause the batch to
# exceed the preferred max bytes, then the current batch is closed and written
# to a block, and a new batch containing the new message is created. If a
# message larger than the preferred max bytes is received, then its batch
# will contain only that message. Because messages may be larger than
# preferred max bytes (up to AbsoluteMaxBytes), some batches may exceed
# the preferred max bytes, but will always contain exactly one transaction.
PreferredMaxBytes: 2 MB

Hyperledger Fabric出块配置详解的更多相关文章

  1. Maven使用笔记(四)pom.xml配置详解

    pom.xml文件配置详解 --声明规范 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=" ...

  2. 黑苹果引导工具 Clover 配置详解及Clover Configurator使用

    黑苹果引导工具 Clover 配置详解及Clover Configurator使用  2017-03-11 14:01:40 by SemiconductorKING 转自:@三个表哥   简介: 可 ...

  3. 【转】Maven pom.xml 配置详解

    原文链接:https://yq.aliyun.com/articles/38271 pom.xml文件配置详解 --声明规范 <project xmlns="http://maven. ...

  4. 2-4、nginx特性及基础概念-nginx web服务配置详解

    Nginx Nginx:engine X 调用了libevent:高性能的网络库 epoll():基于事件驱动event的网络库文件 Nginx的特性: 模块化设计.较好扩展性(不支持模块动态装卸载, ...

  5. MapReduce On Yarn的配置详解和日常维护

    MapReduce On Yarn的配置详解和日常维护 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.MapReduce运维概述 MapReduce on YARN的运维主要是 ...

  6. 使用Squid做代理服务器,Squid单网卡透明代理配置详解(转)

    使用Squid做代理服务器 说到代理服务器,我们最先想到的可能是一些专门的代理服务器网站,某些情况下,通过它们能加快访问互联网的速度.其实,在需要访问外部的局域网中,我们自己就能设置代理,把访问次数较 ...

  7. Nginx配置详解 http://www.cnblogs.com/knowledgesea/p/5175711.html

    Nginx配置详解 序言 Nginx是lgor Sysoev为俄罗斯访问量第二的rambler.ru站点设计开发的.从2004年发布至今,凭借开源的力量,已经接近成熟与完善. Nginx功能丰富,可作 ...

  8. Eclipse-Hadoop开发配置详解

    Eclipse_Hadoop开发详解 html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockqu ...

  9. Log4j配置详解(转)

    一.Log4j简介 Log4j有三个主要的组件:Loggers(记录器),Appenders (输出源)和Layouts(布局).这里可简单理解为日志类别,日志要输出的地方和日志以何种形式输出.综合使 ...

  10. [转]阿里巴巴数据库连接池 druid配置详解

    一.背景 java程序很大一部分要操作数据库,为了提高性能操作数据库的时候,又不得不使用数据库连接池.数据库连接池有很多选择,c3p.dhcp.proxool等,druid作为一名后起之秀,凭借其出色 ...

随机推荐

  1. 在 Go 中恰到好处的内存对齐

    问题 type Part1 struct { a bool b int32 c int8 d int64 e byte } 在开始之前,希望你计算一下 Part1 共占用的大小是多少呢? func m ...

  2. 探秘Transformer系列之(15)--- 采样和输出

    探秘Transformer系列之(15)--- 采样和输出 目录 探秘Transformer系列之(15)--- 采样和输出 0x00 概述 0x01 Generator 1.1 Linear 1.2 ...

  3. rsarsa-给定pqe求私钥对密文解密

    题目: Math is cool! Use the RSA algorithm to decode the secret message, c, p, q, and e are parameters ...

  4. AccessibilityService-weditor获取节点元素信息&Assists实现自动化

    1. weditor 简介 在使用AccessibilityService开发自动化工具或自动化测试脚本时需要知道控件属性才能自动化逻辑.weditor 是一个用于 Android UI 自动化测试的 ...

  5. 新建一个空的 ASP.NET Core Web Application

    前言 Visual Studio 2017 下操作 1. 新建项目 2. 新建空的 ASP.NET Core Web Application 确定后,需要一小点的时间等待依赖库载入... 3. 新建完 ...

  6. python 工具uv

    以下是 Python 环境管理工具 uv 从入门到精通的系统性指南,基于 2025 年最新版本特性整理: 一.uv 核心优势与适用场景 极速性能 • 基于 Rust 开发,依赖解析速度比传统工具快 1 ...

  7. 探秘Transformer系列之(23)--- 长度外推

    探秘Transformer系列之(23)--- 长度外推 目录 探秘Transformer系列之(23)--- 长度外推 0x00 概述 0x01 背景 1.1 问题 1.2 解决思路 1.3 微调的 ...

  8. 二叉树 (王道数据结构 C语言版)

    2004.11.04 计算一颗给定二叉树的所有双分支节点个数 编写把一个树的所有左右子树进行交换的函数 求先序遍历中第k个结点的值 (1 <= k <= 二叉树中的结点个数) #inclu ...

  9. 关于CH182LED配置的说明

    CH182的LED配置有两种模式: 传统LED功能 该功能可通过页7寄存器19控制bit 3-5控制 使用时可将页7寄存器19 bit3 置0 通过bit4-5实现不同模式,默认情况下bit3为0,b ...

  10. APT32 RTC+低功耗调试笔记

    1.项目需求    采用APT32F1023单片机,内部27K时钟驱动RTC,内部6M定时器作为主频.周期检测外部供电是否恢复,如果恢复则使用正常工作模式,否则仅开启RTC,关闭其他外设,进入低功耗待 ...