BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage Presentations From Fan-Out to Fast: Sub-100ms API Design in Distributed Systems

From Fan-Out to Fast: Sub-100ms API Design in Distributed Systems

49:52

Summary

Saranya Vedagiri explains how to design resilient, low-latency distributed APIs under 100ms. Drawing on practical scale at eBay, she discusses hop-by-hop latency budgets, async fanout tradeoffs, thread pool sizing, caching, and circuit breakers. Learn actionable strategies to eliminate tail-latency bottlenecks and establish performance-first engineering practices.

Bio

Saranya Vedagiri is a Staff Engineer at eBay, where she designs and operates large-scale distributed systems with a focus on reliability and low-latency performance. Her work spans API design, service-to-service communication, caching strategies, and resilience patterns that keep critical flows fast under real production traffic.

About the conference

Software is changing the world. QCon London empowers software development by facilitating the spread of knowledge and innovation in the developer community. A practitioner-driven conference, QCon is designed for technical team leads, architects, engineering directors, and project managers who influence innovation in their teams.

Transcript

Saranya Vedagiri: How many of you got the chance to take the Tube today? So many of you have taken the Tube. Have you ever wondered why is the line paused again, anytime in your experience when taking the Tube? I just see a couple of you leaning in. I would like to take the Tube design just like a system design in a distributed system. Just like how we have the map in our hand, it feels as if London is manageable. A couple of lines, a transverse, and you feel like everything is good. That's not the same when you take the actual journey. Your actual journey can have pauses and unexpected reason. That's not what you want. That's similar to a distributed system. When you look at the system diagram, it feels so comforting. A couple of boxes and arrows moving from one to another. You expect everything to go great.

That's not really what happens. When the downstream slows down, you have to retry. Then, when a cache miss happens, you again retry. You fall back to a database. All of this adds time. That is why latency is important. What we are going to do today is considering latency as a route plan. We are going to take each and every hop, make sure there is a budget assigned to each hop, and see how we can get the journey better and make sure one station is not acting as a bottleneck for your complete journey. Today, the title of our discussion is, "From Fanout to Fast: How Do We Build an API within sub-100 milliseconds in a Distributed Environment?" If you are a senior engineer, I will give you concrete patterns which you can go back and apply. If you are an architect, let's look at some of the tradeoffs and system constraints. If you are a leader, let's make sure you have enough information so you can prioritize what is right for the team.

I'm a staff engineer at eBay. I have nearly two decades of experience in the IT industry. Lately, most of my involvement is towards building low latency systems which are scalable and reliable. From my experience, one thing is very sure, building a low latency system is doable once, but if you have to keep it the way that it is always, then it needs a lot of engineering. That's where the real engineering is. Let's see how we can do that. This is why a repeatable process is important. We don't have any quick shortcuts to get it done.

The Cost of a Millisecond

Let's understand, what is the cost of a millisecond. When you compare 120 versus 80, it doesn't sound too dramatic. Users don't experience latency as numbers, they experience it as friction. Friction really compounds. What do we do about it? What we are going to do is we are going to see how we can take the complete request path and divide it into some components or parts and make sure we cap each part with a budget. We also know that when scale comes into picture, your latency drifts. Have you seen the scenario where the system that you are building, let's say you put up a cap limit of your latency to be like 30. This is in a normal scenario. When peak traffic hits, your graph suddenly bumps up to 60. When there is a dependency wobble, you see that the latency shoots up again to 120.

There's no steady graph, but there is always a bump here and there. What has changed? There is no change in your code. The code has remained the same throughout. What has actually changed is the frictions that happen, is the systems which are going down, is the retries which are happening, your thread contention, your queuing, all of these aspects have added to this. A better way to handle is to look at the complete request journey.

Outline

Here is what we will cover. We'll start off with assigning a budget to latency, and make sure every hop has its own budget. Then we'll take a look into a complete journey, and see all the things that could go wrong. We'll see a scenario and how that could be fixed. We'll move on to tradeoffs. Then, without measurement, there is no success. We don't know how far we are without measuring. We'll look at that. We'll look at what the future holds, and we'll wrap it up.

Chapter 1: Latency Budgets - Defining and Managing Performance Targets

