chore: bump go version

This commit is contained in:
Julian Sommer
2026-02-11 12:59:32 +10:00
parent 27530ba270
commit efe07a9ed4
6 changed files with 9 additions and 130 deletions
-2
View File
@@ -89,8 +89,6 @@ mulga/
└── viperblock/ # Block storage
```
Build flag: `GOEXPERIMENT=greenteagc` is used for the GC experiment.
### Testing with AWS CLI
```bash
+1 -1
View File
@@ -45,7 +45,7 @@ sudo add-apt-repository universe
sudo apt install nbdkit nbdkit-plugin-dev pkg-config qemu-system qemu-utils qemu-kvm libvirt-daemon-system libvirt-clients libvirt-dev make gcc unzip xz-utils file
```
Ensure the Go toolkit is installed for version 1.25.7 or higher. Recommended to install the latest directly from [https://go.dev/dl/](https://go.dev/dl/).
Ensure the Go toolkit is installed for version 1.26.0 or higher. Recommended to install the latest directly from [https://go.dev/dl/](https://go.dev/dl/).
Confirm Go is correctly installed, and set in your $PATH.
+3 -3
View File
@@ -43,7 +43,7 @@ build-ui:
# GO commands
go_build:
@echo "\n....Building $(GO_PROJECT_NAME)"
GOEXPERIMENT=greenteagc go build $(GO_BUILD_MOD) -ldflags "-s -w" -o ./bin/$(GO_PROJECT_NAME) cmd/hive/main.go
go build $(GO_BUILD_MOD) -ldflags "-s -w" -o ./bin/$(GO_PROJECT_NAME) cmd/hive/main.go
go_run:
@echo "\n....Running $(GO_PROJECT_NAME)...."
@@ -75,9 +75,9 @@ install-system:
iproute2 netcat-openbsd openssh-client wget git unzip sudo xz-utils file
install-go:
@echo "\n....Installing Go 1.25.7 for $(ARCH) ($(GO_ARCH))...."
@echo "\n....Installing Go 1.26.0 for $(ARCH) ($(GO_ARCH))...."
@if [ ! -d "/usr/local/go" ]; then \
curl -L https://go.dev/dl/go1.25.7.linux-$(GO_ARCH).tar.gz | tar -C /usr/local -xz; \
curl -L https://go.dev/dl/go1.26.0.linux-$(GO_ARCH).tar.gz | tar -C /usr/local -xz; \
else \
echo "Go already installed in /usr/local/go"; \
fi
+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/mulgadc/hive
go 1.25.7
go 1.26.0
require (
github.com/NYTimes/gziphandler v1.1.1
+4 -4
View File
@@ -11,10 +11,10 @@ import (
// Shared NATS servers for all daemon tests — started once in TestMain.
var (
sharedNATSServer *server.Server
sharedNATSURL string
sharedJSServer *server.Server
sharedJSNATSURL string
sharedNATSServer *server.Server
sharedNATSURL string
sharedJSServer *server.Server
sharedJSNATSURL string
)
func TestMain(m *testing.M) {
-119
View File
@@ -1,119 +0,0 @@
#!/bin/bash
# scripts/benchmark-gc.sh
# Benchmark script to compare Go GC performance (Standard vs GreenteaGC)
set -e
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
BIN_PATH="$PROJECT_ROOT/bin/hive"
DATA_DIR="$HOME/hive"
LOGS_DIR="$DATA_DIR/logs"
ITERATIONS=500
CONCURRENCY=12
# Ensure AWS profile is set
export AWS_PROFILE=hive
# Skip SSL verification for local testing
export AWS_CA_BUNDLE="$DATA_DIR/config/server.pem"
# Function to build the binary
build_binary() {
local experiment="$1"
echo "🔨 Building with GOEXPERIMENT=$experiment..."
cd "$PROJECT_ROOT"
# Clean build to ensure no stale artifacts
rm -f "$BIN_PATH"
if [ "$experiment" == "none" ]; then
go build -ldflags "-s -w" -o "$BIN_PATH" cmd/hive/main.go
else
GOEXPERIMENT="$experiment" go build -ldflags "-s -w" -o "$BIN_PATH" cmd/hive/main.go
fi
}
# Function to start services with GC tracing
start_services_traced() {
echo "🚀 Starting services with GODEBUG=gctrace=1..."
export GODEBUG=gctrace=1
"$PROJECT_ROOT/scripts/start-dev.sh" "$DATA_DIR"
sleep 10 # More time for services to stabilize
}
# Function to run load test
run_load() {
echo "🔥 Warming up (20 requests)..."
seq 20 | xargs -I{} -P $CONCURRENCY aws ec2 describe-instances > /dev/null
echo "🏃 Running load test ($ITERATIONS requests)..."
local start_time=$(date +%s%N)
seq $ITERATIONS | xargs -I{} -P $CONCURRENCY aws ec2 describe-instances > /dev/null
local end_time=$(date +%s%N)
local duration=$(( (end_time - start_time) / 1000000 ))
echo "⏱️ Load test completed in ${duration}ms"
echo "$duration" > "$LOGS_DIR/last_duration.txt"
}
# Function to analyze GC logs
analyze_logs() {
local label="$1"
echo "📊 Analyzing logs for $label..."
# Analyze the AWS Gateway log (usually the most active)
local log_file="$LOGS_DIR/awsgw.log"
if [ ! -f "$log_file" ]; then
echo "❌ Log file $log_file not found"
return
fi
# Extract GC stats: gc N @T ... total_time ...
# Format: gc 1 @0.012s 5%: 0.016+0.45+0.003 ms clock, 0.25+0.45/0.70/1.2+0.054 ms cpu, 4->4->0 MB, 5 MB goal, 8 P
local gc_count=$(grep -c "^gc " "$log_file" || echo 0)
local total_gc_ms=$(grep "^gc " "$log_file" | awk -F'ms clock' '{print $1}' | awk '{print $NF}' | awk -F'+' '{sum += $1+$2+$3} END {print sum}')
# Memory usage (max RSS of the process)
local max_rss=$(ps aux | grep "hive service awsgw start" | grep -v grep | awk '{print $6}' | sort -nr | head -n1)
local duration=$(cat "$LOGS_DIR/last_duration.txt")
echo "----------------------------------------"
echo "Results for $label:"
echo "Requests: $ITERATIONS"
echo "Concurrency: $CONCURRENCY"
echo "Total Time: ${duration}ms"
echo "Avg Latency: $(( duration / ITERATIONS ))ms"
echo "GC Cycles: $gc_count"
echo "Total GC Time: ${total_gc_ms}ms"
echo "Max RSS: ${max_rss} KB"
echo "----------------------------------------"
# Save to a summary file
echo "$label,$duration,$gc_count,$total_gc_ms,$max_rss" >> "$PROJECT_ROOT/gc_benchmark_summary.csv"
}
# Cleanup
echo "Cleaning up previous runs..."
"$PROJECT_ROOT/scripts/stop-dev.sh" || true
rm -f "$PROJECT_ROOT/gc_benchmark_summary.csv"
echo "Label,TotalTime_ms,GCCycles,TotalGCTime_ms,MaxRSS_KB" > "$PROJECT_ROOT/gc_benchmark_summary.csv"
# 1. Standard GC Benchmark
echo "🔵 PHASE 1: Standard GC"
build_binary "none"
start_services_traced
run_load
analyze_logs "Standard"
"$PROJECT_ROOT/scripts/stop-dev.sh"
sleep 5
# 2. GreenteaGC Benchmark
echo "🟢 PHASE 2: GreenteaGC"
build_binary "greenteagc"
start_services_traced
run_load
analyze_logs "GreenteaGC"
"$PROJECT_ROOT/scripts/stop-dev.sh"
echo "✅ Benchmarking complete! Summary saved to gc_benchmark_summary.csv"
cat "$PROJECT_ROOT/gc_benchmark_summary.csv" | column -t -s,