What is the size of the default block on hyperldger fabric?
Asked Answered
M

2

10

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

Maestas answered 14/5, 2018 at 18:7 Comment(0)
G
8

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
Glynis answered 16/5, 2018 at 10:39 Comment(1)
I would not say that is the default config, that is the sample config and a sample config is not suitable to be use as default, moreover, the config depends on your chaincode and use case. The default config is the one you download from the release assets OR you could check the default for a genesis block here (the v2.2.1 is the one I use)> github.com/hyperledger/fabric/blob/release-2.1/internal/…Terrijo
O
4

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.

Ommiad answered 23/6, 2018 at 2:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.