TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Monolith First (2015)

40 pointsby bubblehack3r8 months ago

22 comments

kemitche8 months ago
I firmly believe that monolith vs microservice is much more a company organization problem than a tech problem. Organize your code boundaries similar to your team boundaries, so that individuals and teams can move fast in appropriate isolation from each other, but with understandable, agreeable contracts&#x2F;boundaries where they need to interact.<p>Monoliths are simpler to understand, easier to run, and harder to break - up until you have so many people working on them that it becomes difficult for a team to get their work done. At that point, start splitting off &quot;fiefdoms&quot; that let each team move more quickly again.
评论 #41559016 未加载
评论 #41560207 未加载
评论 #41559069 未加载
评论 #41559025 未加载
评论 #41559006 未加载
评论 #41559173 未加载
评论 #41560628 未加载
exabrial8 months ago
Yes? but that really isn&#x27;t the problem. You can do both monoliths and micro-services badly.<p>The real thing that makes software easy to maintain is consistency with itself.<p>If you have one guy that formats his code with spaces and another tabs, that creates friction in the codebase. If you have one guy that always uses `const` or `final`, but another guy that doesn&#x27;t, again hard to maintain.<p>The hard problems are boundaries between business logic is divided. If the application is consistent in how it divides responsibilities, it&#x27;ll be a pretty clean codebase and pretty easy to navigate and maintain. If you have two different rouge agents that disagree on coding styles and boundaries, you&#x27;ll have a pretty difficult codebase to navigate.<p>The easiest codebases have consistent function signatures, architecture, calling conventions, formatting, style, etc and avoid &quot;clever&quot; code.
loughnane8 months ago
&gt; Almost all the successful microservice stories have started with a monolith that got too big and was broken up<p>The less certain you are about a system&#x27;s requirements the more you should prefer a monolith.<p>A well-understood system (eg an internal combustion engine) has well-defined lines and so it _can_ make sense to put barriers in between components so that they can be tweaked&#x2F;replaced&#x2F;fixed without affecting the rest of the system. This gives you worthwhile, but modest overall performance improvements.<p>But if you draw the lines wrong you end up with inefficiencies that outweigh any benefit modularity could bring.<p>Start with a monolith and break it up as the system&#x27;s ideal form reveals itself.
david4228 months ago
My co-worker gave me the quote - &quot;if you have more microservices than clients, you&#x27;re doing it wrong&quot;. Not sure if it was original or not but makes sense to me.
评论 #41563105 未加载
Scubabear688 months ago
I think the overall thesis here is accurate. I can fill in the blanks where Fowler is light on anecdotal evidence. I have done many architecture reviews and private equity due diligence reviews of startup systems.<p>Nearly all the micro services based designs were terrible. A common theme was a one or two scrum team dev cohort building out dozens of Micro services and matching databases. Nearly all of them had horrible performance, throughout and latency.<p>The monolith based systems were as a rule an order of magnitude better.<p>Especially where teams have found you don’t have to deploy a monolith just one way. You can pick and choose what endpoints to expose in various processes, all based on the same monolithic code base.<p>Someday the Internet will figure out Microservices were always a niche architecture and should generally be avoided until you prove you need it. Most of the time all you’re doing is forcing app developers to do poorly what databases and other infrastructure are optimized to do well.
kgeist8 months ago
A few years ago, after having worked on a microservice-oriented project for some time, I joined a team which developed a monolith. To be honest, it felt like a breath of fresh air. What previously took coordination across multiple teams and repositories, tens of API schemas, complex multi-stage releases (your average feature usually touches lots of microservices), complicated synchronization of data stored in tens of DB, with a whole theory on microservice communication and a whole DevOps team with their own &quot;platform&quot; -- now it&#x27;s just a bunch of commits in the same repository, a single release. To prevent code from becoming complex spaghetti, they simply use the modular monolith architecture (modulith). There&#x27;s simply a linter which makes sure module boundaries are not violated (so they are encapsulated properly, just like in microservices). Want to support more load? Just increase the number of workers&#x2F;servers. The single DB becomes too large? Just split it into several DBs and connect to different physical machines as needed. Now I&#x27;m pretty skeptical of the whole microservice thing. To be honest, I can&#x27;t name a single advantage microservices over monoliths anymore. All problems are solvable with a monolith just fine, without all the complexity. The only time we needed to physically split a part of the monolithic codebase into a separate repository was when the infosec department asked us to store and process personal data inside isolated infrastructure to conform to some regulations.
xg158 months ago
I think microservices can be useful for nontechnical reasons: They let you take the &quot;org chart becomes architecture&quot; from an unseen, not really understood force into something explicit that you can observe and manage.<p>Instead of multiple teams working on the same codebase and stepping on each other&#x27;s toes, each team can have clear ownership of &quot;their&quot; services. It also forces the teams to think about API boundaries and API design, simply because no other way of interaction is available. It also incentivices to build services as mostly independent applications (simply because accessing more services becomes harder to develop and test) - which in turn makes your service <i>easier</i> to develop against and test in (relative) isolation.<p>However, what&#x27;s of course a bit ridiculous is to require HTTP and network boundaries for this stuff. In principle, you should get the same benefits with a well-designed &quot;modulith&quot; where the individual modules only communicate through well-defined APIs. But this doesn&#x27;t seem to have caught on as much as microservices have. My suspicion is that network boundaries as APIs provide two things that simple class or interface definitions don&#x27;t: First, stronger decoupling: Microservices live in completely separated worlds, so teams can&#x27;t step on each other&#x27;s toes with dependency conflicts, threading, resource usage, etc. There is a lot of stuff that would be part if the API boundary in a &quot;modulith&quot; that you wouldn&#x27;t realize is, until it starts to bite you. Second, with monoliths, there is some temptation to violate API boundaries if it let&#x27;s you get the job done quickly, at the expense of causing headaches later: Just reuse a private until method from another module, write into a database table, etc. With network&#x2F;process boundaries, this is not possible in the first place.<p>It&#x27;s a whole bunch of very stupid reasons, but as they say, if it&#x27;s stupid and works, it ain&#x27;t stupid.
评论 #41561942 未加载
mrweasel8 months ago
There is also room for the in-between, not a monolith, but also not &quot;micro&quot; services. It is actually possible to have a number of services working together, each on their own a small monolith.<p>I&#x27;ve done multiple projects where we have fairly large service working together. Sometimes they function on their own, other times they hand of a task to another service in order to complete the entire process. Sometimes they need each other to enrich something, but if the other service isn&#x27;t running that&#x27;s okay for a short time.<p>It is also worth remembering that if all your microservice needs to be running at the same time, you just have a distributed monolith, which is so much worse than a regular monolith.
ghomem8 months ago
I love Martin Fowler&#x27;s one pager called Snowflake server - it aged very well and I still use it as a reference in the cloud era. And this text is also good advice IMO.<p>What I feel that is missing on what he calls the &quot;Microservices Premium&quot; is a clear statement that this premium is paid in &quot;ops&quot; hours. That changes the game because of the &quot;ops&quot; resource scarcity.<p>In fact, the microservices dilemma is an optimization problem related to the ops&#x2F;dev ratio that is being wrongly treated as a conceptual problem.<p>This is the simplest analysis I could come up with:<p><a href="https:&#x2F;&#x2F;logical.li&#x2F;blog&#x2F;ops-dev-ratio&#x2F;" rel="nofollow">https:&#x2F;&#x2F;logical.li&#x2F;blog&#x2F;ops-dev-ratio&#x2F;</a>
TrianguloY8 months ago
Another one here working with microservices and almost-hating it.<p>Also<p>&gt; By starting with microservices you get everyone used to developing in separate small teams from the beginning, and having teams separated by service boundaries makes it much easier to scale up the development effort when you need to.<p>Nop, not for my team at least, most features require touching several microservices, so now you have either as many merge conflicts as edges (if one team is responsible for fixing what breaks in the other sides, yes, that happens) or need to have twice the meetings with twice the people to make sure each side is doing what the other expects.
danielovichdk8 months ago
Whenever this man write anything the cargo cults are flocking. That&#x27;s totally okay as long as you are aware.<p>I recommend you to learn to think for yourself given the context you are in, along with the power and social dynamics of such.
forrestthewoods8 months ago
The philosophy that has served me well is &quot;do the simplest possible thing&quot;.<p>Sometimes problems are intrinsically complicated and the solution is required to be complex. But even in that case it&#x27;s important to do the simplest thing you can get away with!<p>My experience is that people, myself included, almost always over-engineer unless they focus really hard on doing the simple thing. It takes concentrated effort to avoid architecture astronauts and their wildly convoluted solutions.<p>It&#x27;s orders of magnitude easier to add complexity than to remove it. Do the simple thing!
apitman8 months ago
I like to follow a pattern I call monomicro. Basically I develop separate programs for different functionality, but make them embeddable so they can be composed and run in the same memory space for small deployments. The code that runs <a href="https:&#x2F;&#x2F;lastlogin.net" rel="nofollow">https:&#x2F;&#x2F;lastlogin.net</a> is a good example. For LastLogin it runs as a globally distributed cluster on fly.io, but it&#x27;s also fully embeddable in any Golang program to act as an auth layer.
dang8 months ago
Related. Others?<p><i>Monolith First (2015)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=26190584">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=26190584</a> - Feb 2021 (340 comments)<p><i>Monolith First (2015)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14778685">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14778685</a> - July 2017 (163 comments)
Rickasaurus8 months ago
Recently was looking at a distributed microservice system at a company that thought they would need massive scale, but pivoted from d2c to enterprise b2b and then found out enterprise b2b companies want data separation. They would have been much better off going monolith first and probably actually sticking with a monolith.
评论 #41558941 未加载
curious_cat_1638 months ago
Yes. It does require thinking about the monolith in a way so it can be broken up should the need arise.<p>Going down the monolith path != Having spaghetti as the core abstraction. :)
评论 #41558967 未加载
ChrisArchitect8 months ago
Related recently:<p><i>Modular Monoliths Are a Good Idea</i><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=41534179">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=41534179</a>
dangoodmanUT8 months ago
Just see things like Redpanda, Cloudflare, etc.<p>These complex systems are made easier by being built as a single binary
alganet8 months ago
Monolith as the final goal is probably a good way to think about the issue.<p>Janky modular stuff first, full of inefficiencies, few formalities, designed to move fast and _not be in production_. Once it&#x27;s up and running (in a test setup), you can &quot;see the shape of it&quot; and make it into a more cohesive thing (a &quot;monolith&quot;).<p>This is consistent with how many other crafts older than programming have coalesced over centuries. I suspect there&#x27;s a reason behind it.<p>You don&#x27;t start with an injection-molded solid piece of metal with carefully designed edges that can be broken later (or shaven off) in different ways. You machine something that you don&#x27;t understand yet using several different tools and practices, then once the piece does what you want (you got a prototype!), you move the production line to injection molding. The resulting mold is way less flexible than the machining process, but much more cohesive and easy to manage.<p>Of course, programming is different. The &quot;production lines&quot; are not the same as in doing plane parts. In programming you &quot;fly the plane&quot; as soon as it is &quot;air worthy&quot; and does improvements and maintenance in mid-flight. It&#x27;s often a single plane, no need to make lots of the same model.<p>So, with that in mind, there&#x27;s an appeal for carefully planning context boundaries. It&#x27;s easier to ditch the old radar system for a new one, or replace the seats, or something like that, all during flight.<p>If the plane breaks down mid-flight, the whole thing is disastrous. So we do stuff like unit testing on the parts, and quality assurance on a &quot;copy of the plane&quot; with no passengers (no real users). Wait, aren&#x27;t those approaches similar to old traditional production lines? Rigs to test component parts individually, fixtures (that comes from the machining world), quality assurance seals of approval, stress tests.<p>So, why the hell are we flying the plane as soon as it is barely air worthy in the first place? It creates all those weird requirements.<p>&gt; When you begin a new application, how sure are you that it will be useful to your users?<p>Well, I don&#x27;t have any clue. But _almost all_ applications I ever built were under serious pressure to be useful real fast. Barely flying was often enough to stop the design process, it got passengers at that point so no need to go back to the drawing board. What it often required by the stakeholders is not a better production process, it&#x27;s just making the barely flying plane bigger.<p>I know, I know. Borrowing experience from other industries is full of drawbacks. It&#x27;s not the same thing. But I can&#x27;t just explain the absurdities of this industry (which are mostly non-related to engineering) in any other way.<p>All of this reminds me of that &quot;If Microsoft made cars...&quot; joke, but it&#x27;s not funny anymore.
brodouevencode8 months ago
the problem with the yagni argument is is you aint gonna need it until you do
评论 #41558869 未加载
评论 #41558875 未加载
评论 #41558862 未加载
the_clarence8 months ago
Yes strive to find one good language and use it everywhere. Then when greater languages like Rust come out you have a problem.
negus8 months ago
A monolith is just one microservice. Is there a choice to be made? &quot;We love monoliths so much so we have dozens of them&quot;
评论 #41558925 未加载
评论 #41558915 未加载