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)

820 pointsby asyrafqlover 4 years ago

84 comments

ser0over 4 years ago
A more common scenario I see is that people start with a monolith that ends up inheriting all the conceptual debt that accumulates as a project evolves. All this debt builds up a great desire for change in the maintaining team.<p>A champion will rise with a clean architecture and design in microservice form that addresses all high visibility pain points, attributing forecasted benefits to the perceived strengths of microservices. The team buys into the pitch and looks forwards to a happily-ever-after ending.<p>The reality though is that the team now has multiple problems, which include:<p>- Addressing conceptual debt that hasn&#x27;t gone away. - Discovering and migrating what the legacy system got right, which is often not documented and not obvious. - Dealing with the overheads of microservices that were not advertised and not prominent at a proof-of-concept scale. - Ensuring business continuity while this piece of work goes on.<p>I would propose alternative is to fix your monolith first. If the team can&#x27;t rewrite their ball of mud as a new monolith, then what are the chances of successfully rewriting and changing architecture?<p>Once there is a good, well functioning monolith, shift a subset of responsibility that can be delegated to a dedicated team - the key point is to respect Conway&#x27;s law - and either create a microservice from it or build a new independent monolith service, which aligns more to service oriented architecture than microservices.
评论 #26191201 未加载
评论 #26191071 未加载
评论 #26191320 未加载
评论 #26199476 未加载
评论 #26192684 未加载
评论 #26195679 未加载
评论 #26192775 未加载
评论 #26221299 未加载
评论 #26191011 未加载
评论 #26191192 未加载
评论 #26193697 未加载
评论 #26191119 未加载
评论 #26192716 未加载
评论 #26195164 未加载
lmilcinover 4 years ago
Hahaha. I have been saying the same for years but have either been punished by my managers or mercilessly downvoted on HN.<p>Somehow mentioning that microservices might not be perfect solution in every case triggers a lot of people.<p>I have actually helped save at least one project in a huge bank which got rolled from 140 services into one. The team got also scaled down to third of its size but was able to work on this monolithic application way more efficiently. Also reliability, which was huge issue before the change, improved dramatically.<p>When I joined, I have observed 6 consecutive failed deployments. Each took entire week to prepare and entire weekend to execute (with something like 40 people on bridge call).<p>When I left I have observed 50 consecutive successful deployments, each requiring 1h to prepare (basically meeting to discuss and approve the change) and 2h of a single engineer to prepare and execute using automation.<p>Most projects absolutely don&#x27;t need microservices.<p>Breaking anything apart brings inefficiencies of having to manage multiple things. Your people now spend time managing applications rather than writing actual business logic. You have to have really mature process to bring those inefficiencies down.<p>If you want to &quot;do microservices&quot; you have to precisely know what kind of benefits you are after. Because the benefits better be higher than the costs or you are just sabotaging your project.<p>There are actually ways to manage huge monolithic application that don&#x27;t require each team to have their own repository, ci&#x2F;cd, binary, etc.<p>How do you think things like Excel or PhotoShop have been developed? It is certainly too large for a single team to handle.
评论 #26191595 未加载
评论 #26193321 未加载
评论 #26198462 未加载
评论 #26194511 未加载
评论 #26192344 未加载
评论 #26198011 未加载
评论 #26192883 未加载
kingdomcome50over 4 years ago
The problem with creating a dichotomy between &quot;monolith&quot; and &quot;microservices&quot; is that... well... it doesn&#x27;t make any sense. You describe your &quot;microservices&quot; and I&#x27;ll explain how it&#x27;s really just a monolith.<p>&quot;So let me get this straight, you have a Billing package and an Ordering package. How are these organized again?&quot;<p>-&gt; &quot;We have a distributed system.&quot;<p>&quot;So you you compile them together and deploy them horizontally across many machines? Like a distributed monolith?&quot;<p>-&gt; &quot;No we use microservices. The two packages are compiled and deployed separately so there is no code dependencies between them.&quot;<p>&quot;Okay. So if I understand this right, you develop each package separately but they both access the same database?&quot;<p>-&gt; &quot;No no no no! Microservices are not just about code dependency management, they are also about data ownership. Each package is developed and deployed separately and <i>also</i> manages it own database.&quot;<p>&quot;Ah, so you have two monoliths?&quot;<p>-&gt; &quot;...&quot;<p>You see the problem is that the above terms are too broad to describe anything meaningful about a system. And usually &quot;monolith&quot; is used to described the dependencies between <i>code</i> whereas &quot;microservices&quot; is used to describe dependencies about <i>data</i>. It turns out there is a lot of overlap.<p>Design and implement your systems according to your use-case and stop worrying about how to label them.
评论 #26197978 未加载
mstipeticover 4 years ago
I keep saying this every time this topic comes up, have a look at elixir&#x2F;erlang. The OTP library gives some great reusable patterns (and elixir project is adding new ones[1]) out of the box. You&#x27;re basically developing a single codebase microservice project which feels like a monolith. You can spread out on multiple machines easily if you need to, the introspection tooling is better than anything you can buy right now, it&#x27;s amazing.<p>Things can get tricky if you need to spread out to hundreds of machines, but 99%+ of projects wont get to that scale.<p>[1] <a href="https:&#x2F;&#x2F;elixir-lang.org&#x2F;blog&#x2F;2016&#x2F;07&#x2F;14&#x2F;announcing-genstage&#x2F;" rel="nofollow">https:&#x2F;&#x2F;elixir-lang.org&#x2F;blog&#x2F;2016&#x2F;07&#x2F;14&#x2F;announcing-genstage&#x2F;</a>
评论 #26192347 未加载
评论 #26191237 未加载
评论 #26191578 未加载
trabant00over 4 years ago
I see services (not micro) as an organizational solution more than a technical one. Multiple teams working on the same service tend to have coordination problems. From this perspective starting with a monolith as you start with one team seems natural.<p>Now the trend of breaking things up for the sake of it - going micro - seems to benefit the cloud, consultancy and solution providers more than anybody else. Orchestrating infrastructure, deployments, dependencies, monitoring, logging, etc, goes from &quot;scp .tar.gz&quot; to rocket science fast as the number of services grows to tens and hundreds.<p>In the end the only way to truly simplify a product&#x27;s development and maintenance is to reduce its scope. Moving complexity from inside the code to the pipelines solves nothing.
评论 #26193134 未加载
100-xyzover 4 years ago
I work for a small company that uses microservices architecture. The product is simple where a user registers, enters preferences, selects from courses and submits a form. A monolith would be doable with 5 good engineers. Instead we have about 50 engineers+QA releasing bug filled code.<p>The company&#x27;s design philosophy is based more on what is fashionable that what is suitable.
评论 #26195036 未加载
评论 #26193236 未加载
评论 #26193308 未加载
ngngngngover 4 years ago
With this in mind, if I were to start a new project today (using Go, which is all I use anymore). I would segment my code inside of a monolith using interfaces. This would incur a very slight initial cost in the organization of the codebase prior to building. As your usage goes up and the need to scale parts of it increases, you could swap these interfaces out little by little by reimplementing the interface to contact your new external microservice.<p>I&#x27;ve worked at several companies where microservices were necessary, and I can&#x27;t believe how clunky they are to work with. I feel like in 2021 I should be able to write a monolith that is capable of horizontally scaling parts of itself.
评论 #26191261 未加载
评论 #26191140 未加载
评论 #26192427 未加载
评论 #26191069 未加载
评论 #26194381 未加载
评论 #26192911 未加载
foreignerover 4 years ago
I&#x27;m embarrassed to say that I recently built microservices first, and am now kicking myself as I merge them back in to a monolith.
评论 #26191304 未加载
评论 #26191004 未加载
评论 #26192457 未加载
bernawilover 4 years ago
But how monolithic were our monoliths anyway? Take your bog-standard ecommerce solution, built with a LAMP stack.<p>Okay, we&#x27;ve got a php process. Let&#x27;s put our business logic there.<p>Okay, I need a database. With current cloud practices, that&#x27;s probably going to be deployed in a different machine. We&#x27;ve got our business logic service and our datastore separated by a network bound from the get go.<p>Okay this is not very performant, I need to cache some data. Let&#x27;s add a redis instance in our cloud provider. I guess this we&#x27;ll be our cache service.<p>Okay we need to do full-text search, let&#x27;s add an elasticsearch cluster through our cloud provider.<p>Okay I need to store users. We can built that into our business logic core, of course, but screw that. We are using Auth0. I guess our &quot;user service&quot; is distributed now. Okay, my php process can&#x27;t keep up with all this requests, let&#x27;s scale this horizontally by deploying multiple php processes behind a load balancer!<p>Okay, now I need to do some batch processing after hours. I could add a cron job for that, but I don&#x27;t want to deal with everything needed for retrying&#x2F;reprocessing&#x2F;failure handling plus now that it&#x27;s a multi-instance deployment it&#x27;s not even clear which process should do this! Let&#x27;s put this work in a Lambda from our cloud provider.<p>So until now, we had a star architecture where everything talked to our business core. But adding this lambda that will talk directly to other services without consulting the core we&#x27;ve lost that.<p>Now, stripping out the business core into its constituent parts doesn&#x27;t sound so strange, does it?
评论 #26195852 未加载
hcarvalhoalvesover 4 years ago
IMO this is an unnecessary dichotomy that we&#x27;re currently forced to deal with, because we don&#x27;t yet have a good solution for programming the &quot;cloud&quot; the same way you program a for a single computer, and that ends up leaking into all the consequent decisions of modularisation, performance, code management, deployment, team organisation, etc.<p>(My holy grail would be programming for distributed environments as if you had one giant single-thread computer, and function calls could arbitrarily happen over IO or not, then concerns would boil down to code organisation first. I believe Erlang&#x27;s OTP model or the way some features of Google Cloud Platform are organised gets us closer to this ideal, but we&#x27;re not quite there yet.)
评论 #26198286 未加载
评论 #26199531 未加载
评论 #26197987 未加载
评论 #26193565 未加载
评论 #26195321 未加载
nojvekover 4 years ago
Most common architecture for SAAS apps is a frontend served from cdn + frontends served by app stores, an api server behind app load balancer (e.g nginx), a database cluster, and a bunch of async long lived cron jobs + on demand jobs.<p>In that architecture you don’t need that many Microservices. The api server is prolly the most important bit and can be served as a monolith.<p>Many 10B+ companies use this architecture. It works well and does the job. Mono&#x2F;Microservices is really about separation of concerns. Separation of concerns mostly around what you want to deploy as a unit, redundancy and what should be scaled as a unit.<p>Agree with author. Start with one chunk, and split when you feel the pain and need that separation of concern. Fewer pieces are easier to reason about.
评论 #26195491 未加载
bob1029over 4 years ago
We did the journey both ways:<p>Monolith -&gt; Microservices -&gt; Monolith<p>The first monolith was so bad that microservices made sense at that point in time. The current monolith is an exemplar of why we do not use microservices anymore. Everything about not fucking with wire protocols or distributed <i>anything</i> is 100x more productive than the alternatives.<p>Deciding you need to split your code base up into perfectly-isolated little boxes tells me you probably have a development team full of children who cannot work together on a cohesive software architecture that everyone can agree upon.
ivanbover 4 years ago
There is no replacement for discipline. If you cannot structure your modules well, what makes you think that your microservice spaghetti would look better?
评论 #26191273 未加载
评论 #26191302 未加载
jiggawattsover 4 years ago
Not even just microservices. Even just unnecessary layers or tiers.<p>I&#x27;m working on a project right now trying to spin up the infrastructure in the public cloud for a simple application that some bored architecture astronaut decided would be better if it had an &quot;API tier&quot;. No specific reason. It should just have tiers. Like a cake.<p>Did you know Azure&#x27;s App Service PaaS offering introduces up to 8-15ms of latency for HTTPS API calls? I know that now. Believe, me I know that all too well.<p>To put things in perspective, back in the days I cut my teeth writing &quot;4K demos&quot; that would be added to zip files on dialup bulletin boards. In those days, I carefully weighed the pros and cons of each function call, because the overheads of pushing those registers onto the stack felt unnecessarily heavyweight for something that&#x27;s used only once or maybe twice.<p>These days, in the era of 5 GHz CPUs with dozens of cores, developers are perfectly happy to accept RPC call overheads comparable to mechanical drive seek times.<p>I can hear the crunching noises now...
caust1cover 4 years ago
I&#x27;m surprised that he doesn&#x27;t mention the Monorepo + Microservice approach. I&#x27;ve found that most of the pain, confusion and bugs when dealing with microservice architectures has to do with the basic overhead of repo management, not the actual microservices themselves.<p>If you have a monorepo, and you make a change to a schema (backwards compatible or not, intentional or not), it&#x27;s a lot easier to catch that quickly with a test rather than having a build pipeline pull in dozens of repos to do integration tests.
评论 #26193242 未加载
评论 #26192951 未加载
ilitiritover 4 years ago
There&#x27;s another issue - sometimes people choose to migrate to microservices because the monolith &quot;can&#x27;t be scaled&quot; or &quot;is too slow&quot; or whatever. Where often the case is just that the monolith was written poorly. But the team doesn&#x27;t realise this and they and up copying the same poor design and technical processes that lead to the initial problems to the microservice refactor. Now they have the same problems with potentially higher complexity.<p>A problem I&#x27;ve seen on the project I&#x27;m working on is that the team seems to want to do conflate orthogonal issues from a design and technical perspective. &quot;We&#x27;re going to microservices because the monolith is slow and horrible. We&#x27;re going to use CQRS to alleviate pressure on the repositories. We&#x27;re going to use Event Sourcing because it works nicely with CQRS.&quot;<p>Question: &quot;Why are we Event Sourcing this simple CRUD process?&quot;<p>Answer: &quot;Because we are moving from the Monolith to Microservices&quot;.
jillesvangurpover 4 years ago
One issue with any form of modularization is that dependency cycles are not desirable and have the side effect of creating a need for ever more modules. The reason is that any dependency cycle can be trivially broken by adding another module.<p>You get dependency cycles when two dependent services need the same thing and you lack a good place to put that thing. You start with modules A and B. Then B need something that A has and then A needs something that B has. You can&#x27;t do it without introducing a dependency cycle. So, you introduce C with the new thing. And A and B depend on C but B still also depends on A. And so on.<p>True weather you do Corba, COM, SOAP, Web RPC, OSGi, Gradle modules, etc. The only difference is the overhead of creating those modules is different and has varying levels of ceremony, management needs, etc. Also refactoring the module structure gets more complicated with some of these. And that&#x27;s important because an organically grown architecture inevitably needs refactoring. And that tends to be a lot more tedious once you have micro services. And inevitably you will need to refactor. Unless you did waterfall perfectly and got the architecture and modularization right in one go. Hint: you won&#x27;t.<p>Finally, the same kind of design principles you use for structuring your code (e.g. SOLID, keeping things cohesive, maximizing cohesiveness, Demeter&#x27;s law, etc.) also applies to module design. Services with lots of outgoing dependencies are a problem. Services that do too much (low cohesiveness are a problem). Services that skip layers are a problem. The solutions are the same: refactor and change the design. Except that&#x27;s harder with micro-services.<p>That&#x27;s why Martin Fowler is right. Start with a monolith. Nothing wrong with those and should not stop you practicing good design. Using microservices actually makes it harder to do so. So, don&#x27;t introduce microservices until you have to for a good technical or organizational reason (i.e. Conway&#x27;s law can be a thing). But don&#x27;t do it for the wrong reason of it being the hip thing to do.
评论 #26194265 未加载
kpmahover 4 years ago
The main problem I have with the &#x27;monolith first&#x27; advice is that it implies &#x27;microservices later&#x27;. It feels like people have forgotten how to build good, simple, modular code.
throwaway4goodover 4 years ago
Martin. The archicture astronaut. Finally returning to earth. Landing the same spot where he took off. But wiser ...
评论 #26194098 未加载
评论 #26196525 未加载
评论 #26192748 未加载
hayst4ckover 4 years ago
If you imagine a monolith as a service that:<p><pre><code> takes a request -&gt; deserializes it&#x2F;unpacks it to a function call -&gt; sets up the context of the function call (is the user logged in etc) -&gt; calls the business logic function with the appropriate context and request parameters -&gt; eventually sends requests to downstream servers&#x2F;data stores to manipulate state -&gt; handles errors&#x2F;success -&gt; formats a response and returns it </code></pre> The main problem I&#x27;ve seen in monoliths is that there is no separation&#x2F;layering between unraveling a requests context, running the business logic, making the downstream requests, and generating a response.<p>Breaking things down into simplified conceptual components I think there is a: request, request_context, request_handler, business_logic, downstream_client, business_response, full_response<p>What is the correct behavior?<p><pre><code> return request_handler(request): request -&gt; request_context; business_response = business_logic(request_context, request): downstream_client(); downstream_client(); business_response -&gt; full_response; return full_response; business_response = request_handler(request_context, request): return business_logic(request_context, request): downstream_client(); downstream_client(); business_response -&gt; full_response; return full_response; request -&gt; request_context; business_response = request_handler(request_context, request, downstream_client): return business_logic(request_context, request, downstream_client): downstream_client(); downstream_client(); business_response -&gt; full_response; return full_response; something else? </code></pre> In most monoliths you will see all forms of behavior and that is the primary problem with monoliths. Invoke any client anywhere. Determine the requests context anywhere. Put business logic anywhere. Format a response anywhere. Handle errors in 20 different ways in 20 different places. Determine the request is a 403 in business logic, rather than server logic? All of a sudden your business logic knows about your server implementation. Instantiate a client to talk to your database inside of your business logic? All of a sudden your business logic is probably manipulating server state (such as invoking threads, or invoking new metrics collection clients).<p>The point at which a particular request is handed off to the request specific business logic is the most important border in production.
评论 #26191464 未加载
评论 #26191244 未加载
je42over 4 years ago
&gt; It takes a lot, perhaps too much, discipline to build a monolith in a sufficiently modular way that it can be broken down into microservices easily.<p>have seen that happening. importing modules from all over the place to get a new feature out in the monolith. also, note this happened with rapid on boarding, the code-review culture was not strong enough to prevent this.<p>so the timing of the change from monolith to micro-service is critical, in order to get rid of it. otherwise, chances are high you got a monolith and microservices to take care of.
matijashover 4 years ago
I like the &quot;peeling off&quot; strategy - starting with the monolith and adding microservices from the edges.<p>I&#x27;ve been working on something that tries to make starting with a monolith in React&#x2F;Node.js relatively easy. Still don&#x27;t have much of the &quot;peeling&quot; support but that is something we&#x27;re looking to add: <a href="https:&#x2F;&#x2F;github.com&#x2F;wasp-lang&#x2F;wasp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;wasp-lang&#x2F;wasp</a>
jjjeii3over 4 years ago
I heard so many horror stories that some company tried to break up a large monolith to microservices and after X years of working on it, they give up. For example, in monolith you can use transactions and change millions of rows. If something goes wrong, the entire transaction will be rolled back. If you use microservices, you can only use transactions within a single service.
vergessenmirover 4 years ago
The main takeaway for me is clean modularity in a system with strong decoupling, the modules can be in a single application boundary (a monolith) or across multiple (services or microservices).<p>The design challenge becomes making sure that your modules can execute within the monolith or across services. The work to be done can be on a thread level or process level. The interfaces or contracts should be the same from the developers point of view. The execution of the work is delegated to a separate framework that can flip between thread and process models transparently without extra code.<p>This is how I approached my last microservices project. It could be built as one massive monolith or deployed as several microservices. You could could compose or decompose depending on how much resources where needed for the work.<p>I fail to understand why techniques around these approaches aren&#x27;t talked about in detail. They have some degree of difficulty in implementation but are very achievable and the upsides are definitely worth it.
评论 #26191650 未加载
评论 #26191604 未加载
评论 #26191617 未加载
评论 #26191771 未加载
srikuover 4 years ago
A bit of a shameless plug, but really looking for feedback .. I&#x27;ve been experimenting with Inai [1][2], a framework that can help build modular microservice-like software with similar Dev team independence properties but can independently be built and deployed as a monolith or as separate services operationally. So far, I&#x27;ve had fun building an internal project at much higher speed than I&#x27;ve managed any similar project and had more fun doing it. I feel the idea (which is still nascent) has some merit, but would like to know what folks think.<p>[1] source - <a href="https:&#x2F;&#x2F;github.com&#x2F;Imaginea&#x2F;Inai" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Imaginea&#x2F;Inai</a><p>[2] blog post describing Inai - <a href="https:&#x2F;&#x2F;labs.imaginea.com&#x2F;inai-rest-in-the-small&#x2F;" rel="nofollow">https:&#x2F;&#x2F;labs.imaginea.com&#x2F;inai-rest-in-the-small&#x2F;</a><p>PS: I&#x27;ve had some difficulty characterising Inai (as you can tell).
harperleeover 4 years ago
In my main side project what I&#x27;ve done is separate different conceptual components in clojure libraries that I then import into my main program (clojure enables you to seamlessly require a private github repo as a library).<p>This way you get most of the benefits of separating a codebase (such as testing different things, leaving code that barely works in the repo, pointing to older versions of part of the monolith, smaller repos, etc.) whilst integration between modules is a one-liner, so I don´t need microservices, servers, information transformation, etc.<p>There&#x27;s even the possibility to dynamically add library requirements with add-lib, an experimental tools.deps functionality.
评论 #26192801 未加载
FpUserover 4 years ago
I always use monolith when building my servers. Only split microservices part when it is really required. Particular example:<p>I&#x27;ve built native C++ server that does some complex computations in some business domains.<p>When this monolith exposes generic JSON RPC based API where agents (human or software) can connect and do various tasks: admin, business rules design and configuration, client management, report design etc. etc. based on permission sets.<p>Now actual business client came. They have their own communication API and want integration with our server and of course being &quot;customer is a king&quot; they want communications tailored to their API. I was warned that this customer is one of many more that company is signing deals with. Not gonna put Acme specific code into main server.<p>This is where microservice part comes. Just wrote a small agent that mediates between client API and ours. Not much work at all. Come another client I can add more specific parts to this new microservice, or give it to other team to build their own based on first one as a template.<p>Physical scalability - I do not worry about. We re not Google and will never be due to nature of the business. Still main server can execute many 1000s of requests&#x2F;s sustainably on my laptop (thank you C++). Put it on some real server grade hardware and forget about all that horizontal scalability. Big savings.
atletaover 4 years ago
I, like many others, have been saying this for years. Too bad I didn&#x27;t see this link before, it would have helped convincing a few people in the past. Now, fortunately, it doesn&#x27;t seem that much of a heresy to say that monoliths (or SOA) is the right architecture a lot of the time (maybe most of the time).<p>I remember, a little more than 4 years ago I was brought on to save a product launch for a startup. They were, as far as I can remember, already creating the 2nd iteration&#x2F;rewrite of their MVP with the first one <i>never released</i> and just few months short of doing their first release one of their developers started to convince everyone that the code base was a pile of crap and that they need to rebuild the whole thing is microservices. Because there is no other way around. The system was built in PHP and the otherwise smart and motivated developer wanted to rebuild it as a set of JS microservices.<p>He almost managed to convince the management, including the devlopment lead and the rest of the team. And it wasn&#x27;t easy to convince him that that would have been a pretty dumb move and that it wouldn&#x27;t have just taken a few more months, just because creating a &#x27;user service&#x27; with a mongo backend was something he could pull of in his spare time.<p>Then I realized that there is something inherent in these kind of situations. Some people come around stating that a new piece of technology (or other knowledge) is better and then suddenly the rest of the world is somehow on the defense. Because they know something the rest don&#x27;t so how could you prove them wrong? Not easy. And funny enough, this is actually a classic case of the shifting of the burden of proof fallacy.
vijaybrittoover 4 years ago
I have worked on both types of applications and what he says is very true. The startup which failed to launch because of difficulties in getting the architecture and infrastructure right. It was around 2014 and the company company eventually ran out money and more importantly missed the time frame. The second product was a massive enterprise product that had 100s of members working on it on any given day. The product was written in Java as a monolith. It was slow to develop and a pain to work on. But it worked and the product succeeded. People complained that it was slow and they were right.<p>So they decided to break it up into multiple services. First was a pdf report generation service which I wrote in node.js. Then more and more services were added and other other modules were ported as node apps or separate java apps. In the end it was around 12 services and all of them worked well.<p>The monolith was still there but it&#x27;s fast enough and users were happy. That&#x27;s a lesson I&#x27;ll never forget and have understood that time and velocity are far more important for a product to succeed!
marsven_42over 4 years ago
If you design for testability and use proper dependency injection your &quot;monolith&quot; will already be &quot;ready&quot; for micro services.
kfkover 4 years ago
From my experience the issue with monoliths is organizational and cultural first, then technical (maybe). Monoliths are usually managed by 1 team (IT for instance). This 1 team has never had to collaborate with other teams on building&#x2F;configuring&#x2F;improving the monolith. Centralizing things works well for stability but it is horrible for innovation. For instance, ERPs like SAP are monoliths, how do you inject, say, an AI algo to improve productivity on managing invoices into it? That team pushing for that AI is probably super close to accounting but probably far from the SAP IT team. The SAP IT team is incentivized on stability while the accounting one on productivity, how do you resolve the conflict? How do you work together and collaborate? I am sure microservices have many issues, but they make these conversations not just easier but <i>necessary</i>. I think this is the biggest advantage of microservices.
pc86over 4 years ago
We are in the middle of the first production-scale deployment of a greenfield microservice-based application now and there are certainly a lot of pain points. On the flip side, I&#x27;ve been a part of about half a dozen extremely successful strangler migrations[0], some of which were downright <i>easy</i> even with a complicated business domain. I often wonder if we would have been better off deploying a monolith in half the time and immediately starting a strangler migration once the rate of business changes slows down. I&#x27;ve become more and more convinced over the past decade that Monolith First + Strangler Migration is most stable, safest way to deliver mid-sized software projects.<p>[0] <a href="https:&#x2F;&#x2F;microservices.io&#x2F;patterns&#x2F;refactoring&#x2F;strangler-application.html" rel="nofollow">https:&#x2F;&#x2F;microservices.io&#x2F;patterns&#x2F;refactoring&#x2F;strangler-appl...</a>
Cthulhu_over 4 years ago
I&#x27;ve worked in two major microservices environments. The one was a new application where everything was sloppily wired together via REST APIs and the code itself was written in Scala. A massively weird conflict there where the devs wanted a challenge on a code level but nobody wanted to think about the bigger picture.<p>The other was an attempted rebuild of an existing .NET application to a Java microservices &#x2F; service bus system. I think there was no reason for a rebuild and a thorough cleanup would have worked. If that one did not move to the microservices system, the people calling the shots would not have a leg to stand on because the new system would not be significantly better, and it would take years to reach feature and integration parity.
yagodragonover 4 years ago
I recently got introduced to the Laravel framework in php. I think it&#x27;s probably the best implementation of a monolith web framework right now. Php is very simple if you come from c&#x2F;java and the framework provides you with so much functionality out of the box.
alexmingoiaover 4 years ago
The question isn&#x27;t microservices or monolith. The question is: What problem are we solving, and what&#x27;s the most efficient way to solve it?<p>Requirements should dictate architecture. Data should dictate the model. Avoid unnecessary work. Be mindful of over-engineering.
darkstar_16over 4 years ago
There is no one size fits all solution here. In my experience it is sometimes good to start (conceptually) as a monolith and then divide the service into Microservices, eventually. Also depends on the maturity and experience of the team handling the services because micro services do like a different temperament both to develop and to manage.<p>I&#x27;m not from the camp that believes in creating services for every single thing - It&#x27;s the same camp that believes in starting with distributed databases and then moving in the same direction. I believe in PostgreSQL everything and then moving to distributed only if the application demands ... Wait did I just start another war in here !
soheilover 4 years ago
A lot of people are saying microservices are great if you do it right. What they miss is they require a whole bunch more people than a monolith to operate, they ignore the cost of adding those people. Really it&#x27;s like comparing apples and oranges, sure if you have the resources and the headcount to have 37 and a half teams each owning only one piece of your app in a competent way go for that architecture, but if not then stop advocating for a unicorn that only large companies with big budgets can benefit from and preaching it to startups that are struggling to get off the ground as if that should be the industry norm.
mac01021over 4 years ago
I just wonder what kind of organization or project faces this kind of decision.<p>I&#x27;ve worked on workflow&#x2F;crud-type web applications whose computational needs could be met using a single server with a couple of GB of RAM using a single database, indefinitely into the future. I don&#x27;t see why it would occur to someone to split one of those into multiple services.<p>I&#x27;ve worked on systems for which many such servers were required in order to provide the expected throughput and, in such a case, writing a monolith is really not an option.<p>Is there a significant middle ground?
mark_l_watsonover 4 years ago
Thank you Martin. I have argued against micro services for writing systems (until you really need them) for a while and get real pushback.<p>For me, the issue is that a monolith based on, for example, Apache Tomcat using background work threads let’s me also handle background tasks in one JVM. I have not used this pattern in a long time, but when I did it served me well.<p>I think Java and the JVM are more suitable for this than Python and a web framework. I tried this approach with JRuby one time using background worker threads but I wouldn’t use CRuby.
ivanbover 4 years ago
Now that Fowler himself wrote about it I hope that the masses follow. Next I hope that the trend of going vertical-first comes back. Mr Fowler, could you please write an article on vertical-first scaling?
评论 #26196088 未加载
评论 #26191559 未加载
vonwoodsonover 4 years ago
Micro services is a networked&#x2F;cloud buzzword for The Unix Philosophy. Doing “one job and doing it well” implies, though, that you know what that job is, what the right tool is, and that you know how to do it well. Another word for “monolith” could easily be “prototype” for the sake of this article. If only we all had the time and money to do real software engineering, amirite? But, time and time again I’ve been proven out that “the hack becomes the solution” and that we’re not going to go back and “fix” working code.
forgingaheadover 4 years ago
Your first and biggest problem when you start a technology startup is lack of customers and revenue. Do everything that gets you to the first customers and first revenue, and do everything that helps you find a repeatable &amp; mechanical distribution strategy to reach more customers and more revenue.<p>Then and only then should you even consider paying back your technical debt. Monolith first always until you have the cash to do otherwise, and even then only if your app desperately needs it.
tekmavenover 4 years ago
Microservices are hard. Monoliths are hard too. Focus on the product and the customer, build what they need. Architecture is a means to make a successful product.
评论 #26194359 未加载
anticristiover 4 years ago
I&#x27;m wondering if &quot;microservices&quot; hasn&#x27;t lost it&#x27;s initial meaning. To me, an application composed of the &quot;core&quot;, a message queue and a database server already qualifies as &quot;microservices&quot;. I know which parts are &quot;delicate&quot; and which parts are &quot;kill-at-will&quot;. <i>That</i> is what I care about at a very high level, not having a separate codebase for every single HTTP route.
sublimefireover 4 years ago
The fact that we talk about it raises some questions. Surely it depends on the problem at hand. There are multiple companies solving various issues and those are either global or local, well defined or ambiguous. There is no one approach as it depends on where you stand at the moment as well. Another problem is developers themselves as they are incentivized to push for &quot;over-engineering&quot; as it&#x27;ll make their CVs look better.
scavenger5over 4 years ago
I question the relevance of this with cloud based solutions such as AWS Lambda, where you can spin up a production ready auto-scaled service very quickly; it certainly reduces the cost of ownership and operations. Sure if you are a team of 20 developers working on an app - go monolith.<p>But if you are a 300 person organization launching something from the ground up, I would choose many serverless solutions over a single monolith.
RcouF1uZ4gsCover 4 years ago
&gt; But even experienced architects working in familiar domains have great difficulty getting boundaries right at the beginning. By building a monolith first, you can figure out what the right boundaries are, before a microservices design brushes a layer of treacle over them.<p>I think this is one of the most important points. Often it takes time to figure out what the right boundaries are. Very rarely do you get it right a priori.
0xbadcafebeeover 4 years ago
&quot;Monolith vs microservices&quot; is a bit like &quot;Fullsize SUV vs multiple sedans&quot;. They are used differently, so you should pick that which fits your purposes. And the idea that you have to do one or the other is a bit ridiculous. I&#x27;ve seen plenty of businesses that organically landed on a mix of monolith and microservice and things in between. Don&#x27;t get caught up in formalism.
jlengrandover 4 years ago
I wonder what would the trend be without the push for the huge megacorps that couldn&#x27;t do without microservices (MAGA mostly) that decided to start selling their cloud services.<p>Would they have kept them for themselves (including k8s), would microservices be just as fashionable? I&#x27;d really like to know the answer, while watching my friends startup of 4 people running they 14 microservices on a k8s cluster.
brokencodeover 4 years ago
A microservice architecture should mainly be used to solve runtime issues, such as to improve scalability or fault tolerance. Also, it can be useful in order to adopt new languages or frameworks.<p>It is not something that should be used simply to clean up your code. You can refactor your code in any way you see fit within a monolith. Adding a network later in between your modules does not make this task simpler.
ChrisMarshallNYover 4 years ago
I tend to take a “hybrid” approach. I believe in modular architectures, as I think they result in much better quality, but the design needs to be a “whole system” design, with the layers&#x2F;modules derived from the aggregate.<p>Once that is done, I work on each module as a standalone project, with its own lifecycle.<p>I’m also careful not to break things up “too much.” Not everything needs to be a standalone module.
sigmamlover 4 years ago
If we were to ignore the mechanism part of microservices, we could say that qmail and postfix have a microservices architecture. Both of them have fared much better than monilithic Sendmail. And, their track records for resilience and reliability are very encouraging too.<p>There exist other ways of designing &#x27;microservices&#x27; that are not necessarily conventional monoliths!
aryehofover 4 years ago
Surely a radical viewpoint against the (current) state of the art in software architecture?<p>Why swim against a tide of industry “best practice” that says ...<p>... Lets make our application into many communicating distributed applications. Where the boundaries lie is unclear, but everyone says this is the way to produce an application (I mean applications), so this must be the way to go.
ThouYSover 4 years ago
This is the never ending cycle of &quot;too much order&quot; - &quot;too much chaos&quot;. It takes a lot of experience to be able to judge how much chaos you want. That is all.. experience. I don&#x27;t think any theoretical theory can tell you how much or how little is right
Shicholasover 4 years ago
Monoliths are even easier to manage in 2021 because of workspace dependency management (e.g. yarn workspaces, cargo workspaces) etc. You can have your cake (microservices built as separate packages) and eat it too (a monorepo workspace w&#x2F; all your code).
ngc248over 4 years ago
A monolith designed using Component Based architecture where each of the components has a well defined service boundary, can easily be split up into a microservices architecture. Each of the components from the monolith making up a subsequent microservice.
akavelover 4 years ago
(2015)<p>I am very interested in what he could add now.
etoykanover 4 years ago
I don&#x27;t understand why people think that microservices are monoliths are 2 only options.<p><a href="https:&#x2F;&#x2F;eng.uber.com&#x2F;microservice-architecture&#x2F;" rel="nofollow">https:&#x2F;&#x2F;eng.uber.com&#x2F;microservice-architecture&#x2F;</a>
mathgeniusover 4 years ago
I take this same philosophy at all levels of my code. It&#x27;s like the big bang: start out with a dense hot lump of code and as it grows and cools off things break apart into subunits and become more organized, documented, standalone, etc.
vemvover 4 years ago
Modular First.<p>You start out as technically a monolith, but that is prepared at all times to be decomposed into services, if and when the need arises.<p>It&#x27;s nothing too fancy - can be simply another name for Hexagonal Architecture, functional-core-imperative-shell, etc.
rudnevrover 4 years ago
it&#x27;s surprising to be _so_ disagree.<p>The value of microservices is to isolate risks and have some manageable entity to reason about, to have an understandable scope of lifecycle, test coverage and relations with other services. The larger the piece, the harder it is to do.<p>Splitting up is normally harder than building up, and often impossible to agree on. Any monolyth I worked on was coupled more than necessary because of regular developer dynamics to use all code available in classpath. I&#x27;ve never even saw a successful monolyth split - you just usually rewrite from scratch, lift-n-shifting pieces here and there.
1penny42centsover 4 years ago
Monolith <i>First</i>.<p>The point of this idea isn&#x27;t that it says &quot;monolith&quot;; it&#x27;s that it includes time as a factor. Too much of our discussion focuses on one state or another, and not on the evolution between states.
hardwaresoftonover 4 years ago
&gt; The second issue with starting with microservices is that they only work well if you come up with good, stable boundaries between the services - which is essentially the task of drawing up the right set of BoundedContexts.<p>&gt; The logical way is to design a monolith carefully, paying attention to modularity within the software, both at the API boundaries and how the data is stored. Do this well, and it&#x27;s a relatively simple matter to make the shift to microservices.<p>This is the big take-away to me -- for a long while now I&#x27;ve seen this whole monoliths-vs-microservices debate as a red herring. Whether your conduit is functions in shared virtual address space, HTTP or a Kafka topic the real problem is designing the right contracts, protocols and interface boundaries. There&#x27;s obviously an operational difference in latencies and deployment difficulty (i.e. deploying 5 separate apps versus 1) but deep down the architectural bits don&#x27;t get any easier to do correctly, they just get easier to cover up (and don&#x27;t sink your deployment&#x2F;performance&#x2F;etc) when you do them badly when there&#x27;s less latency.<p>What we&#x27;re witnessing is a dearth of architectural skill -- which isn&#x27;t completely unreasonable because 99% of developers (no matter the inflated title you carry) are not geniuses. We have collectively stumbled upon decent guidelines&#x2F;theories (single responsibility, etc), but just don&#x27;t have the skill and&#x2F;or discipline to make them work. This is like discovering how to build the next generation of bridge, but not being able to manage the resulting complexity.<p>I think the only way I can make the point stick is by building a bundle of libraries (ok, you could call it a framework) that takes away this distinction -- the perfect DDD library that just takes your logic (think free monads&#x2F;effect systems in the haskell sense) and gives you everything else, including a way to bundle services together into the same &quot;monolith&quot; at deployment time. The biggest problem is that the only language I can think of which has the expressive power to pull this off and build bullet-proof codebases is Haskell. It&#x27;d be a hell of a yak shave and more recently I&#x27;ve committed to not spending <i>all</i> my time shaving yaks.<p>Another hot take if you liked the one above -- Domain Driven Design is the most useful design for modern software development. The gang of 4 book can be reduced to roughly a few pages of patterns (which you would have come across yourself, though you can argue not everyone would), and outside of that is basically a porn mag for Enterprise Java (tm) developers.
knownover 4 years ago
Reminds me <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Tanenbaum%E2%80%93Torvalds_debate" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Tanenbaum%E2%80%93Torvalds_deb...</a>
crb002over 4 years ago
Using Haskell style IO types - couldn&#x27;t we lift and shift anything at build time between a network call and a function call? Monolith that could shard at any function boundary into microservices.
thinkingemoteover 4 years ago
If starting from scratch, lets say a startup, it&#x27;s still true that the vast majority of all software projects fail. Therefore optimising things prematurely is not a good use of time or money.
BillinghamJover 4 years ago
&gt; I feel that you shouldn&#x27;t start with microservices unless you have reasonable experience of building a microservices system in the team<p>Well, yeah... obviously. That&#x27;s not the same thing as it being bad to start with microservices generally.<p>I just don&#x27;t agree with this at all. The designer of the architecture clearly does need to know how to design service-based architectures and needs to have a very strong understanding of the business domain to draw reasonable initial boundaries. These are not unusual traits when starting a company as a technical founder.
评论 #26191037 未加载
评论 #26190904 未加载
评论 #26190878 未加载
highspeedbusover 4 years ago
The big curse of microservices is the word &quot;Micro&quot;. It should have just the right size, be it big or small.
notthegov2over 4 years ago
Brilliant article Martin and brilliant discussion Hacker News. This is why this forum is still the best.
ecmascriptover 4 years ago
I worked on a project that was a monolith. A team was placed to rewrite it to microservices and shortly after I quit that job. About a year after that I ate lunch with a ex-colleague that told me they were still working on that rewrite.<p>Looking at the page now it looks like the monolith is still running as far as I can see, about 5 years later. I guess they gave up. :)
评论 #26191427 未加载
hendryover 4 years ago
hah, I made a video on the same vibe. <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=clagrT5BC7g" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=clagrT5BC7g</a><p>Martin is definitely ahead of the curve, or perhaps I&#x27;m behind.
_sohanover 4 years ago
Microservices primarily solve a team scaling problem. Then comes technical.
评论 #26195718 未加载
jaygray0919over 4 years ago
We started with flask(<a href="https:&#x2F;&#x2F;flask.palletsprojects.com&#x2F;en&#x2F;1.1.x&#x2F;" rel="nofollow">https:&#x2F;&#x2F;flask.palletsprojects.com&#x2F;en&#x2F;1.1.x&#x2F;</a>) and never looked back. It enables pure, iterative, incremental development.
idlemindover 4 years ago
Article is from 2015. Should this be added to the title?
celticninjaover 4 years ago
To make microservies you just first build a monolith
ernoppover 4 years ago
He can write all the posts about software engineering practices he wants his server is still down right now :)
a_imhoover 4 years ago
Gall&#x27;s law.
p5vover 4 years ago
my TL;DR of the entire article:<p>&gt; Although the evidence is sparse, I feel that you shouldn&#x27;t start with microservices unless you have *reasonable experience of building a microservices system* in the team.
ibraheemdevover 4 years ago
[2015]
heurociover 4 years ago
Architecting systems is a dance around tradeoffs: What weight do you you assign to each of the &#x27;ilities&#x27;. Some products&#x2F;services are inherently complex. For those, complexity can not be destroyed.Just transformed from one form to another. I agree that there in many cases people jump on the micro services architecture too soon, without first developing a mature understanding of the domains involved in the application as well as data flow and state transitions. Some years ago I was involved in re-architecting a monolith. This was a team that cherished testing, had modules and layers in the monolith , swore by DRY and so on. There were a few problems: * Adding features was an expensive exercise. For all the layers in place, the abstractions and interfaces were evolved over 5 years and not necessarily with enough design upfront. * Performance was poor: The monolithic architecture was not necessarily to blame here, but rather using a document oriented data store and doing all the marshalling&#x2F;unmarshalling in the application code. The reasoning was that &#x27;we can store anything. we can interpret it any way we like&#x27;. In practice, the code was re-inventing what relational databases were designed for.<p>I proposed and designed a micro services architecture with the team. I had done that sort of thing a few times even before they were called micro services. There were a few advantages: * The product team had the freedom to re-think the value proposition, the packaging, the features. It was critical for the business in order to remain competitive. * The development team could organize in small sub teams with natural affinity to the subdomains they had more experience&#x2F;expertise in. * Each domain could progress at the pace that fits, with versioned APIs ensuring compatibility. Not necessarily a unique micro service success prerequisite. One can argue versioning APIs is a good best practices even for internal APIs but the reality is that versioning internal APIs is often less prioritized or addressed to begin with.<p>There are technical pros and cons for monolith&#x2F;MS. Additional data that can augment this decision is the org structure , the teams dynamic and the skillsets available. In the case of that project, the team had excellent discipline around testing and CI&#x2F;CD. Of course there are challenges. Integration testing becomes de-facto impossible locally. Debugging is not super difficult with the right logging, but still harder. One challenge I saw with that project and other projects that adopt microservices is that the way of thinking switch to &#x27;ok so this should be a new service&#x27;. I think this is a dangerous mindset, because it trivializes the overhead of what introducing a new service means. I have developed some patterns that I call hybrid architecture patterns, and they have served me well.<p>One thing to consider when deciding what road to take, is how does the presentation layer interact with the micro services. When it is possible to map the presentation to a domain or a small subset of the domains, the micro services approach suffers less from the cons. A monolithic presentation ---&gt; Micro services backend could severely reduce benefits.<p>2 good references here: &#x27;Pattern oriented software architectures&#x27; &#x27;Evaluating software architecture&#x27;
franklampardover 4 years ago
......
Yuioupover 4 years ago
Thank you, Martin.
wwww4allover 4 years ago
Monoliths are solution in search of problems. Micro services are solution in search of problems.<p>Generally, focus on solving the problems first.<p>Can the problem be solved by some static rendering of data? Monolith is better solution.<p>Does the problem require constant data updates from many sources and dynamic rendering of data changes? Micro services and reactive architecture are better solutions.<p>There’s no one size fits all solution. The better software engineers recognizes the pros and cons of many architecture patterns and mix match portions that make sense for the solution, given schedule, engineering resources, and budget.
评论 #26191101 未加载
optimalsolverover 4 years ago
Was hoping for something 2001-related.