Latency budget. This is nothing but what your goal is versus what your system design is supporting. Let's say you want to build a recommendation engine which needs to respond within 50 milliseconds, because it's going to be used in multiple different components in your pages, exposed in emails and everything. How is your system design supporting this? That's what we need to see. How does it help, actually? When you have a concrete plan, it helps you with two things. One is prioritization. You don't really need to spend 100 milliseconds on a nice-to-have if you already know what is your cap limit. The other thing is alignment. It makes better alignment between the different teams. We don't need to explain each team between the product, the engineering, your quality teams about various aspects, because everybody comes to an alignment with one cause that they have to deliver things at a low latency.

Now what we will do is we will take the complete path from the client to the way that the client can receive the response and divide it into sub-parts, and make sure each part does not take more than what it is allocated. Here is a rough estimate of how we could break this down. There are a few things where we can utilize some buffer, but there are a few things which you cannot utilize a buffer. The edge layer, there's nothing we could do about it. Most of the content pull up your TLS, and the initial routing needs to happen here, which is going to take time, and you have to give it that. Let's cap it with 10 milliseconds. The next one comes the gateway. That's where your authentication and throttling happens, and you have to give it a 5 millisecond. Then next comes the application logic.

This is where it can be done in a single microservice or more. Just a pointer here. I think we have been overusing the terms of microservice where teams have started to really subdivide it into so many services that what could be done by one service is being done by four now. What we are forgetting is the network hop, which is involved in all of these things. We cap it at 30. Then the next one is the data access layer, where you definitely need an entity service, which is actually writing to your database, which could be whatever database that you're choosing. Then comes the buffer. It's better to save some buffer. Here we are adding 10 to 15 milliseconds as a buffer just to make sure there is enough time. Reality exists, so whenever there is a delay, you are just serving your buffer to make sure you have that time with you.

Chapter 2: The Request Journey - Tracing the Path of a Fast Request

Next, we look at a sample journey, a request journey, and see how things can go wrong in this journey. This is simple, considering we already saw the budget allocation. Your request travels from the client to the edge, and then the authentication, then it moves to your application logic, your persistence layer, and the way back. Now some teams don't realize that there is a component for serialization when you send your response back. That is where the JSON payload translations happen. Sometimes they wonder, why is my application logic fast, but my API itself isn't? This is one reason. Having seen the path, where does the latency hide in all of these things? The network hop. When we take the network hop, we have the TLS handshake, the connection pools, we have DNS lookups, everything. What I would suggest is, if it's possible, removing one hop saves a lot of time than actually rewriting thousands of code.

If you think about this, so let's say we have an item service, which needs to call a couple of other services, like the item, detail service, which calls the seller details to fetch all the seller details. Then the feedback rating, the feedback reviews, the completed text of it, the image URL, everything. It has to call a number of downstream services. Now if each service takes a particular time, so now it is important to see whether we need to talk to all of these services synchronously or asynchronously, and how much of it is actually exposed to the outside clients. If it is an internal service, do we want to use gRPC? What that helps with, it helps with communication between two services, which could be faster if there is more data payload with sharing. If it is a REST service and if it is public-facing, then it makes sense to use JSON, because it's more meaningful when you read it.

The other thing is serialization. As I said, when your payloads are increasing, you have to pay for serialization. What can happen? For example, if I'm returning item details, I have a lot of information with me, title, description, SKU details, what is my last transaction, who bought my last item, so many information. Do I have to send all of this information for my client? My clients for an item service, could be search, could be cart, could be checkout, could be an email, could be some metrics. All of these clients, do all of them need the same information? Is there some customization which could be done based on who the client is? Do you need to use a REST service or do you want to use a GraphQL, because it is a read service. All of these discussions need to be done and decided. These are some things which could hide your latency.

