“The API is slow,” is a constant complaint and it’s one of the reasons that we need to include reasonable response times into our Service Level Agreements.
But, when it is slow we want to know why it is slow, and one of the problems is that an API is a lot of different things. It's a User Interface (UI) calling to a gateway, although there could be caching along the way. There are all the services and the data in the back end, and each hop along the way to get that data and each hop on the way back to deliver that data takes time.
Sometimes the latency between different hops is really quick, and it’s often it's pretty obvious where something is slow. We can see that there is a service running slow because we can see other things on a monitor like a processor is maxed out or a server has gone dark.
But when it's just slowly degrading we want to add something called “context.” We are including context headers in these transactions using the open tracing standards which allow us to track which service called which service and how long it took for those calls.
This allows us to start to see trends, preferably before a server goes dark or a processor maxes out. You can see where the problem is, what the problem is and, perhaps, start to understand why your API is… slowwwwww.