My teammate Rory has written up how we optimised the code for on-call schedule generation after specific pathological requests could cause the scheduler to spin out and consume a bunch of CPU.
It’s a good story including a lot of tips on how to optimise Go applications in production, as well as generally how to approach a problem like this.