Cold caches. What if there is a cache miss at the wrong moment? Then you have to fall back to the database, which adds up your latency. DB query shape. There are a few queries. Like, if you miss the tuning of the queries, if you miss the constraints, if the constraints are not built right, then it is going to take time, and you end up tuning it at the wrong moment after you are live. These are some things to be checked beforehand. Queuing and contention comes into play when we are using threads. If a downstream fails, the queue size increases, the thread contention increases. Now eventually you try to retry because you have not got the response. Your request comes pouring in. Now you have a lot of things to handle and the system eventually fails. Then the dependencies. When you have more dependencies, your total SLA is dependent on it, because that's from the slowest downstream that you are calling. Observability. If you're adding too much log, where is your tracing information? How much are you tracing? Are you doing 1%? Are you doing more than that? All these tiny pieces make a huge impact.

Chapter 3: Scenarios and Fixes - Addressing Common Latency Pitfalls

Now let's take a scenario and look at the fixes for it. Here is the case when we faced that. The p95 was looking fine, but the users still timed out. What happened was we got issues raised, from one of the clients, saying, I'm getting a lot of timeouts. When we look at our dashboard, our dashboard is green. We don't see pretty much. We don't really see that, because we are taking in billions of calls. For the client, they have millions of calls. Then even a small failure, in this case, it was less than 1% for us, but nearly 1% for them. If you take the example of the item service, if it's coming from the checkout, then every single transaction is valuable. Any single transaction, we don't want to result in a failure. That's exactly what we wanted to look at. How do we face this?

How do we investigate this problem? How do we solve this problem? When you're having your majority works, your p99 works, your p95 works, but that's where, in your p99, it's not the way that it has to. First of all, let's see how we went about investigating this. We need to take from the client how much logs they have. Try to map those into your system. Like, are you able to trace it out? This is why, if there are leaders in the group, it is important to make sure you have added all the observability metrics for your services, because there is no time after having an incident that you go back and add all of these things. Now, if you have not built dashboards for your p99, this is the time to build that. If you're having those dashboards, look at it. Now, what is the difference between a successful transaction and where it has timed out?

What is the bottleneck that you're seeing here? It could be some downstream is not returning, the cache lookup was a failure, we had to go back, retried so many times, it didn't work. What is that exact problem? Note down all those problems that you're seeing and compare it with the dashboards that you have. Does it correlate? Are you looking at your thread health? Are you looking at your queue size? Does it correlate somewhere? Are you looking at your DB dashboards. Did you receive peak load during that time? Did you look at the cache dashboards? Are you having cache misses? Are the cache calls increased? Look at all of that information which you have and see what corresponds. Now when you look at the cost, it's always tempting to say that it can be the retries that we did, or it is the cache request which has failed.

There can be so many causes which is not really evident at the first glance, and those could be retry amplification. I've seen some of the codes when reviewing. Every time there is a retry, they increase the retry timeout. First time it is 500, second time they add it to 1,000. What is the benefit of this? If you want to build a high latency system and you retry, you're capping it at 500 and 1,000, you're not in the game. Your service is already going to lose it. Make sure your retries make sense. If you're looking up from cache, if it is Redis Cache, usually it responds in 5 milliseconds. Do you want to cap it at 8 or 10, and then do a retry? Don't wait for 50 milliseconds and do a retry. Probability of you capping it lower and then doing a retry might result in a better one.

Maybe you are reaching a different pod. The other one would be thread pool starvation. Here, if an application is using just one thread pool for the entire journey, it has a good potential to bring the system down. We'll talk more in detail about thread pool in the coming slides. The next is database tail latency. There are situations where database is taking more time, maybe bad query, maybe you hit a wrong shard, hotspots, things like that. Observability gaps. You're logging too much of information. Then your GC or the JVM pauses. What do we do about it? In our case, we did three things, which actually helped us. The one is payload reduction. We were retaining a lot of information. Look at your maps. We had a key-value pair map, which was having user-related information. It had thousands of keys in it. We were returning this to 400-plus applications.

Not every application actually needs this. They probably need only 5 or 10 keys, but we were returning everything because that's all associated with the user. We didn't have the ability to request for a certain case. Now, once we changed that, that was helpful. Look at your response. Scan through each field one by one. Look to see if everything is making sense for the client, from the client perspective. Then, your retry discipline. Retry only if you're making idempotent calls. Here, again, you have to cap your limit and make sure you're giving thread pools separately for each of the downstream. That is what it is with thread pool guardrails.

Chapter 4: Tradeoffs - Balancing Speed with Other Priorities

