News for hackers. Stuff that matters.
Re:Microservices? Please Don't by nhumrich on Tuesday December 13, 2016 @10:22AM (#13167407)
The author never discusses the most important pieces of microservices. The biggest one in my mind being organizational scalability. He talks about scalability from a performance viewpoint but not an org standpoint. Same with speed. Yes microservices add overhead and can be slower than a monolith, but they can give you autonomy and business speed. Business speed is so much more important than performance.
Re:Microservices? Please Don't by djsumdog on Tuesday December 13, 2016 @12:25PM (#13168561)
The author didn't discuss queues once. I work at a company that uses microservices and queues. Right now we use Rabbit, which is terrible for some reasons I won't get into, but the one good thing about it is that each message has to be acked. You take a message, you process it and then you make that you've processed it.

Things don't get lost. You can requeue messages that end up being dead-lettered due to bugs. You can scale the number of services that read from that queue. You can have services up independently if they just read and write from a system that says, "here's a chunk of data to process."

You can loose data with Rabbit, and if you're starting from the ground up you might want to look at something like Kafka instead. If you don't care about message loss and just need throughput (like if you're doing real time logs or sensor data), something like zeromq might be more appropriate.

The idea behind microservices is that you gain stability at the expense of some redundancy.

Re:Microservices? Please Don't by UK-AL on Tuesday December 13, 2016 @12:39PM (#13168690)
We use queues + microservices. It's a good combo.

We also split the messages into different types, commands and events. A command is to perform a specific action and is normally aimed at a specific service. And event alerts any subscribed service that a action has happened.

So you send a CreateOrder command. After processing it would fire off a CreatedOrder event which any subscribed service could pick up(Such as a EmailService sending a confirm email). Allows you to create workflows, and monitoring systems quite easily.

I'm interested in your experience with RabbitMQ?

Re:Microservices? Please Don't by djsumdog on Tuesday December 13, 2016 @06:12PM (#13172167)
So you're using event sourcing then? We're doing the same thing using akka-persistence.

I'm not directly on the team that maintains our RMQ instances so I'm not the best to comment on it. Our dev-ops team have a complicated set of shovels and federation to deal with/minimize data loss, but I haven't had to delve into those scripts too much yet.

Re:Microservices? Please Don't by StabbyCutyou on Tuesday December 13, 2016 @01:50PM (#13169471)
I didn't discuss queues because queues aren't intrinsically a part of a MS architecture.

You certainly can do it that way, and there are lots of benefits, but queues (and if you're doing this at scale, distributed queues) are an entirely distinct subject matter that I chose not to touch on for this.

Also, things can still get lost with queues. Network failures, partitions, bugs in your own publishers and consumers... nothing is fool-proof, and it takes a lot of work to reduce that loss rate to 0.

Re:Microservices? Please Don't by gshulegaard on Tuesday December 13, 2016 @02:08PM (#13169705)
> I didn't discuss queues because queues aren't intrinsically a part of a MS architecture.

I find this an odd juxtaposition. On one hand I see what you are saying, but on the other I believe the nature of MS architecture places huge emphasis on State and State management that isn't necessarily as large a focus in Monolithic patterns. Stateless versus Stateful and now the creative application of "Soft"-state design patterns become non-trivial concerns in a MS world.

To that end, I feel like some address (positive or negative) on the impacts MS architecture have on state and the pros-and-cons I think are topical.

I was also wondering, for my own education, if you could expound a little on your points here:

> Also, things can still get lost with queues. Network failures, partitions, bugs in your own publishers and consumers

Specifically:

> Network failures

I had always thought that the delivery guarantees of TCP (and maybe the new QUIC protocol over UDP) were robust against network failures. What kind of edge cases would result in data loss in queue context?

> partitions

I am entirely ignorant on how partitions might result in data loss...so what kind of things have you seen?

> bugs in your own publishers and consumers

Isn't this true across any application regardless of architecture? Or are you implying that MS architecture/Queues some how increase the likelihood of bugs by nature?

Thanks in advance! (I always enjoy learning new things and hearing about/learning from other's experiences)

Re:Microservices? Please Don't by StabbyCutyou on Tuesday December 13, 2016 @02:51PM (#13170257)
So, specifically in the context of a distributed queue (which, if we're talking about using MS arch + queueing due to scale concerns, you really need some kind of distribution to the message queue imo), these things get a lot harder.

Just because TCP provides resilience doesn't mean that you're perfectly defended against all kinds of issues here.

I'm mostly talking about things in the category of bugs in the software layer using TCP (the drivers, the consumers/publishers, race conditions, batching messages, not receiving ACKs, etc). There are a lot of little things that can go wrong.

In terms of partitions, look up a series by a guy named Aphyr called "Jepsen". It goes over the CAP theorem as it applies to distributed datastores and queues. His examples and tests will demonstrate the concepts behind partitioning better than I can explain over a HN comment :)

And yes, these types of failures are implicit everywhere - but every additional layer you add, every hop in the chain, every interaction added to the request flow increases the surface area for problems. Especially once you push high scale with hundreds of nodes, become nic or cpu bound, etc etc.

There is a lot to unpack here, and it's not as simple as it seems on the face of it.

Re:Microservices? Please Don't by joostdevries on Tuesday December 13, 2016 @02:07PM (#13169693)
What are the issues you're facing with RabbitMQ? I'm about to start a new project and we still have choice which queueing to use...
Re:Microservices? Please Don't by fdim on Tuesday December 13, 2016 @11:14AM (#13167855)
Until performance becomes a critical issue and then you have to deal with increased costs (hardware), caching, complexity... And if you happen to pair service with its own database (trustpilot), aggregating data for statistical reason becomes even more 'fun'.
Re:Microservices? Please Don't by blauditore on Tuesday December 13, 2016 @11:33AM (#13168068)
I think it's touched in #2 and #4. The author argues that it becomes more complicated because each service needs to be understood thoroughly and mentions the "not-my-problem syndrome".

While these issues are definitely there, the problem of understanding a subsystem also exists on large monolithic applications. The not-my-problem syndrome seems like an indicator of bad devs and/or company culture (I've seen this happen once) and might be mitigated by making people work on multiple microservices instead of completely separating them.

In my opinion, separating a big project into multiple services emerges from the fact that most languages don't have built-in features for modularization on a large scale. In Java, for instance, there are methods < classes < packages. Once there are dozens of packages and thousands of classes, a project becomes hard to navigate and understand, especially when code isn't well-written with hacks disregarding modularizations. Using microservices reduces scope and prohibits some of these no-gos.

Re:Microservices? Please Don't by lmm on Tuesday December 13, 2016 @12:17PM (#13168479)
> In Java, for instance, there are methods < classes < packages. Once there are dozens of packages and thousands of classes, a project becomes hard to navigate and understand, especially when code isn't well-written with hacks disregarding modularizations. Using microservices reduces scope and prohibits some of these no-gos.

At that point you step up to using multiple maven modules. Which can give much the same development experience as microservices, but without the extra network boundary.

Re:Microservices? Please Don't by blauditore on Tuesday December 13, 2016 @01:51PM (#13169494)
Yeah, that's one way to go, and also supports separate versioning and release cycles of different subsystems.

However, since all code is compiled into one large application there are other problems arising.

One I've seen often is sloppy dependency management: A explicitly depends on B, B on C. Now, a dev working in A starts using classes from C without declaring the dependency. Everything works because C is still included through B, but as soon as B gets removed, things start to break. There is mvn dependency:analyze to discover such issues, but it's not 100% exact, and people need to actively use it.

I think such a system built into and enforced by a language would be another quantum leap.

Re:Microservices? Please Don't by lmm on Tuesday December 13, 2016 @03:02PM (#13170374)
It's very normal for methods in B to return types from C in that scenario though. And if you do remove the dependency on B, you get the error at compile time. So I don't see this as a major problem (it's maybe a problem if something's implicitly activated by reflection, but I see the reflection as the bigger problem there)
Re:Microservices? Please Don't by blauditore on Tuesday December 13, 2016 @03:29PM (#13170649)
When running into these runtime errors, it's sometimes not clear what module a missing class came from for complex setups, especially in a part of code you didn't recently work in. Then, the right version needs to be determined by following removed intermediate modules. It would just be cleaner and more reliable if the original dev had done this when writing the code in question.

But yeah, at least it fails on compile time already.

Re:Microservices? Please Don't by lmm on Tuesday December 13, 2016 @04:00PM (#13170950)
> When running into these runtime errors, it's sometimes not clear what module a missing class came from for complex setups, especially in a part of code you didn't recently work in.

Just go to search.maven.org and do a full class name search, no?

Re:Microservices? Please Don't by blauditore on Tuesday December 13, 2016 @04:19PM (#13171134)
The problem is that this doesn't work for modules not published there, i.e. if you have a large in-house code base split into many maven modules.
Re:Microservices? Please Don't by lmm on Tuesday December 13, 2016 @06:28PM (#13172303)
IDEs can open classes by name, wherever they are on the classpath. I'd normally have all projects open in any case even on quite large codebases - it's very practical with modern hardware.
Re:Microservices? Please Don't by blauditore on Wednesday December 14, 2016 @04:39AM (#13174838)
Indeed, but it takes some time to get there in case of dozens or hundreds of modules in different git repos (again, depending on the size of your ecosystem).
Re:Microservices? Please Don't by lmm on Wednesday December 14, 2016 @06:07AM (#13175147)
I just don't see how this is a problem. For any class on your classpath, ctrl-shift-t or whatever will go to it. If removing a dependency lead to missing that class, you can probably just open it, and you can certainly revert the removal and then just open it. Or do a classname search on your internal maven repository.
Re:Microservices? Please Don't by eej71 on Tuesday December 13, 2016 @10:33AM (#13167493)
I think the author criticizes that view point in the final paragraph of fallacy #4. No?
Re:Microservices? Please Don't by nhumrich on Tuesday December 13, 2016 @04:10PM (#13171065)
Not really. That section is about "simplicity". Microservices can be more complicated, but they shorten the feedback loop and reduce hand-offs.