Leveraging Serverless Architecture

To Gently Break Apart Your Monolith

Linda Nichols

@lynnaloo

Norfolk.js

norfolkjs.org

RevolutionConf

Virginia Beach, VA

www.eta.im

@etechadvisor

The Monolith

@lynnaloo

The Monolith

@lynnaloo

  • Single-tiered

  • Performs all tasks​

  • Not modular

  • Legacy technology

  • On-premises/On a Mainframe

  • Expensive to host/maintain

The Monolith

@lynnaloo

The Monolith?

@lynnaloo

The Monolith Onion

@lynnaloo

@lynnaloo

  • Long-lasting, yet perishable

  • Contains many layers

  • Difficult to modularize

  • Messy when applied directly to bare metal

  • There can be a "smell"

The Monolith Onion

@lynnaloo

The Monolith Onion

BREAKING APART the monolith

@lynnaloo

  • Separate the application tiers

  • Create microservices

  • Upgrade legacy technology

  • Re-write application code

  • Move to "the cloud"

refactoring is expensive

@lynnaloo

legacy stays legacy

@lynnaloo

Patching is cheap.

works "just fine" now.

containers, containers, containers...

@lynnaloo

breaking apart the monolith

@lynnaloo

what is serverless

@lynnaloo

Serverless Architecture is an event-driven system that uses remote functions (via a BaaS or a FaaS product) without concern for the operations of the containers that execute the code.  

Example: AWS with Aws Lambda

serverless functions

@lynnaloo

  • No Ops required*

  • Developers focus on code

  • Triggered by internal or external events

  • Built-in API Gateway

  • Costs nearly nothing

serverless functions

@lynnaloo

serverless functions

@lynnaloo

'use strict';

const catNames = require('cat-names');

function getCatName(event, context, callback) {
    callback(null, { payload: `Your cat name is ${catNames.random()}.` });
}

module.exports.getCatName;

Functions are microservices

@lynnaloo

  • Responsible for one specific task

  • Lightweight and fast

  • Re-usable

  • Deployed independently

  • Stateless

  • Not dependent on other services

gently break apart the monolith

@lynnaloo

@lynnaloo

Look for functionality that has the fewest dependencies executable by an event:

  • Cron  jobs

  • Background services

  • Calls to APIs

  • Maintenance scripts

  • Logging/analytics

  • Message bus

break off serverless microservices

@lynnaloo

break off serverless microservices

conclusion

@lynnaloo

As more functionality is removed, less compute power is needed for the monolith. Re-engineering a small core is now more manageable and less expensive.

conclusion

@lynnaloo

Modernization doesn’t have to be a one-time effort.

 

Serverless architecture facilitates gradual changes and results in a more immediate reduction in complexity and cost.

Thank You!

@lynnaloo

Photo Credit

@lynnaloo

@PaulCHINJR

Made with Slides.com