r/coding • • Aug 15 '22

Event Driven Architecture — 5 Pitfalls to Avoid

https://medium.com/wix-engineering/event-driven-architecture-5-pitfalls-to-avoid-b3ebf885bdb1
69 Upvotes

22 comments sorted by

12

u/mexicocitibluez Aug 15 '22

First off, Event Sourcing and Event Driven Architecture are 2 totally different things. Event Sourcing everywhere IS NOT A PITFALL of event-driven architectures. They are different concepts.

Second, the first issue could have been solved with the outbox pattern.

2

u/natan-sil Aug 15 '22

Thank you for your comment.
As I see it event-driven architecture can be an alternative to Event Sourcing. and they have similarities in how they can solve the optimized query issue.

You're right about the outbox pattern. it's not used at Wix though

1

u/mexicocitibluez Aug 15 '22

You're right about the outbox pattern. it's not used at Wix though

That's interesting. Is there a reason why? Or is it not as appropriate when you use kafka vs a traditional message bus?

1

u/natan-sil Aug 16 '22

I think that for most cases resiliency offered by Greyhound Producer was "good enough", and otherwise CDC via Debezium will be used which is a more generalized solution

10

u/fapmonad Aug 15 '22

At Wix we have been gradually migrating our growing set of microservices (currently at 2300)

A recent article says they have 1200 engineers, so that's roughly 2 services per engineer...

https://www.calcalistech.com/ctechnews/article/s1mlpunf9

→ More replies (1)

9

u/FairKing Aug 15 '22 edited Aug 15 '22

Looks overcomplicated to me. Why just save an event in queue (async) or trigger (sync), and if it fails, rollback the transaction?

I wrote such event manager in one single class (about 100 lines) and use it in huge ERP systems with microservices. Some events are sync, some of them async depending on situation.

And why "right order"? You produce only one event "PaymentCompleted". After it processed in warehouse you produce another event "ReadyToLoadItems" and so on. I think you have something wrong with your design if order matters to you.

IMHO: Complicated processes have less chance to succeed and moreover survive over longer period of time.

1

u/Unable-Lingonberry19 Aug 15 '22

Can you expand on this? Order matters in your situation too right? Also, can you expand on how you implement the calls and the transaction?

1

u/transeunte Aug 15 '22
  1. Transactions may not be available or desirable

  2. There are cases where ordering matter, especially if the events only contain partial changes

1

u/[deleted] Aug 16 '22

The "right order" thing is indeed very important sometimes. Imagine a manufacturer where production is in the sequence of the line. All parts need to be ordered in sequence (== in "right order"). If not, you'll either struggle to resequence ahead of assembling the part or assemble in wrong sequence.

So in some scenarios, "right order" is on of the most important things of the business applications.

1

u/FairKing Sep 16 '22

You don't use order but event dependency instead. You trigger the second event after the first one is successful. In case of order how do you know that the first one was successful? Order adds complexity. I never use such approach.

If you can provide with such example where my theory, I use in production for years, fails.

→ More replies (1)

21

u/recycled_ideas Aug 15 '22

First pitfall to avoid, event driven architecture. It's a great pattern where it fits, but putting it where it doesn't is a nightmare. Literally billions of dollars have been burned going down this path.

Second pitfall to avoid, 2030 microservices, this is a solution to a self created problem.

I mean if you love pissing money away, sure.

8

u/whatapitynevermind Aug 15 '22 edited Jun 09 '23

[deleted]

6

u/mexicocitibluez Aug 15 '22

First pitfall to avoid, event driven architecture. It's a great pattern where it fits, but putting it where it doesn't is a nightmare.

Same with every other pattern and concept.

0

u/recycled_ideas Aug 15 '22

True, but event driven is one of the most misused and it's application is one of the narrowest while the cost of getting it wrong is particularly high.

0

u/natan-sil Aug 15 '22

Thank you for your comment.
Indeed at Wix there is a hybrid architecture of both request-reply and event-driven.
2300 microservices can't all need the same solutions. that's for sure.

how come 2300? Wix hosts and renders more than 100 million websites, with complete back-office/business solutions as well and an open platform for plugins. with many different verticals (e.g. stores, restaurants, hotels, events, photography). It's a huge production eco-system

1

u/recycled_ideas Aug 16 '22

how come 2300? Wix hosts and renders more than 100 million websites, with complete back-office/business solutions as well and an open platform for plugins. with many different verticals (e.g. stores, restaurants, hotels, events, photography). It's a huge production eco-system

So either you're saying that you have 2300 microservice instances which is a big who cares and doesn't justify an event based system or you're still saying you've got 2300 different microservices which means you've built an insane unmanageable architecture (which is why you're turning to eventing which is just going to make your life even harder in the long run).

The top two "why the fuck are we doing this?" architectures right now are microservices and event driven and guess what you've got the money to burn bingo there.

The fact that your service is basically WordPress(in terms of features) just makes this kind of design even wackier. I'm betting dollars to donuts you've got a big central data store (possibly per customer) that is actually your bottleneck in the overwhelming majority of instances anyway.

1

u/natan-sil Aug 16 '22

The case is the latter. each service has various amount of instances.

we do have numerous optional features that wordpress also offers + very pluggable system.

in terms of data storage. there is no bottleneck as data is also distributed and sharded, usually allowing eventual consistency only (except for use cases that require strong consistency).

→ More replies (1)

1

u/[deleted] Aug 16 '22

[removed] — view removed comment

1

u/recycled_ideas Aug 16 '22

2300 microservices for a CMS for people who want easy web hosting.

I doubt most of their clients even need any kind of massive scaling or anything like this kind of architecture.