@@ -21,273 +21,42 @@ spec:
2121 initContainers :
2222 - name : fix-permissions
2323 image : busybox
24- command : ["sh", "-c", "chmod -R 777 /data && echo 'Permissions fixed!'"]
24+ command : ["sh", "-c", "mkdir -p /data/workspace && chmod -R 777 /data/workspace && echo 'Permissions fixed!'"]
2525 volumeMounts :
2626 - name : data
2727 mountPath : /data
2828 containers :
2929 - name : test
3030 image : ghcr.io/starkware-libs/sequencer/sequencer:dean-k8s_batching_test-fd3d4f1
31- workingDir : /data
31+ workingDir : /data/workspace
3232 command : ["/bin/bash", "-c"]
33+ env :
34+ - name : RUST_LOG
35+ value : info
36+ - name : BLOCKS_TO_SYNC
37+ value : " 200000"
38+ - name : BATCH_SIZE
39+ value : " 100"
40+ - name : PATH
41+ value : /app/target/release:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
3342 args :
3443 - |
3544 set -e
3645
3746 echo "========================================="
38- echo "DEAN'S BATCHING TEST: 0 → 250K "
47+ echo "DEAN'S BATCHING TEST: 0 → 200K "
3948 echo "========================================="
4049 echo ""
41-
42- # CLEAN THE DISK FIRST (remove any old data)
43- echo "Cleaning disk of any previous test data..."
44- echo "Contents before cleanup:"
45- ls -la /data/
46- echo ""
47-
48- # Delete everything except lost+found
49- cd /data
50- find . -mindepth 1 -maxdepth 1 ! -name 'lost+found' -exec rm -rf {} + 2>/dev/null || true
51-
52- echo "Contents after cleanup:"
53- ls -la /data/
54- echo ""
55-
56- # Verify it's clean
57- if [ "$(find /data -name 'SN_MAIN' -o -name 'batcher' -o -name 'class_manager' 2>/dev/null)" ]; then
58- echo "❌ ERROR: Failed to clean disk! Old databases still exist!"
59- find /data -name 'SN_MAIN' -o -name 'batcher' -o -name 'class_manager'
60- exit 1
61- fi
62-
63- echo "✓ Disk cleaned successfully"
64- echo ""
65-
66- export PATH="/app/target/release:$PATH"
67- export RUST_LOG=info
68-
69- TARGET=250000
70-
71- # Test WITHOUT batching
72- echo ""
73- echo "=== TEST 1: WITHOUT BATCHING ==="
74- mkdir -p /data/test_without
75- cd /data/test_without
76-
77- cat > config.json << 'EOF'
78- {
79- "state_sync_config.central_sync_client_config.sync_config.enable_block_batching": false,
80- "state_sync_config.storage_config.db_config.path_prefix": "."
81- }
82- EOF
83-
84- echo "Starting sync WITHOUT batching from block 0..."
85- START1=$(date +%s)
86-
87- apollo_node \
88- --config_file /configs/base_layer_config.json \
89- --config_file /configs/batcher_config.json \
90- --config_file /configs/class_manager_config.json \
91- --config_file /configs/consensus_manager_config.json \
92- --config_file /configs/revert_config.json \
93- --config_file /configs/versioned_constants_overrides_config.json \
94- --config_file /configs/validate_resource_bounds_config.json \
95- --config_file /configs/gateway_config.json \
96- --config_file /configs/http_server_config.json \
97- --config_file /configs/l1_endpoint_monitor_config.json \
98- --config_file /configs/l1_gas_price_provider_config.json \
99- --config_file /configs/l1_gas_price_scraper_config.json \
100- --config_file /configs/l1_provider_config.json \
101- --config_file /configs/l1_scraper_config.json \
102- --config_file /configs/mempool_config.json \
103- --config_file /configs/mempool_p2p_config.json \
104- --config_file /configs/monitoring_endpoint_config.json \
105- --config_file /configs/sierra_compiler_config.json \
106- --config_file /configs/state_sync_config.json \
107- --config_file /configs/mainnet_deployment \
108- --config_file /configs/mainnet_hybrid \
109- --config_file /configs/node_config \
110- --config_file /configs/minimal_node_config.json \
111- --config_file /configs/mainnet_secrets.json \
112- --config_file config.json > sync.log 2>&1 &
113-
114- PID1=$!
115- echo "PID: $PID1"
116- echo "Monitoring progress (checking every 1 second)..."
117-
118- # Monitor until target
119- LAST_BLOCK=0
120- while kill -0 $PID1 2>/dev/null; do
121- CURRENT=$(tail -100 sync.log 2>/dev/null | grep -oE 'height[^=]*=[^0-9]*[0-9]+' | grep -oE '[0-9]+' | sort -n | tail -1)
122-
123- if [ ! -z "$CURRENT" ] && [ "$CURRENT" != "$LAST_BLOCK" ]; then
124- LAST_BLOCK=$CURRENT
125- ELAPSED=$(($(date +%s) - START1))
126- echo " Block $CURRENT (${ELAPSED}s elapsed)"
127- fi
128-
129- if [ ! -z "$CURRENT" ] && [ "$CURRENT" -ge "$TARGET" ]; then
130- echo " Reached target! Stopping at block $CURRENT..."
131- kill -9 $PID1 2>/dev/null || true
132- break
133- fi
134-
135- sleep 1
136- done
137-
138- wait $PID1 2>/dev/null || true
139-
140- END1=$(date +%s)
141- TIME1=$((END1 - START1))
142- BLOCKS1=$(tail -100 sync.log 2>/dev/null | grep -oE 'height[^=]*=[^0-9]*[0-9]+' | grep -oE '[0-9]+' | sort -n | tail -1)
143- BLOCKS1=${BLOCKS1:-0}
144-
145- echo ""
146- echo "=== RESULT 1: WITHOUT BATCHING ==="
147- echo " Blocks synced: $BLOCKS1"
148- echo " Time: ${TIME1}s ($(($TIME1 / 60))m $(($TIME1 % 60))s)"
149- if [ "$TIME1" -gt 0 ] && [ "$BLOCKS1" -gt 0 ]; then
150- SPEED1=$(awk "BEGIN {printf \"%.2f\", $BLOCKS1 / $TIME1}")
151- echo " Speed: $SPEED1 blocks/sec"
152- else
153- SPEED1=0
154- echo " Speed: N/A"
155- fi
156-
157- DISK1=$(du -sh . 2>/dev/null | cut -f1)
158- echo " Disk usage: $DISK1"
159-
160- # Clean for next test
161- echo ""
162- echo "Cleaning up for next test..."
163- cd /data
164- rm -rf /data/test_without /data/batcher /data/class_manager
165- echo " ✓ Cleaned"
166-
167- # Test WITH batching
168- echo ""
169- echo "=== TEST 2: WITH BATCHING ==="
170- mkdir -p /data/test_with
171- cd /data/test_with
172-
173- cat > config.json << 'EOF'
174- {
175- "state_sync_config.central_sync_client_config.sync_config.enable_block_batching": true,
176- "state_sync_config.central_sync_client_config.sync_config.block_batch_size": 100,
177- "state_sync_config.storage_config.db_config.path_prefix": "."
178- }
179- EOF
180-
181- echo "Starting sync WITH batching from block 0..."
182- START2=$(date +%s)
183-
184- apollo_node \
185- --config_file /configs/base_layer_config.json \
186- --config_file /configs/batcher_config.json \
187- --config_file /configs/class_manager_config.json \
188- --config_file /configs/consensus_manager_config.json \
189- --config_file /configs/revert_config.json \
190- --config_file /configs/versioned_constants_overrides_config.json \
191- --config_file /configs/validate_resource_bounds_config.json \
192- --config_file /configs/gateway_config.json \
193- --config_file /configs/http_server_config.json \
194- --config_file /configs/l1_endpoint_monitor_config.json \
195- --config_file /configs/l1_gas_price_provider_config.json \
196- --config_file /configs/l1_gas_price_scraper_config.json \
197- --config_file /configs/l1_provider_config.json \
198- --config_file /configs/l1_scraper_config.json \
199- --config_file /configs/mempool_config.json \
200- --config_file /configs/mempool_p2p_config.json \
201- --config_file /configs/monitoring_endpoint_config.json \
202- --config_file /configs/sierra_compiler_config.json \
203- --config_file /configs/state_sync_config.json \
204- --config_file /configs/mainnet_deployment \
205- --config_file /configs/mainnet_hybrid \
206- --config_file /configs/node_config \
207- --config_file /configs/minimal_node_config.json \
208- --config_file /configs/mainnet_secrets.json \
209- --config_file config.json > sync.log 2>&1 &
210-
211- PID2=$!
212- echo "PID: $PID2"
213- echo "Monitoring progress (checking every 1 second)..."
214-
215- # Monitor until target
216- LAST_BLOCK=0
217- while kill -0 $PID2 2>/dev/null; do
218- CURRENT=$(tail -100 sync.log 2>/dev/null | grep -oE 'height[^=]*=[^0-9]*[0-9]+' | grep -oE '[0-9]+' | sort -n | tail -1)
219-
220- if [ ! -z "$CURRENT" ] && [ "$CURRENT" != "$LAST_BLOCK" ]; then
221- LAST_BLOCK=$CURRENT
222- ELAPSED=$(($(date +%s) - START2))
223- echo " Block $CURRENT (${ELAPSED}s elapsed)"
224- fi
225-
226- if [ ! -z "$CURRENT" ] && [ "$CURRENT" -ge "$TARGET" ]; then
227- echo " Reached target! Stopping at block $CURRENT..."
228- kill -9 $PID2 2>/dev/null || true
229- break
230- fi
231-
232- sleep 1
233- done
234-
235- wait $PID2 2>/dev/null || true
236-
237- END2=$(date +%s)
238- TIME2=$((END2 - START2))
239- BLOCKS2=$(tail -100 sync.log 2>/dev/null | grep -oE 'height[^=]*=[^0-9]*[0-9]+' | grep -oE '[0-9]+' | sort -n | tail -1)
240- BLOCKS2=${BLOCKS2:-0}
241-
50+ echo "Using test_batching.sh script (same approach as deploy_batching_test.sh)"
24251 echo ""
243- echo "=== RESULT 2: WITH BATCHING ==="
244- echo " Blocks synced: $BLOCKS2"
245- echo " Time: ${TIME2}s ($(($TIME2 / 60))m $(($TIME2 % 60))s)"
246- if [ "$TIME2" -gt 0 ] && [ "$BLOCKS2" -gt 0 ]; then
247- SPEED2=$(awk "BEGIN {printf \"%.2f\", $BLOCKS2 / $TIME2}")
248- echo " Speed: $SPEED2 blocks/sec"
249- else
250- SPEED2=0
251- echo " Speed: N/A"
252- fi
25352
254- DISK2=$(du -sh . 2>/dev/null | cut -f1)
255- echo " Disk usage: $DISK2"
53+ # Copy test script from ConfigMap
54+ cp /test-scripts/test_batching.sh .
55+ chmod +x test_batching.sh
25656
257- # Comparison
258- echo ""
259- echo "========================================="
260- echo "FINAL COMPARISON"
261- echo "========================================="
262- echo ""
263- echo "WITHOUT Batching:"
264- echo " Blocks: $BLOCKS1"
265- echo " Time: ${TIME1}s"
266- echo " Speed: $SPEED1 blocks/sec"
267- echo ""
268- echo "WITH Batching:"
269- echo " Blocks: $BLOCKS2"
270- echo " Time: ${TIME2}s"
271- echo " Speed: $SPEED2 blocks/sec"
272- echo ""
273-
274- if [ "$SPEED1" != "0" ] && [ "$SPEED2" != "0" ]; then
275- RATIO=$(awk "BEGIN {printf \"%.2f\", $SPEED2 / $SPEED1}")
276- if [ "$TIME2" -lt "$TIME1" ]; then
277- TIME_RATIO=$(awk "BEGIN {printf \"%.2f\", $TIME1 / $TIME2}")
278- echo "WITH BATCHING IS ${TIME_RATIO}x FASTER"
279- echo " Speed improvement: ${RATIO}x"
280- else
281- TIME_RATIO=$(awk "BEGIN {printf \"%.2f\", $TIME2 / $TIME1}")
282- echo "WITH BATCHING IS ${TIME_RATIO}x SLOWER"
283- echo " Speed ratio: ${RATIO}x"
284- fi
285- fi
57+ # Run the test script
58+ ./test_batching.sh 2>&1 | tee test_output.log
28659
287- echo ""
288- echo "NOTE: Blocks 0-50k are very small (~80 bytes each)"
289- echo "Batching may add overhead on tiny blocks"
290- echo "For fair comparison, test blocks 200k+ with real transactions"
29160 echo ""
29261 echo "========================================="
29362 echo "TEST COMPLETE"
@@ -305,11 +74,16 @@ spec:
30574 - name : configs
30675 mountPath : /configs
30776 readOnly : true
77+ - name : test-scripts
78+ mountPath : /test-scripts
79+ readOnly : true
30880 volumes :
30981 - name : data
31082 persistentVolumeClaim :
31183 claimName : dean-hyperdisk-pvc
31284 - name : configs
31385 configMap :
31486 name : sequencer-configs
315-
87+ - name : test-scripts
88+ configMap :
89+ name : dean-test-scripts
0 commit comments