If you want to achieve public service level traffic and cost then you pretty much need to find a way to leverage object storage.
Cursor introduced an S3 WAL in their new system, Continuity. https://cursor.com/blog/git-at-any-scale
Codeberg is buckling because of old hardware and not-so-great operational devops processes. I am stating that as a former core member with access to these and the historic goals of changing something to the better. The underlying software is not the issue.
GitHub and GitLab were built on Ruby. The language behind this is much less suited to serve a platform with that many requests.
The hard part is the SRE engineering behind it and the option to potentially make tweaks in the underlying codebase when needed, to fix possible bottlenecks (most often it comes down to how SQL is being processed).