2019-05-19 16:10:46 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package overlay_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2020-03-27 19:35:29 +00:00
|
|
|
"fmt"
|
2019-05-19 16:10:46 +01:00
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
2021-05-16 18:09:15 +01:00
|
|
|
"github.com/zeebo/errs"
|
2020-03-27 19:35:29 +00:00
|
|
|
"go.uber.org/zap"
|
2022-06-28 12:53:39 +01:00
|
|
|
"golang.org/x/sync/errgroup"
|
2019-05-19 16:10:46 +01:00
|
|
|
|
2021-05-16 18:09:15 +01:00
|
|
|
"storj.io/common/errs2"
|
2019-12-27 11:48:47 +00:00
|
|
|
"storj.io/common/pb"
|
|
|
|
"storj.io/common/storj"
|
|
|
|
"storj.io/common/testrand"
|
2019-05-19 16:10:46 +01:00
|
|
|
"storj.io/storj/satellite"
|
2019-07-28 06:55:36 +01:00
|
|
|
"storj.io/storj/satellite/overlay"
|
2019-05-19 16:10:46 +01:00
|
|
|
"storj.io/storj/satellite/satellitedb/satellitedbtest"
|
|
|
|
)
|
|
|
|
|
|
|
|
func BenchmarkOverlay(b *testing.B) {
|
|
|
|
satellitedbtest.Bench(b, func(b *testing.B, db satellite.DB) {
|
|
|
|
const (
|
|
|
|
TotalNodeCount = 211
|
|
|
|
OnlineCount = 90
|
|
|
|
OfflineCount = 10
|
|
|
|
)
|
|
|
|
|
|
|
|
overlaydb := db.OverlayCache()
|
|
|
|
ctx := context.Background()
|
|
|
|
|
|
|
|
var all []storj.NodeID
|
|
|
|
var check []storj.NodeID
|
|
|
|
for i := 0; i < TotalNodeCount; i++ {
|
2019-06-26 11:38:51 +01:00
|
|
|
id := testrand.NodeID()
|
2019-05-19 16:10:46 +01:00
|
|
|
all = append(all, id)
|
|
|
|
if i < OnlineCount {
|
|
|
|
check = append(check, id)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-29 18:58:41 +01:00
|
|
|
for i, id := range all {
|
|
|
|
addr := fmt.Sprintf("127.0.%d.0:8080", i)
|
|
|
|
lastNet := fmt.Sprintf("127.0.%d", i)
|
|
|
|
d := overlay.NodeCheckInInfo{
|
|
|
|
NodeID: id,
|
|
|
|
Address: &pb.NodeAddress{Address: addr},
|
|
|
|
LastIPPort: addr,
|
|
|
|
LastNet: lastNet,
|
|
|
|
Version: &pb.NodeVersion{Version: "v1.0.0"},
|
|
|
|
IsUp: true,
|
|
|
|
}
|
|
|
|
err := overlaydb.UpdateCheckIn(ctx, d, time.Now().UTC(), overlay.NodeSelectionConfig{})
|
2019-05-19 16:10:46 +01:00
|
|
|
require.NoError(b, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// create random offline node ids to check
|
|
|
|
for i := 0; i < OfflineCount; i++ {
|
2019-06-26 11:38:51 +01:00
|
|
|
check = append(check, testrand.NodeID())
|
2019-05-19 16:10:46 +01:00
|
|
|
}
|
|
|
|
|
2023-06-26 09:25:13 +01:00
|
|
|
b.Run("KnownReliable", func(b *testing.B) {
|
|
|
|
onlineWindow := 1000 * time.Hour
|
2019-05-19 16:10:46 +01:00
|
|
|
for i := 0; i < b.N; i++ {
|
2023-06-26 09:25:13 +01:00
|
|
|
online, _, err := overlaydb.KnownReliable(ctx, check, onlineWindow, 0)
|
2019-05-19 16:10:46 +01:00
|
|
|
require.NoError(b, err)
|
2023-06-26 09:25:13 +01:00
|
|
|
require.Len(b, online, OnlineCount)
|
2019-05-19 16:10:46 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2020-04-29 18:58:41 +01:00
|
|
|
b.Run("UpdateCheckIn", func(b *testing.B) {
|
2019-05-19 16:10:46 +01:00
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
id := all[i%len(all)]
|
2020-04-29 18:58:41 +01:00
|
|
|
addr := fmt.Sprintf("127.0.%d.0:8080", i)
|
|
|
|
lastNet := fmt.Sprintf("127.0.%d", i)
|
|
|
|
d := overlay.NodeCheckInInfo{
|
|
|
|
NodeID: id,
|
|
|
|
Address: &pb.NodeAddress{Address: addr},
|
|
|
|
LastIPPort: addr,
|
|
|
|
LastNet: lastNet,
|
|
|
|
Version: &pb.NodeVersion{Version: "v1.0.0"},
|
|
|
|
}
|
|
|
|
err := overlaydb.UpdateCheckIn(ctx, d, time.Now().UTC(), overlay.NodeSelectionConfig{})
|
2019-05-19 16:10:46 +01:00
|
|
|
require.NoError(b, err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2021-05-16 18:09:15 +01:00
|
|
|
b.Run("UpdateCheckInContended-100x", func(b *testing.B) {
|
|
|
|
for k := 0; k < b.N; k++ {
|
|
|
|
var g errs2.Group
|
|
|
|
for i := 0; i < 100; i++ {
|
|
|
|
g.Go(func() error {
|
|
|
|
d := overlay.NodeCheckInInfo{
|
|
|
|
NodeID: all[0],
|
|
|
|
Address: &pb.NodeAddress{Address: "127.0.0.0:8080"},
|
|
|
|
LastIPPort: "127.0.0.0:8080",
|
|
|
|
LastNet: "127.0.0",
|
|
|
|
Operator: &pb.NodeOperator{
|
|
|
|
Email: "hello@example.com",
|
|
|
|
Wallet: "123123123123",
|
|
|
|
},
|
|
|
|
Version: &pb.NodeVersion{Version: "v1.0.0"},
|
|
|
|
IsUp: true,
|
|
|
|
}
|
|
|
|
return overlaydb.UpdateCheckIn(ctx, d, time.Now().UTC(), overlay.NodeSelectionConfig{})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
require.NoError(b, errs.Combine(g.Wait()...))
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2019-05-19 16:10:46 +01:00
|
|
|
b.Run("UpdateNodeInfo", func(b *testing.B) {
|
2019-07-08 19:24:42 +01:00
|
|
|
now := time.Now()
|
2019-05-19 16:10:46 +01:00
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
id := all[i%len(all)]
|
2020-06-16 13:16:55 +01:00
|
|
|
_, err := overlaydb.UpdateNodeInfo(ctx, id, &overlay.InfoResponse{
|
2019-05-19 16:10:46 +01:00
|
|
|
Type: pb.NodeType_STORAGE,
|
|
|
|
Operator: &pb.NodeOperator{
|
|
|
|
Wallet: "0x0123456789012345678901234567890123456789",
|
2019-06-18 01:28:40 +01:00
|
|
|
Email: "a@mail.test",
|
2019-05-19 16:10:46 +01:00
|
|
|
},
|
|
|
|
Capacity: &pb.NodeCapacity{
|
2020-02-12 21:19:42 +00:00
|
|
|
FreeDisk: 1000,
|
2019-05-19 16:10:46 +01:00
|
|
|
},
|
|
|
|
Version: &pb.NodeVersion{
|
|
|
|
Version: "1.0.0",
|
|
|
|
CommitHash: "0",
|
|
|
|
Timestamp: now,
|
|
|
|
Release: false,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
require.NoError(b, err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2019-09-20 21:35:52 +01:00
|
|
|
b.Run("UpdateCheckIn", func(b *testing.B) {
|
|
|
|
now := time.Now()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
id := all[i%len(all)]
|
|
|
|
err := overlaydb.UpdateCheckIn(ctx, overlay.NodeCheckInInfo{
|
|
|
|
NodeID: id,
|
|
|
|
Address: &pb.NodeAddress{
|
|
|
|
Address: "1.2.4.4",
|
|
|
|
},
|
|
|
|
IsUp: true,
|
|
|
|
Capacity: &pb.NodeCapacity{
|
2020-02-12 21:19:42 +00:00
|
|
|
FreeDisk: int64(i),
|
2019-09-20 21:35:52 +01:00
|
|
|
},
|
|
|
|
Operator: &pb.NodeOperator{
|
|
|
|
Email: "a@mail.test",
|
|
|
|
Wallet: "0x0123456789012345678901234567890123456789",
|
|
|
|
},
|
|
|
|
Version: &pb.NodeVersion{
|
|
|
|
Version: "1.0.0",
|
|
|
|
CommitHash: "0",
|
|
|
|
Timestamp: now,
|
|
|
|
Release: false,
|
|
|
|
},
|
2019-11-15 22:43:06 +00:00
|
|
|
},
|
|
|
|
now,
|
2020-01-03 00:00:18 +00:00
|
|
|
overlay.NodeSelectionConfig{},
|
|
|
|
)
|
2019-09-20 21:35:52 +01:00
|
|
|
require.NoError(b, err)
|
|
|
|
}
|
|
|
|
})
|
2019-05-19 16:10:46 +01:00
|
|
|
})
|
|
|
|
}
|
2020-03-27 19:35:29 +00:00
|
|
|
|
|
|
|
func BenchmarkNodeSelection(b *testing.B) {
|
|
|
|
satellitedbtest.Bench(b, func(b *testing.B, db satellite.DB) {
|
2020-07-10 07:10:01 +01:00
|
|
|
var (
|
2020-03-27 19:35:29 +00:00
|
|
|
Total = 10000
|
|
|
|
Offline = 1000
|
|
|
|
NodesPerNet = 2
|
|
|
|
|
|
|
|
SelectCount = 100
|
|
|
|
ExcludedCount = 90
|
2020-04-23 23:30:50 +01:00
|
|
|
|
|
|
|
newNodeFraction = 0.05
|
2020-03-27 19:35:29 +00:00
|
|
|
)
|
|
|
|
|
2020-07-10 07:10:01 +01:00
|
|
|
if testing.Short() {
|
|
|
|
Total /= 10
|
|
|
|
Offline /= 10
|
|
|
|
SelectCount /= 10
|
|
|
|
ExcludedCount /= 10
|
|
|
|
}
|
|
|
|
|
2020-04-23 23:30:50 +01:00
|
|
|
SelectNewCount := int(100 * newNodeFraction)
|
|
|
|
|
2020-03-27 19:35:29 +00:00
|
|
|
now := time.Now()
|
|
|
|
twoHoursAgo := now.Add(-2 * time.Hour)
|
|
|
|
|
|
|
|
overlaydb := db.OverlayCache()
|
2022-06-28 12:53:39 +01:00
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
defer cancel()
|
2020-03-27 19:35:29 +00:00
|
|
|
|
|
|
|
nodeSelectionConfig := overlay.NodeSelectionConfig{
|
2020-04-23 23:30:50 +01:00
|
|
|
NewNodeFraction: newNodeFraction,
|
2020-03-27 19:35:29 +00:00
|
|
|
MinimumVersion: "v1.0.0",
|
|
|
|
OnlineWindow: time.Hour,
|
|
|
|
DistinctIP: true,
|
|
|
|
MinimumDiskSpace: 0,
|
2021-10-20 11:54:52 +01:00
|
|
|
AsOfSystemTime: overlay.AsOfSystemTimeConfig{
|
|
|
|
Enabled: true,
|
|
|
|
DefaultInterval: -time.Microsecond,
|
|
|
|
},
|
2020-03-27 19:35:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var excludedIDs []storj.NodeID
|
|
|
|
var excludedNets []string
|
|
|
|
|
|
|
|
for i := 0; i < Total/NodesPerNet; i++ {
|
|
|
|
for k := 0; k < NodesPerNet; k++ {
|
|
|
|
nodeID := testrand.NodeID()
|
|
|
|
address := fmt.Sprintf("127.%d.%d.%d", byte(i>>8), byte(i), byte(k))
|
|
|
|
lastNet := fmt.Sprintf("127.%d.%d.0", byte(i>>8), byte(i))
|
|
|
|
|
|
|
|
if i < ExcludedCount && k == 0 {
|
|
|
|
excludedIDs = append(excludedIDs, nodeID)
|
|
|
|
excludedNets = append(excludedNets, lastNet)
|
|
|
|
}
|
|
|
|
|
2020-04-29 18:58:41 +01:00
|
|
|
addr := address + ":12121"
|
|
|
|
d := overlay.NodeCheckInInfo{
|
|
|
|
NodeID: nodeID,
|
|
|
|
Address: &pb.NodeAddress{Address: addr},
|
|
|
|
LastIPPort: addr,
|
2021-07-07 20:20:23 +01:00
|
|
|
IsUp: true,
|
2020-03-27 19:35:29 +00:00
|
|
|
LastNet: lastNet,
|
2020-04-29 18:58:41 +01:00
|
|
|
Version: &pb.NodeVersion{Version: "v1.0.0"},
|
|
|
|
Capacity: &pb.NodeCapacity{
|
2020-03-27 19:35:29 +00:00
|
|
|
FreeDisk: 1_000_000_000,
|
|
|
|
},
|
|
|
|
}
|
2020-04-29 18:58:41 +01:00
|
|
|
err := overlaydb.UpdateCheckIn(ctx, d, time.Now().UTC(), overlay.NodeSelectionConfig{})
|
2020-03-27 19:35:29 +00:00
|
|
|
require.NoError(b, err)
|
|
|
|
|
2020-06-16 13:16:55 +01:00
|
|
|
_, err = overlaydb.UpdateNodeInfo(ctx, nodeID, &overlay.InfoResponse{
|
2020-03-27 19:35:29 +00:00
|
|
|
Type: pb.NodeType_STORAGE,
|
|
|
|
Capacity: &pb.NodeCapacity{
|
|
|
|
FreeDisk: 1_000_000_000,
|
|
|
|
},
|
|
|
|
Version: &pb.NodeVersion{
|
|
|
|
Version: "v1.0.0",
|
|
|
|
Timestamp: now,
|
|
|
|
Release: true,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
require.NoError(b, err)
|
|
|
|
|
|
|
|
if i%2 == 0 { // make half of nodes "new" and half "vetted"
|
2021-07-07 20:20:23 +01:00
|
|
|
_, err = overlaydb.TestVetNode(ctx, nodeID)
|
2020-03-27 19:35:29 +00:00
|
|
|
require.NoError(b, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if i > Total-Offline {
|
|
|
|
switch i % 3 {
|
|
|
|
case 0:
|
2021-07-15 15:14:13 +01:00
|
|
|
err := overlaydb.TestSuspendNodeUnknownAudit(ctx, nodeID, now)
|
2020-03-27 19:35:29 +00:00
|
|
|
require.NoError(b, err)
|
|
|
|
case 1:
|
2022-10-11 17:13:29 +01:00
|
|
|
_, err := overlaydb.DisqualifyNode(ctx, nodeID, time.Now(), overlay.DisqualificationReasonUnknown)
|
2020-03-27 19:35:29 +00:00
|
|
|
require.NoError(b, err)
|
|
|
|
case 2:
|
|
|
|
err := overlaydb.UpdateCheckIn(ctx, overlay.NodeCheckInInfo{
|
|
|
|
NodeID: nodeID,
|
|
|
|
Address: &pb.NodeAddress{
|
|
|
|
Address: address,
|
|
|
|
},
|
|
|
|
Operator: nil,
|
|
|
|
Version: nil,
|
|
|
|
}, twoHoursAgo, nodeSelectionConfig)
|
|
|
|
require.NoError(b, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
criteria := &overlay.NodeCriteria{
|
2021-10-20 11:54:52 +01:00
|
|
|
FreeDisk: 0,
|
|
|
|
ExcludedIDs: nil,
|
|
|
|
ExcludedNetworks: nil,
|
|
|
|
MinimumVersion: "v1.0.0",
|
|
|
|
OnlineWindow: time.Hour,
|
|
|
|
AsOfSystemInterval: -time.Microsecond,
|
2020-03-27 19:35:29 +00:00
|
|
|
}
|
|
|
|
excludedCriteria := &overlay.NodeCriteria{
|
2021-10-20 11:54:52 +01:00
|
|
|
FreeDisk: 0,
|
|
|
|
ExcludedIDs: excludedIDs,
|
|
|
|
ExcludedNetworks: excludedNets,
|
|
|
|
MinimumVersion: "v1.0.0",
|
|
|
|
OnlineWindow: time.Hour,
|
|
|
|
AsOfSystemInterval: -time.Microsecond,
|
2020-03-27 19:35:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
b.Run("SelectStorageNodes", func(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
2020-04-09 16:19:44 +01:00
|
|
|
selected, err := overlaydb.SelectStorageNodes(ctx, SelectCount, 0, criteria)
|
2020-03-27 19:35:29 +00:00
|
|
|
require.NoError(b, err)
|
|
|
|
require.NotEmpty(b, selected)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
b.Run("SelectNewStorageNodes", func(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
2020-04-09 16:19:44 +01:00
|
|
|
selected, err := overlaydb.SelectStorageNodes(ctx, SelectCount, SelectCount, criteria)
|
2020-03-27 19:35:29 +00:00
|
|
|
require.NoError(b, err)
|
|
|
|
require.NotEmpty(b, selected)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
b.Run("SelectStorageNodesExclusion", func(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
2020-04-09 16:19:44 +01:00
|
|
|
selected, err := overlaydb.SelectStorageNodes(ctx, SelectCount, 0, excludedCriteria)
|
2020-03-27 19:35:29 +00:00
|
|
|
require.NoError(b, err)
|
|
|
|
require.NotEmpty(b, selected)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
b.Run("SelectNewStorageNodesExclusion", func(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
2020-04-09 16:19:44 +01:00
|
|
|
selected, err := overlaydb.SelectStorageNodes(ctx, SelectCount, SelectCount, excludedCriteria)
|
2020-03-27 19:35:29 +00:00
|
|
|
require.NoError(b, err)
|
|
|
|
require.NotEmpty(b, selected)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2020-04-23 23:30:50 +01:00
|
|
|
b.Run("SelectStorageNodesBoth", func(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
selected, err := overlaydb.SelectStorageNodes(ctx, SelectCount, SelectNewCount, criteria)
|
|
|
|
require.NoError(b, err)
|
|
|
|
require.NotEmpty(b, selected)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
b.Run("SelectStorageNodesBothExclusion", func(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
selected, err := overlaydb.SelectStorageNodes(ctx, SelectCount, SelectNewCount, excludedCriteria)
|
|
|
|
require.NoError(b, err)
|
|
|
|
require.NotEmpty(b, selected)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
b.Run("GetNodesNetwork", func(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
excludedNetworks, err := overlaydb.GetNodesNetwork(ctx, excludedIDs)
|
|
|
|
require.NoError(b, err)
|
|
|
|
require.NotEmpty(b, excludedNetworks)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2023-07-06 13:35:26 +01:00
|
|
|
service, err := overlay.NewService(zap.NewNop(), overlaydb, db.NodeEvents(), overlay.NewPlacementRules().CreateFilters, "", "", overlay.Config{
|
2020-03-27 19:35:29 +00:00
|
|
|
Node: nodeSelectionConfig,
|
2021-01-28 11:46:18 +00:00
|
|
|
NodeSelectionCache: overlay.UploadSelectionCacheConfig{
|
2020-04-24 17:11:04 +01:00
|
|
|
Staleness: time.Hour,
|
|
|
|
},
|
2020-03-27 19:35:29 +00:00
|
|
|
})
|
2020-12-22 19:07:07 +00:00
|
|
|
require.NoError(b, err)
|
2020-03-27 19:35:29 +00:00
|
|
|
|
2022-06-28 12:53:39 +01:00
|
|
|
var background errgroup.Group
|
|
|
|
serviceCtx, serviceCancel := context.WithCancel(ctx)
|
|
|
|
background.Go(func() error { return errs.Wrap(service.Run(serviceCtx)) })
|
|
|
|
defer func() { require.NoError(b, background.Wait()) }()
|
|
|
|
defer func() { serviceCancel(); _ = service.Close() }()
|
|
|
|
|
2020-03-27 19:35:29 +00:00
|
|
|
b.Run("FindStorageNodes", func(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
2020-05-06 14:05:31 +01:00
|
|
|
selected, err := service.FindStorageNodesForUpload(ctx, overlay.FindStorageNodesRequest{
|
2021-10-20 11:54:52 +01:00
|
|
|
RequestedCount: SelectCount,
|
|
|
|
ExcludedIDs: nil,
|
|
|
|
MinimumVersion: "v1.0.0",
|
|
|
|
AsOfSystemInterval: -time.Microsecond,
|
2020-03-27 19:35:29 +00:00
|
|
|
})
|
|
|
|
require.NoError(b, err)
|
|
|
|
require.NotEmpty(b, selected)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
b.Run("FindStorageNodesExclusion", func(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
2020-05-06 14:05:31 +01:00
|
|
|
selected, err := service.FindStorageNodesForUpload(ctx, overlay.FindStorageNodesRequest{
|
2021-10-20 11:54:52 +01:00
|
|
|
RequestedCount: SelectCount,
|
|
|
|
ExcludedIDs: excludedIDs,
|
|
|
|
MinimumVersion: "v1.0.0",
|
|
|
|
AsOfSystemInterval: -time.Microsecond,
|
2020-03-27 19:35:29 +00:00
|
|
|
})
|
|
|
|
require.NoError(b, err)
|
|
|
|
require.NotEmpty(b, selected)
|
|
|
|
}
|
|
|
|
})
|
2020-04-24 17:11:04 +01:00
|
|
|
|
2021-01-28 11:46:18 +00:00
|
|
|
b.Run("UploadSelectionCacheGetNodes", func(b *testing.B) {
|
2020-04-24 17:11:04 +01:00
|
|
|
for i := 0; i < b.N; i++ {
|
2021-01-28 11:46:18 +00:00
|
|
|
selected, err := service.UploadSelectionCache.GetNodes(ctx, overlay.FindStorageNodesRequest{
|
2021-10-20 11:54:52 +01:00
|
|
|
RequestedCount: SelectCount,
|
|
|
|
ExcludedIDs: nil,
|
|
|
|
MinimumVersion: "v1.0.0",
|
|
|
|
AsOfSystemInterval: -time.Microsecond,
|
2020-04-24 17:11:04 +01:00
|
|
|
})
|
|
|
|
require.NoError(b, err)
|
|
|
|
require.NotEmpty(b, selected)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2021-01-28 11:46:18 +00:00
|
|
|
b.Run("UploadSelectionCacheGetNodesExclusion", func(b *testing.B) {
|
2020-04-24 17:11:04 +01:00
|
|
|
for i := 0; i < b.N; i++ {
|
2021-01-28 11:46:18 +00:00
|
|
|
selected, err := service.UploadSelectionCache.GetNodes(ctx, overlay.FindStorageNodesRequest{
|
2021-10-20 11:54:52 +01:00
|
|
|
RequestedCount: SelectCount,
|
|
|
|
ExcludedIDs: excludedIDs,
|
|
|
|
MinimumVersion: "v1.0.0",
|
|
|
|
AsOfSystemInterval: -time.Microsecond,
|
2020-04-24 17:11:04 +01:00
|
|
|
})
|
|
|
|
require.NoError(b, err)
|
|
|
|
require.NotEmpty(b, selected)
|
|
|
|
}
|
|
|
|
})
|
2020-03-27 19:35:29 +00:00
|
|
|
})
|
|
|
|
}
|