This commit is contained in:
Para Dox
2025-05-25 21:19:23 +07:00
parent edb6e7518b
commit a70284eec1
4 changed files with 56 additions and 5 deletions

View File

@@ -9,6 +9,17 @@ x-logging-defaults: &logging-defaults
# this is why we have a minimal profile that doesn't actually exist in reth. # this is why we have a minimal profile that doesn't actually exist in reth.
# This node is built from source with architecture-specific optimizations # This node is built from source with architecture-specific optimizations
# Build command: docker compose build --build-arg ARCH_TARGET=${ARCH_TARGET:-native} ethereum-mainnet-reth-minimal # Build command: docker compose build --build-arg ARCH_TARGET=${ARCH_TARGET:-native} ethereum-mainnet-reth-minimal
#
# IMPORTANT: Cache optimization considerations
# If running multiple nodes on the same machine, be aware that:
# - L3 cache is shared across all cores, causing cache contention
# - Multiple nodes compete for cache space, reducing optimization effectiveness
# - Consider CPU pinning to minimize cache conflicts:
# docker run --cpuset-cpus="0-7" ethereum-mainnet-reth-minimal # Pin to specific cores
# - For AMD X3D CPUs, CCD0 (cores 0-7) has the 3D V-Cache
# - For multi-node setups, generic builds may perform better than cache-optimized ones
# Usage: # Usage:
# #

View File

