In this chapter, we discussed optimizations. First, we explored tools for measuring performance—Welle, which is an alternative to the classic Apache Benchmarking tool, and Drill, which uses scripts to perform load tests.
Then we created a tiny microservice and measured its performance. Focusing on results, we applied some optimizations to that microservice—we avoided blocking a shared state for reading, we reused a value by a reference instead of cloning it, and we added the caching of rendered templates. Then we measured the performance of the optimized microservice and compared it with the original version.
In the last section of this chapter, we got acquainted with alternative techniques of optimization—using LTO, aborting execution without backtracing instead of panicking, reducing the size of a compiled binary, benchmarking small pieces of code...