I think now we started off with why a millisecond is important. We looked at budget. We also saw a request journey. How things could go wrong in that journey. Now it is time to look at some of the tradeoffs that are available. The first one is async fanout. We know what fanout is. Like one request turning into multiple. When we have such a fanout scenario, there are multiple options by which you can execute. One is doing things serially, the obvious way: one after the other. Or, see how much you could parallelize it in a couple of threads. Like whether you want to do two things at once. Then maybe your output needs to be fed for the other downstream calls. You take a judgment about it and do it. Then, if you're doing asynchronously, you also have options of running it in a separate background thread, or you want to drop an event.

Or let's say you make a fire and forget call. Like, what are the options that you have? What is making sense for your application at that moment? Maybe let's take an example to understand this better. If we take placing on an order as an example, when you take place order, there are a number of things which have to happen immediately, like after you hit on that place order button. One thing is you're supposed to receive your order confirmation email, the inventory has to get reduced. Your payment has to be made. You have to detect from the buyer, credit to the seller. Your metrics, you need to drop the metrics. Maybe giving this information to a couple of other downstream services which actually takes in this for the feedback and other things. Now when there are a lot of things, not all of these things have to happen serially.

When you take the item service response, where item has to call image, call seller details, call feedback and everything, again here there are a couple of things which needs to happen at the moment for sending the response back, but the couple of things need not happen synchronously. That is why we need to decide what needs to happen when, and see if you can move certain parts below the radar. When you want to do that asynchronously, making your configuration for a thread pool is very important. What is a thread pool? Let's compare it with, maybe you have a fixed number of workers in your kitchen. Let's say two workers. You have orders piling in. What happens? The two workers may not be able to do all the orders, and your orders are piling. Let's say you have very few orders, there's a very good chance that they bump onto each other.

Now, having this right configuration is very important. How could we go about it? What could help us to define what is the right configuration? This is where we need to check, what is our application doing? Is it an I/O intense work? Is it doing an I/O intense work, or is it doing a CPU intense work? Some examples could be, for CPU intense work, are you doing any algorithm processing? Are you doing image processing? Are you validating fields using your rules engine? Are you doing any encryption, decryption, or maybe tokenization? What are you actually doing? If you're doing all of these works, it is CPU intense work. Closer to your CPU cores, if you're using an 8-core system, maybe 8 threads, you should be good with this, with a normal load. Let's say if you're doing an I/O intense work, calling your REST service, calling your downstream, or waiting because you don't get the response, you have to wait.

You're looking at file. You're making a cache call, database call. All of these are I/O intense work. Since there is a waiting time involved, we need to make sure that you're adding more threads, taking this into account. A small example could be, if you are waiting for 80 milliseconds, and that particular downstream is capable of giving you a response in 20, the formula is the number of cores that you have times 1 plus 80 by 20, which nearly comes to about 40 threads. When you're having your CPU intense work, you are only at 8. If you're having an I/O intense work, you are at 40 now. Using the right number is very helpful. Your service could be doing both. Then you need to carefully check what your service is doing and make sure your limits are set based on that. This is no hard and fixed number.

It is more as a starting point where you should actually fine-tune it based on your results, based on the dashboards that you're seeing. Go back and fine-tune this. Also, there is one more important thing to understand, is, what is your incoming traffic? How much concurrent requests are you going to receive? That is also important to determine this thread count. A simple way could be from Little's Law, where, what is your latency? Latency into number of requests per second. If your latency is 50 milliseconds for your service and you are expected to get 500, then it's about 25 concurrent requests that you are seeing. This is even before the retries that you have to do, system getting abnormal, and things like that. This is just a starting number. Make sure you cap your threads at the right number. Along with the thread pool, the other thing which we need to be careful about is queuing.

Once you have set some number with your thread pool, if there are more requests, you need to make sure your queue size is also right, because that's where the next requests are going to be queued in. Now, let's say both your thread pool and your queue is full, then, what next? You need some rejection policy set up. What is your rejection policy? Have you carefully analyzed your rejection policy? Are you going to outright reject your request? Are you going to pick up any low priority work and remove that from your queue? What is that? You have to define that correctly, which will help you. Also, the other thing could be the memory, which you have to check, and things like that.

Next comes the caching. We don't expect everything to be returned by the service. You don't need to go to database to return every information through the service. There are moments that you have to leverage using cache. What type of a cache? What data do you put in your cache? What is the key that you're going to use in your cache? That's where all these engineering concepts lie. Are you going to use a single cache to look up all the information? Let's say, for the item information, do you want to add feedback into the cache? Is the review itself making sense or do you want to add the feedback score? Is adding item description making sense or do you want to add the price. What is making sense? What is the time? What is the benefit this is going to give? Of course, it's going to give you latency importance.

Because 5 milliseconds versus 30, and that's the tradeoff. Make sure you are building cache, which are multi-level, if possible. You don't want to make your cache bulky also. The payload in the cache shouldn't be bulky. You want to make sure that you are giving the right data, checking the payload size as well. Make sure it's not like more than a few KB. Using a cache is not going to solve all the problems until you have invalidation set right. If you're not invalidating your data as the data changes, if you're not making it accurate, then there is a chance that you're not showing the clients the right information. Then there is no point in using the cache. Invalidation becomes very important. How are you going to invalidate this data? There are a couple of options. If you set a fixed TTL, then till that time, the data is there and then it moves away.

Is that the practical approach that you want to take? Sometimes you want to change it when the actual data is being changed by the user. Then you want an event-based approach. You also have like version-based. Choose version-based only if you are sure about, is there a reliable plan to choose the exact version because you don't want to get into trouble of choosing what is the right version to be picked up. There is also another concept of stale-while-revalidate. This is where you know the information is stale, but it's ok to return that. You have to determine who are your clients. You don't want to have a checkout reading price from a cache. You want the most accurate information. You need to go to the DB for it. Choose what is your application doing, the responsibility of the application. How much delay is your client acceptable? That could be different between different clients.

If you're sending an email, it's fine to build something which is not really accurate, which can be eventually consistent. That is fine. Choose based on your clients as well. Then, we also have the option of using group-based, where it is best advised for derived or aggregated views. A general rule of thumb, maybe if you're experimenting it for the first time, will be start it with a TTL and then fine-tune it. Once you fine-tune it, use the event-based approach.

You know that you want to cache. You know how you can have the right data. Now you need to understand that data classification is important. You don't want to get into any of those compliance issues where you have added the wrong data, especially when you're in the financial industry. What are the data classifications available? Public data, anything which is public. When you search for an item, you get all this listing information. You get seller details, like what is the seller's name? Where is he selling this item from? These details. These are all publicly available. It's ok to cache it. What about internal data? Some of those unique IDs. You have UUID. Do you want to expose it outside? What about your item ID? Do you want to expose it outside? These are things that need to be determined. This is something that you need to work with your InfoSec team to understand what is the organization's level of classification, and how much they want to expose it, add it to a cache, and things like that.

What about confidential data, like name, address, phone number, things like this? Definitely, we need to encrypt it or tokenize it. Whatever is the best fit or recommendation from the InfoSec team. Now this is a time where we need to think, does it make sense to add it in cache? We are going to cache because we want to reduce the time. Now if you're adding a confidential data in the cache, be mindful that you need to pay for decrypting it or de-tokenizing it. Are you ready to accept that? Is your system ok to do that? Then, about classified information. Your SSN number, your passport number, all of this information, a strict no. You cannot cache this data.

Next, we'll move on to circuit breakers. Circuit breakers are very helpful. It helps you contain your problem area to a specific region. It doesn't allow the entire system to be brought down. Instead, it contains the problem in one specific area. In that way, circuit breaker is very important. If you take a mental model. What happens, let's say when a downstream fails, and you have 10 downstream calling, and one of the downstream suddenly starts failing, the queue starts to build up, your thread pool queue is also high, your backup queue is also high. Now, as per your system logic, you try to retry and you also have incoming requests. There is a complete possibility of system being down. You are actually having a self-inflicted failure. Even if there is a request which does not need this downstream A, the request could fail for them. A circuit breaker helps in that.

It helps you contain that. It is important to use this. When the circuit breaker is open, it's not going to allow any request. It's going to allow time for the particular downstream to prepare itself, to come back up. When it partially opens up to send a few requests is to see whether it succeeds. Once it succeeds, it sends the remaining requests. This is very helpful.

