Skip to content

Commit

Permalink
enable jemaloc, fix misc issues
Browse files Browse the repository at this point in the history
  • Loading branch information
iurii-ssv committed Oct 29, 2024
1 parent 827064a commit 78114b2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cli/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Args struct {
// Global expose available global config for cli command
type Global struct {
LogLevel string `yaml:"LogLevel" env:"LOG_LEVEL" env-default:"info" env-description:"Defines logger's log level"`
LogFormat string `yaml:"LogFormat" env:"LOG_FORMAT" env-default:"console" env-description:"Defines logger's encoding, valid values are 'json' and 'console'(default)"`
LogFormat string `yaml:"LogFormat" env:"LOG_FORMAT" env-default:"console" env-description:"Defines logger's encoding, valid values are 'json' and 'console' (default)"`
LogLevelFormat string `yaml:"LogLevelFormat" env:"LOG_LEVEL_FORMAT" env-default:"capitalColor" env-description:"Defines logger's level format, valid values are 'capitalColor' (default), 'capital' or 'lowercase'"`
LogFilePath string `yaml:"LogFilePath" env:"LOG_FILE_PATH" env-default:"./data/debug.log" env-description:"Defines a file path to write logs into"`
LogFileSize int `yaml:"LogFileSize" env:"LOG_FILE_SIZE" env-default:"500" env-description:"Defines a file size in megabytes to rotate logs"`
Expand Down
2 changes: 1 addition & 1 deletion cli/operator/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ var StartNodeCmd = &cobra.Command{
operatorPrivKey,
keyManager,
)
nodeProber.AddNode(nodeprobe.EvenSyncerNode, eventSyncer)
nodeProber.AddNode(nodeprobe.EventSyncerNode, eventSyncer)
}

nodeProber.Start(cmd.Context())
Expand Down
13 changes: 9 additions & 4 deletions nodeprobe/nodeprobe.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

const (
EvenSyncerNode = "Ethereum event syncer"
EventSyncerNode = "Ethereum event syncer"
ConsensusClientNode = "Ethereum consensus client"
ExecutionClientNode = "Ethereum execution client"

Expand Down Expand Up @@ -110,7 +110,12 @@ func (p *Prober) probe(ctx context.Context) {
p.healthy.Store(healthy.Load())

if !p.healthy.Load() {
p.logger.Error("not all Ethereum nodes are healthy")
p.logger.Error(fmt.Sprintf(
"not all nodes (%s, %s, %s), are healthy",
EventSyncerNode,
ConsensusClientNode,
ExecutionClientNode,
))
if h := p.unhealthyHandler; h != nil {
h()
}
Expand Down Expand Up @@ -159,9 +164,9 @@ func (p *Prober) CheckEventSyncerHealth(ctx context.Context) error {
defer p.nodesMu.Unlock()
ctx, cancel := context.WithTimeout(ctx, p.interval)
defer cancel()
es, ok := p.nodes[EvenSyncerNode]
es, ok := p.nodes[EventSyncerNode]
if !ok {
return fmt.Errorf("%s not found", EvenSyncerNode)
return fmt.Errorf("%s not found", EventSyncerNode)
}
return es.Healthy(ctx)
}
10 changes: 4 additions & 6 deletions storage/kv/badger.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ package kv
import (
"bytes"
"context"
"github.com/dgraph-io/ristretto/z"
"sync"
"time"

"github.com/ssvlabs/ssv/logging/fields"

"github.com/dgraph-io/badger/v4"
"github.com/dgraph-io/ristretto/z"
"github.com/pkg/errors"
"go.uber.org/zap"

"github.com/ssvlabs/ssv/logging"
"github.com/ssvlabs/ssv/logging/fields"
"github.com/ssvlabs/ssv/storage/basedb"
"go.uber.org/zap"
)

// BadgerDB struct
Expand Down Expand Up @@ -95,7 +93,7 @@ func createDB(logger *zap.Logger, options basedb.Options, inMemory bool) (*Badge
out := z.CallocNoRef(1, "jemalloc check")
defer z.Free(out)
jemallocEnabled := len(out) > 0
logger.Debug("jemalloc allocator will be used", zap.Bool("jemalloc_enabled", jemallocEnabled))
logger.Debug("checking if jemalloc allocator will be used", zap.Bool("jemalloc_enabled", jemallocEnabled))

return &badgerDB, nil
}
Expand Down

0 comments on commit 78114b2

Please sign in to comment.