Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOISSUE: performance test branch #763

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ledger-core/configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type CommonAppConfig struct {
type VirtualNodeConfig struct {
CommonAppConfig
LogicRunner LogicRunner
Virtual Virtual
}

type LightNodeConfig struct {
Expand All @@ -66,6 +67,7 @@ type Configuration struct {
Log Log
Metrics Metrics
LogicRunner LogicRunner
Virtual Virtual
APIRunner APIRunner
AdminAPIRunner APIRunner
TestWalletAPI TestWalletAPI
Expand Down Expand Up @@ -101,6 +103,7 @@ func NewConfiguration() Configuration {
Log: NewLog(),
Metrics: NewMetrics(),
LogicRunner: NewLogicRunner(),
Virtual: NewVirtual(),
APIRunner: NewAPIRunner(false),
AdminAPIRunner: NewAPIRunner(true),
AvailabilityChecker: NewAvailabilityChecker(),
Expand Down
2 changes: 2 additions & 0 deletions ledger-core/configuration/testdata/changed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ service:
cachedirectory: network_cache
ledger:
lightchainlimit: 5
virtual:
maxrunners: 0
log:
level: Debug
adapter: zerolog
Expand Down
2 changes: 2 additions & 0 deletions ledger-core/configuration/testdata/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ service:
cachedirectory: network_cache
ledger:
lightchainlimit: 5
virtual:
maxrunners: 0
log:
level: Info
adapter: zerolog
Expand Down
21 changes: 21 additions & 0 deletions ledger-core/configuration/virtual.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2020 Insolar Network Ltd.
// All rights reserved.
// This material is licensed under the Insolar License version 1.0,
// available at https://github.com/insolar/assured-ledger/blob/master/LICENSE.md.

package configuration

// Virtual holds configuration for virtual.
type Virtual struct {
// MaxRunners limits number of contract executions running in parallel.
// If set to zero or a negative value, limit will be set automatically to
// `( runtime.NumCPU() - 2 ) but not less then 4`.
MaxRunners int
}

// NewVirtual creates new default virtual configuration.
func NewVirtual() Virtual {
return Virtual{
MaxRunners: 0, // auto
}
}
3 changes: 2 additions & 1 deletion ledger-core/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ func (m *Metrics) Init(ctx context.Context) error {
zpages.Handle(mux, "/debug")
}

inslogger.FromContext(ctx).Warn("ignoring config param INSOLAR_METRICS_NAMESPACE = %s", m.config.Namespace)
_, err := insmetrics.RegisterPrometheus(
m.config.Namespace,
insolarNamespace,
m.registry,
m.config.ReportingPeriod,
errLogger,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ log:
outputparams: ""
buffersize: 0
llbuffersize: 0
virtual:
maxrunners: 0
metrics:
listenaddress: 0.0.0.0:9091
namespace: placeholder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ log:
outputparams: ""
buffersize: 0
llbuffersize: 0
virtual:
maxrunners: 0
metrics:
listenaddress: 0.0.0.0:9091
namespace: placeholder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ log:
outputparams: ""
buffersize: 0
llbuffersize: 0
virtual:
maxrunners: 0
metrics:
listenaddress: 0.0.0.0:9091
namespace: placeholder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ log:
outputparams: ""
buffersize: 0
llbuffersize: 0
virtual:
maxrunners: 0
metrics:
listenaddress: 0.0.0.0:9091
namespace: placeholder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ log:
outputparams: ""
buffersize: 0
llbuffersize: 0
virtual:
maxrunners: 0
metrics:
listenaddress: 0.0.0.0:9091
namespace: placeholder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ log:
outputparams: ""
buffersize: 0
llbuffersize: 0
virtual:
maxrunners: 0
metrics:
listenaddress: 0.0.0.0:9091
namespace: placeholder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ service:
cachedirectory: network_cache
ledger:
lightchainlimit: 5
virtual:
maxrunners: 0
log:
level: Debug
adapter: zerolog
Expand Down Expand Up @@ -58,4 +60,4 @@ tracer:
probabilityrate: 1
samplingrules: {}
introspection:
addr: 0.0.0.0:55503
addr: 0.0.0.0:55503
8 changes: 6 additions & 2 deletions ledger-core/server/internal/virtual/app_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package virtual

import (
"context"
"fmt"
"runtime"

"github.com/insolar/assured-ledger/ledger-core/application/testwalletapi"
Expand All @@ -29,13 +30,16 @@ func AppFactory(ctx context.Context, cfg configuration.Configuration, comps insa
virtualDispatcher.Affinity = comps.AffinityHelper
virtualDispatcher.AuthenticationService = authentication.NewService(ctx, comps.AffinityHelper)

// TODO: rewrite this after PLAT-432
if n := runtime.NumCPU() - 2; n > 4 {
if cfg.Virtual.MaxRunners > 0 {
virtualDispatcher.MaxRunners = cfg.Virtual.MaxRunners
} else if n := runtime.NumCPU() - 2; n > 4 {
virtualDispatcher.MaxRunners = n
} else {
virtualDispatcher.MaxRunners = 4
}

fmt.Println("======= MAX RUNNERS: ", virtualDispatcher.MaxRunners)

testAPI := testwalletapi.NewTestWalletServer(cfg.TestWalletAPI, virtualDispatcher, comps.BeatHistory)

// ComponentManager can only work with by-pointer objects
Expand Down