athens icon indicating copy to clipboard operation
athens copied to clipboard

Very slow when go.mod contains a new go version (go1.23) than in athens image (go1.22) - not caching

Open chlunde opened this issue 1 year ago • 2 comments

Describe the bug A clear and concise description of what the bug is.

Inside the athens container, the following command takes 40s when go.mod for github.com/org/repo uses go1.23:

wget http://localhost:3000/github.com/org/repo/@v/hash.info -O -

Downgrading go.mod to to go1.22.8 and updating the hash to that commit results in a 3 second response time.

There are probably three issues here:

  • Quick fix: Upgrade athens to go1.23
  • Probably (not confirmed): SDK is downloaded but not cached in /var/lib/athens (when using disk cache)
  • When a new Go toolchain is used, /var/lib/athens is not updated (when using disk cache)

To Reproduce

module github.com/org/repo

go 1.23.2

Expected behavior

  • Fast download second time a new SDK is used (Newer SDKs cached, and module cached)

Environment (please complete the following information):

  • OS: [e.g. Linux 64bit]
  • Go version : 1.22.8/1.23
  • Proxy version : 0.5.4
  • Storage (fs/mongodb/s3 etc.) : fs

chlunde avatar Nov 06 '24 09:11 chlunde

Proxy version : 0.5.4 Storage (fs/mongodb/s3 etc.) : fs

just to clarify, do you mean v0.15.4 with disk StorageType?


Anyway, I am able to reproduce what you've encountered with go version 1.22.8 on Athens v0.15.4 using StorageType "memory" and "disk"), but not when i am using s3

have you had a chance to try this with other StorageTypes, like s3, mongo, minio, etc.? it would be super helpful if you could give that a shot too

To Reproduce

  1. module fetched: curl -v http://localhost:3000/github.com/planetscale/cli/@v/v0.214.0.info (which has go 1.23.2 directive in its go.mod)
  2. go version: go version go1.22.8 darwin/arm64
  3. config.dev.toml: StorageType = "disk" or memory

Logs

Expand to see logs on Athens server
❯ go version
go version go1.22.8 darwin/arm64
❯ make run
cd ./cmd/proxy && go run . -config_file ../../config.dev.toml
INFO[7:19PM]: Exporter not specified. Traces won't be exported
INFO[7:19PM]: Starting application	tcpPort=:3000
DEBUG[7:19PM]: saving github.com/planetscale/[email protected] to storage...	http-method=GET http-path=/github.com/planetscale/cli/@v/v0.214.0.info request-id=5c06cbda-044d-46fb-926d-5cd789f239e5
INFO[7:19PM]: github.com/planetscale/[email protected] requires go >= 1.23.2 (running go 1.22.8; GOTOOLCHAIN=local)	http-method=GET http-path=/github.com/planetscale/cli/@v/v0.214.0.info kind=Not Found module=github.com/planetscale/cli operation=download.InfoHandler ops=[download.InfoHandler pool.Info protocol.Info protocol.processDownload stash.Pool stasher.Stash stasher.fetchModule goGetFetcher.Fetch module.downloadModule] request-id=5c06cbda-044d-46fb-926d-5cd789f239e5 version=v0.214.0
INFO[7:19PM]: incoming request	http-method=GET http-path=/github.com/planetscale/cli/@v/v0.214.0.info http-status=404 request-id=5c06cbda-044d-46fb-926d-5cd789f239e5

Response from curl: 404

Expand to see curl verbose response

❯ curl -v http://localhost:3000/github.com/planetscale/cli/@v/v0.214.0.info

  • Host localhost:3000 was resolved.
  • IPv6: ::1
  • IPv4: 127.0.0.1
  • Trying [::1]:3000...
  • Connected to localhost (::1) port 3000

GET /github.com/planetscale/cli/@v/v0.214.0.info HTTP/1.1 Host: localhost:3000 User-Agent: curl/8.7.1 Accept: /

  • Request completely sent off < HTTP/1.1 404 Not Found < Content-Type: application/json; charset=utf-8 < Date: Mon, 18 Nov 2024 11:21:54 GMT < Content-Length: 0 <
  • Connection #0 to host localhost left intact ~ ❯

i'm trying to narrow down if this only happens specifically for memory/disk storage type

ngshiheng avatar Nov 18 '24 11:11 ngshiheng

@ngshiheng I now see that it's very slow when using go install foo@commitid but it works fine with go install [email protected]

chlunde avatar Feb 10 '25 10:02 chlunde