Background
SandboxLogArchiveTask runs per-worker as a daily cron job, tars up
each stopped sandbox's log directory and uploads it via ossutil cp
to the primary OSS bucket. Both the worker and the OSS bucket live
inside the same VPC, but today the task uses the same endpoint the
SDK sees — which has to be the public one because the SDK runs on
developer machines outside the VPC.
Result: every byte of archive traffic (which scales with sandbox
count × log verbosity and is by far the dominant OSS flow) goes over
the public network, paying public-egress bandwidth cost that a VPC
server_endpoint would eliminate.
Proposal
- Add
server_endpoint: str = "" to OssAccountConfig. Document it
as server-side-only — it is deliberately never surfaced in the
STS response returned by /get_token, so the SDK cannot depend on
it even accidentally.
- Have
SandboxLogArchiveTask._archive_one try server_endpoint
first and fall back to endpoint on failure. Empty and equal
entries are deduplicated, so a legacy YAML that only sets
endpoint still makes exactly one attempt.
Empty server_endpoint yields identical behavior to today's config,
so existing YAMLs need no change.
Scope note
An earlier version of this proposal also introduced a
POST /stage_sandbox_file admin API to move the SDK's
download_via_oss inline ossutil cp (sandbox → OSS leg) to the
server side. That path was dropped because:
- The SDK download flow already has a mandatory public-endpoint leg
(OSS → user machine), so optimizing only the sandbox → OSS leg does
not eliminate the public-egress cost — it just cuts it roughly in
half for a low-volume flow.
- The complexity cost was high: a new admin API surface, server-side
ossutil install logic, SDK migration + coordinated release.
- Archive traffic is orders of magnitude larger than user-triggered
download_file traffic, so this PR captures ~95% of the benefit at
a fraction of the complexity.
Non-goals
- SDK upload / download endpoint changes (kept on public endpoint by
design — user machines are outside the VPC).
- Any change to the STS response body.
Background
SandboxLogArchiveTaskruns per-worker as a daily cron job, tars upeach stopped sandbox's log directory and uploads it via
ossutil cpto the primary OSS bucket. Both the worker and the OSS bucket live
inside the same VPC, but today the task uses the same
endpointtheSDK sees — which has to be the public one because the SDK runs on
developer machines outside the VPC.
Result: every byte of archive traffic (which scales with sandbox
count × log verbosity and is by far the dominant OSS flow) goes over
the public network, paying public-egress bandwidth cost that a VPC
server_endpointwould eliminate.Proposal
server_endpoint: str = ""toOssAccountConfig. Document itas server-side-only — it is deliberately never surfaced in the
STS response returned by
/get_token, so the SDK cannot depend onit even accidentally.
SandboxLogArchiveTask._archive_onetryserver_endpointfirst and fall back to
endpointon failure. Empty and equalentries are deduplicated, so a legacy YAML that only sets
endpointstill makes exactly one attempt.Empty
server_endpointyields identical behavior to today's config,so existing YAMLs need no change.
Scope note
An earlier version of this proposal also introduced a
POST /stage_sandbox_fileadmin API to move the SDK'sdownload_via_ossinlineossutil cp(sandbox → OSS leg) to theserver side. That path was dropped because:
(OSS → user machine), so optimizing only the sandbox → OSS leg does
not eliminate the public-egress cost — it just cuts it roughly in
half for a low-volume flow.
ossutil install logic, SDK migration + coordinated release.
download_filetraffic, so this PR captures ~95% of the benefit ata fraction of the complexity.
Non-goals
design — user machines are outside the VPC).