5 ms·
As long as everything is idempotent. You don't want to have this happen: Host A calls host B Host B runs SQL+COMMIT DB commit finishes Host B deadline expi
by nitrogen 6y ago
As long as everything is idempotent. You don't want to have this happen:
Host A calls host B
Host B runs SQL+COMMIT
DB commit finishes
Host B deadline expires
DB success reaches host B
Also would need fanatical time synchronization. Maybe even PTP rather than NTP?
- londons_explore 6y agoGoogle has awesome clock sync in its datacenters (sub millisecond), and in general all RPC calls should be idempotent (since the network or either host can fail at any point). I think one might be able to make this approach work with poor clock sync by having the request contain the number of milliseconds left, rather than an absolute time. It isn't great if network delays dominate, but typically it's queueing delays that dominate most webservice responses.
- tgsovlerkhgsel 6y agoThis (or equivalent) will happen. You can either design your software to handle it correctly, or you can have buggy software. Clock sync doesn't really help, especially if a request can trigger multiple independent action that can individually succeed or fail. The simplest example where this goes wrong is posting a post on Reddit. You write your text into a text box and submit. You get an Error 500. You cannot know if your post went through (even if you go check whether your post is visible, sometimes the replica that you got your response from hasn't gotten your post yet). And they don't do any deduping, so if you just retry, you may end up with multiple copies of your reply.