Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
bae69488
Commit
bae69488
authored
Dec 30, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b5bfc158
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
33 deletions
+41
-33
go/neo/neo_test.go
go/neo/neo_test.go
+11
-26
go/neo/t_cluster_test.go
go/neo/t_cluster_test.go
+30
-7
No files found.
go/neo/neo_test.go
View file @
bae69488
...
...
@@ -36,8 +36,6 @@ import (
"lab.nexedi.com/kirr/neo/go/internal/xtracing/tracetest"
"lab.nexedi.com/kirr/go123/exc"
"lab.nexedi.com/kirr/go123/xnet"
"lab.nexedi.com/kirr/go123/xnet/pipenet"
"lab.nexedi.com/kirr/go123/xsync"
)
...
...
@@ -54,7 +52,7 @@ func tracetestMasterStorage(t0 *tracetest.T) {
lastTid
,
err
:=
zstor
.
Sync
(
bg
);
X
(
err
)
// create the cluster
t
:=
tNewCluster_MS
(
t0
,
"abc1"
,
zback
)
t
:=
tNewCluster_MS
(
t0
,
"abc1"
,
zback
,
tClusterOptions
{}
)
defer
t
.
Stop
()
M
:=
t
.
Master
(
"m"
)
C
:=
t
.
NewClient
(
"c"
,
"m:1"
)
...
...
@@ -349,14 +347,13 @@ func tracetestMasterStorage(t0 *tracetest.T) {
}
// XXX kill Mnet/Snet/Cnet -> pass which network to use to tNewCluster
func
benchmarkGetObject
(
b
*
testing
.
B
,
Mnet
,
Snet
,
Cnet
xnet
.
Networker
,
benchit
func
(
xcload1
func
()))
{
func
benchmarkGetObject
(
b
*
testing
.
B
,
opt
tClusterOptions
,
benchit
func
(
xcload1
func
()))
{
X
:=
exc
.
Raiseif
tracetest
.
Run
(
b
,
func
(
t0
*
tracetest
.
T
)
{
// create test cluster
zback
:=
xfs1back
(
"../zodb/storage/fs1/testdata/1.fs"
)
t
:=
tNewCluster_MS
(
t0
,
"abc1"
,
zback
)
t
:=
tNewCluster_MS
(
t0
,
"abc1"
,
zback
,
opt
)
defer
t
.
Stop
()
M
:=
t
.
Master
(
"m"
)
...
...
@@ -398,16 +395,16 @@ func benchmarkGetObject(b *testing.B, Mnet, Snet, Cnet xnet.Networker, benchit f
})
}
func
benchmarkGetObjectSerial
(
b
*
testing
.
B
,
Mnet
,
Snet
,
Cnet
xnet
.
Networker
)
{
benchmarkGetObject
(
b
,
Mnet
,
Snet
,
Cne
t
,
func
(
xcload1
func
())
{
func
benchmarkGetObjectSerial
(
b
*
testing
.
B
,
opt
tClusterOptions
)
{
benchmarkGetObject
(
b
,
op
t
,
func
(
xcload1
func
())
{
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
xcload1
()
}
})
}
func
benchmarkGetObjectParallel
(
b
*
testing
.
B
,
Mnet
,
Snet
,
Cnet
xnet
.
Networker
)
{
benchmarkGetObject
(
b
,
Mnet
,
Snet
,
Cne
t
,
func
(
xcload1
func
())
{
func
benchmarkGetObjectParallel
(
b
*
testing
.
B
,
opt
tClusterOptions
)
{
benchmarkGetObject
(
b
,
op
t
,
func
(
xcload1
func
())
{
//println()
b
.
SetParallelism
(
32
)
// we are io-bound
b
.
RunParallel
(
func
(
pb
*
testing
.
PB
)
{
...
...
@@ -420,29 +417,17 @@ func benchmarkGetObjectParallel(b *testing.B, Mnet, Snet, Cnet xnet.Networker) {
}
func
BenchmarkGetObjectNetPipe
(
b
*
testing
.
B
)
{
net
:=
pipenet
.
New
(
"testnet"
)
Mhost
:=
net
.
Host
(
"m"
)
Shost
:=
net
.
Host
(
"s"
)
Chost
:=
net
.
Host
(
"c"
)
benchmarkGetObjectSerial
(
b
,
Mhost
,
Shost
,
Chost
)
benchmarkGetObjectSerial
(
b
,
tClusterOptions
{
Network
:
"pipenet"
})
}
func
BenchmarkGetObjectNetPipeParallel
(
b
*
testing
.
B
)
{
net
:=
pipenet
.
New
(
"testnet"
)
Mhost
:=
net
.
Host
(
"m"
)
Shost
:=
net
.
Host
(
"s"
)
Chost
:=
net
.
Host
(
"c"
)
benchmarkGetObjectParallel
(
b
,
Mhost
,
Shost
,
Chost
)
benchmarkGetObjectParallel
(
b
,
tClusterOptions
{
Network
:
"pipenet"
})
}
func
BenchmarkGetObjectTCPlo
(
b
*
testing
.
B
)
{
net
:=
xnet
.
NetPlain
(
"tcp"
)
defer
net
.
Close
()
benchmarkGetObjectSerial
(
b
,
net
,
net
,
net
)
benchmarkGetObjectSerial
(
b
,
tClusterOptions
{
Network
:
"lonet"
})
}
func
BenchmarkGetObjectTCPloParallel
(
b
*
testing
.
B
)
{
net
:=
xnet
.
NetPlain
(
"tcp"
)
defer
net
.
Close
()
benchmarkGetObjectParallel
(
b
,
net
,
net
,
net
)
benchmarkGetObjectParallel
(
b
,
tClusterOptions
{
Network
:
"lonet"
})
}
go/neo/t_cluster_test.go
View file @
bae69488
...
...
@@ -26,6 +26,7 @@ import (
"sync"
"lab.nexedi.com/kirr/go123/xnet"
"lab.nexedi.com/kirr/go123/xnet/lonet"
"lab.nexedi.com/kirr/go123/xnet/pipenet"
"lab.nexedi.com/kirr/go123/xnet/virtnet"
"lab.nexedi.com/kirr/go123/xsync"
...
...
@@ -87,12 +88,19 @@ type ITestClient interface {
zodb
.
IStorageDriver
}
// tClusterOptions represents options for a test NEO cluster.
type
tClusterOptions
struct
{
// Network forces usage of this kind of network for node inter-networking (pipenet|lonet).
Network
string
}
// tNewCluster creates new NEO test cluster.
//
// At the end of the test the cluster has to be stopped via t.Stop().
//
// TODO add options describing whether node type X should be created via Go or via Py.
func
tNewCluster
(
ttest
*
tracetest
.
T
,
name
string
)
*
tCluster
{
func
tNewCluster
(
ttest
*
tracetest
.
T
,
name
string
,
opt
tClusterOptions
)
*
tCluster
{
t
:=
&
tCluster
{
T
:
ttest
,
name
:
name
,
...
...
@@ -100,10 +108,25 @@ func tNewCluster(ttest *tracetest.T, name string) *tCluster {
nodeTab
:
make
(
map
[
string
]
*
tNode
),
}
// test network
// XXX allow to use lonet
t
.
network
=
pipenet
.
AsVirtNet
(
pipenet
.
New
(
"testnet"
))
// create test network
network
:=
opt
.
Network
if
network
==
""
{
network
=
"pipenet"
// TODO default to lonet if Py nodes will be present
}
var
net
*
virtnet
.
SubNetwork
var
err
error
switch
network
{
default
:
panic
(
fmt
.
Sprintf
(
"unknown network %q"
,
network
))
case
"pipenet"
:
net
=
pipenet
.
AsVirtNet
(
pipenet
.
New
(
"testnet"
))
case
"lonet"
:
net
,
err
=
lonet
.
Join
(
context
.
Background
(),
""
)
// XXX ctx = ttest.Ctx ?
if
err
!=
nil
{
ttest
.
Fatal
(
err
)
}
}
t
.
network
=
net
t
.
traceOn
=
true
t
.
erouter
=
NewEventRouter
()
...
...
@@ -367,8 +390,8 @@ func (m *tMaster) Run(ctx context.Context) error {
// tNewCluster_MS starts simple NEO cluster with 1 master and 1 storage nodes.
// The cluster is returned in ready-to-start state.
func
tNewCluster_MS
(
t0
*
tracetest
.
T
,
name
string
,
Sback
storage
.
Backend
)
*
tCluster
{
t
:=
tNewCluster
(
t0
,
name
)
func
tNewCluster_MS
(
t0
*
tracetest
.
T
,
name
string
,
Sback
storage
.
Backend
,
opt
tClusterOptions
)
*
tCluster
{
t
:=
tNewCluster
(
t0
,
name
,
opt
)
t
.
NewMaster
(
"m"
)
t
.
NewStorage
(
"s"
,
"m:1"
,
Sback
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment