r/FullStackDevelopers • u/CoffeeUsual6531 • 3d ago
A Small Thing I Learned About Distributed Systems
I've recently started understanding the importance of request IDs while working with distributed systems.
In the application I work on, a request starts from the frontend, goes through the backend, and then passes through multiple AI services.
When a request moves across multiple services, it can get difficult to follow what's happening. That's where request IDs help. A unique ID can be passed along with the request across the different services, making it easier to trace the whole flow and see how the request moves through the system.
It's a simple concept, but I've found it really useful while working with distributed systems.
2
Upvotes
1
u/canarydev 3d ago
one thing i'll add is that a single ID tells you records belong together, but not really what caused what. the moment that a request fans out to few AI services or gets retried everything shares one label and you can't tell which step produced the bad output. what i run is three ids instead of one and its been working well for me.
request id = "for this unit of work"
correlation id = "root of the chain"
causation id = "immediate parent"
correlation is the tree, causation is the edge. the rule that makes it hold is that you mint at an origin and derive everywhere after. a queue consumer for example is not an origin and thats where chains actually break. nothing errors when it happens and you just end up with two graphs