3 ms·
There's not really an actual UNKNOWN. As the article illustrated, there're distinct steps in the client-side processing, so we do know with certainty which part
by kccqzy 7y ago
There's not really an actual UNKNOWN. As the article illustrated, there're distinct steps in the client-side processing, so we do know with certainty which part of the client code emitted the error. We might know anything about the remote server but the point is the error is known at the client side. It could be failure to create socket, failure to send messages, failure to receive back any reply within the stipulated deadline, the remote server returning an error, etc.
In practice the easiest thing is simply to propagate the error onwards, without affecting other independent requests (failure domains), and let something intelligent handle the error. It could very well be a human sitting at a computer seeing an internal error message, who can then decide to retry or not.
Also often times it's acceptable to just log the error and carry on. I don't know of anything that can promise a 100% error-free SLA. With careful engineering achieving even 99.999% success rate is possible, but I don't think anyone would actually promise 100%.
- azylman 7y ago> failure to receive back any reply within the stipulated deadline If you get this error back, the client doesn't know if the server actually processed it or not, so knowing where the client failed isn't actually useful for knowing the state of the request and what needs to happen next. To handle something like this, you need a resilient design around client-server communications (e.g. assuming retries on the client side and idempotent behavior on the server side). Immediately erroring out on the client is usually going to lead to a poor user experience and might lead to inconsistent behavior.
- kccqzy 7y ago> so knowing where the client failed isn't actually useful for knowing the state of the request and what needs to happen next. Correct. Which is why the client should just error out and stop processing and return the error to the user, who will have more context and knows whether or not a retry is necessary or desirable. My argument is that your "resilient design around client-server communications" isn't necessary in the majority of cases, and is often unwarranted over-engineering. Poor user experience is fine, if they don't happen very often, and go away upon a retry. Even banks do that. It's fine. No one will be offended if your app shows an internal error message once a month (a five-minute outage in a month is still more than 99.9% availability).
- ubu7737 7y agoThis is correct. In an authorization with a user waiting at the POS, you fail-fast and let the user retry. During the clearing/settlement phases, you don't have a waiting user. You're settling accounts and moving money. Nothing is allowed to fail silently.
- azylman 7y ago> the client should just error out and stop processing and return the error to the user, who will have more context and knows whether or not a retry is necessary or desirable... Even banks do that. It's fine If a user at a bank tries to transfer $10,000, gets an internal server error and retries because their balance hasn't updated (banks don't process these in realtime), and checks the next day and finds $20,000 gone, that's a big problem. The user can't be responsible for this, you need something more. You're not wrong that this isn't necessary in the majority of cases (updating your email address?) - but the majority of cases don't need distributed systems. By the time you're talking about distributed systems (which is the focus of this article and discussion), you absolutely do need this, in the vast majority of cases.
- ubu7737 7y agoAvoiding duplicate processing is a very big part of compliance in banking transactions. Making mistakes in this area is somewhat common but very punitive for the institution that makes the mistake. As a result, design priorities are heavily skewed toward exactly-once processing of financial transactions.
- foota 7y agoEh, in that case you're asking for trouble by requiring the server to be successful. If I had to write an API like that I would definitely go with randomized tokens per logical request for dedupe on retries. If it's a user facing transaction it should be a transaction resource that's created and then the server does the retries imo, with the user able to view the status.
- azylman 7y ago