Skip to content

Commit

Permalink
add jemalloc printout, disable jemalloc
Browse files Browse the repository at this point in the history
  • Loading branch information
iurii-ssv committed Oct 29, 2024
1 parent 27405c8 commit 3557717
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
COMMIT=$(git rev-parse HEAD) && \
VERSION=$(git describe --tags $(git rev-list --tags --max-count=1) --always) && \
CGO_ENABLED=1 GOOS=linux go install \
-tags="blst_enabled,jemalloc" \
-tags="blst_enabled" \
-ldflags "-X main.Commit=$COMMIT -X main.Version=$VERSION -linkmode external -extldflags \"-static -lm\"" \
./cmd/ssvnode

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ifneq ($(SHARE_CONFIG),)
NODE_COMMAND_ARGS+= --share-config=${SHARE_CONFIG}
endif

BOOTNODE_COMMAND_ARGS_ARGS=--config=${CONFIG_PATH}
BOOTNODE_COMMAND_ARGS=--config=${CONFIG_PATH}

COV_CMD="-cover"
ifeq ($(COVERAGE),true)
Expand Down Expand Up @@ -152,7 +152,7 @@ stop:
.PHONY: start-boot-node
start-boot-node:
@echo "Running start-boot-node"
${BUILD_PATH} start-boot-node ${BOOTNODE_COMMAND_ARGS_ARGS}
${BUILD_PATH} start-boot-node ${BOOTNODE_COMMAND_ARGS}

MONITOR_NODES=prometheus grafana
.PHONY: docker-monitor
Expand Down
6 changes: 6 additions & 0 deletions storage/kv/badger.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package kv
import (
"bytes"
"context"
"github.com/dgraph-io/ristretto/z"
"sync"
"time"

Expand Down Expand Up @@ -91,6 +92,11 @@ func createDB(logger *zap.Logger, options basedb.Options, inMemory bool) (*Badge
go badgerDB.periodicallyCollectGarbage(logger, options.GCInterval)
}

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))

return &badgerDB, nil
}

Expand Down

0 comments on commit 3557717

Please sign in to comment.