Then, what about fallbacks? Maybe we could take this example. When you're viewing an item on a search, you actually see this hottest item trigger, or you see this, five people are viewing onto this item. I have 10 purchased this item two hours back, or an hour back. All of these are hot information which are available. You need to be more accurate to give this information, or maybe nearly accurate. What if we don't have this? What if the service which returns this information are failing? Then you probably go and use your fallback text, which is like, maybe, yes, this is a hot item. Many people are viewing. We had more transactions. Don't give the exact number. This is the use of fallback. Consciously decide based on what your service is doing. Check if there are any places where you could use this tactic of a fallback.

It doesn't have to be a static text. It could also be defaulting to certain numbers based on the situation. The other one is data partitioning, which is mostly underrated. The main theme is to avoid hotspots. Why do we want to avoid hotspots? Because we want to distribute the traffic to all the shards possible. When you're deciding about partitions, make sure you choose a key which will give you a unique distribution across. Don't choose something like, I'm going to put all my hot sellers into one shard, like the top sellers into one shard. When there is a specific season, for example, Thanksgiving in the U.S., it's going to make all the requests go into that shard. It does not make sense to divide your sharding based on this theme. Rather use a key which is very generic: maybe the ID of the user itself, maybe his login name.

Use things which are generic, and make sure that gives a default distribution or a common distribution into all the shards. Sometimes due to regulations, it is also required that you need to split your data based on the region. Like EU region, you need to have a separate shard. U.S. region, you need to have a separate shard. This does not solve the problem because, again, if you have a seasonal event, it's going to go into that particular shard. That is why it is important to subdivide it based on the other keys that you have.

Chapter 5: Measuring Speed - Tools and Metrics for Performance

Now that we have seen a quick recap, we started with why is latency important, why is being fast important. We saw a request journey. We saw a list of tradeoffs. Now, until we measure, we don't know how good we are performing. That is why measuring things is really important. A measure could tell you how long things went well, or did not go well. Tracing will tell you why something happened. If you're not having tracing, you are missing out on something, on identifying why the problem even happened. Tracing is very important. If you haven't built it, it's time to actually build this. There could be themes, with the teams coming up saying, "My Redis is failing. My DB looks fine, but my cache calls are failing." How are we figuring out all of these things? Only because we have tracing built. You are able to take just the unique ID, look through the complete request, and see where exactly the problem has happened.

If you are able to identify, that's because you have tracing built in. Let's move on to having SLOs. Before maybe going into SLOs, I want to touch base on SLIs, service level indicators. They are like direct metric information. Let's say you are getting 100k requests per second. Then let's say around 95k requests have succeeded, and the remaining 5k were not successful. This 95% is your success rate, or your application's availability is just 95%. The same thing, you could track for your error rates, you could track for a specific error also. You have that specific downstream, you can tie it based on the feedback system, what is the availability of the feedback system. All of those things could be done. You could also have measures like, how many of my requests is responding well within 200 milliseconds? If the number was 99.8, then that is the time that you have done it.

How do we tie this to a goal? That's where SLO comes in, service level objective. Let's say you want to make sure in a 30-day period, I want the availability of my system to be 99.9. Then that is your SLO. What happens when you set this up? You are going to be alerted. The team is going to be alerted. The leaders are going to know, when an SLO, the buffer, the time that you had, if you're utilizing that buffer in a week, which you had set for a month, then it is time to pause on all your velocity works that you're doing, and first fix the system. Did I make a wrong judgment about the SLO? My SLO number itself, did I do a mistake in configuring that, or should I go back and check my application service? Check the path, where is it going wrong?

Has it been happening consistently? Then there is something to do about it. Then there is some refactoring which needs to be done. There is no one solution which can fix it. You have to do small things at every journey to make sure that you're getting it right. This is where SLO is very helpful. Thread pool observability. We saw about thread pools and the importance of thread pool. Now, if we don't have an observability dashboard, you are not going to know whether your queue is getting built up. Am I getting an alert for it? Setting up alerts, before that, you need a dashboard. We need dashboards for active threads. What is my queue size? What is a completed task count? Then, what is my rejection rate? If I have information for all of these, then it's helpful for me to fine-tune during the next iteration.

