You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using echo/oapi-codegen for a pretty simple API I wrote to handle managing a package repository. Basically it just takes uploaded files and puts them somewhere in a filesystem. I've noticed recently (I don't think anything changed code wise, I think my upload file size just reached a tipping point) that my API is consuming a lot of memory and subsequently gets killed by k8s. The file that I noticed this on is 1.5GB. When I try to upload it, the API ends up using close to 8GB of memory. I've tested enabling h2c, upping the read frame size, etc. I also tried a couple older versions to see if any code changes caused it and it doesn't seem to have. I normally run this behind a reverse proxy in k8s, but I've been testing locally on my laptop, so I don't think there's any sort of network latency/etc that could be causing issues.
Any thoughts on things I could try to narrow down what I'm doing wrong?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've been using echo/oapi-codegen for a pretty simple API I wrote to handle managing a package repository. Basically it just takes uploaded files and puts them somewhere in a filesystem. I've noticed recently (I don't think anything changed code wise, I think my upload file size just reached a tipping point) that my API is consuming a lot of memory and subsequently gets killed by k8s. The file that I noticed this on is 1.5GB. When I try to upload it, the API ends up using close to 8GB of memory. I've tested enabling h2c, upping the read frame size, etc. I also tried a couple older versions to see if any code changes caused it and it doesn't seem to have. I normally run this behind a reverse proxy in k8s, but I've been testing locally on my laptop, so I don't think there's any sort of network latency/etc that could be causing issues.
Any thoughts on things I could try to narrow down what I'm doing wrong?
For reference, here is the API code:
https://github.com/atlascloud/packages
Server init:
https://github.com/atlascloud/packages/blob/main/cmd/api/main.go
Upload function:
https://github.com/atlascloud/packages/blob/main/internal/openapi/packages.go#L120
(I also tried stripping everything out of this function to the point that it was a debug log and a return line with a hardcoded string)
Beta Was this translation helpful? Give feedback.
All reactions