diff --git a/bench_test.go b/bench_test.go index 732454465..365d25cf8 100644 --- a/bench_test.go +++ b/bench_test.go @@ -139,6 +139,7 @@ func TestBenchParallelServe(t *testing.T) { for k := 0; k < *iterNum; k++ { var vmGroup sync.WaitGroup + semLoad := make(chan bool, 10) if !*isWithCache { dropPageCache() @@ -148,10 +149,13 @@ func TestBenchParallelServe(t *testing.T) { for i := 0; i < parallel; i++ { vmIDString := strconv.Itoa(vmID + i) + semLoad <- true + vmGroup.Add(1) go func(i int) { defer vmGroup.Done() + defer func() { <-semLoad }() resp, _, err := funcPool.Serve(context.Background(), vmIDString, imageName, "replay") require.NoError(t, err, "Function returned error") @@ -159,6 +163,9 @@ func TestBenchParallelServe(t *testing.T) { }(i) } + for i := 0; i < cap(semLoad); i++ { + semLoad <- true + } vmGroup.Wait() duration := time.Since(tStart).Milliseconds() diff --git a/functions.go b/functions.go index 9a333accd..7ca6ee31f 100644 --- a/functions.go +++ b/functions.go @@ -137,7 +137,8 @@ func (p *FuncPool) RemoveInstance(fID, imageName string, isSync bool) (string, e return f.RemoveInstance(isSync) } -// DumpUPFPageStats Dumps the memory manager's stats for a function about the number of the unique pages and the number of the pages that are reused across invocations +// DumpUPFPageStats Dumps the memory manager's stats for a function about the number of +// the unique pages and the number of the pages that are reused across invocations func (p *FuncPool) DumpUPFPageStats(fID, imageName, functionName, metricsOutFilePath string) error { f := p.getFunction(fID, imageName) @@ -398,7 +399,8 @@ func (f *Function) RemoveInstance(isSync bool) (string, error) { return r, err } -// DumpUPFPageStats Dumps the memory manager's stats about the number of the unique pages and the number of the pages that are reused across invocations +// DumpUPFPageStats Dumps the memory manager's stats about the number of +// the unique pages and the number of the pages that are reused across invocations func (f *Function) DumpUPFPageStats(functionName, metricsOutFilePath string) error { return orch.DumpUPFPageStats(f.vmID, functionName, metricsOutFilePath) } diff --git a/go.mod b/go.mod index 907c48d9f..28fc34241 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/containerd/containerd v1.3.6 github.com/sirupsen/logrus v1.6.0 github.com/stretchr/testify v1.6.1 - github.com/ustiugov/fccd-orchestrator/ctriface v0.0.0-20200814073951-0661716e8f1f + github.com/ustiugov/fccd-orchestrator/ctriface v0.0.0-20200814104500-c1a8ec1da550 github.com/ustiugov/fccd-orchestrator/helloworld v0.0.0-20200803195925-0629e1cf4599 github.com/ustiugov/fccd-orchestrator/metrics v0.0.0-20200813133133-6b46b3623de0 github.com/ustiugov/fccd-orchestrator/proto v0.0.0-20200803195925-0629e1cf4599 diff --git a/go.sum b/go.sum index 5f86422a0..91cefc4ec 100644 --- a/go.sum +++ b/go.sum @@ -666,6 +666,8 @@ github.com/ustiugov/fccd-orchestrator/ctriface v0.0.0-20200813133133-6b46b3623de github.com/ustiugov/fccd-orchestrator/ctriface v0.0.0-20200813133133-6b46b3623de0/go.mod h1:THyJkBUoFSBkKaXEmL9ArXnvweCEZURADXTrEFMR/BE= github.com/ustiugov/fccd-orchestrator/ctriface v0.0.0-20200814073951-0661716e8f1f h1:XeF7ySbWrKqrxedD/6U3lPinVit4622QUCvjqCwkGIQ= github.com/ustiugov/fccd-orchestrator/ctriface v0.0.0-20200814073951-0661716e8f1f/go.mod h1:Ull4lf+2AMshamCVtBlmGfuCVkoE0+KgIQDWmMQsx7g= +github.com/ustiugov/fccd-orchestrator/ctriface v0.0.0-20200814104500-c1a8ec1da550 h1:M/c9DGaVdiiyw2W4HBL9TnU7H8gTRddKFQ5YytGqLng= +github.com/ustiugov/fccd-orchestrator/ctriface v0.0.0-20200814104500-c1a8ec1da550/go.mod h1:r2dHTyaCHWXSdYIHIOIlVbKNXpLEZFCn2a2sbAYWBc0= github.com/ustiugov/fccd-orchestrator/helloworld v0.0.0-20200710144657-9fbec6857e48/go.mod h1:5dhCs/XynpQoQcrhd/YgUBjGahhNpTknQUcC1kHRCaA= github.com/ustiugov/fccd-orchestrator/helloworld v0.0.0-20200710145415-bb09d1a68889/go.mod h1:5dhCs/XynpQoQcrhd/YgUBjGahhNpTknQUcC1kHRCaA= github.com/ustiugov/fccd-orchestrator/helloworld v0.0.0-20200710150633-096cac68bd72 h1:r67pqykSYWZHFYfIKuT44PTXFJWu5lJcatkV16d3vKU= @@ -727,6 +729,8 @@ github.com/ustiugov/fccd-orchestrator/memory/manager v0.0.0-20200813132011-cbc5d github.com/ustiugov/fccd-orchestrator/memory/manager v0.0.0-20200813132011-cbc5d5f6f0a2/go.mod h1:RnM7KtF9SaVH0lyeTOFvbMq2E+e+1LAH4rT4AQc2uB0= github.com/ustiugov/fccd-orchestrator/memory/manager v0.0.0-20200814064842-03f16a02475d h1:GaiSsXzAEwVrHXEis4MP6kEwLJ+lsExjOMZJIqQNdnI= github.com/ustiugov/fccd-orchestrator/memory/manager v0.0.0-20200814064842-03f16a02475d/go.mod h1:RnM7KtF9SaVH0lyeTOFvbMq2E+e+1LAH4rT4AQc2uB0= +github.com/ustiugov/fccd-orchestrator/memory/manager v0.0.0-20200814104410-a0b269be4cb2 h1:Q8GDhAw8tByrPQxgpOVX8lcGzQKpvIUxmVOkqpC/r1E= +github.com/ustiugov/fccd-orchestrator/memory/manager v0.0.0-20200814104410-a0b269be4cb2/go.mod h1:RnM7KtF9SaVH0lyeTOFvbMq2E+e+1LAH4rT4AQc2uB0= github.com/ustiugov/fccd-orchestrator/metrics v0.0.0-20200723085111-a9d697412510 h1:2F3Bp/P7C2UMKU+vakjEW/++E2yCntucHKNiRxcxQOE= github.com/ustiugov/fccd-orchestrator/metrics v0.0.0-20200723085111-a9d697412510/go.mod h1:NOrYF6usVkdr6gpXAP7pk7jp1MlAXlrZQuUEOVhRuV8= github.com/ustiugov/fccd-orchestrator/metrics v0.0.0-20200723105930-96d5e1cb279b h1:0ukOv2nUQqj14TLHf5MkVyvbyiV6AxwUSI7PQQnVdKQ=