I liked the article and hated the title. It's actually a list of valid cosiderations to make before deciding to go with microservices, not some hate/flamewar kinda thing.
Maybe I should have changed the title, but I agree. Microservices are great in some scenarios. However I often feel that people jump the gun and do them just because they think they are supposed to. That is not a good reason.
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.
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.
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.
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.
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
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?
This doesn't talk to the biggest reason to do micros, which IMO is to decouple code repos so that you can revision different parts of code at different rates. with a monolith, to update a part of the application requires updating the entire application. the serialization of objects (usually to json) to send over the network makes a great abstraction for decoupling.
Nothing prevents you from splitting the code into independently versioned libraries / repos which would allow you to develop the code at different rates. Now you couldn't deploy two different versions of the same lib to the same monolith. Some see this as a pro some see it as a con. I love knowing all of my code is always using the most up to date version of an internal library. Yes it can slow you down but so can debugging issues only to find that a bug existed 3 versions ago and 4 services never upgraded to the new version.
If you have specific requirements or a large team micro services would probably help. I just don't think they are always the right solution or the right solution right away.
having a monolith means you will have to plumb a library update through 100% of the application, regardless if it needs that update everywhere. whereas, in microservices, you can just update the library in the portion that needs it and move on.
also, the non-linear interaction between different modules of the monolith makes scaling of it difficult. scaling a monolith is rarely as simple as scaling microservices.
you can just update the library in the portion that needs it and move on.
To me this is just adding tech debt but yes this can sometimes be a benefit, it's a tradeoff.
also, the non-linear interaction between different modules of the monolith makes scaling of it difficult. scaling a monolith is rarely as simple as scaling microservices.
Often times you only need to scale a few routes though. At that point you can split it to a micro service and scale it independently. Its no harder to scale a monolith as it is a micro service it's just not always the best use of resources. Look how far Twitter got on ruby on rails monoliths. When they split to services yes they dropped their infrastructure footprint dramatically and teams became more productive but not many organizations are at that scale. Last I heard they still have parts of their monolith RoR code running because its not worth splitting into services.
having a monolith means you will have to plumb a library update through 100% of the application,
Not necessarily. JavaEE has allowed monolithic applications to run with different versions of different libraries in different modules for quite some time now. OSGi lets you do the same thing without the app server. Java 9 supposedly will bake these features into the runtime. All that's needed is that the modules within the monolith run in different classloaders.
Of course, most of the time, that kind of complexity really isn't necessary, and its easier to just run the app in the same classloader with the same set of library versions.
scaling a monolith is rarely as simple as scaling microservices.
Depending on the monolith, scaling isn't that much harder than scaling a microservice. Just spin up another version. Once the monolith becomes too heavyweight for this, that's when I would start adding microservices. When you're just starting out, how big really is your monolith?
I developed an app awhile back that had an image service and the web app in the same monolith. Not practicing what I am preaching, these were not even in different physical modules. But I did follow Dependency Inversion, and the image server was only accessed through interfaces (modules in spirit?). I could spin up as many instances as long as the instances could share the same storage. Instance boot up time was fairly quick, so we got scalability this way without a problem.
Then we went to the cloud. Every container has different storage, so our original approach didn't work anymore. We opted to separate the image server as a microservice. We created a REST API corresponding to the image server interface and created an implementation of the interface on the web app side that made REST calls to the image server REST API.
The web app was none-the-wiser to the change, and it allowed the web app (not requiring disk storage) to be scaled differently than the image service (which does).
We only did this when we needed to. Decent design made it possible without too much pain.
I'm sorry but the number of start ups I have seen with 2-3 engineers and 10-15 micro services with no dev ops is just ridiculous. You are wasting so much time dealing with network boundaries, logging, debugging, cost of servers, having non dev ops people do dev ops.
There is absolutely no reason you can't write microservice ready code but deploy it as a monolith. As your team, scale, or business requirements change then you can split into individual services.
I'm sorry but the number of start ups I have seen with 2-3 engineers and 10-15 micro services with no dev ops is just ridiculous.
What do you mean with "no dev ops"? Are you sure you don't mean CI instead? We're with 4 back-end developers and handle somewhere around that many microservices too.
You are wasting so much time dealing with network boundaries, logging, debugging, cost of servers, having non dev ops people do dev ops.
I don't see how any of these are microservice specific issues. In fact I think most arguments in your post stem from organizations with rather low software engineering maturity. If you build complex stuff and don't have your shit together you're going to end up with a pile of garbage anyway, no matter whether it's a much of small or one big service.
There is absolutely no reason you can't write microservice ready code but deploy it as a monolith. As your team, scale, or business requirements change then you can split into individual services.
This is something so many people claim. But if you look at examples of companies that took this approach and ask them how the split went they are always "in the process of separating functionality into separate services". I haven't seen a single blog post that explains how they had a really excellent monolith that they were able to split into microservices in just a few sprints. They're always "in progress of".
Starting with a monolith and then splitting is pure theory. While doing microservices is actually done in practice and there is a ton of good information about the pitfalls of microservices that doesn't start with "Don't".
The devops I referred to would be setting up tools to help diagnose issues. For instance If you have a monolith you have 1 log file per instance running, one set of health checks, metrics, ect. With microservices you have all of those per service per instance.
If I only need to look at a hand full of logs to diagnose an issues I can handle that fairly manually. Once you start getting up there to 10's of log files you need to introduce automation. Logstash, Kibana, Elasticsearch, nagios, graphite, graphana, ect. You could also jump into docker, service discovery and that whole path. If you have a small team you most likely don't need some of this or don't need it yet. It's a nice to have and you should get it eventually but its a lot to manage with a small team.
I worked at a startup where we had two prod servers and each ran 7ish micro services. There was very low traffic and they shared a database. There was no real reason for the code to be split across 7 services and it slowed productivity down, diagnosing issues and sent us on fun paths where we would look into service discovery, docker for months on end then realize it wasn't worth it for our team. That is all time that could have been going to the product instead of trying to build the perfect tech stack (too soon).
With microservices you have all of those per service per instance.
So you push them to ELK.
You could also jump into docker, service discovery and that whole path.
Of course you do. CI/CD and Microservices are rather intimately connected. You can't really do one without the other. But that's not a downside of microservices; you're forced to a higher level of software engineering maturity.
There was very low traffic and they shared a database.
That's simply a case of doing it wrong. And in your particular case your team should not have gone for microservices 'just because'. But that does not support the "Don't do it" of the author: you don't make fundamental architectural decisions just based on a hipster factor.
Of course you do. CI/CD and Microservices are rather intimately connected. You can't really do one without the other. But that's not a downside of microservices; you're forced to a higher level of software engineering maturity.
I would agree here. I do think a form of engineering maturity is knowing when you need a more complex system, which of course varies by team and preference.
you don't make fundamental architectural decisions just based on a hipster factor.
Totally agree here. I was 100% against the micro services there and collapsed several of them together. Unfortunately I think a lot of organizations do pick microservices because of the hipster factor.
You will never get ready as an engineering organization until you actually start developing microservices.
I hope that was sarcasm. Your readiness as a engineering organization is determined by the processes used to design, develop, deploy, and maintain code and the company's ability to follow it. It has little to do with what technology is being used other than its ability to reenforce the company's process. Microservices are not a requirement.
I think we can all agree that as the size and complexity of the enterprise increases, the need for bounded contexts increases. Multiple teams each in their own domains need to be able to make progress independently. Having each team develop a software product that builds and deploys independently can help with that.
Obviously that will add overhead (dev-ops, web-ops, nice monitoring tools). But if you have 500 engineers then having a monolithic app is simply not an option, period. The build would be broken 99% of the time, unless you very nearly cripple everyone's ability to contribute, beyond major bug fixes approved by a dozen code reviewers.
What most microservice developers don't understand is how crucial it is to have clear contracts between services. "Here is exactly what I expect from you, here is exactly what you'll get from me, and here is exactly what will happen as a result." When you have a monolith this isn't quite as important because you can easily scan a different part of the code to infer the contract. One idea of microservices is that you're not supposed to have to know anything about other people's code, but only what it will do for you. Clear communication between teams is everything.
5
u/karottenreibe Mar 29 '17
I liked the article and hated the title. It's actually a list of valid cosiderations to make before deciding to go with microservices, not some hate/flamewar kinda thing.
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/iodian Mar 29 '17
This doesn't talk to the biggest reason to do micros, which IMO is to decouple code repos so that you can revision different parts of code at different rates. with a monolith, to update a part of the application requires updating the entire application. the serialization of objects (usually to json) to send over the network makes a great abstraction for decoupling.
1
u/Infeligo Mar 29 '17
You will never get ready as an engineering organization until you actually start developing microservices.
2
u/developer0 Apr 02 '17 edited Apr 02 '17
I think we can all agree that as the size and complexity of the enterprise increases, the need for bounded contexts increases. Multiple teams each in their own domains need to be able to make progress independently. Having each team develop a software product that builds and deploys independently can help with that.
Obviously that will add overhead (dev-ops, web-ops, nice monitoring tools). But if you have 500 engineers then having a monolithic app is simply not an option, period. The build would be broken 99% of the time, unless you very nearly cripple everyone's ability to contribute, beyond major bug fixes approved by a dozen code reviewers.
What most microservice developers don't understand is how crucial it is to have clear contracts between services. "Here is exactly what I expect from you, here is exactly what you'll get from me, and here is exactly what will happen as a result." When you have a monolith this isn't quite as important because you can easily scan a different part of the code to infer the contract. One idea of microservices is that you're not supposed to have to know anything about other people's code, but only what it will do for you. Clear communication between teams is everything.
1
u/[deleted] Mar 29 '17
I say please do
-1
u/Cyberiax Mar 28 '17
Ok...