@@ -30,7 +30,17 @@ x-logging-defaults: &logging-defaults
services: services:
base-mainnet-op-reth-minimal: base-mainnet-op-reth-minimal:
image: ${BASE_RETH_IMAGE:-ghcr.io/paradigmxyz/op-reth}:${BASE_MAINNET_RETH_VERSION:-v1.4.3} build:
context: ./
dockerfile: reth.Dockerfile
args:
LLVM_IMAGE: ${LLVM_IMAGE:-snowstep/llvm}
LLVM_VERSION: ${LLVM_VERSION:-20250514100911}
RETH_VERSION: ${BASE_MAINNET_RETH_VERSION:-v1.4.3}
RETH_REPO: ${BASE_MAINNET_RETH_REPO:-https://github.com/paradigmxyz/reth}
ARCH_TARGET: ${ARCH_TARGET:-native}
PROFILE: ${RETH_BUILD_PROFILE:-maxperf}
BUILD_OP_RETH: true
sysctls: sysctls:
# TCP Performance # TCP Performance
net.ipv4.tcp_slow_start_after_idle: 0 # Disable slow start after idle net.ipv4.tcp_slow_start_after_idle: 0 # Disable slow start after idle

View File

@@ -30,7 +30,17 @@ x-logging-defaults: &logging-defaults
services: services:
base-mainnet-op-reth-pruned: base-mainnet-op-reth-pruned:
image: ${BASE_RETH_IMAGE:-ghcr.io/paradigmxyz/op-reth}:${BASE_MAINNET_RETH_VERSION:-v1.4.3} build:
context: ./
dockerfile: reth.Dockerfile
args:
LLVM_IMAGE: ${LLVM_IMAGE:-snowstep/llvm}
LLVM_VERSION: ${LLVM_VERSION:-20250514100911}
RETH_VERSION: ${BASE_MAINNET_RETH_VERSION:-v1.4.3}
RETH_REPO: ${BASE_MAINNET_RETH_REPO:-https://github.com/paradigmxyz/reth}
ARCH_TARGET: ${ARCH_TARGET:-native}
PROFILE: ${RETH_BUILD_PROFILE:-maxperf}
BUILD_OP_RETH: true
sysctls: sysctls:
# TCP Performance # TCP Performance
net.ipv4.tcp_slow_start_after_idle: 0 # Disable slow start after idle net.ipv4.tcp_slow_start_after_idle: 0 # Disable slow start after idle

View File

@@ -83,9 +83,9 @@ ENV SCCACHE_DIR=/tmp/sccache
ENV RUSTC_WRAPPER=/usr/local/bin/sccache ENV RUSTC_WRAPPER=/usr/local/bin/sccache
# Set C/C++ flags for dependencies # Set C/C++ flags for dependencies
ENV CFLAGS_BASE="-O3 -flto=thin -fomit-frame-pointer -fno-semantic-interposition -funroll-loops -ffast-math" ENV CFLAGS_BASE="-O3 -flto -fomit-frame-pointer -fno-semantic-interposition -funroll-loops -ffast-math"
ENV CXXFLAGS_BASE="-O3 -flto=thin -fomit-frame-pointer -fno-semantic-interposition -funroll-loops -ffast-math" ENV CXXFLAGS_BASE="-O3 -flto -fomit-frame-pointer -fno-semantic-interposition -funroll-loops -ffast-math"
ENV LDFLAGS="-Wl,-O3 -Wl,--as-needed -Wl,--gc-sections -flto=thin" ENV LDFLAGS="-Wl,-O3 -Wl,--as-needed -Wl,--gc-sections -flto"
# Configure architecture-specific flags and build # Configure architecture-specific flags and build
RUN --mount=type=cache,target=/usr/local/cargo/registry \ RUN --mount=type=cache,target=/usr/local/cargo/registry \
@@ -159,6 +159,26 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \
RUSTFLAGS="-C target-cpu=native -C link-arg=-fuse-ld=/usr/local/bin/mold -C opt-level=3" \ RUSTFLAGS="-C target-cpu=native -C link-arg=-fuse-ld=/usr/local/bin/mold -C opt-level=3" \
CFLAGS="$CFLAGS_BASE -march=native" \ CFLAGS="$CFLAGS_BASE -march=native" \
CXXFLAGS="$CXXFLAGS_BASE -march=native"; \ CXXFLAGS="$CXXFLAGS_BASE -march=native"; \
elif [ "$ARCH_TARGET" = "multinode-zen4" ] || [ "$ARCH_TARGET" = "multinode-7950x" ]; then \
# Optimized for multiple nodes on same machine - reduced cache assumptions
RUSTFLAGS="-C target-cpu=znver4 -C link-arg=-fuse-ld=/usr/local/bin/mold -C opt-level=3 -C llvm-args=-enable-machine-outliner" \
CFLAGS="$CFLAGS_BASE -march=znver4 -mtune=znver4 --param l1-cache-line-size=64 --param l1-cache-size=32 --param l2-cache-size=512" \
CXXFLAGS="$CXXFLAGS_BASE -march=znver4 -mtune=znver4 --param l1-cache-line-size=64 --param l1-cache-size=32 --param l2-cache-size=512"; \
elif [ "$ARCH_TARGET" = "multinode-zen5" ] || [ "$ARCH_TARGET" = "multinode-9950x" ]; then \
# Optimized for multiple nodes on same machine - reduced cache assumptions
RUSTFLAGS="-C target-cpu=znver5 -C link-arg=-fuse-ld=/usr/local/bin/mold -C opt-level=3 -C llvm-args=-enable-machine-outliner" \
CFLAGS="$CFLAGS_BASE -march=znver5 -mtune=znver5 --param l1-cache-line-size=64 --param l1-cache-size=48 --param l2-cache-size=512" \
CXXFLAGS="$CXXFLAGS_BASE -march=znver5 -mtune=znver5 --param l1-cache-line-size=64 --param l1-cache-size=48 --param l2-cache-size=512"; \
elif [ "$ARCH_TARGET" = "multinode-epyc" ]; then \
# Optimized for multiple nodes on EPYC systems - assume shared resources
RUSTFLAGS="-C target-cpu=znver4 -C link-arg=-fuse-ld=/usr/local/bin/mold -C opt-level=3" \
CFLAGS="$CFLAGS_BASE -march=znver4 -mtune=znver4 --param l1-cache-line-size=64 --param l1-cache-size=32 --param l2-cache-size=256" \
CXXFLAGS="$CXXFLAGS_BASE -march=znver4 -mtune=znver4 --param l1-cache-line-size=64 --param l1-cache-size=32 --param l2-cache-size=256"; \
elif [ "$ARCH_TARGET" = "multinode-generic" ]; then \
# Generic multinode optimization - conservative cache assumptions
RUSTFLAGS="-C target-cpu=x86-64-v3 -C link-arg=-fuse-ld=/usr/local/bin/mold -C opt-level=3" \
CFLAGS="$CFLAGS_BASE -march=x86-64-v3 --param l1-cache-line-size=64 --param l1-cache-size=32 --param l2-cache-size=256" \
CXXFLAGS="$CXXFLAGS_BASE -march=x86-64-v3 --param l1-cache-line-size=64 --param l1-cache-size=32 --param l2-cache-size=256"; \
else \ else \
RUSTFLAGS="-C target-cpu=$ARCH_TARGET -C link-arg=-fuse-ld=/usr/local/bin/mold -C opt-level=3" \ RUSTFLAGS="-C target-cpu=$ARCH_TARGET -C link-arg=-fuse-ld=/usr/local/bin/mold -C opt-level=3" \
CFLAGS="$CFLAGS_BASE -march=$ARCH_TARGET" \ CFLAGS="$CFLAGS_BASE -march=$ARCH_TARGET" \