Chapter 6: Culture and Future - Building a Performance-First Mindset

Now that we have seen about how we could measure, how we could fix it, we have seen a lot about technical things going wrong, technical aspects going wrong. Now it is time to look at the human side of things. What is within our control? What can we do as a team to get this done? That's where culture comes into picture. During planning, are we talking about SLA? Are we talking about latency? Are we talking about what is our goal? During retrospective, did we talk about the last incident which happened? What was the last issue where you had to come back online and check things on a weekend? Did you have to spend your night over it? What was that incident? Are we discussing it as a team? Are we trying to fix our dashboards? Are we trying to fix our alerts? I know that teams set up alerts only in Slack, and your Slack thread is filled up with all these alert messages, nobody is looking into it.

Are we looking into that? These are things collectively which a team needs to take up, like during your planning session, during your retrospective. This is nothing but performance and review. What are some of the anti-patterns which we need to avoid? Considering staging data. Let's say you're doing a load test in staging and taking that number for your production. That's no way the same. Your environment in your lower region is not the same as what you're doing in production. Do not take that as a benchmark. If you're going live, maybe start with 1%, 2% traffic. Or even better, start it with traffic mirroring, if that is allowed. You mirror your traffic and see whether your new flow that you've added is performing at the same level as earlier in production. Is it delaying your latency? Is there something that you need to restructure? The other things could be synchronous logging, where you're logging too much information.

What is the future holding for us? There are a lot of things, like capabilities around adaptive routing where routing could be done to regions which are having less traffic. AI-assisted predictions, you can have models to predict, this is the hot cache. Make sure you can warm it up beforehand. You can use predictive warming. Edge-native executions, all of these are in the future.

The 48-Hour Playbook

Let me give you some information which you could try before the weekend. When you go back, what could you do? Choose a simple flow in your application, from end to end. Note it down. Work with your lead. Is there any journey that could be removed? Is there any duplicate logic? I've also seen these patterns when I'm reviewing code between the teams. If there is a dependency X, and you have three flows, like A is calling B, B is calling C. You always have this X which is getting called in all the flows. You tend to have that one service which everybody wants. What do we go about it? Is there anything that you can do about changing it? These are all things that you can check. Now, instrument it, and budget. You'll note down what is the graph. If you don't have a p99 dashboard, create one.

Note down what was the current latency. If it is at 500, yes, note it down. Look at the different junctions, your paths. Note down what each path has taken up. Now, where do you want to go from here? What is your budget? Cap it. Make improvements. Remove that unnecessary call. Rephrase it. Add thread pools. Parallelize it, if it's possible. Add cache if it's not there. Do all of these things, and take a result out of it. Run an L&P and take a result out of it. Now you can check the before and after metrics. I would like to leave with one quote. We are what we repeatedly do, so excellence is not an act, but a habit. I hope we inculcate that as a habit.

Questions and Answers

Participant 1: With regards to p95 and p99, what are they? Is it percentile?

Saranya Vedagiri: Yes.

Participant 2: I have one question around serialization and that you mentioned that we should clear up if it is not required. How do we measure the cost between clearing up the data before it gets serialized and to be returned versus just sending the entire data and then hoping that it will work?

Saranya Vedagiri: This is where your logging is helpful. Let's say you're calling x downstream service and you have the log from your application level and you also have the logging from your downstream. They will tell you, I received the request at 10, I returned back at 10, 10, or whatever, that milliseconds. In your logging, you would have not got the time that they had mentioned, so look at that. There is a buffer in between. Is that adding up, between what they say as they have sent to what you have received? There can be only a certain buffer for your network. If you are seeing a 50 milliseconds difference, then there is something going wrong. Is it your queue or is it your size? There is no one direct indicator, but it could be either of these two things.

 

See more presentations with transcripts

 

Recorded at:

Software is changing the world. QCon London empowers software development by facilitating the spread of knowledge and innovation in the developer community. A practitioner-driven conference, QCon is designed for technical team leads, architects, engineering directors, and project managers who influence innovation in their teams.

Nov 27, 2026

BT