munz & more Serverless Architectures OTNLaTAM AUG 2017 Dr. Frank Munz
2 Frank Munz • Founded munz & more in 2007 • 17 years Oracle Middleware, Cloud, and Distributed Computing • Consulting and High-End Training • Wrote two Oracle WLS and one Cloud book
Oracle announced FaaS at OOW2016
AWS API: JSON Snippet munz & more #4
AWS SDKs munz & more #5 AWS language bindings Oracle language bindings, e.g. Java: https://github.com/oracle/bmcs-java-sdk
CLI munz & more #6 $ aws ec2 describe-regions --output table Oracle	open	sourced Bare	Metal	CLI https://blogs.oracle.com/de velopers/open-sourcing- bare-metal-cloud-services- cli
AWS Console: Services munz & more #7
Oracle Cloud Console munz & more #8
True Elasticity 9
Oracle: Pay Per Use
munz & more #11 https://www.blog.google/topics/google-cloud/google-invests-indigo-undersea-cable-improve-cloud-infrastructure-southeast-asia/
New Undersea Cable (Google) munz & more #12
Pay Per Use • You own a massively parallel and distributed and highly available supercomputer with linear costs • 100h of 1 instance = 1h of 100 instances • Your IT resources are not fixed anymore
Cloud Computing API Elasticity Pay	per	use Fully	Programmable	Data	Center
PaaS IaaS Oracle	Bare	Metal Amazon	EC2 Oracle	ACCS AWS	Beanstalk FaaS Oracle	TBD AWS	Lambda automatic	elasticity. True	pay	per	use. Min/Max,	trigger, IaaS	pricing API	✅ Elasticity? Pay	per	use? Container	Service OCCS AWS	ECS Launch	Configuration +Autoscaling Groups +Scaling	Events, pay	/h	/	server Easy	scaling	(OCCS) IaaS	pay	per	use	pricing
Serverless
Serverless vs. FaaS munz & more #18 • AWS announced Lambda in 2014 as serverless. • Lambda is Function as a Service (FaaS) • PaaS is ”serverless” (in a broader sense) • FaaS is the cool thing – not “serverless” https://dzone.com/articles/serverless-architecture-1
Serverless Example: S3 munz & more #19 Replicated	to	3	availability	zones	(=DC) Availability	99.99% Durability	99.999999999% (eleven	9s) 14	worldwide	regions region	->	API	parameter Blob	storage	with	RESTful Interface: PUT (key, value)
S3 munz & more #20 GET	http://fmtestweb.s3-website.eu-central-1.amazonaws.com/
Serverless Example: S3 munz & more #21 • Never provision storage • Off instance service = NO server -> “serverless” • NO web server • $0,02 per GB + requests Werner Vogel’s blog is on S3: http://www.allthingsdistributed.com/
S3 is to data as FaaS is to code munz & more #22
FaaS
Edit Code Inline / Upload munz & more #24 npm node-lambda package for locally running and remotely deploying your node.js event: event passed to function context: runtime context callback: optional return (or null)
Definition: Function as a Service • Automated elasticity • True pay per invokation • Stateless • Event based munz & more #25 Definition • Choose memory -> compute power, I/O • Using container tech Characteristics
FaaS Implementations Amazon Google Microsoft Oracle Name Lambda Cloud	Functions Azure	Functions tbd Year 2014 2016 2016 2016 Status prod alpha beta announced Language Support NodeJS 4.3.2,	Java 8,	Python	2.7, .Net 1.0.1	C#,	native Linux NodeJS JS,	PHP, C#,	F#, Python,	bash, PowerShell ? Remarks Deploy	from	github or	BitBucket,	CLI Bundle functions, OneDrive	and	Bot Service	integration Linked to	Event Hub	CS? Link https://aws.amazon.com/la mbda/ https://azure.microsoft.com/e n-us/services/functions/ https://azure.microsoft.com/en- us/services/functions/ https://cloud.oracle.com /home
Lambda Tech Details • Retries + dead letter Q • Metering in 100 ms (compute x time) • You can use environment variables, threads and start processes • Invocation times may differ • No scaling parameter munz & more #27
Lambda: Limits per Function munz & more #28
Cost Savings • Expedia(2016): – 2.3 billions calls – 200k hours / month – $ 550 a month • Postlight – API GW, Lambda, Serverless – Costs dropped 2 orders of magnitude to $ 370 munz & more #29 https://www.youtube.com/watch?v=gT9x9LnU_rE https://trackchanges.postlight.com/serving-39-million-requests-for-370-month-or-how-we- reduced-our-hosting-costs-by-two-orders-of-edc30a9a88cd
Events to Trigger Functions munz & more #30 Events	from	Cloud	Service - API-Gateway - S3 - SNS - Kinesis - Cognito - Cloud	Formation - Cloud	Watch log	/	events	/	scheduled - Code	Commit - Apps	using	AWS	SDK λVendor	lock-in? also	multiple	sources
Create Lambda munz & more #31 S3
Example 1: Simple Scenario munz & more #32
Test Code munz & more #33 1 2 34
API-Gateway Design and expose API to consumer, can trigger Lambda and brings more features: • Authentication • Traffic management • Import Swagger definitions • Create JavaScript, Android, iOS SDKs • XML to REST conversion • Uses Cloud Front (CDN) internally Pricing: #calls + outbound traffic (+cache) munz & more #34
Example 2: Image Recognition 35 https://github.com/awslabs/lambda-refarch-imagerecognition
Image Recognition munz & more #36 Extract meta	data AI	based ecognition Create thumbnail
37 BaaS
Pay Per Use Every started request is charged: • First 1 million req/month are free + 400,000 GB seconds of compute time • $0.20 per 1 million req + $0.00001667 per GB second Lambda: free tier is forever. munz & more #38
Security
“Try to attack something that only lives for few milli-seconds” (AWS)
Gone in 60ms munz & more #41 https://www.youtube.com/watch?v=YZ058hmLuv0
Security • Not discussed here: Are Clouds Safe? • Small attack surface: – Container lifetime -> request = milli-seconds – No open ports – Not listening to an IP – You cannot call Lambdas directly: triggered by events “Exploit video” by CCC: “Gone in 60ms” munz & more #42
Microservices
Microservices Developing a single application as • a suite of small services • each running in its own process / owns it‘s data • communicating with lightweight mechanisms (M. Fowler / J. Lewis) https://martinfowler.com/articles/microservices.html
Frank Munz / OTN Latam 2016 #47 Service owns its data Less enterprise, more application centric Continuous Unlocking
munz & more #48 Is	𝛌 the	new	μ ?
FaaS vs. K8s Microservices FaaS fulfills M. Fowler’s microservices definition munz & more #49 AWS Lambda (compared to Docker with Kubernetes) ✅ Benefits	of	FaaS - “serverless” - zero	config auto	scaling - true	pay	per	use ->	higher	abstraction Limits	of	FaaS - language/framework	choice - resource	limits - execution	time	/	size	limit - vendor	lock-in ->	reduced	flexibility
A. Cockroft Ten years ago, a monolithic application was the best way to deliver business logic, … five years ago the best option shifted to microservices Today, another shift is taking place, to event driven functions (FaaS) munz & more #50 https://read.acloud.guru/evolution-of-business-logic-from-monoliths-through-microservices-to-functions-ff464b95a44d
Software
Serverless Framework Why a framework if your code runs in a “frame”? • Repeating patterns: IAM, API-GW, S3 bucket etc • NodeJS, Python, Java • AWS and Azure • Generates, deploys, runs Lambda in 3 LOC based on generated YAML + .py file munz & more #52https://serverless.com/
Serverless Framework munz & more #53
Hardware
- 100	TB	Storage,	256	bit	TPM - 3x	10	GB/s	NICs - Cluster	up	to	5, 99.999%	data	durability - iSCSI,	Ethernet,	SIM	Card - Lambda	in	Python:	Greengrass - S3	PUT	->	Lambda - Lambda	functions ->	public	API,	e.g.	AWS - E-Ink	Shipping	label	that	updates - $	300	/	10	days AWS Snowball Edge (FaaS in a Box):
AWS Greengrass Lambda in embedded devices • Linux 4.4+ • Locally execute Lambda triggered by local event • Greengrass Core + IoT SDK munz & more #56
TL;DR #serverless / #FaaS ”Serverless” ∋ FaaS / all major clouds / event driven / stateless / true pay per use / automatic scalability / integrates with other CS / vendor lock in? / -> cross-cloud frameworks emerge / 𝛌 could be the new µ! @frankmunz
www.linkedin.com/in/frankmunz/ www.munzandmore.com/blog facebook.com/cloudcomputingbook facebook.com/weblogicbook @frankmunz youtube.com/weblogicbook -> more than 50 web casts Don’t be shy J

