+ All Categories
Home > Documents > MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our...

MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our...

Date post: 30-Oct-2019
Category:
Upload: others
View: 6 times
Download: 0 times
Share this document with a friend
49
MICROSERVICES WITHOUT SERVERS GLYNN BIRD, Developer Advocate @ IBM @glynn_bird
Transcript
Page 1: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

MICROSERVICES WITHOUT SERVERSGLYNN BIRD, Developer Advocate @ IBM@glynn_bird

Page 2: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

SERVERS ARE KILLING YOUR PRODUCTIVITY

Page 3: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

2005Servers in the server room

2008Our servers in a data centre 2011

Rented servers in a data centre

2013Virtual servers in the cloud

Page 4: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

100%uptime

Page 5: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

scale

Page 6: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

< Ops> Dev

Page 7: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

WASN’T THE CLOUD SUPPOSED TO FIX THIS?

Page 8: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

“COMPUTING AS A UTILITY”Source: https://flic.kr/p/5aHJFh

Page 9: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

averageutilisation 20% - 40% of capacity

Page 10: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

AWS LAMBDA

Page 11: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

…WHY IS THIS DIFFERENT?

Page 12: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

FUNCTIONS-AS-A-SERVICE

Page 13: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

SCALING: 0 to N

Page 14: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

PAY-AS-YOU-GO

flickr photo by a loves dc https://flickr.com/photos/alovesdc/3466740007 CC (BY) license

Page 15: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

Source: http://uk.businessinsider.com/amazon-web-services-lambda-explained-2015-11

Page 16: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

ISN’T THIS JUST PLATFORM-AS-A-SERVICE?

Page 17: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in
Page 18: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in
Page 19: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

PROVIDERS

Page 20: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

Source: http://cloudacademy.com/blog/serverlessconf-recap-serverless/

Page 21: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

SPOILER:

THERE’S STILL SERVERSflickr photo by BobMical https://flickr.com/photos/small_realm/11189803153 CC (BY-NC) license

Page 22: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

ENOUGH TALKING…BRING ON THE

CODE.

Page 23: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

IBM OPENWHISK

Page 24: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in
Page 25: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

OPEN SOURCEhttp://openwhisk.org/

Page 26: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

$ git clone https://github.com/openwhisk/openwhisk.git

$ cd openwhisk/tools/vagrant

$ vagrant up

Page 27: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in
Page 28: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

RUNTIMES

Page 29: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

'use strict'

const messages = require('./messages')const rp = require('request-promise')const url = require('url')const path = require('path')

class BaseOperation { constructor (options) { this.options = options }

request (options) { return rp(options).catch(err => this.handle_errors(err)) }

params (method, path) { return { json: true, method: method, url: this.path_url(path), headers: { Authorization: this.auth_header() } } }

path_url (url_path) { const endpoint = url.parse(this.options.api) endpoint.pathname = path.resolve(endpoint.pathname, url_path) return url.format(endpoint) }

namespace (options) { if (options && options.hasOwnProperty('namespace')) { return options.namespace } else if (this.options.hasOwnProperty('namespace')) { return this.options.namespace }

throw new Error(messages.MISSING_NAMESPACE_ERROR) }

qs (options, names) { return names.filter(name => options.hasOwnProperty(name)) .reduce((previous, name) => { previous[name] = options[name] return previous }, {}) }

auth_header () { const api_key_base64 = new Buffer(this.options.api_key).toString('base64') return `Basic ${api_key_base64}` }

handle_errors (reason) { if (reason.hasOwnProperty('statusCode')) { switch (reason.statusCode) { case 401: case 403: throw new Error(messages.INVALID_AUTH_ERROR) case 404: throw new Error(messages.MISSING_URL_ERROR) case 408: throw new Error(messages.INVOKE_TIMEOUT_ERROR) case 409: throw new Error(messages.CREATE_CONFLICT_ERROR) default: let error = 'Missing error message.' if (reason.error && reason.error.response && reason.error.response.result && reason.error.response.result.error) { error = reason.error.response.result.error } throw new Error(`${messages.API_SYSTEM_ERROR} ${error}`) } }

throw new Error(`Error encountered calling OpenWhisk: ${reason.message}`) }}

module.exports = BaseOperation

my_service.js

Page 30: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

function main(params) { // put your code here!

return {…};}

Entry Point Event Parameters

Service Result my_service.js

Page 31: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

import com.google.gson.JsonObject;public class Hello { public static JsonObject main(JsonObject args) { JsonObject response = new JsonObject(); return response; }}

Entry Point Event Parameters

Service Result

my_service.java

Page 32: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

ACTIONS

Page 33: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

TRIGGERS

Page 34: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

CHATBOTS

Page 35: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in
Page 36: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in
Page 37: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in
Page 38: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in
Page 39: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in
Page 40: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in
Page 41: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

Petition System

Page 42: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

Petition verification

Page 43: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

Petition microservices

Page 44: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

"BURNYOUR

SERVERS"

@glynn_bird

Page 45: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

Flickr https://www.flickr.com/photos/hzeller/4261947108/

Page 46: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

COMPUTE LIMITSflickr photo by zund https://flickr.com/photos/zund/12202485675 CC (BY-NC-ND) license

Page 47: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

MONITORING, DEBUGGING

AND TESTINGflickr photo by Thomas Hawk https://flickr.com/photos/thomashawk/4544013443 CC (BY-NC) license

Page 48: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

FRAMEWORKS

Page 49: MICROSERVICES WITHOUT SERVERS - files.gotocon.com · 2005 Servers in the server room 2008 Our servers in a data centre 2011 Rented servers in a data centre 2013 Virtual servers in

https://goo.gl/pJqgrc

slack.openwhisk.org

#openwhisk

@glynn_bird @openwhisk


Recommended