What is the size of the default block on hyperldger fabric?

与世无争的帅哥 提交于 2019-12-04 11:08:04

问题


I'm trying to create a estimation of the size of a chain if i create a new blockchain using hyperldger.

In order to have an idea of disk space usage i would like to know that is the average size of a default block in the hyperldger fabric.

Thank you before hand, Best Regards


回答1:


Bellow you can find default configuration provided for ordering service. You can actually control block size with BatchTimeout and BatchSize parameters, also note that this is pretty use case dependent as it relies on transaction size, i.e. the logic of your chaincode.

################################################################################
#
#   SECTION: Orderer
#
#   - This section defines the values to encode into a config transaction or
#   genesis block for orderer related parameters
#
################################################################################
Orderer: &OrdererDefaults

    # Orderer Type: The orderer implementation to start
    # Available types are "solo" and "kafka"
    OrdererType: solo

    Addresses:
        - orderer.example.com:7050

    # 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
    BatchSize:

        # Max Message Count: The maximum number of messages to permit in a batch
        MaxMessageCount: 10

        # Absolute Max Bytes: The absolute maximum number of bytes allowed for
        # the serialized messages in a batch.
        AbsoluteMaxBytes: 98 MB

        # Preferred Max Bytes: The preferred maximum number of bytes allowed for
        # the serialized messages in a batch. A message larger than the preferred
        # max bytes will result in a batch larger than preferred max bytes.
        PreferredMaxBytes: 512 KB



回答2:


The value is configured:

################################################################################
#   SECTION: Orderer
################################################################################
Orderer: &OrdererDefaults
    OrdererType: solo
    Addresses:
        #- orderer0.ordererorg:7050
        - orderer0:7050
    Kafka:
        Brokers:
    BatchTimeout: 2s
    BatchSize:
        MaxMessageCount: 10
        AbsoluteMaxBytes: 98 MB
        PreferredMaxBytes: 512 KB
    Organizations:

The file is located in configtx.yaml, and it is defined in config.go.

// BatchSize contains configuration affecting the size of batches.
type BatchSize struct {
    MaxMessageCount   uint32 `yaml:"MaxMessageSize"`
    AbsoluteMaxBytes  uint32 `yaml:"AbsoluteMaxBytes"`
    PreferredMaxBytes uint32 `yaml:"PreferredMaxBytes"`
}

The values are set according the configtx.yaml file above.



来源:https://stackoverflow.com/questions/50336505/what-is-the-size-of-the-default-block-on-hyperldger-fabric

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!