Repository navigation
Add Go ucloud-gatewayd fast-path front door and cap store chunk-index RAM (Phase 2) - #72
Merged
Merged
Conversation
… RAM (Phase 2) 1. Add runtime/gatewayd (pure Go stdlib, CGO_ENABLED=0): fast-path HTTP front door in front of Python control_plane that handles /v1/exec/* statelessly via HMAC + fresh worker map, proxies running-sandbox POST /exec, GET /jobs, GET/PUT /files, and PUT /archive directly to ucloud-noded with zero-copy streaming, evicts cached routes immediately on park/wake/delete/migration/ worker-reboot, and falls back transparently to Python on miss/parked/stale. 2. Emit internal X-UCloud-Gateway-Route hint from control_plane/create and sandbox_proxy only when fronted by X-UCloud-Gateway-Front-Door: 1. 3. Bound chunk_index.py caches (META_CACHE_BYTES, TAIL_CACHE_IDS, locator_cache, PRAGMA cache_size=-8000) to eliminate multi-GB RSS growth on the store node. 4. Fix standalone exec_front.rs to return 400 directly on malformed/partial exec payloads instead of falling through to 404. 5. Support Linux bind mounts in systemd.py require_registry_mount via /proc/self/mountinfo, update stale diagram in docs/architecture.md, and wire runtime/gatewayd into scripts/check.sh.
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.
Summary
Enables smaller/cheaper permanent Gateway and Store VMs to scale beyond 1,000+ concurrent sandboxes without Gateway GIL or Store RAM bottlenecks:
runtime/gatewayd/(pure Go stdlib,CGO_ENABLED=0, zero external deps):control_planethat offloads all high-QPS/long-poll/streaming data-plane routes directly toucloud-noded:/v1/exec/<session>[/events|/stdin|/close-stdin|/signal]via byte-for-byte compatible HMAC verification (xr1.<b64>.<mac>) + in-memory worker freshness table seeded from/v1/nodesand updated onPOST /v1/nodes/heartbeat.POST /v1/sandboxes/<id>/exec,GET /jobs/*,GET/PUT /files,PUT /archivewith zero-copy streaming uploads (constant memory, no 256 MiB Python buffer) and Go-sideX-UCloud-Exec-Session-Prefixsigning.DELETE,park,wake,detach,migration, or batch delete, evicts worker routes onnode_epochreboot, bounds route TTL (30s), strips internalX-UCloud-Gateway-Routeheaders, and transparently falls back to Python on miss /404/409/503/ stale worker.X-UCloud-Gateway-Routeonly when fronted byX-UCloud-Gateway-Front-Door: 1(sandboxes/gateway/create.py,sandboxes/gateway/sandbox_proxy.py).sandboxes/chunk_index.pymemory caches (META_CACHE_BYTES256→64 MiB,TAIL_CACHE_IDS2M→250k,locator_cache64→16, SQLitePRAGMA cache_size=-8000) to prevent multi-GB RSS bloat starving Linux page cache on the Store Node.sandboxes/systemd.pyrequire_registry_mountto recognize Linux bind mounts via/proc/self/mountinfo(enabling local NVMe registry bind mounts).runtime/noded/src/exec_front.rsto return400instead of404on malformed/partial exec payloads.docs/architecture.mdand wireruntime/gatewaydintoscripts/check.sh.Verification
runtime/gatewayd:go vet+go test -race(including Python/Go HMAC parity vector and 1,500-concurrent-request fast-path stress test: 0.31s, 0 upstream hits).tests/test_gatewayd_contract.py: end-to-end test running compileducloud-gatewaydin front of realLocalFleet+ standalone Rustucloud-noded.scripts/check.sh(with PostgreSQL): PASSED — all 202 Python modules, Go (managed_process,chunk_serve,gatewayd), Rustucloud-noded, wheel build, and all 133 SDK tests.