HTTP/2 Transport Benchmarks, Findings, and Production Server Tuning - #291
Merged
Conversation
Add Caddy and Toxiproxy fixtures for comparing HTTP/1.1 and HTTP/2 across peer reads and server-side slices. Verify negotiated protocols, record local and cat2.cloud results, and document the decision to retain HTTP/2 for Client requests without enabling it for peer chunk traffic.
Add Caddy and Toxiproxy fixtures for comparing HTTP/1.1 and HTTP/2 across peer reads and server-side slices. Verify negotiated protocols, record local and cat2.cloud results, and document the decision to retain HTTP/2 for Client requests without enabling it for peer chunk traffic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HTTP/2 Transport Benchmarks, Findings, and Production Server Tuning
Summary
This branch implements the investigation outlined in
plans/http2-optim2.mdto determine whether HTTP/2 multiplexing should be adopted for peer-cache and chunk I/O incaterva2.c2cacheandpython-blosc2(C2Array.aget_chunk), compared to the current pooled HTTP/1.1 approach.Through local fixtures and live benchmarks against the production server (
https://cat2.cloud/demo), we identified and resolved a critical reverse-proxy bottleneck, benchmarked multi-chunk workloads across varying concurrency levels, and established clear architectural guidelines for transport defaults.Key Achievements & Findings
1. Benchmark Suite & Protocol Assertion Fixtures
Added reproducible benchmark harnesses under
examples/benchmarks/http2/:peer_read.py: Cold sparse-cache multi-chunk retrieval with strict protocol assertion (HTTP/1.1vsHTTP/2) and support for multi-dimensional--sliceexpressions.single_fetch.py: Isolates network transfer time from cframe deserialization and NumPy materialization for single large slices (api/fetch).simulated_latency.py& Caddyfile: Automated local test fixture using Caddy (TLS/HTTP2) and Toxiproxy (RTT simulation) with verified certificate authorities, integrated intocaterva2/tests/test_peers.py.2. Production Nginx Audit & 6x Slicing Acceleration (
cat2.cloud)Initial benchmarks on
cat2.cloudshowed HTTP/1.1 performing ~4.3x slower than HTTP/2 on single slices (1.36 s vs 0.32 s). Auditing the production Nginx configuration revealed two major bottlenecks:proxy_buffers 8 4k) caused Nginx to spool the 2.68 MB compressed slice to disk files (/var/lib/nginx/proxy/...).Fix Applied:
upstream demo { server unix:...; keepalive 32; }+proxy_http_version 1.1; proxy_set_header Connection "";).proxy_buffers 16 128k; proxy_busy_buffers_size 256k;) to stream directly from RAM to the network card without disk I/O.tcp_nodelay on;andtcp_nopush on;.Result: Single-slice download times dropped from 1.36 s down to 0.22 s (a 6x speedup), matching HTTP/2 (~0.22 s vs 0.24 s).
3. Multi-Chunk Benchmarks on
gaia-3d.b2ndTested concurrent chunk retrieval on
@public/large/gaia-3d.b2ndacross 64 chunks (~20–50 KiB compressed per chunk) against the tunedcat2.cloudserver:Why pooled HTTP/1.1 wins for chunk I/O:
CWND, filling WAN bandwidth in parallel. HTTP/2 forces all streams through 1 TCP connection and 1 congestion window.h2frame demultiplexing over active streams.Architectural Conclusions & Decisions
caterva2.Client: Keephttp2=True(default). For interactive user queries and single slices, HTTP/2 matches HTTP/1.1 throughput (~0.22 s) while minimizing server socket exhaustion under multi-user load and supporting cleanRST_STREAMstream cancellation.c2cache&python-blosc2(C2Array.aget_chunk): Retain pooled HTTP/1.1 (http2=False). For bulk concurrent chunk downloads, connection pooling consistently outperforms HTTP/2 multiplexing by 15% to 30%. No code changes are required in either repository.