Skip to content

Commit b77b6d1

Browse files
committed
Revert [FAB-6096]
This reverts commit e09a94c. Reason for revert: Accidentally merged own commit Change-Id: I4d72d984eeca2bb714ebba45abb3e3c8f92ca7d6 Signed-off-by: Kostas Christidis <kostas@christidis.io>
1 parent e09a94c commit b77b6d1

File tree

2 files changed

+30
-23
lines changed

2 files changed

+30
-23
lines changed

orderer/common/performance/utils.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func init() {
4646
msp := mspmgmt.GetLocalMSP()
4747
signer, err = msp.GetDefaultSigningIdentity()
4848
if err != nil {
49-
panic(fmt.Errorf("Failed to get default signer: %s", err))
49+
panic(fmt.Errorf("Failed to initialize get default signer: %s", err))
5050
}
5151
}
5252

orderer/common/server/benchmark_test.go

+29-22
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"time"
1818

1919
"github.com/hyperledger/fabric/common/tools/configtxgen/localconfig"
20+
"github.com/hyperledger/fabric/common/tools/configtxgen/provisional"
2021
"github.com/hyperledger/fabric/orderer/common/localconfig"
2122
perf "github.com/hyperledger/fabric/orderer/common/performance"
2223
cb "github.com/hyperledger/fabric/protos/common"
@@ -25,10 +26,10 @@ import (
2526

2627
// Usage: BENCHMARK=true go test -run=TestOrdererBenchmark[Solo|Kafka][Broadcast|Deliver]
2728
//
28-
// Benchmark test makes [ch] channels, creates [bc] clients per client per channel per
29-
// orderer. There are [ord] orderer instances in total. A client ONLY interacts with ONE
30-
// channel and ONE orderer, so the number of client in total is [ch * bc * ord]. Note that
31-
// all clients execute concurrently.
29+
// Benchmark test makes [ch] channels, creates [bc] clients per client per orderer. There are
30+
// [ord] orderer instances in total. A client ONLY interacts with ONE channel and ONE
31+
// orderer, so the number of client in total is [ch * bc * ord]. Note that all clients are
32+
// concurrent.
3233
//
3334
// The test sends [tx] transactions of size [kb] in total. These tx are evenly distributed
3435
// among all clients, which gives us [tx / (ch * bc * ord)] tx per client.
@@ -55,7 +56,7 @@ import (
5556
// ordered. This is important for evaluating elapsed time of async broadcast operations.
5657
//
5758
// Again, each deliver client only interacts with one channel and one orderer, which
58-
// results in [ch * dc * ord] deliver clients in total.
59+
// results in [a * f * e] deliver clients in total.
5960
//
6061
// ch -> channelCounts
6162
// bc -> broadcastClientPerChannel
@@ -69,10 +70,8 @@ import (
6970
// as deliver is effectively retrieving pre-generated blocks, so it shouldn't be choked
7071
// by slower broadcast.
7172
//
72-
// Note: At least three Kafka brokers listening on localhost:[9092-9094] are required to
73-
// run the Kafka-based benchmark. This is set in the `envvars` map and can be adjusted
74-
// if need be.
75-
// TODO Spin up ephemeral Kafka containers for test
73+
// Note: a Kafka broker listening on localhost:9092 is required to run Kafka based benchmark
74+
// TODO(jay_guo) use ephemeral kafka container for test
7675

7776
const (
7877
MaxMessageCount = 10
@@ -88,11 +87,10 @@ var envvars = map[string]string{
8887
"ORDERER_GENERAL_GENESISPROFILE": localconfig.SampleDevModeSoloProfile,
8988
"ORDERER_GENERAL_LEDGERTYPE": "file",
9089
"ORDERER_GENERAL_LOGLEVEL": "error",
91-
"ORDERER_KAFKA_VERBOSE": "false",
9290
localconfig.Prefix + "_ORDERER_BATCHSIZE_MAXMESSAGECOUNT": strconv.Itoa(MaxMessageCount),
9391
localconfig.Prefix + "_ORDERER_BATCHSIZE_ABSOLUTEMAXBYTES": strconv.Itoa(AbsoluteMaxBytes) + " KB",
9492
localconfig.Prefix + "_ORDERER_BATCHSIZE_PREFERREDMAXBYTES": strconv.Itoa(PreferredMaxBytes) + " KB",
95-
localconfig.Prefix + "_ORDERER_KAFKA_BROKERS": "[localhost:9092, localhost:9093, localhost:9094]",
93+
localconfig.Prefix + "_ORDERER_KAFKA_BROKERS": "[localhost:9092]",
9694
}
9795

9896
type factors struct {
@@ -121,13 +119,16 @@ func (f factors) String() string {
121119
// As benchmark tests are skipped by default, we put this test here to catch
122120
// potential code changes that might break benchmark tests. If this test fails,
123121
// it is likely that benchmark tests need to be updated.
124-
func TestOrdererBenchmarkSolo(t *testing.T) {
122+
func TestOrdererBenchmark(t *testing.T) {
123+
os.Setenv(localconfig.Prefix+"_ORDERER_ORDERERTYPE", provisional.ConsensusTypeSolo)
124+
defer os.Unsetenv(localconfig.Prefix + "_ORDERER_ORDERERTYPE")
125+
125126
for key, value := range envvars {
126127
os.Setenv(key, value)
127128
defer os.Unsetenv(key)
128129
}
129130

130-
t.Run("Benchmark Sample Test (Solo)", func(t *testing.T) {
131+
t.Run("Benchmark Sample Test", func(t *testing.T) {
131132
benchmarkOrderer(t, 1, 5, PreferredMaxBytes, 1, 0, 1, true)
132133
})
133134
}
@@ -138,6 +139,9 @@ func TestOrdererBenchmarkSoloBroadcast(t *testing.T) {
138139
t.Skip("Skipping benchmark test")
139140
}
140141

142+
os.Setenv(localconfig.Prefix+"_ORDERER_ORDERERTYPE", provisional.ConsensusTypeSolo)
143+
defer os.Unsetenv(localconfig.Prefix + "_ORDERER_ORDERERTYPE")
144+
141145
for key, value := range envvars {
142146
os.Setenv(key, value)
143147
defer os.Unsetenv(key)
@@ -183,6 +187,9 @@ func TestOrdererBenchmarkSoloDeliver(t *testing.T) {
183187
t.Skip("Skipping benchmark test")
184188
}
185189

190+
os.Setenv(localconfig.Prefix+"_ORDERER_ORDERERTYPE", provisional.ConsensusTypeSolo)
191+
defer os.Unsetenv(localconfig.Prefix + "_ORDERER_ORDERERTYPE")
192+
186193
for key, value := range envvars {
187194
os.Setenv(key, value)
188195
defer os.Unsetenv(key)
@@ -228,14 +235,14 @@ func TestOrdererBenchmarkKafkaBroadcast(t *testing.T) {
228235
t.Skip("Skipping benchmark test")
229236
}
230237

238+
os.Setenv(localconfig.Prefix+"_ORDERER_ORDERERTYPE", provisional.ConsensusTypeKafka)
239+
defer os.Unsetenv(localconfig.Prefix + "_ORDERER_ORDERERTYPE")
240+
231241
for key, value := range envvars {
232242
os.Setenv(key, value)
233243
defer os.Unsetenv(key)
234244
}
235245

236-
os.Setenv("ORDERER_GENERAL_GENESISPROFILE", localconfig.SampleDevModeKafkaProfile)
237-
defer os.Unsetenv("ORDERER_GENERAL_GENESISPROFILE")
238-
239246
var (
240247
channelCounts = []int{1, 10}
241248
totalTx = []int{10000}
@@ -276,14 +283,14 @@ func TestOrdererBenchmarkKafkaDeliver(t *testing.T) {
276283
t.Skip("Skipping benchmark test")
277284
}
278285

286+
os.Setenv(localconfig.Prefix+"_ORDERER_ORDERERTYPE", provisional.ConsensusTypeKafka)
287+
defer os.Unsetenv(localconfig.Prefix + "_ORDERER_ORDERERTYPE")
288+
279289
for key, value := range envvars {
280290
os.Setenv(key, value)
281291
defer os.Unsetenv(key)
282292
}
283293

284-
os.Setenv("ORDERER_GENERAL_GENESISPROFILE", localconfig.SampleDevModeKafkaProfile)
285-
defer os.Unsetenv("ORDERER_GENERAL_GENESISPROFILE")
286-
287294
var (
288295
channelCounts = []int{1, 10}
289296
totalTx = []int{10000}
@@ -505,16 +512,16 @@ func benchmarkOrderer(
505512
// Experiment shows that atomic counter is not bottleneck.
506513
assert.Equal(t, uint64(totalTx), txCount, "Expected to send %d msg, but actually sent %d", uint64(totalTx), txCount)
507514

508-
ordererProfile := os.Getenv("ORDERER_GENERAL_GENESISPROFILE")
515+
ordererType := os.Getenv(localconfig.Prefix + "_ORDERER_ORDERERTYPE")
509516

510517
fmt.Printf(
511-
"Messages: %6d Message Size: %3dKB Channels: %3d Orderer (%s): %2d | "+
518+
"Message: %6d Message Size: %3dKB Channels: %3d Orderer(%s): %2d | "+
512519
"Broadcast Clients: %3d Write tps: %5.1f tx/s Elapsed Time: %0.2fs | "+
513520
"Deliver clients: %3d Read tps: %8.1f blk/s Elapsed Time: %0.2fs\n",
514521
totalTx,
515522
msgSize,
516523
numOfChannels,
517-
ordererProfile,
524+
ordererType,
518525
numOfOrderer,
519526
broadcastClientPerChannel*numOfChannels*numOfOrderer,
520527
float64(totalTx)/btime.Seconds(),

0 commit comments

Comments
 (0)