serverless architectures - entwicklertag · ser verless is about the of ser vers. build and run...
TRANSCRIPT
ARCHITECTURES(WITH INFRASTRUCTURE)
Niko Köbler So�ware-Architect, Developer & Trainer
| |
SERVERLESS
AWS
[email protected] www.n-k.de @dasniko
DISCLAIMERThis is silver bullet,
no standard, but opinionated!
NO
SERVER ?WHAT
This is what actually mean...serverless
Serverless is about the of servers.
Build and run applications servers.
management
without thinkingabout
OF COMPUTINGPhysical Servers in datacentersVirtual Machines in datacentersVirtual Machines in CloudContainers on Virtual MachinesServerless as the unit of compute
EVOLUTION
COMPUTE Functions are the unit of deployment and scaling.No machines, VMs, or containers visible in theprogramming model.Permanent storage lives elsewhere.Scales per request; Users cannot over- or under-provision capacity.Never pay for idle (no cold servers/containers or their costs).Implicitly fault-tolerant because functions can runanywhere.BYOC - Bring Your Own Code.Metrics and logging are a universal right.
SERVERLESS MANIFESTO
Source: various AWS presentations
PaaS FaaSis as
DevOps NoOps
vs.
vs.
AWS Event Driven
JVM-based languages (Java 8), JavaScript (Node.js), Python, C#, (more to come)
Versions, Encrypted Environment Variables, Step Functions
Pay as you use - in 100ms blocks (e.g. 100ms w/ 128MB memory = USD 0.000000208)
LAMBDA
AWS EXAMPLE
LAMBDANODE
exports.handler = (event, context) => { console.log('Received event:', JSON.stringify(event)); }
AWS EXAMPLE
LAMBDAJAVA
public class ImageProcessor implements RequestHandler<S3Event, Void> { @Override public Void handleRequest(S3Event s3Event, Context context) {
// get the S3 event data from the event request S3EventNotification.S3EventNotificationRecord record = s3Event.getRecords().get(0);
// your code goes here...
// return an object with specified type (see class generics) return null; } }
AWS EVENTSS3
Cloud Watch
Config
AWS IoT
Cognito
SES
API Gateway
(no complete list)
LAMBDA
DynamoDB
Cloud Formation
Kinesis
Code Commit
SNS
Echo / Alexa
Cron
GATEWAY"Reverse Proxy"
hides possible multiple service calls (aka "service composition", ESB?)
distributes requests to proper service instances
"Mock" services
Caching, Throttling, DDoS attack protection, etc.
API
API GATEWAYNETFLIX
GATEWAY"Reverse Proxy"
hides possible multiple service calls (aka "service composition", ESB?)
distributes requests to proper service instances
"Mock" services
Caching, Throttling, DDoS attack protection, etc.
API
GATEWAYAUTHENTICATION / AUTHORIZATION
AWS Cognito / STS
Custom Authorizer (Lambda Function, returning IAM policies)
API
API GATEWAY AUTHORIZATION
DYNAMOFully Managed NoSQL Data Store
Schemaless Data Model
Seamless Scalabiltiy, "no limits"
Pay by Read-/Write-Capacity-Units
DB
SERVERLESS ARCHITECTUREWEB
SERVERLESS ARCHITECTUREWEB
API Gateway with , Push and SNS SQS
TESTING
TESTING
Functions are easy to test, stateless and little to no dependencies
UNIT TESTS
TESTING
Environment, Infrastructuremax. 1024 of running processes/threads
max. 100 concurrent Lambdas per Region no remote debugging
INTEGRATION TESTS
COMPETITORS?
MICROSOFTAZURE FUNCTIONS
JavaScript, C#, Python, PHP
COMPETITOR
ON ?PREMISE
COMPETITOR
IBM BLUEMIX
Bluemix Cloud & OnPremiseOpen Source / Apache License v2.0JavaScript (Node.js), Python and... Swi�!Docker SupportFunction-Chaining
OPENWHISK
IBM
LET'S GET STARTEDOPENWHISK
$ git clone https://github.com/openwhisk/openwhisk.git $ cd openwhisk/tools/vagrant $ vagrant up
IBM JAVASCRIPT EXAMPLE
Create the action in OpenWhisk
Run the action
Result
OPENWHISK
function main(params) { return {payload: 'Hello, ' + params.name}; }
$ wsk action create hello hello.js
$ wsk action invoke hello --blocking --result --param name Niko
{ "payload": "Hello, Niko" }
Overview: Documentation, Logging & Monitoring, Metrics ! (typical things for distributed environments)
Cloud Provider Binding / Dependency: APIs, Portability, Costs, SLAs
DRAWBACKS
?WANT TO START?
Give a try!
Manages all the Cloud-Resources and Deployment.
CURIOUS
serverless.com
SERVERLESS.COM# Install serverless globally $ npm install serverless -g
# Create an AWS Lamdba function in Node.js $ serverless create --template aws-nodejs
# Deploy to live AWS account $ serverless deploy
# Function deployed! $ http://api.amazon.com/users/update
BUT POWERFUL
No need to run/manage Application ServersFast results, minimal effort, minimal TTM(!)Low costs, minimal financial riskAutomatic Scalabiltiy and Availability "out-of-the-box"
SERVERLESS
THANK !ANY ?
Slides:
Niko Köbler So�ware-Architect, Developer & Trainer
| |
YOUQUESTIONS
http://bit.ly/serverless-slides
[email protected] www.n-k.de @dasniko
LINKSAWS Lambda: Amazon API Gateway:
Google Cloud Functions:
Microso� Azure Functions:
IBM OpenWhisk: IBM OpenWhisk SourceCode:
Serverless Framework:
https://aws.amazon.com/lambdahttps://aws.amazon.com/api-
gateway
https://cloud.google.com/functions
https://azure.microso�.com/services/functionshttps://developer.ibm.com/openwhisk
https://github.com/openwhisk/openwhiskhttp://serverless.com