Serverless / FaaS / Lambda and how it relates to Microservices

  • 1.
    munz & more Serverless ArchitecturesOTNLaTAM AUG 2017 Dr. Frank Munz
  • 2.
    2 Frank Munz • Foundedmunz & more in 2007 • 17 years Oracle Middleware, Cloud, and Distributed Computing • Consulting and High-End Training • Wrote two Oracle WLS and one Cloud book
  • 3.
  • 4.
    AWS API: JSONSnippet munz & more #4
  • 5.
    AWS SDKs munz &more #5 AWS language bindings Oracle language bindings, e.g. Java: https://github.com/oracle/bmcs-java-sdk
  • 6.
    CLI munz & more#6 $ aws ec2 describe-regions --output table Oracle open sourced Bare Metal CLI https://blogs.oracle.com/de velopers/open-sourcing- bare-metal-cloud-services- cli
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
    munz & more#11 https://www.blog.google/topics/google-cloud/google-invests-indigo-undersea-cable-improve-cloud-infrastructure-southeast-asia/
  • 12.
    New Undersea Cable(Google) munz & more #12
  • 13.
    Pay Per Use •You own a massively parallel and distributed and highly available supercomputer with linear costs • 100h of 1 instance = 1h of 100 instances • Your IT resources are not fixed anymore
  • 14.
    Cloud Computing API ElasticityPay per use Fully Programmable Data Center
  • 15.
  • 16.
  • 18.
    Serverless vs. FaaS munz& more #18 • AWS announced Lambda in 2014 as serverless. • Lambda is Function as a Service (FaaS) • PaaS is ”serverless” (in a broader sense) • FaaS is the cool thing – not “serverless” https://dzone.com/articles/serverless-architecture-1
  • 19.
    Serverless Example: S3 munz& more #19 Replicated to 3 availability zones (=DC) Availability 99.99% Durability 99.999999999% (eleven 9s) 14 worldwide regions region -> API parameter Blob storage with RESTful Interface: PUT (key, value)
  • 20.
    S3 munz & more#20 GET http://fmtestweb.s3-website.eu-central-1.amazonaws.com/
  • 21.
    Serverless Example: S3 munz& more #21 • Never provision storage • Off instance service = NO server -> “serverless” • NO web server • $0,02 per GB + requests Werner Vogel’s blog is on S3: http://www.allthingsdistributed.com/
  • 22.
    S3 is todata as FaaS is to code munz & more #22
  • 23.
  • 24.
    Edit Code Inline/ Upload munz & more #24 npm node-lambda package for locally running and remotely deploying your node.js event: event passed to function context: runtime context callback: optional return (or null)
  • 25.
    Definition: Function asa Service • Automated elasticity • True pay per invokation • Stateless • Event based munz & more #25 Definition • Choose memory -> compute power, I/O • Using container tech Characteristics
  • 26.
    FaaS Implementations Amazon GoogleMicrosoft Oracle Name Lambda Cloud Functions Azure Functions tbd Year 2014 2016 2016 2016 Status prod alpha beta announced Language Support NodeJS 4.3.2, Java 8, Python 2.7, .Net 1.0.1 C#, native Linux NodeJS JS, PHP, C#, F#, Python, bash, PowerShell ? Remarks Deploy from github or BitBucket, CLI Bundle functions, OneDrive and Bot Service integration Linked to Event Hub CS? Link https://aws.amazon.com/la mbda/ https://azure.microsoft.com/e n-us/services/functions/ https://azure.microsoft.com/en- us/services/functions/ https://cloud.oracle.com /home
  • 27.
    Lambda Tech Details •Retries + dead letter Q • Metering in 100 ms (compute x time) • You can use environment variables, threads and start processes • Invocation times may differ • No scaling parameter munz & more #27
  • 28.
    Lambda: Limits perFunction munz & more #28
  • 29.
    Cost Savings • Expedia(2016): –2.3 billions calls – 200k hours / month – $ 550 a month • Postlight – API GW, Lambda, Serverless – Costs dropped 2 orders of magnitude to $ 370 munz & more #29 https://www.youtube.com/watch?v=gT9x9LnU_rE https://trackchanges.postlight.com/serving-39-million-requests-for-370-month-or-how-we- reduced-our-hosting-costs-by-two-orders-of-edc30a9a88cd
  • 30.
    Events to TriggerFunctions munz & more #30 Events from Cloud Service - API-Gateway - S3 - SNS - Kinesis - Cognito - Cloud Formation - Cloud Watch log / events / scheduled - Code Commit - Apps using AWS SDK λVendor lock-in? also multiple sources
  • 31.
  • 32.
    Example 1: SimpleScenario munz & more #32
  • 33.
    Test Code munz &more #33 1 2 34
  • 34.
    API-Gateway Design and exposeAPI to consumer, can trigger Lambda and brings more features: • Authentication • Traffic management • Import Swagger definitions • Create JavaScript, Android, iOS SDKs • XML to REST conversion • Uses Cloud Front (CDN) internally Pricing: #calls + outbound traffic (+cache) munz & more #34
  • 35.
    Example 2: ImageRecognition 35 https://github.com/awslabs/lambda-refarch-imagerecognition
  • 36.
    Image Recognition munz &more #36 Extract meta data AI based ecognition Create thumbnail
  • 37.
  • 38.
    Pay Per Use Everystarted request is charged: • First 1 million req/month are free + 400,000 GB seconds of compute time • $0.20 per 1 million req + $0.00001667 per GB second Lambda: free tier is forever. munz & more #38
  • 39.
  • 40.
    “Try to attacksomething that only lives for few milli-seconds” (AWS)
  • 41.
    Gone in 60ms munz& more #41 https://www.youtube.com/watch?v=YZ058hmLuv0
  • 42.
    Security • Not discussedhere: Are Clouds Safe? • Small attack surface: – Container lifetime -> request = milli-seconds – No open ports – Not listening to an IP – You cannot call Lambdas directly: triggered by events “Exploit video” by CCC: “Gone in 60ms” munz & more #42
  • 43.
  • 44.
    Microservices Developing a singleapplication as • a suite of small services • each running in its own process / owns it‘s data • communicating with lightweight mechanisms (M. Fowler / J. Lewis) https://martinfowler.com/articles/microservices.html
  • 47.
    Frank Munz /OTN Latam 2016 #47 Service owns its data Less enterprise, more application centric Continuous Unlocking
  • 48.
    munz & more#48 Is 𝛌 the new μ ?
  • 49.
    FaaS vs. K8sMicroservices FaaS fulfills M. Fowler’s microservices definition munz & more #49 AWS Lambda (compared to Docker with Kubernetes) ✅ Benefits of FaaS - “serverless” - zero config auto scaling - true pay per use -> higher abstraction Limits of FaaS - language/framework choice - resource limits - execution time / size limit - vendor lock-in -> reduced flexibility
  • 50.
    A. Cockroft Ten yearsago, a monolithic application was the best way to deliver business logic, … five years ago the best option shifted to microservices Today, another shift is taking place, to event driven functions (FaaS) munz & more #50 https://read.acloud.guru/evolution-of-business-logic-from-monoliths-through-microservices-to-functions-ff464b95a44d
  • 51.
  • 52.
    Serverless Framework Why aframework if your code runs in a “frame”? • Repeating patterns: IAM, API-GW, S3 bucket etc • NodeJS, Python, Java • AWS and Azure • Generates, deploys, runs Lambda in 3 LOC based on generated YAML + .py file munz & more #52https://serverless.com/
  • 53.
  • 54.
  • 55.
    - 100 TB Storage, 256 bit TPM - 3x 10 GB/s NICs -Cluster up to 5, 99.999% data durability - iSCSI, Ethernet, SIM Card - Lambda in Python: Greengrass - S3 PUT -> Lambda - Lambda functions -> public API, e.g. AWS - E-Ink Shipping label that updates - $ 300 / 10 days AWS Snowball Edge (FaaS in a Box):
  • 56.
    AWS Greengrass Lambda inembedded devices • Linux 4.4+ • Locally execute Lambda triggered by local event • Greengrass Core + IoT SDK munz & more #56
  • 57.
    TL;DR #serverless /#FaaS ”Serverless” ∋ FaaS / all major clouds / event driven / stateless / true pay per use / automatic scalability / integrates with other CS / vendor lock in? / -> cross-cloud frameworks emerge / 𝛌 could be the new µ! @frankmunz
  • 58.