diff --git a/ethereum/reth/ethereum-mainnet-reth-minimal-trace--nimbus.yml b/ethereum/reth/ethereum-mainnet-reth-minimal-trace--nimbus.yml index 1922261e..1a4c4675 100644 --- a/ethereum/reth/ethereum-mainnet-reth-minimal-trace--nimbus.yml +++ b/ethereum/reth/ethereum-mainnet-reth-minimal-trace--nimbus.yml @@ -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 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 +# +# 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: # diff --git a/op/reth/base-mainnet-op-reth-minimal-trace--benchmark.yml b/op/reth/base-mainnet-op-reth-minimal-trace--benchmark.yml index 0075d325..ba6f4209 100644 --- a/op/reth/base-mainnet-op-reth-minimal-trace--benchmark.yml +++ b/op/reth/base-mainnet-op-reth-minimal-trace--benchmark.yml @@ -30,7 +30,17 @@ x-logging-defaults: &logging-defaults services: 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: # TCP Performance net.ipv4.tcp_slow_start_after_idle: 0 # Disable slow start after idle diff --git a/op/reth/base-mainnet-op-reth-pruned-trace--benchmark.yml b/op/reth/base-mainnet-op-reth-pruned-trace--benchmark.yml index b8bedf88..1b3fb10b 100644 --- a/op/reth/base-mainnet-op-reth-pruned-trace--benchmark.yml +++ b/op/reth/base-mainnet-op-reth-pruned-trace--benchmark.yml @@ -30,7 +30,17 @@ x-logging-defaults: &logging-defaults services: 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: # TCP Performance net.ipv4.tcp_slow_start_after_idle: 0 # Disable slow start after idle diff --git a/reth.Dockerfile b/reth.Dockerfile index 9f098a6c..6cb9721c 100644 --- a/reth.Dockerfile +++ b/reth.Dockerfile @@ -83,9 +83,9 @@ ENV SCCACHE_DIR=/tmp/sccache ENV RUSTC_WRAPPER=/usr/local/bin/sccache # Set C/C++ flags for dependencies -ENV CFLAGS_BASE="-O3 -flto=thin -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 LDFLAGS="-Wl,-O3 -Wl,--as-needed -Wl,--gc-sections -flto=thin" +ENV CFLAGS_BASE="-O3 -flto -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" # Configure architecture-specific flags and build 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" \ CFLAGS="$CFLAGS_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 \ 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" \