API Performance
Everybody loves performance. The faster, the better, right? Performance is always a hot topic, and for APIs, it is essential. The more performant your API is, the better experience your users will have. You will save money on your infrastructure if your API does not consume many resources. Also, if your API is fast enough, it will be easier to absorb spikes in traffic. The good news for you is that Go is a very fast language, so if you are using Go, you are already in a great position. But there are two things that you need to be clear about. One, you can’t optimize without knowing what to optimize, and two, when optimizing, there is something that is always faster than executing highly optimized code, and that is not executing it. For those two reasons, we are going to cover the following in this chapter:
- How we reduce the load on the server with HTTP caching headers
- How we use an entity tag (ETag) to reduce bandwidth usage
- How we use...