Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> It's also a mechanically simpler thing to send out a request and wait for the response than to do the dance via a message queue.

Yeah, this is simpler for the requester, but not for the counterpart that has to respond. Because now, the responder has to have 100% uptime and better not fail during the request, otherwise things get lost.

Let's take sending emails as an example. You have a server A that can send emails, you have a server B that fulfills requests/actions by a user. Let's just assume that this is the (legacy) setting we are dealing with.

Now, what do you do if you want to send the user an email on a certain action, e.g. a password reset or changing a payment information etc.? Is B then making a synchronous request to A? What if server A is currently down due to maintenance? What if A uses another entity to send the emails, which itself is down? How do you observe the current state of the system and e.g. detect that A is overloaded?

With a message queue you get all those things for free and A doesn't even have to have any persistence layer for "retries" in case of crashes etc.

While it's true that those issues can all be resolved by "by load balancing or persistence" it just means that you now traded one issue (having a message queue) for multiple issues (having database(s), having load balancer(s) and essentially re-implementing a part of a message queue).

In most cases a message queue seems like a good trade-off.



This is where the "or persistence" bit comes in, but the trade-off isn't as you describe. One way to approach it would be for B to set a flag against the user in the database they must already have, because they have users so that A can process password resets on its own schedule. It's add a column versus add a message queue. Databases already come with locking primitives and well understood patterns, no reinvention needed.


You are now assuming that they indeed have a database nd store users in there, and not use a 3rd party system that might not even allow to attach meta data (or at least make it difficult).


In which case why is the password reset my problem at all?

But even if I've handed off identity management entirely, I almost certainly do have some per-user state. Otherwise... what on earth am I doing with users in the first place?


Well, maybe because the 3rd party service is not reliable or you want to send an additional mail.

But okay, fair point - password-reset is maybe not the greatest example. But it doesn't invalidate the general point (I gave a couple of other examples).

> Otherwise... what on earth am I doing with users in the first place?

Maybe just making sure that the user is known and has paid for plan X (if the 3rd party service offers that).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: