Commit 4df008a0 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a922259e
...@@ -553,36 +553,48 @@ func TestMasterStorage(t *testing.T) { ...@@ -553,36 +553,48 @@ func TestMasterStorage(t *testing.T) {
} }
func BenchmarkGetObject(b *testing.B) { func benchmarkGetObject(b *testing.B, Mnet, Snet, Cnet xnet.Networker) {
// create test cluster <- XXX factor to utility func // create test cluster <- XXX factor to utility func
net := pipenet.New("testnet")
Mhost := net.Host("m")
Shost := net.Host("s")
Chost := net.Host("c")
zstor := xfs1stor("../../zodb/storage/fs1/testdata/1.fs") zstor := xfs1stor("../../zodb/storage/fs1/testdata/1.fs")
M := NewMaster("abc1", ":1", Mhost)
S := NewStorage("abc1", "m:1", ":1", Shost, zstor)
C := client.NewClient("abc1", "m:1", Chost)
// spawn M & S
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
wg, ctx := errgroup.WithContext(ctx) wg, ctx := errgroup.WithContext(ctx)
defer wg.Wait() defer wg.Wait()
defer cancel() defer cancel()
// XXX to wait for "ready to start" -> XXX add something to M api? // spawn M
M := NewMaster("abc1", "", Mnet)
// XXX to wait for "M listens at ..." & "ready to start" -> XXX add something to M api?
tracer := &MyTracer{xtesting.NewSyncTracer()} tracer := &MyTracer{xtesting.NewSyncTracer()}
tc := xtesting.NewTraceChecker(b, tracer.SyncTracer) tc := xtesting.NewTraceChecker(b, tracer.SyncTracer)
pg := &tracing.ProbeGroup{} pg := &tracing.ProbeGroup{}
tracing.Lock() tracing.Lock()
pnode := neo_traceNodeChanged_Attach(nil, tracer.traceNode)
traceMasterStartReady_Attach(pg, tracer.traceMasterStartReady) traceMasterStartReady_Attach(pg, tracer.traceMasterStartReady)
tracing.Unlock() tracing.Unlock()
wg.Go(func() error { wg.Go(func() error {
return M.Run(ctx) return M.Run(ctx)
}) })
// determing M serving address XXX better with M api
ev := tracer.Get1()
mnode, ok := ev.Event.(*traceNode)
if !ok {
b.Fatal("after M start: got %T ; want traceNode", ev.Event)
}
Maddr := mnode.NodeInfo.Addr.String()
tracing.Lock()
pnode.Detach()
tracing.Unlock()
ev.Ack()
// now after we know Maddr create S & C and start S serving
S := NewStorage("abc1", Maddr, "", Snet, zstor)
C := client.NewClient("abc1", Maddr, Cnet)
wg.Go(func() error { wg.Go(func() error {
return S.Run(ctx) return S.Run(ctx)
}) })
...@@ -628,3 +640,16 @@ func BenchmarkGetObject(b *testing.B) { ...@@ -628,3 +640,16 @@ func BenchmarkGetObject(b *testing.B) {
xcload1() xcload1()
} }
} }
func BenchmarkGetObjectPipe(b *testing.B) {
net := pipenet.New("testnet")
Mhost := net.Host("m")
Shost := net.Host("s")
Chost := net.Host("c")
benchmarkGetObject(b, Mhost, Shost, Chost)
}
func BenchmarkGetObjectTCPlo(b *testing.B) {
net := xnet.NetPlain("tcp")
benchmarkGetObject(b, net, net, net)
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment