SlideShare una empresa de Scribd logo
1 de 57
Descargar para leer sin conexión
Frankfurt | 26 & 27
September 2018
Production-Ready Serverless Java
Applications in 3 Weeks
with S3, Lambda, API Gateway, SNS, DynamoDB and Aurora Serverless
by Elmar Warken and Vadym Kazulkin, ip.labs GmbH
Contact
Vadym Kazulkin, ip.labs GmbH
v.kazulkin@iplabs.de
www.xing.com/profile/Vadym_Kazulkin
@VKazulkin, @ServerlessBonn (Meetup)
Elmar Warken, ip.labs GmbH
e.warken@iplabs.de
www.xing.com/profile/Elmar_Warken
ip.labs GmbH
Revenue Share Project
Revenue Share Calculator Service Requirements
1. Automatic calculation for the complete previous month on the 1st of each
month for each customer
2. Manual calculation via a simple GUI
• For the current month so far
• Recalculation for the previous months
3. Calculation results as downloads, download link per email
4. Archive with calculated results for each customer
5. For internal use only!
Serverless decision for RevShare project
• spike workloads only at the beginning of a month
• service is idle more than 99% of the time
 We use Function as a Service, to never pay for idle.
7
RS core
calculator
Turnover info
input data:
order data & calculation rules
output data:
RS calculation & input data
email with path to
download RS
calculation result
Central DB
Management
Server
extract customer, year
and month from the
file path
Key example: revsharetool-storage-demo/input-data/1000000/import/201806/revshare-final.json
RS calculator app
customer, year, month
AWS
X-Ray
AWS
Lambda
Amazon API
Gateway
Implementing „Revenue Share Calculation“ Lambda with Java SDK
RevenueShare Service Lambda memory setting
Selecting memory size for a Lambda function
• Price 0,00001667 USD per GB-second
• CPU power allocation proportional to amount of memory
• more „GB“ will often just improve performance and not increase costs!
• cheaper GB setting may save costs, when lambda function
often has to wait
12
Lambda profiling with X-Ray
13
Request references from X-Ray and CloudWatch
14
Billed Duration and Max Memory Used
15
XRay activation
16
XRay activation in Java
17
Lambda free tier
• 136170 sec. per month with the most powerful CPU setting
• = more than 1h per day
• with max 1 call every 2 sec.
18
Amazon API
Gateway
• Expose Lambda functions as RESTful web
service
• API Management functionality built in:
• authorization and access control for API calls with IAM
• request monitoring and analytics
• overload protection
• version management
• APIs as products (SaaS, AWS Marketplace)
• SDK generation
Amazon API Gateway
API Gateway for different AWS services
• Access different AWS
services in a consistent
manner
API Gateway for Lambda function in RevShare App
Cost influence of API gateway
22
0,408 1,032
1,656
2,28
2,904
3,528
4,152
4,776
3,908
4,532
5,156
5,78
6,404
7,028
7,652
8,276
100 MS 400MS 700MS 1000MS 1300MS 1600MS 1900MS 2200MS
duration per call
cost per million API calls in $ for a 128 MB
function
without API Gateway with API Gateway
Defining APIs for Lambdas – manual approach
Resources
Operations
Automated API definitions with „Serverless“ framework
24
Automated API definitions with „Serverless“ framework
25
26
Aggregations
Source: Advanced Design Patterns for Amazon DynamoDB https://www.youtube.com/watch?v=jzeKPKpucS0
Aggregations with DynamoDB Streams and Lambda
Aggregations with DynamoDB Streams and Lambda
Aggregations with DynamoDB Lambda Execution Role
Aggregations with DynamoDB Streams and Lambda
Auto Scaling
Source: Yan Cui: "The problems with DynamoDB Auto Scaling and how it might be improved"
https://hackernoon.com/the-problems-with-dynamodb-auto-scaling-and-how-it-might-be-improved-a92029c8c10b
Scheduled Auto Scaling
Scheduled Auto Scaling Example
DynamoDB Pricing
DynamoDB works by provisioning throughput at the table level. The throughput
is set up as follows:
• Each write capacity unit (WCU) gives 1KB/s of write throughput
• Each read capacity unit (RCU) gives 4KB/s of read throughput
• Read and write throughput are independent
Partitioning Math
By Capacity = (Total RCU)/3000 + (Total WCU)/1000
By Size = Total size / 10 GB
Number of partitions = CEILING (MAX (Capacity, Size))
Max RCUs per partition=3000; Max WCUs per partition=1000
Throughput (RCU & WCU) is uniformly spread across partitions
In case of exceeding throughput per partition -
ProvisionedThroughputExceededException
Partitioning Math
Table Size=40 GB , RCUs=1500, WCUs=400
By Capacity = 1500/3000 + 400/1000=0.9
By Size = 40 GB / 10 GB =4
Number of partitions = CEILING (MAX (0.9,4)) =4
RCUs per partition=1500/4 =375
WCUs per partition=400/4 =100
Data per partition=40 GB/4 = 10GB
Example of ProvisionedThroughputExceededException
DynamoDB Table with 40 GB of data -> gives 4 partitions
Source: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html#bp-partition-key-
partitions-adaptive
DynamoDB
Exceeding Throughput
Causes:
• Uneven distribution of data due to the wrong choice of partition key
• Frequent accessing of the same key in a partition (the most popular item,
also known as a hot key)
• A request rate greater than the provisioned throughput
Solutions to the hot key problems
• Distribute your key accross partitions
• Avoid mixing cold and hot keys
• Split the hot key (key+ random (0,X))
Source: Deep Dive on DynamoDB https://www.youtube.com/watch?v=bCW3lhsJKfw
Source: Advanced Design Patterns for Amazon DynamoDB
https://www.youtube.com/watch?v=jzeKPKpucS0
New Feature : DynamoDB Adaptive Capacity
Source: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html#bp-partition-key-
partitions-adaptive
DynamoDB canonical use cases
• Key-value lookups on well-distributed records
• Avoiding complex queries (and joins)
• Limiting hot keys
Challenges with DynamoDB
DynamoDB is not the right choice for each solution
• Think of the access pattern in advance
• Difficult to change access patterns (partition&sort key) & table structure
afterwards
• Difficult to replace DynamoDB with another even (NoSQL) database in the future
Why NoSQL database DynamoDB?
Project use case and challenges:
• Fixed Scheme (argument against NoSQL DB)
• Small size of the table and the entities
• Learning curve for the new technology
• No aggregate functions was sum, avg, count and as expected no joins
Amazon Aurora Serverless
(GA for MySql in us-east-1 N. Virginia since 09.08.2018)
What Is Amazon Aurora Serverless?
Amazon Aurora (MySql/Postgres)
Source: “AWS Summit - London | twitch.tv/aws | Aurora Serverless Preview Update”
https://www.youtube.com/watch?v=J3A_TJZosu8
What Is Amazon Aurora Serverless?
Amazon Aurora Serverless Architeсture
Source: https://aws.amazon.com/de/blogs/aws/aurora-serverless-ga/
Amazon Aurora Serverless Architeсture
Source: “AWS Summit - London | twitch.tv/aws | Aurora Serverless Preview Update”
https://www.youtube.com/watch?v=J3A_TJZosu8
Amazon Aurora Serverless Pricing & Settings
Source: https://aws.amazon.com/de/blogs/aws/aurora-serverless-ga/
Amazon Aurora Serverless CloudWatch Monitoring
Source: https://aws.amazon.com/de/blogs/aws/aurora-serverless-ga/
Amazon Aurora Serverless Pricing & Settings
Source: https://aws.amazon.com/de/blogs/aws/aurora-serverless-ga/
26 sec Cold-start
Downscaling
4 -> 2 ACUs
Pause the cluster
Use cases for Amazon Aurora Serverless
• Seldom usage (weekly jobs) + additional spikes
• Noticable initial latencies acceptable
• Aurora and therefore Lambda are behind VPC
• Drastically increases also Lambda cold start
• #AWSWishList: Aurora Serverless works like DynamoDB: HTTP+IAM Role
• Dev/Test Database
Source: Ajay Nair „Become a Serverless Black Belt” https://www.youtube.com/watch?v=oQFORsso2go
Questions?
www.iplabs.de
Thank You!

Más contenido relacionado

La actualidad más candente

Autoscale DynamoDB with Dynamic DynamoDB
Autoscale DynamoDB with Dynamic DynamoDBAutoscale DynamoDB with Dynamic DynamoDB
Autoscale DynamoDB with Dynamic DynamoDB
Sebastian Dahlgren
 
Big data dive amazon emr processing
Big data dive amazon emr processingBig data dive amazon emr processing
Big data dive amazon emr processing
Olga Lavrentieva
 

La actualidad más candente (20)

What's New with Amazon DynamoDB - AWS Online Tech Talks
What's New with Amazon DynamoDB - AWS Online Tech TalksWhat's New with Amazon DynamoDB - AWS Online Tech Talks
What's New with Amazon DynamoDB - AWS Online Tech Talks
 
Data Access Patterns
Data Access PatternsData Access Patterns
Data Access Patterns
 
AWS re:Invent 2016: How Citus Enables Scalable PostgreSQL on AWS (DAT207)
AWS re:Invent 2016: How Citus Enables Scalable PostgreSQL on AWS (DAT207)AWS re:Invent 2016: How Citus Enables Scalable PostgreSQL on AWS (DAT207)
AWS re:Invent 2016: How Citus Enables Scalable PostgreSQL on AWS (DAT207)
 
