[#1350] node: Add unit test to measure time required for evacuation
All checks were successful
DCO action / DCO (pull_request) Successful in 1m4s
Tests and linters / Run gofumpt (pull_request) Successful in 1m16s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m8s
Vulncheck / Vulncheck (pull_request) Successful in 2m18s
Build / Build Components (pull_request) Successful in 2m38s
Tests and linters / gopls check (pull_request) Successful in 2m52s
Tests and linters / Staticcheck (pull_request) Successful in 3m2s
Tests and linters / Lint (pull_request) Successful in 4m4s
Tests and linters / Tests (pull_request) Successful in 6m51s
Tests and linters / Tests with -race (pull_request) Successful in 6m59s
All checks were successful
DCO action / DCO (pull_request) Successful in 1m4s
Tests and linters / Run gofumpt (pull_request) Successful in 1m16s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m8s
Vulncheck / Vulncheck (pull_request) Successful in 2m18s
Build / Build Components (pull_request) Successful in 2m38s
Tests and linters / gopls check (pull_request) Successful in 2m52s
Tests and linters / Staticcheck (pull_request) Successful in 3m2s
Tests and linters / Lint (pull_request) Successful in 4m4s
Tests and linters / Tests (pull_request) Successful in 6m51s
Tests and linters / Tests with -race (pull_request) Successful in 6m59s
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
088528f3fa
commit
fb3d0e23eb
1 changed files with 59 additions and 1 deletions
|
@ -33,9 +33,11 @@ import (
|
|||
|
||||
type containerStorage struct {
|
||||
cntmap map[cid.ID]*container.Container
|
||||
latency time.Duration
|
||||
}
|
||||
|
||||
func (cs *containerStorage) Get(id cid.ID) (*coreContainer.Container, error) {
|
||||
time.Sleep(cs.latency)
|
||||
coreCnt := coreContainer.Container{
|
||||
Value: *cs.cntmap[id],
|
||||
}
|
||||
|
@ -724,3 +726,59 @@ func TestEvacuateShardObjectsRepOneOnly(t *testing.T) {
|
|||
require.Equal(t, uint64(4), res.ObjectsSkipped())
|
||||
require.Equal(t, uint64(0), res.ObjectsFailed())
|
||||
}
|
||||
|
||||
func TestEvacuateShardObjectsRepOneOnlyBench(t *testing.T) {
|
||||
t.Skip()
|
||||
e, ids, _ := newEngineEvacuate(t, 2, 0)
|
||||
defer func() {
|
||||
require.NoError(t, e.Close(context.Background()))
|
||||
}()
|
||||
|
||||
cnrmap := make(map[cid.ID]*container.Container)
|
||||
var cids []cid.ID
|
||||
// Create containers with policy REP 1
|
||||
for i := range 10_000 {
|
||||
cnr1 := container.Container{}
|
||||
p1 := netmap.PlacementPolicy{}
|
||||
p1.SetContainerBackupFactor(1)
|
||||
x1 := netmap.ReplicaDescriptor{}
|
||||
x1.SetNumberOfObjects(2)
|
||||
p1.AddReplicas(x1)
|
||||
cnr1.SetPlacementPolicy(p1)
|
||||
cnr1.SetAttribute("i", strconv.Itoa(i))
|
||||
|
||||
var idCnr1 cid.ID
|
||||
container.CalculateID(&idCnr1, cnr1)
|
||||
|
||||
cnrmap[idCnr1] = &cnr1
|
||||
cids = append(cids, idCnr1)
|
||||
}
|
||||
|
||||
e.SetContainerSource(&containerStorage{
|
||||
cntmap: cnrmap,
|
||||
latency: time.Millisecond * 100,
|
||||
})
|
||||
|
||||
for _, cnt := range cids {
|
||||
for range 1 {
|
||||
obj := testutil.GenerateObjectWithCID(cnt)
|
||||
var putPrm shard.PutPrm
|
||||
putPrm.SetObject(obj)
|
||||
_, err := e.shards[ids[0].String()].Put(context.Background(), putPrm)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
}
|
||||
|
||||
var prm EvacuateShardPrm
|
||||
prm.ShardID = ids[0:1]
|
||||
prm.Scope = EvacuateScopeObjects
|
||||
prm.RepOneOnly = true
|
||||
prm.ContainerWorkerCount = 10
|
||||
|
||||
require.NoError(t, e.shards[ids[0].String()].SetMode(mode.ReadOnly))
|
||||
|
||||
start := time.Now()
|
||||
_, err := e.Evacuate(context.Background(), prm)
|
||||
t.Logf("evacuate took %v\n", time.Since(start))
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue