Browse Source

Tweak channel for performance test

pull/169/head
Jae Kwon 9 years ago
parent
commit
dfdd3cf18f
3 changed files with 14 additions and 16 deletions
  1. +2
    -7
      benchmarks/map_test.go
  2. +4
    -3
      benchmarks/simu/counter.go
  3. +8
    -6
      consensus/reactor.go

+ 2
- 7
benchmarks/map_test.go View File

@ -11,11 +11,11 @@ func BenchmarkSomething(b *testing.B) {
numChecks := 100000
keys := make([]string, numItems)
for i := 0; i < numItems; i++ {
keys[i] = RandStr(32)
keys[i] = RandStr(100)
}
txs := make([]string, numChecks)
for i := 0; i < numChecks; i++ {
txs[i] = RandStr(32)
txs[i] = RandStr(100)
}
b.StartTimer()
@ -30,10 +30,5 @@ func BenchmarkSomething(b *testing.B) {
counter++
}
}
for _, tx := range txs {
if _, ok := foo[tx]; ok {
counter++
}
}
}
}

+ 4
- 3
benchmarks/simu/counter.go View File

@ -40,15 +40,16 @@ func main() {
//txBytes := hex.EncodeToString(buf[:n])
request := rpctypes.NewRPCRequest("fakeid", "broadcast_tx", Arr(buf[:8]))
reqBytes := wire.JSONBytes(request)
fmt.Println("!!", string(reqBytes))
//fmt.Println("!!", string(reqBytes))
fmt.Print(".")
err := ws.WriteMessage(websocket.TextMessage, reqBytes)
if err != nil {
Exit(err.Error())
}
if i%100 == 0 {
if i%1000 == 0 {
fmt.Println(i)
}
time.Sleep(time.Millisecond * 10)
time.Sleep(time.Microsecond * 1)
}
ws.Stop()


+ 8
- 6
consensus/reactor.go View File

@ -86,14 +86,16 @@ func (conR *ConsensusReactor) GetChannels() []*p2p.ChannelDescriptor {
SendQueueCapacity: 100,
},
&p2p.ChannelDescriptor{
ID: DataChannel,
Priority: 5,
SendQueueCapacity: 2,
ID: DataChannel,
Priority: 2,
SendQueueCapacity: 50,
RecvBufferCapacity: 50 * 4096,
},
&p2p.ChannelDescriptor{
ID: VoteChannel,
Priority: 5,
SendQueueCapacity: 40,
ID: VoteChannel,
Priority: 5,
SendQueueCapacity: 100,
RecvBufferCapacity: 100 * 100,
},
}
}


Loading…
Cancel
Save