Amazon Web Services lection 6
Amazon Web Services lection 6  Amazon Web Services lection 6
Amazon Web Services lection 6
 
Server-less solution for moving Millions of Images in Cloud - Brett Sutter, ...
 Server-less solution for moving Millions of Images in Cloud - Brett Sutter, ... Server-less solution for moving Millions of Images in Cloud - Brett Sutter, ...
Server-less solution for moving Millions of Images in Cloud - Brett Sutter, ...
 
Spark and the Hadoop Ecosystem: Best Practices for Amazon EMR
Spark and the Hadoop Ecosystem: Best Practices for Amazon EMRSpark and the Hadoop Ecosystem: Best Practices for Amazon EMR
Spark and the Hadoop Ecosystem: Best Practices for Amazon EMR
 
Square Peg Round Hole: Serverless Solutions For Non-Serverless Problems
Square Peg Round Hole: Serverless Solutions For Non-Serverless ProblemsSquare Peg Round Hole: Serverless Solutions For Non-Serverless Problems
Square Peg Round Hole: Serverless Solutions For Non-Serverless Problems
 
Build Your Web Analytics with node.js, Amazon DynamoDB and Amazon EMR (BDT203...
Build Your Web Analytics with node.js, Amazon DynamoDB and Amazon EMR (BDT203...Build Your Web Analytics with node.js, Amazon DynamoDB and Amazon EMR (BDT203...
Build Your Web Analytics with node.js, Amazon DynamoDB and Amazon EMR (BDT203...
 
(BDT204) Rendering a Seamless Satellite Map of the World with AWS and NASA Da...
(BDT204) Rendering a Seamless Satellite Map of the World with AWS and NASA Da...(BDT204) Rendering a Seamless Satellite Map of the World with AWS and NASA Da...
(BDT204) Rendering a Seamless Satellite Map of the World with AWS and NASA Da...
 
Amazon Web Services lection 2
Amazon Web Services lection 2Amazon Web Services lection 2
Amazon Web Services lection 2
 
Almacenamiento en la nube con AWS
Almacenamiento en la nube con AWSAlmacenamiento en la nube con AWS
Almacenamiento en la nube con AWS
 
Intro to batch processing on AWS
Intro to batch processing on AWSIntro to batch processing on AWS
Intro to batch processing on AWS
 
Autoscale DynamoDB with Dynamic DynamoDB
Autoscale DynamoDB with Dynamic DynamoDBAutoscale DynamoDB with Dynamic DynamoDB
Autoscale DynamoDB with Dynamic DynamoDB
 
Log Analytics with Amazon Elasticsearch Service & Kibana
Log Analytics with Amazon Elasticsearch Service & KibanaLog Analytics with Amazon Elasticsearch Service & Kibana
Log Analytics with Amazon Elasticsearch Service & Kibana
 
Big data dive amazon emr processing
Big data dive amazon emr processingBig data dive amazon emr processing
Big data dive amazon emr processing
 
Benefícios e melhores práticas no uso do Amazon Redshift
Benefícios e melhores práticas no uso do Amazon RedshiftBenefícios e melhores práticas no uso do Amazon Redshift
Benefícios e melhores práticas no uso do Amazon Redshift
 
Long running aws lambda - Joel Schuweiler, Minneapolis
Long running aws lambda -  Joel Schuweiler, MinneapolisLong running aws lambda -  Joel Schuweiler, Minneapolis
Long running aws lambda - Joel Schuweiler, Minneapolis
 
ENT306 Migrating Large Scale Data Sets to the Cloud
ENT306 Migrating Large Scale Data Sets to the CloudENT306 Migrating Large Scale Data Sets to the Cloud
ENT306 Migrating Large Scale Data Sets to the Cloud
 
(STG202) AWS Import/Export Snowball: Large-Scale Data Ingest into AWS
(STG202) AWS Import/Export Snowball: Large-Scale Data Ingest into AWS(STG202) AWS Import/Export Snowball: Large-Scale Data Ingest into AWS
(STG202) AWS Import/Export Snowball: Large-Scale Data Ingest into AWS
 
Workshop: Deploy a Deep Learning Framework on Amazon ECS
Workshop: Deploy a Deep Learning Framework on Amazon ECSWorkshop: Deploy a Deep Learning Framework on Amazon ECS
Workshop: Deploy a Deep Learning Framework on Amazon ECS
 

Similar a "Production-ready Serverless Java Applications in 3 weeks" at AWS Community Days 2018 by Vadym Kazulkin/Elmar Warken

AWS CLOUD 2018- Amazon DynamoDB기반 글로벌 서비스 개발 방법 (김준형 솔루션즈 아키텍트)
AWS CLOUD 2018- Amazon DynamoDB기반 글로벌 서비스 개발 방법 (김준형 솔루션즈 아키텍트)AWS CLOUD 2018- Amazon DynamoDB기반 글로벌 서비스 개발 방법 (김준형 솔루션즈 아키텍트)
AWS CLOUD 2018- Amazon DynamoDB기반 글로벌 서비스 개발 방법 (김준형 솔루션즈 아키텍트)
Amazon Web Services Korea
 
Building Serverless Web Applications - DevDay Austin 2017
Building Serverless Web Applications - DevDay Austin 2017Building Serverless Web Applications - DevDay Austin 2017
Building Serverless Web Applications - DevDay Austin 2017
Amazon Web Services
 

Similar a "Production-ready Serverless Java Applications in 3 weeks" at AWS Community Days 2018 by Vadym Kazulkin/Elmar Warken (20)

Production Ready Serverless Java Applications in 3 Weeks AWS UG Cologne Febru...
Production Ready Serverless Java Applications in 3 Weeks AWS UG Cologne Febru...Production Ready Serverless Java Applications in 3 Weeks AWS UG Cologne Febru...
Production Ready Serverless Java Applications in 3 Weeks AWS UG Cologne Febru...
 
Serverless on AWS : Understanding the hard parts at Serverless Meetup Dusseld...
Serverless on AWS : Understanding the hard parts at Serverless Meetup Dusseld...Serverless on AWS : Understanding the hard parts at Serverless Meetup Dusseld...
Serverless on AWS : Understanding the hard parts at Serverless Meetup Dusseld...
 
Serverless on AWS : Understanding the hard parts at Froscon 2019
Serverless on AWS : Understanding the hard parts at Froscon 2019Serverless on AWS : Understanding the hard parts at Froscon 2019
Serverless on AWS : Understanding the hard parts at Froscon 2019
 
"Serverless Java Applications" at Froscon 2018 by Vadym Kazulkin/Elmar Warken
"Serverless Java Applications" at Froscon 2018 by Vadym Kazulkin/Elmar Warken"Serverless Java Applications" at Froscon 2018 by Vadym Kazulkin/Elmar Warken
"Serverless Java Applications" at Froscon 2018 by Vadym Kazulkin/Elmar Warken
 
使用 AWS 無伺服器運算服務打造您的第一個語音助理
使用 AWS 無伺服器運算服務打造您的第一個語音助理使用 AWS 無伺服器運算服務打造您的第一個語音助理
使用 AWS 無伺服器運算服務打造您的第一個語音助理
 
AWS CLOUD 2018- Amazon DynamoDB기반 글로벌 서비스 개발 방법 (김준형 솔루션즈 아키텍트)
AWS CLOUD 2018- Amazon DynamoDB기반 글로벌 서비스 개발 방법 (김준형 솔루션즈 아키텍트)AWS CLOUD 2018- Amazon DynamoDB기반 글로벌 서비스 개발 방법 (김준형 솔루션즈 아키텍트)
AWS CLOUD 2018- Amazon DynamoDB기반 글로벌 서비스 개발 방법 (김준형 솔루션즈 아키텍트)
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Building Serverless Web Applications - DevDay Austin 2017
Building Serverless Web Applications - DevDay Austin 2017Building Serverless Web Applications - DevDay Austin 2017
Building Serverless Web Applications - DevDay Austin 2017
 
Serverless Architecture Patterns
Serverless Architecture PatternsServerless Architecture Patterns
Serverless Architecture Patterns
 
serverless_architecture_patterns_london_loft.pdf
serverless_architecture_patterns_london_loft.pdfserverless_architecture_patterns_london_loft.pdf
serverless_architecture_patterns_london_loft.pdf
 
Serverless Comparison: AWS vs Azure vs Google vs IBM
Serverless Comparison: AWS vs Azure vs Google vs IBMServerless Comparison: AWS vs Azure vs Google vs IBM
Serverless Comparison: AWS vs Azure vs Google vs IBM
 
Building Serverless Web Applications - DevDay Los Angeles 2017
Building Serverless Web Applications - DevDay Los Angeles 2017Building Serverless Web Applications - DevDay Los Angeles 2017
Building Serverless Web Applications - DevDay Los Angeles 2017
 
Introduce AWS Lambda for newbie and Non-IT
Introduce AWS Lambda for newbie and Non-ITIntroduce AWS Lambda for newbie and Non-IT
Introduce AWS Lambda for newbie and Non-IT
 
Raleigh DevDay 2017: Real time data processing using AWS Lambda
Raleigh DevDay 2017: Real time data processing using AWS LambdaRaleigh DevDay 2017: Real time data processing using AWS Lambda
Raleigh DevDay 2017: Real time data processing using AWS Lambda
 
Serverless Web Apps using API Gateway, Lambda and DynamoDB
Serverless Web Apps using API Gateway, Lambda and DynamoDBServerless Web Apps using API Gateway, Lambda and DynamoDB
Serverless Web Apps using API Gateway, Lambda and DynamoDB
 
SMC303 Real-time Data Processing Using AWS Lambda
SMC303 Real-time Data Processing Using AWS LambdaSMC303 Real-time Data Processing Using AWS Lambda
SMC303 Real-time Data Processing Using AWS Lambda
 
Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T...
 Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T... Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T...
Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T...
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Čtvrtkon #64 - AWS Serverless - Michal Haták
Čtvrtkon #64 - AWS Serverless - Michal HatákČtvrtkon #64 - AWS Serverless - Michal Haták
Čtvrtkon #64 - AWS Serverless - Michal Haták
 
Raleigh DevDay 2017: Build a serverless web application in one day workshop
Raleigh DevDay 2017: Build a serverless web application in one day workshopRaleigh DevDay 2017: Build a serverless web application in one day workshop
Raleigh DevDay 2017: Build a serverless web application in one day workshop
 

Más de Vadym Kazulkin

Más de Vadym Kazulkin (20)

Amazon DevOps Guru for Serverless Applications at DevOpsCon 2024 London
Amazon DevOps Guru for Serverless Applications at DevOpsCon 2024 LondonAmazon DevOps Guru for Serverless Applications at DevOpsCon 2024 London
Amazon DevOps Guru for Serverless Applications at DevOpsCon 2024 London
 
Making sense of service quotas of AWS Serverless services and how to deal wit...
Making sense of service quotas of AWS Serverless services and how to deal wit...Making sense of service quotas of AWS Serverless services and how to deal wit...
Making sense of service quotas of AWS Serverless services and how to deal wit...
 
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
 
How to reduce cold starts for Java Serverless applications in AWS at Serverle...
How to reduce cold starts for Java Serverless applications in AWS at Serverle...How to reduce cold starts for Java Serverless applications in AWS at Serverle...
How to reduce cold starts for Java Serverless applications in AWS at Serverle...
 
Revolutionize DevOps lifecycle with Amazon CodeCatalyst and DevOps Guru at De...
Revolutionize DevOps lifecycle with Amazon CodeCatalyst and DevOps Guru at De...Revolutionize DevOps lifecycle with Amazon CodeCatalyst and DevOps Guru at De...
Revolutionize DevOps lifecycle with Amazon CodeCatalyst and DevOps Guru at De...
 
Amazon DevOps Guru for the Serverless Applications at AWS Community Day NL 2023
Amazon DevOps Guru for the Serverless Applications at AWS Community Day NL 2023Amazon DevOps Guru for the Serverless Applications at AWS Community Day NL 2023
Amazon DevOps Guru for the Serverless Applications at AWS Community Day NL 2023
 
Making sense of service quotas of AWS Serverless services and how to deal wit...
Making sense of service quotas of AWS Serverless services and how to deal wit...Making sense of service quotas of AWS Serverless services and how to deal wit...
Making sense of service quotas of AWS Serverless services and how to deal wit...
 
How to reduce cold starts for Java Serverless applications in AWS at InfoShar...
How to reduce cold starts for Java Serverless applications in AWS at InfoShar...How to reduce cold starts for Java Serverless applications in AWS at InfoShar...
How to reduce cold starts for Java Serverless applications in AWS at InfoShar...
 
Adopting Java for the Serverless World at Voxxed Days Bruxelles 2023
Adopting Java for the Serverless World at Voxxed Days Bruxelles 2023Adopting Java for the Serverless World at Voxxed Days Bruxelles 2023
Adopting Java for the Serverless World at Voxxed Days Bruxelles 2023
 
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
 
AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...
AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...
AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...
 
Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...
Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...
Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...
 
Amazon DevOps Guru for the Serverless Applications at AWS Community Day Bene...
Amazon DevOps Guru for the Serverless Applications at  AWS Community Day Bene...Amazon DevOps Guru for the Serverless Applications at  AWS Community Day Bene...
Amazon DevOps Guru for the Serverless Applications at AWS Community Day Bene...
 
Amazon CodeGuru vs SonarQube for Java Developers at JCon 2022
Amazon CodeGuru vs SonarQube for Java Developers at JCon 2022Amazon CodeGuru vs SonarQube for Java Developers at JCon 2022
Amazon CodeGuru vs SonarQube for Java Developers at JCon 2022
 
Adopting Java for the Serverless World at JUG Saxony Day 2022
Adopting Java for the Serverless World at JUG Saxony Day 2022Adopting Java for the Serverless World at JUG Saxony Day 2022
Adopting Java for the Serverless World at JUG Saxony Day 2022
 
Projects Valhalla and Loom DWX 2022
Projects Valhalla and Loom DWX 2022Projects Valhalla and Loom DWX 2022
Projects Valhalla and Loom DWX 2022
 
Adopting Java for the Serverless World at VoxxedDays Luxemburg
Adopting Java for the Serverless World at VoxxedDays LuxemburgAdopting Java for the Serverless World at VoxxedDays Luxemburg
Adopting Java for the Serverless World at VoxxedDays Luxemburg
 
Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...
Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...
Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...
 
Adopting Java for the Serverless World at JUG Bonn 2022
Adopting Java for the Serverless World at JUG Bonn 2022Adopting Java for the Serverless World at JUG Bonn 2022
Adopting Java for the Serverless World at JUG Bonn 2022
 
Adopting Java for the Serverless World at JUG Darmstadt 2022
Adopting Java for the Serverless World at JUG Darmstadt 2022Adopting Java for the Serverless World at JUG Darmstadt 2022
Adopting Java for the Serverless World at JUG Darmstadt 2022
 

Último

Último (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

"Production-ready Serverless Java Applications in 3 weeks" at AWS Community Days 2018 by Vadym Kazulkin/Elmar Warken

  • 1. Frankfurt | 26 & 27 September 2018
  • 2. Production-Ready Serverless Java Applications in 3 Weeks with S3, Lambda, API Gateway, SNS, DynamoDB and Aurora Serverless by Elmar Warken and Vadym Kazulkin, ip.labs GmbH
  • 3. Contact Vadym Kazulkin, ip.labs GmbH v.kazulkin@iplabs.de www.xing.com/profile/Vadym_Kazulkin @VKazulkin, @ServerlessBonn (Meetup) Elmar Warken, ip.labs GmbH e.warken@iplabs.de www.xing.com/profile/Elmar_Warken
  • 6. Revenue Share Calculator Service Requirements 1. Automatic calculation for the complete previous month on the 1st of each month for each customer 2. Manual calculation via a simple GUI • For the current month so far • Recalculation for the previous months 3. Calculation results as downloads, download link per email 4. Archive with calculated results for each customer 5. For internal use only!
  • 7. Serverless decision for RevShare project • spike workloads only at the beginning of a month • service is idle more than 99% of the time  We use Function as a Service, to never pay for idle. 7
  • 8. RS core calculator Turnover info input data: order data & calculation rules output data: RS calculation & input data email with path to download RS calculation result Central DB Management Server extract customer, year and month from the file path Key example: revsharetool-storage-demo/input-data/1000000/import/201806/revshare-final.json RS calculator app customer, year, month
  • 10. Implementing „Revenue Share Calculation“ Lambda with Java SDK
  • 11. RevenueShare Service Lambda memory setting
  • 12. Selecting memory size for a Lambda function • Price 0,00001667 USD per GB-second • CPU power allocation proportional to amount of memory • more „GB“ will often just improve performance and not increase costs! • cheaper GB setting may save costs, when lambda function often has to wait 12
  • 14. Request references from X-Ray and CloudWatch 14
  • 15. Billed Duration and Max Memory Used 15
  • 18. Lambda free tier • 136170 sec. per month with the most powerful CPU setting • = more than 1h per day • with max 1 call every 2 sec. 18
  • 19. Amazon API Gateway • Expose Lambda functions as RESTful web service • API Management functionality built in: • authorization and access control for API calls with IAM • request monitoring and analytics • overload protection • version management • APIs as products (SaaS, AWS Marketplace) • SDK generation Amazon API Gateway
  • 20. API Gateway for different AWS services • Access different AWS services in a consistent manner
  • 21. API Gateway for Lambda function in RevShare App
  • 22. Cost influence of API gateway 22 0,408 1,032 1,656 2,28 2,904 3,528 4,152 4,776 3,908 4,532 5,156 5,78 6,404 7,028 7,652 8,276 100 MS 400MS 700MS 1000MS 1300MS 1600MS 1900MS 2200MS duration per call cost per million API calls in $ for a 128 MB function without API Gateway with API Gateway
  • 23. Defining APIs for Lambdas – manual approach Resources Operations
  • 24. Automated API definitions with „Serverless“ framework 24
  • 25. Automated API definitions with „Serverless“ framework 25
  • 26. 26
  • 27.
  • 28. Aggregations Source: Advanced Design Patterns for Amazon DynamoDB https://www.youtube.com/watch?v=jzeKPKpucS0
  • 29. Aggregations with DynamoDB Streams and Lambda
  • 30. Aggregations with DynamoDB Streams and Lambda
  • 31. Aggregations with DynamoDB Lambda Execution Role
  • 32. Aggregations with DynamoDB Streams and Lambda
  • 33. Auto Scaling Source: Yan Cui: "The problems with DynamoDB Auto Scaling and how it might be improved" https://hackernoon.com/the-problems-with-dynamodb-auto-scaling-and-how-it-might-be-improved-a92029c8c10b
  • 36. DynamoDB Pricing DynamoDB works by provisioning throughput at the table level. The throughput is set up as follows: • Each write capacity unit (WCU) gives 1KB/s of write throughput • Each read capacity unit (RCU) gives 4KB/s of read throughput • Read and write throughput are independent
  • 37. Partitioning Math By Capacity = (Total RCU)/3000 + (Total WCU)/1000 By Size = Total size / 10 GB Number of partitions = CEILING (MAX (Capacity, Size)) Max RCUs per partition=3000; Max WCUs per partition=1000 Throughput (RCU & WCU) is uniformly spread across partitions In case of exceeding throughput per partition - ProvisionedThroughputExceededException
  • 38. Partitioning Math Table Size=40 GB , RCUs=1500, WCUs=400 By Capacity = 1500/3000 + 400/1000=0.9 By Size = 40 GB / 10 GB =4 Number of partitions = CEILING (MAX (0.9,4)) =4 RCUs per partition=1500/4 =375 WCUs per partition=400/4 =100 Data per partition=40 GB/4 = 10GB
  • 39. Example of ProvisionedThroughputExceededException DynamoDB Table with 40 GB of data -> gives 4 partitions Source: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html#bp-partition-key- partitions-adaptive
  • 40. DynamoDB Exceeding Throughput Causes: • Uneven distribution of data due to the wrong choice of partition key • Frequent accessing of the same key in a partition (the most popular item, also known as a hot key) • A request rate greater than the provisioned throughput
  • 41. Solutions to the hot key problems • Distribute your key accross partitions • Avoid mixing cold and hot keys • Split the hot key (key+ random (0,X)) Source: Deep Dive on DynamoDB https://www.youtube.com/watch?v=bCW3lhsJKfw Source: Advanced Design Patterns for Amazon DynamoDB https://www.youtube.com/watch?v=jzeKPKpucS0
  • 42. New Feature : DynamoDB Adaptive Capacity Source: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html#bp-partition-key- partitions-adaptive
  • 43. DynamoDB canonical use cases • Key-value lookups on well-distributed records • Avoiding complex queries (and joins) • Limiting hot keys
  • 44. Challenges with DynamoDB DynamoDB is not the right choice for each solution • Think of the access pattern in advance • Difficult to change access patterns (partition&sort key) & table structure afterwards • Difficult to replace DynamoDB with another even (NoSQL) database in the future
  • 45. Why NoSQL database DynamoDB? Project use case and challenges: • Fixed Scheme (argument against NoSQL DB) • Small size of the table and the entities • Learning curve for the new technology • No aggregate functions was sum, avg, count and as expected no joins
  • 46. Amazon Aurora Serverless (GA for MySql in us-east-1 N. Virginia since 09.08.2018)
  • 47. What Is Amazon Aurora Serverless?
  • 48. Amazon Aurora (MySql/Postgres) Source: “AWS Summit - London | twitch.tv/aws | Aurora Serverless Preview Update” https://www.youtube.com/watch?v=J3A_TJZosu8
  • 49. What Is Amazon Aurora Serverless?
  • 50. Amazon Aurora Serverless Architeсture Source: https://aws.amazon.com/de/blogs/aws/aurora-serverless-ga/
  • 51. Amazon Aurora Serverless Architeсture Source: “AWS Summit - London | twitch.tv/aws | Aurora Serverless Preview Update” https://www.youtube.com/watch?v=J3A_TJZosu8
  • 52. Amazon Aurora Serverless Pricing & Settings Source: https://aws.amazon.com/de/blogs/aws/aurora-serverless-ga/
  • 53. Amazon Aurora Serverless CloudWatch Monitoring Source: https://aws.amazon.com/de/blogs/aws/aurora-serverless-ga/
  • 54. Amazon Aurora Serverless Pricing & Settings Source: https://aws.amazon.com/de/blogs/aws/aurora-serverless-ga/ 26 sec Cold-start Downscaling 4 -> 2 ACUs Pause the cluster
  • 55. Use cases for Amazon Aurora Serverless • Seldom usage (weekly jobs) + additional spikes • Noticable initial latencies acceptable • Aurora and therefore Lambda are behind VPC • Drastically increases also Lambda cold start • #AWSWishList: Aurora Serverless works like DynamoDB: HTTP+IAM Role • Dev/Test Database Source: Ajay Nair „Become a Serverless Black Belt” https://www.youtube.com/watch?v=oQFORsso2go