tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

Lesson 211 - Improvements for Caddy

Open dunglas opened this issue 1 year ago • 1 comments

For a more fair comparison, you should set the GOGC environment variable to off to disable Go's garbage collector. Stress tests and benchmarks will trigger a lot of collections that will occur very differently (when the server is idle on the happy path) when handling real-life traffic, which tends to distort comparisons (it's also possible to change the ratio instead).

If you're using containers with a small amount of available memory, you should also GOMEMLIMIT, this can dramatically improve performance.

More info:

  • https://pkg.go.dev/runtime#hdr-Environment_Variables
  • https://blog.cloudflare.com/go-dont-collect-my-garbage/
  • https://weaviate.io/blog/gomemlimit-a-game-changer-for-high-memory-applications

dunglas avatar Nov 04 '24 15:11 dunglas

Thank you! I'll try it out, actually i deploy both on VMs, using m7a.large instances.

antonputra avatar Nov 04 '24 16:11 antonputra