Open utterances-bot opened 4 years ago
Nice to see such good explanation of the concept which have been there for ages on the firmware side, and now have been implemented in various other areas.
Thanks @bhaveshbh. I wasn't aware of this but I can imagine now where it would be useful. What is the simplest implementation of debounce on the firmware side, if you had to share one?
In the firmware context a common example are physical buttons. When you push a button and a signal is supposed to go "on" it actually oscillates between on/off before stabilizing. Because the processor is much faster than the time it takes for the button to stop "bouncing", you normally add a timeout to skip the noisy part and read a clean value after some delay. In electronics, and for buttons specifically, an alternate technique is to add a capacitor in parallel, which smooths out the noise.
In any case, choosing the delay value or the capacitor's value is mostly guesswork specific to the button used. I think choosing the delay on queue debouncing is also like that. A long delay throttles the rate at which requests are processed, but a short one floods the server with requests.
Debouncing Execution of Jobs in a Queue
Debouncing is a commonly discussed concept in a frontend interview. This post discusses how it is crucial in its own sense, and how we used it while building one of our products at upGrad.
https://mohitkarekar.com/posts/2020/debouncing-queue/