Download - Beware the monolith
Beware theMonolith
Presentation by Dee WilcoxNashville PHP - March 8, 2016
Developing for ScaleIn enterprise-level development projects, or projects where the application is the business, it is easy to find ourselves unintentionally scaling up to a monolith. This month we’ll spend some time learning together how we can build stable enterprise applications that scale, while moving away from this architectural design pattern.
Speak up! Take the survey.(With a little help from your smart phone)
http://goo.gl/forms/o3qJZ1Krpw
Are you working on a monolith or distributed system?
Which do you prefer?
Source: xkcd.com/1504/
1. What is a Monolith?How do you know if you are working on one?
➔ Single-TieredThe user interface and data access code are combined into a single program from a single platform. Very few layers of abstraction.
➔ Self-ContainedIndependent from other systems and applications.
➔ Deeply IntegratedModels are collapsed for simplicity.
It’s an integrated system that collapses as many unnecessary conceptual models as possible. Eliminates as much needless abstraction as you can swing a hammer at. IT’S A BIG FAT NO TO DISTRIBUTING YOUR SYSTEM lest it truly prevents you from doing what really needs to be done.
Source
From Majestic Monolith by David Heinemeier Hansson on SignalVsNoise
2. Benefits of a Monolith
➔ One codebase to maintain
➔ Application logic is tightly coupled to the data model and user interface
➔ Everything is in one place
Monoliths aren’t all bad. In fact, they are widely used even in modern tech companies. But when polled, most Nashville-based developers preferred a distributed architecture. We can debate which way is right, but it reallydepends on the application and the environment.
Meet Etsy.
Either Etsy is a monolith or it is a shining example of what service-oriented architecture looks like
and/or microservices, depending on who you ask...
There are other languages at play at Etsy, but as far as the guts of the API and the web application, it is largely
PHP. There’s a huge advantage in that, a massive advantage.
Source
Microservices, monoliths and laser nail guns: Etsy tech boss on finding the right focus
Meet Bootcamp.
One of the benefits to the majestic monolith is that it
basically presumes that the people who work on it
also understand it.
Source
The Majestic Monolith
Monoliths work best on small teams dedicated to one application. Even in the best case
scenario, documentation, documentation! Silos of knowledge are dangerous without documentation..
Now for some data. (Thanks to everyone for participating!)
This survey was limited to the
NashDev Slack team and the
Nashville PHP meetup group.
http://goo.gl/forms/o3qJZ1Krpw
Meet Netflix.
“Give the developers the pain, and they'll automate everything out of the way.”
Source
https://www.battery.com/our-team/member/adrian-cockcroft/
Defeat the monolith by going small. Tiny, even.Microservices are small applications that represent one piece of business logic, or one function within the application. When designed as an API, the application becomes a front end client consuming various API endpoints.
Pro Tip
Microservices can be broken down into larger chunks, but generally, the smaller, the better. This makes them easier to maintain and helps keep the system decoupled.
3. Benefits of Microservices➔ Application logic, user interface,
and data models are de-coupled.
➔ Easier to maintain and deploy.
➔ Easier to teach to new team members.
➔ Increases application stability.
➔ Ability to fail gracefully.
Strong application architecture is a simple as clear lines and simple patterns.
Consider the simple marble run.
COMPLEX PATTERNS COMBINED WITH MILLIONS OF DESIGN CHOICES SLOW DOWN THE SYSTEM AND MAKE IT DIFFICULT TO UNDERSTAND.
Source: thisiscolossal.com
Some of our monolithic applications end up looking like this.
But perhaps they should look more like this.
Building API Centric Applications
An API Centric web application executes most, if not all, of its functionality through API calls. The application is separated into the front end client and the codebase(s) for the API(s) it consumes. A formerly monolithic app will likely consume many microservices.
4. Best Practices➔ Design your application so that it
is consuming APIs from your microservices.
➔ Break each business task out intoa microservice with an exposed API.
➔ Require authentication with your services. It goes without saying, but
this is an crucial for security.
➔ Use AWS to distribute and load balance your services. We have
seen huge performance gains simply by moving our infrastructure to AWS.
tl;dr
Microservices, Monoliths, and Laser Nail Guns
Adopting Microservices at Netflix: Lessons for Team and Process Design
Microservices: A Definition of This New Architectural Term
Stay in Touch t/s/l @dee_wilcoxe/ [email protected]