-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAB-6132] Provide Kafka environment for benchmark
Add a 3 broker kafka environment for use when running benchmarks. 1. cd orderer/common/server 2. Start kafka: docker-compose up -d 3. Run all kafka benchmarks: BENCHMARK=true go test -run TestOrdererBenchmarkKafkaBroadcast or, specify a single benchmark permutation as follows: TestOrdererBenchmarkKafkaBroadcast/10ch/10000tx/10kb/10bc/0dc/10ord (The permutation has to be valid as defined in the source code) Change-Id: I2e24c73dcb450f98992f6c21420fda64372012f6 Signed-off-by: Kostas Christidis <kostas@christidis.io> Signed-off-by: Luis Sanchez <sanchezl@us.ibm.com>
- Loading branch information
1 parent
61c8f1f
commit 7a3f162
Showing
2 changed files
with
166 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# Copyright IBM Corp. All Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
version: '3' | ||
|
||
# Defines a 3 broker Kafka cluster environment. | ||
# - Kafka brokers are exposed on the host network on ports 9092, 9192, & 9292. | ||
# - No communication security (e.g. TLS) has been enabled. | ||
# - A 3 node Zookeeper cluster is also defined, but not exposed to the host. | ||
# - Kafka brokers use separate listeners for communication inside and outside | ||
# the docker environment. | ||
# - EXTERNAL listener ports are mapped to the host network. | ||
# - REPLICATION listener ports are used for broker-to-broker communication. | ||
# | ||
# Host Kafka Internal Zookeeper | ||
# Network Cluster Network Cluster | ||
# ┌───┐ ┌───┐ | ||
# │ │ ┌───────────────┐ │ │ ┌──────┐ | ||
# ┌────┴─┐ │ ┌────┴─┐ │ │ │◀──▶│ 2181 ├─────────────┐ | ||
# │ 9092 │─┼──▶│ 9092 │ kafka0 │ │ │ └────┬─┘ │ | ||
# └────┬─┘ │ └────┬─┘ ┌─┴────┐ │ │ │ zookeeper0 │ | ||
# │ │ └─────────────┤ 9093 │◀──▶│ │ │ │ | ||
# │ │ └──────┘ │ │ └───────────────┘ | ||
# │ │ │ │ | ||
# │ │ ┌───────────────┐ │ │ ┌──────┐ | ||
# ┌────┴─┐ │ ┌────┴─┐ │ │ │◀──▶│ 2181 ├─────────────┐ | ||
# │ 9192 │─┼──▶│ 9092 │ kafka1 │ │ │ └────┬─┘ │ | ||
# └────┬─┘ │ └────┬─┘ ┌─┴────┐ │ │ │ zookeeper0 │ | ||
# │ │ └─────────────┤ 9093 │◀──▶│ │ │ │ | ||
# │ │ └──────┘ │ │ └───────────────┘ | ||
# │ │ │ │ | ||
# │ │ ┌───────────────┐ │ │ ┌──────┐ | ||
# ┌────┴─┐ │ ┌────┴─┐ │ │ │◀──▶│ 2181 ├─────────────┐ | ||
# │ 9292 │─┼──▶│ 9092 │ kafka2 │ │ │ └────┬─┘ │ | ||
# └────┬─┘ │ └────┬─┘ ┌─┴────┐ │ │ │ zookeeper0 │ | ||
# │ │ └─────────────┤ 9093 │◀──▶│ │ │ │ | ||
# │ │ └──────┘ │ │ └───────────────┘ | ||
# │ │ │ │ | ||
# └───┘ └───┘ | ||
|
||
services: | ||
|
||
zookeeper0: | ||
image: hyperledger/fabric-zookeeper | ||
restart: always | ||
environment: | ||
- ZOO_MY_ID=200 | ||
- ZOO_SERVERS=server.200=zookeeper0:2888:3888 server.201=zookeeper1:2888:3888 server.202=zookeeper2:2888:3888 | ||
|
||
zookeeper1: | ||
image: hyperledger/fabric-zookeeper | ||
restart: always | ||
environment: | ||
- ZOO_MY_ID=201 | ||
- ZOO_SERVERS=server.200=zookeeper0:2888:3888 server.201=zookeeper1:2888:3888 server.202=zookeeper2:2888:3888 | ||
|
||
zookeeper2: | ||
image: hyperledger/fabric-zookeeper | ||
restart: always | ||
environment: | ||
- ZOO_MY_ID=202 | ||
- ZOO_SERVERS=server.200=zookeeper0:2888:3888 server.201=zookeeper1:2888:3888 server.202=zookeeper2:2888:3888 | ||
|
||
kafka0: | ||
image: hyperledger/fabric-kafka | ||
restart: always | ||
environment: | ||
- KAFKA_BROKER_ID=800 | ||
- KAFKA_HOST_NAME=kafka0 | ||
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181 | ||
- KAFKA_LISTENERS=EXTERNAL://0.0.0.0:9092,REPLICATION://0.0.0.0:9093 | ||
- KAFKA_ADVERTISED_LISTENERS=EXTERNAL://localhost:9092,REPLICATION://kafka0:9093 | ||
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=EXTERNAL:PLAINTEXT,REPLICATION:PLAINTEXT | ||
- KAFKA_INTER_BROKER_LISTENER_NAME=REPLICATION | ||
- KAFKA_MESSAGE_MAX_BYTES=103809024 | ||
- KAFKA_REPLICA_FETCH_MAX_BYTES=103809024 | ||
- KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE=false | ||
- KAFKA_DEFAULT_REPLICATION_FACTOR=3 | ||
- KAFKA_MIN_INSYNC_REPLICAS=2 | ||
depends_on: | ||
- zookeeper0 | ||
- zookeeper1 | ||
- zookeeper2 | ||
ports: | ||
- 9092:9092 | ||
|
||
kafka1: | ||
image: hyperledger/fabric-kafka | ||
restart: always | ||
environment: | ||
- KAFKA_BROKER_ID=801 | ||
- KAFKA_HOST_NAME=kafka1 | ||
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181 | ||
- KAFKA_LISTENERS=EXTERNAL://0.0.0.0:9092,REPLICATION://0.0.0.0:9093 | ||
- KAFKA_ADVERTISED_LISTENERS=EXTERNAL://localhost:9192,REPLICATION://kafka1:9093 | ||
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=EXTERNAL:PLAINTEXT,REPLICATION:PLAINTEXT | ||
- KAFKA_INTER_BROKER_LISTENER_NAME=REPLICATION | ||
- KAFKA_MESSAGE_MAX_BYTES=103809024 | ||
- KAFKA_REPLICA_FETCH_MAX_BYTES=103809024 | ||
- KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE=false | ||
- KAFKA_DEFAULT_REPLICATION_FACTOR=3 | ||
- KAFKA_MIN_INSYNC_REPLICAS=2 | ||
depends_on: | ||
- zookeeper0 | ||
- zookeeper1 | ||
- zookeeper2 | ||
ports: | ||
- 9192:9092 | ||
|
||
kafka2: | ||
image: hyperledger/fabric-kafka | ||
restart: always | ||
environment: | ||
- KAFKA_BROKER_ID=802 | ||
- KAFKA_HOST_NAME=kafka2 | ||
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181 | ||
- KAFKA_LISTENERS=EXTERNAL://0.0.0.0:9092,REPLICATION://0.0.0.0:9093 | ||
- KAFKA_ADVERTISED_LISTENERS=EXTERNAL://localhost:9292,REPLICATION://kafka2:9093 | ||
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=EXTERNAL:PLAINTEXT,REPLICATION:PLAINTEXT | ||
- KAFKA_INTER_BROKER_LISTENER_NAME=REPLICATION | ||
- KAFKA_MESSAGE_MAX_BYTES=103809024 | ||
- KAFKA_REPLICA_FETCH_MAX_BYTES=103809024 | ||
- KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE=false | ||
- KAFKA_DEFAULT_REPLICATION_FACTOR=3 | ||
- KAFKA_MIN_INSYNC_REPLICAS=2 | ||
depends_on: | ||
- zookeeper0 | ||
- zookeeper1 | ||
- zookeeper2 | ||
ports: | ||
- 9292:9092 |