Download - Beware the monolith

Transcript
Page 1: Beware the monolith

Beware theMonolith

Presentation by Dee WilcoxNashville PHP - March 8, 2016

Page 2: Beware the monolith

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.

Page 3: Beware the monolith

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?

Page 4: Beware the monolith

Source: xkcd.com/1504/

Page 5: Beware the monolith

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.

Page 6: Beware the monolith

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

Page 7: Beware the monolith

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

Page 8: Beware the monolith

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.

Page 10: Beware the monolith

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

Page 11: Beware the 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..

Page 12: Beware the monolith

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

Page 13: Beware the monolith

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/

Page 14: Beware the monolith

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.

Page 15: Beware the monolith

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.

Page 16: Beware the monolith

Strong application architecture is a simple as clear lines and simple patterns.

Page 17: Beware the monolith

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

Page 18: Beware the monolith

Some of our monolithic applications end up looking like this.

Page 19: Beware the monolith

But perhaps they should look more like this.

Page 20: Beware the monolith

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.

Page 21: Beware the monolith

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.

Page 22: Beware the monolith

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

Page 23: Beware the monolith

Stay in Touch t/s/l @dee_wilcoxe/ [email protected]


Top Related