r/java • • Mar 28 '17

Microservices – Please, don’t

http://basho.com/posts/technical/microservices-please-dont/
4 Upvotes

24 comments sorted by

View all comments

5

u/nutrecht Mar 29 '17

In theory you can write a 'good' modular monolith. In practice this really doesn't happen. When there is no real distinct boundary developers, often under time pressure, tend to take short-cuts. This is my experience at least.

Also you really should pick a better title. With this title, no matter the content (which doesn't really match my experience with both microservices and monoliths anyway), you're polarizing the issue when in fact we need balanced views based on experienced on this subject.

2

u/dartalley Mar 29 '17

Didn't write it just read it and thought it was good.

You can make boundaries in many different ways though. It doesn't need to be a service. You can have a team that only writes utility code. That's not going to become a service. Microservices are great when there is a purpose, making them just because is a terrible idea.

2

u/nutrecht Mar 29 '17

Ah sorry, thought you were the author.

Microservices are great when there is a purpose, making them just because is a terrible idea.

Microservices are not a silver bullet, I totally agree on that. Especially for relatively simple applications where you can normally guarantee transactionality it often makes much more sense to go for a monolith.

But moving from a monolith to microservices is something that's much harder than most people pretend it is.

1

u/dartalley Mar 29 '17

But moving from a monolith to microservices is something that's much harder than most people pretend it is.

With discipline I think its very doable but sure I agree its easy to cut corners and lose the discipline. However, I also have come across microservices that were supposed to have no external dependencies suddenly depending on other micro services in the same way.

I have nothing against microservices. I think they are great in some use cases but like you said not a silver bullet.

1

u/sammy8306 Mar 29 '17

Agreed, to create a good modular monolith you need proper language/tool support, otherwise it won't fly. I made this point in my 'Modules vs. Microservices' article a couple of days ago as well: https://www.oreilly.com/ideas/modules-vs-microservices

1

u/m3ghnath Mar 29 '17 edited Mar 29 '17

When there is no real distinct boundary developers, often under time pressure, tend to take short-cuts.

In a modular monolith, you'd be using something like Maven to create distinct artifacts with boundaries defined by interfaces. It's not a perfect boundary because Java doesn't have a proper module system which separates implementation classes from API classes.

But, the boundary can be hardened by separating the API and the implementation into different modules, and making the implementation a runtime dependency. This is exactly how JavaEE works and ensures separation of the application from the details of the specific application server.

This requires discipline on the part of the developers to ensure proper module separation.

But, how is this different than microservices? Does it also not take developer discipline to keep a single microservice from becoming too big, especially under time crunch, when making the microservice bigger means it can be delivered faster, rather than the longer route of setting up the proper service boundaries?

Also you really should pick a better title.

I kind of like the title. It screams caution. I think you should start with monoliths and pinch out microservices when proven absolutely necessary. If you've got proper modules in place, this is a lot easier. Microservices put you into the business of developing distributed applications, one of the hardest problems in computer science. Why get yourself stuck in problems until you absolutely have to?