3 ms·
Erlang and OTP, as ugly as it is (to me) got a lot right on this front already.
by sirsinsalot 3y ago
Erlang and OTP, as ugly as it is (to me) got a lot right on this front already.
- davidw 3y agoIndeed. I do wish there were a few more "extras" in OTP, because "let it crash" needs some more details in some circumstances. For instance if you have a system with a user interface and some various components, like say, a database, and the database becomes unavailable, you don't want the entire system to crash. You want it to display an error message to the user and maybe go into some kind of diagnostic mode or other "things are not normal" state. Something like https://github.com/jlouis/fuse https://github.com/jlouis/fuse is one approach. I had a small stab at creating something similar: https://github.com/davidw/hardcore https://github.com/davidw/hardcore
- toast0 3y agoLet it crash is just the start of the process, really. Write the happy path, with pattern matching so that if things failed, it does crash, like ok = do_the_thing(). You're also expected to monitor crash reports and (live) update the system to handle crashes that need more specific handling than a simple restart. In a distributed system you always need to handle the case where you sent a request and didn't get a response and the request may or may not have been processed. Once you accept that, it's totally reasonable for the request processor to crash during a request, because the requester always needs to be know what to do in case they get no response or a non-specific error.