Ask HN: When should event-driven architecture be avoided?
There are plenty of good resources for how to do domain-driven design, microservices, cloud functions, and event-driven architecture. I understand why these paradigms are useful for rapidly scaling an application. Queueing, the ability to adjust resources per service, and enabling separate teams to build their microservice differently.
However, they also add quite a bit of complexity. Using pub/sub breaks execution context, cloud functions are difficult to debug/test/develop locally, etc. I'm having trouble finding quality dissenting opinions online around this topic. Most resources I've found are geared towards how to implement these technologies properly.
In what scenarios would you NOT recommend event-driven architecture?
17 comments
[ 3.1 ms ] story [ 38.9 ms ] threadThat means you either have time to focus more on your customers, and therefore win more business, or you just take home more money if it is fixed-income contract work.
I consider companies that add complexity just because BigTechCo does more interested in playing or pretending to be on a path towards success than to actually be.
So I would imagine anything single-threaded would not require it.
Though admittedly, the only modern application or program that I can think of that would be single-threaded is a CLI command
As an example, imagine a small system where a user changes their email address. In the beginning you might only have one action "update database". As the system grows, maybe new teams start to add new features triggered from that event, say "send confirmation email", "calculate fraud score", "send new email to marketing vendor". You could just go and call all those APIs, but at some point you want to emit a "change email event" and just let the other systems do with it what they will.
Refer to the first 3 bullet points of the Bezos Mandate.
In fact it is this that makes event driven so attractive, rather the solving a difficult problem right now, someone will need to sort out the mess later.
Avoid if you have rules that depend on a system "state"
Having said that, toy systems aside, almost all systems require reasoning of their overall state at some point, so in general - avoid.
The amount of times I've seen software clearly want to have a form of PID controller and fail to realize that such a thing even exists are countless.
How well do controllers work with non-numerical inputs? I would assume the usual use cases involve numerical data from sensors.
Does it work well with applications where the importance of availability supersedes consistency? When I hear controller, I can’t help but think single point of failure
/s orchestrating workloads on 10^5 hosts.
You correctly identified the overhead of these approaches is massive and has implications bigger than the software. The impact on developers cannot be understated.
The approaches you listed are useful, and the dissent I have isn’t so much on the approach, as the timing of when it gets used. Tons of software will never need its benefits and shouldn’t pay the tax ever. Paying the tax before you have to is very rarely worth it in my experience.
That said, IME, event-driven architectures are more often than not the right choice for complex software. It's just a very intuitive way to model software.