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. 李沐动手学深度学习V2-chapter_linear-networks

    李沐动手学深度学习V2 文章内容说明 本文主要是自己学习过程中的随手笔记,需要自取 课程参考B站:https://space.bilibili.com/1567748478?spm_id_from=3 ...

  2. 设备管理笔记1-oee

    什么是oee 类似于一种设备管理模型,如软件行业的质量模型.cmmi模型等 指标包括什么? 正常指标应该是多少,目前我们的指标为多少? 制造行业存在的6大问题分别是什么 指标包括什么? 包括 可用性性 ...

  3. 【Bug记录】[@vue/compiler-sfc] `defineProps` is a compiler macro and no longer needs to be imported.

    [Bug记录][@vue/compiler-sfc] defineProps is a compiler macro and no longer needs to be imported. Vue3项 ...

  4. Mac port 443: Connection refused

    MAC 安装brew raw.githubusercontent.com port 443: Connection refused 本人亲自认证过,踩过多种方案,最终认证的解决方案 原因:由于某些你懂 ...

  5. IvorySQL 4.0 之 Invisible Column 功能解析

    前言 随着数据库应用场景的多样化,用户对数据管理的灵活性和隐私性提出了更高要求.IvorySQL 作为一款基于 PostgreSQL 并兼容 Oracle 的开源数据库,始终致力于在功能上保持领先和创 ...

  6. linux 根目录扩容方法

    准备知识 linux volume 1.(PV)physical volume disk : 物理硬盘 物理硬盘需要转换成lvm(logic volume manage)可识别的状态,将磁盘的syst ...

  7. Oracle体系结构和用户管理

    本篇博客将对Oracle的体系结构.存储结构.内存结构和进程结构进行初步介绍,从而从宏观上把握它的物理组成.文件组成和各种进程,对于进一步的了解可以起到很好地作用 一.Oralce体系结构 1.概述 ...

  8. BUUCTF---密码学的心声

    题目 打开题目获取一个BMP的格式图片,根据歌词尝试转换成ASCII码 转ASCII码 将曲谱上面转化,发现是8进制从而转为ASCII码 点击查看代码 nums = [111, 114, 157, 1 ...

  9. 【Python】基础操作

    指定解释器的运行环境 有时候我们会遇见报错 SyntaxError: Non-ASCII character '\xe4' in file E:/PycharmProjects/LEDdisplay2 ...

  10. 【服务器】npm配置国内镜像源

    [服务器]npm配置国内镜像源 零.问题 配置Node.js的HTTPS的时候,下载不了 一.解决 这里使用的是淘宝的镜像: npm config set registry https://regis ...