SlideShare una empresa de Scribd logo
1 de 47
Descargar para leer sin conexión
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Building High Throughput, Bursty Data Apps
with Amazon SQS, SNS & AWS Lambda
Robert Chow
Principal Product Manager
Amazon Web Services
A P I 3 0 6
Cristian García
VP of Infrastructure
Letgo
Luca Di Lieto
Solutions Architect –
2BEAT Product Owner
Enel
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Scenarios
Publishing at a media company
Processing financial transactions at a bank
Order processing at a retailer
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Serverless technologies
No infrastructure to
provision or manage
Scales automatically
by unit of consumption
Don’t pay for idle
(pay per invocation)
Built-in security
highly available compute
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS modern application development
SERVERLESS COMPUTE AND DATASTORES
AWS
Lambda
AWS
Fargate
Amazon
API Gateway
Amazon
SNS
Amazon
SQS
AWS
Step Functions
SERVERLESS INTEGRATION
DEVELOPER TOOLS
SECURITY AND COMPLIANCE
Amazon Aurora
Serverless
Amazon
S3
Amazon
DynamoDB
AWS
AppSync
AWS
IAM
AWS Firewall
Manager
Amazon
Cognito
Amazon
Inspector
Amazon
VPC
Amazon
GuardDuty
Amazon
Macie
Amazon
CloudFormation
AWS
Cloud9
AWS
CloudTrail
AWS
CloudWatch
AWS
X-Ray
AWS Serverless
App RepositoryFPO
AWS
CodePipeline
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon SNS, SQS and AWS Lambda
Amazon SNS
(Simple Notification Service)
Amazon SQS
(Simple Queue Service)
AWS Lambda
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Event-driven architecture
Lambda
function
topicAmazon
SNS
User generated
events
Application or job
triggered events
Amazon
RDS
traditional server
Amazon
SQS
queue Lambda
function
Message
filters
Amazon
DynamoDB
Amazon
S3
Amazon
EC2
SNS Message Filtering
1. 2.
SQS as an event source for Lambda
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Event distribution
Event Sources
Lambda
function
topicAmazon
SNSApplication or job
triggered events
traditional server
Amazon
SQS
Message
filters
Amazon
EC2
Message Filters
Fan-Out
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Event distribution and bursty loads
Throughput
Fan-Out ratio
Lambda
function
topicAmazon
SNSApplication or job
triggered events
traditional server
Amazon
SQS
Message
filters
Amazon
EC2
Filters
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Event processing
Amazon
SQS
queue Lambda
function
Amazon
RDS
1. Message inserted into to a
queue
2. Lambda polls queue and
invokes function
3. Lambda removes message
from queue
Lambda Processing
Message Processing
AWS
Lambda
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Event processing and bursty loads
Amazon
SQS
queue Lambda
function
Amazon
RDS
1. Message inserted into to a
queue
2. Lambda polls queue and
invokes function
3. Lambda removes message
from queue
AWS
Lambda
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Lambda automatic scaling
• 5 concurrent functions to start + 60/minute
• Message batching
• Long polling
Queue
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Lambda cold starts
Your Function
Warm Start
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon SNS or SQS as event sources for AWS Lambda
Comparison SNS -> Lambda SNS -> SQS -> Lambda
Scenario Downstream consumers are rate
not constrained
Downstream consumers are rate
constrained
Message
Deletion
Once delivered, message is
deleted (even if processing is not
successful)
Lambda deletes message upon
successful processing
Retention/
Retries
Delivery retry - up to 13 hours Message retention up to 14 days.
Cristian García
VP of Infrastructure
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Letgo
• 100M downloads
• 400M products
• 6B messages
• 65% listing growth in 2018
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The Letgo project
• >5Pb of monthly data
• >72K requests/sec
• Data oriented
• Squad modeled
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Transactions and usage
• Exponential growth and usage of many
AWS services
• Delivering close to 1 trillion monthly
SQS/SNS messages
• But…
• Not everything was a bed of roses in 2016...
• Because we used REST API’s for our
microservice communications
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
This seems good when it runs, but…
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
…but not as good we thought
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
REST API constraints
Infrastructure:
• High latency average
• Handle sudden traffic spikes
• Data loss in case a service is down
• Not affordable cost escalation
Coding:
• Complexity coding for HTTP having
better options 
• Not microservice-able
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Domain-driven migration challenge
• Each service publishes to its own SNS
topic, other services interested on the
data can subscribe to the topic
• In case service B needs the data and
changes from service A, just needs to
subscribe one of its own queues to the
service
• Usage of database projections for
storing data subsets
• Stage 1
• Stage 2
• Stage 3
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Domain events
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Outage in consumer tier
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Why message filtering improved our services?
Without:
Filtering via code, high discarded
messages ratio (>90%), waste of
compute resources
With:
Only the correct message is sent to
to queue, then the consumer can
scale just for this kind of events
Money talks Speed talks
Filtered messages: real world results
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Cost evolution
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Tips and tricks
• Compute: Squeeze your instance!
• Scaling: Take a look at ApproximateNumberOfMessagesVisible
• AWS Lambda: Means instant muscle, so use it carefully!
• Dead_letter: 5 attempts + redrive policy
• Data loss: The messages will be there
Luca Di Lieto
Solutions Architect – 2BEAT Product Owner
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Enel group overview
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ENEL Smart Meters
2016
Open Meter:
Smart Meters
2.0
2001
First digital meter
installed
2006
Entire Italian Customer base
32 mn digital meters
2018
44 mn digital meters
10% Smart Meters 2.0
(~4 million)
2020
Strategic Plan
48 mn digital meters
36% Smart Meters 2.0
(~17 million)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Home
Energy Box
In Home
Device
Street-level sensors
and actuators for
Remote Control
Low Voltage
Manager
BEAT
Central System
3G/4G/Fiber Optic
Narrow-Band Power Line Communication (PLC)
W-MBUS 169 MHz Radio Communication
Market
SYSTEM ARCHITECTURE
Enel Open Meter
Smart Meters
near site mgt
Heat, Gas,
Watermeter
Meter
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
KEY FEATURES AND BENEFITS
Smart Meters 2.0
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
2BEAT
PROCESS, ANALYZE AND FORWARD ENERGY
CONSUMPTION PROFILES
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Consumption profiles
PREVIOUS GENERATION SMART METERS 2.0 / 2BEAT
• Records consumption at the end of
month
• Consumption is mainly relative to a
single metric (Active Energy) and to
three different bands
• 32 mn messages per month
• 3.2 GB data per month
• Records one measure every 15
minutes
• A number for each metric (3
different metrics)
• Load profile for each user per day
• 288 mn messages per day
• 288 GB data per day
• 96 mn raw data points per month • 12.5 bn raw data points per day
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Architecture
PREVIOUS GENERATION SMART METERS 2.0 / 2BEAT
• Based on traditional technologies like
Application Servers and RDBMS
• Pay for the peak due to architectural
constraints; there isn’t flexibility on
cost
• Quite monolithic
• Limitations on scalability
• Administration and deploy require in-
depth skills
• Redesign to make the application
idem-potent and not monolithic
• Pay per use
• Reengineering with microservices
based on AWS serverless components
• Use of scalable solutions
• Reduce administration and
deployment effort
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Current architecture
Legacy
Application
Amazon Elastic
Beanstalk
Amazon
Dynamo DB
Amazon Kinesis Data
Stream/Kinesis Data
Firehose
Devices
EXTERNAL
SYSTEM
Amazon SQS
Amazon SQS
Amazon S3
Amazon Redshift
Spectrum
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Current architecture
Legacy
Application
Get concentrators data
Amazon Elastic
Beanstalk
Publish msg to external
systems
Amazon
Dynamo DB
Amazon Kinesis Data
Stream/Kinesis Data
Firehose
Store messages as
json flat files
Load from S3 and perform
SQL analisys
Devices
EXTERNAL
SYSTEM
Send JSON message obtained
from SQS and entities events
Store data for
processing purposes.
60 Days
Amazon SQS
Amazon SQS
Amazon S3
288 mn req/day
Avg. 10k msg/s
Peak 20k msg/s
288 mn req/day
10k msg/s
(Twenty EC2
Instances)
Read Capacity: 20k item/s
Write Capacity: 20k item/s
Retention 60 days: 17 TBs of data
Record size: 1 KB
Storage:
518 TBs
for 5 yearsNote: Estimation for 32 mn
meters; currently it manages
5 mn meters.
Re-execution of a
request
Amazon Redshift
Spectrum
Data processing
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Evolution: Go fully serverless
AWS Elastic Beanstalk is a platform
based on EC2 instances and implies
a different administration compared
to serverless; it was a valuable
solution when we started the project
The availability of AWS Lambda
polling SQS gives us the opportunity
to go fully serverless.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Legacy
Application
AWS Lamba
Amazon
Dynamo DB
Amazon Kinesis Data
Stream/Kinesis Data
Firehose
Devices
EXTERNAL
SYSTEM
Amazon SQS
Amazon SQS
Amazon S3
Amazon Redshift
Spectrum
To-be architecture
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon SQS as an event source for AWS Lambda benefits
• Easier to operate
A fully serverless solution is well accepted by our Operations team. A mixed solution
is deviation from company standards.
• Easier to deploy
We deploy it with a company CI/CD infrastructure based on AWS CloudFormation
• Easier to scale
Scales quickly with AWS Lambda
• AWS Lambda is in the Enel “approved” AWS services portfolio
• Simplified monitoring and logging using Amazon CloudWatch
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Future Plans
The legacy application supports
proprietary protocol for device
communication that requires long
lived connection pulling data from
devices. Requires a complete
redesign with more suitable
approaches.
We are evaluating redesigning it by
leveraging on AWS IoT Core and
AWS Greengrass.
Summary
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Summary
• Amazon SNS, SQS, and AWS Lambda for high-throughput, bursty
applications
• Fully managed and serverless
• Scale up or scale down, no pre-provisioning resources required, don’t pay for idle periods
• Amazon SNS, SQS, and AWS Lambda for event driven designs
• Native integration with AWS event sources
• Pub/sub to decouple publishers from subscribers
• New features improve handling of high-throughput, bursty traffic
• Use message filtering to reduce processing load (and cost) of publishers and subscribers
• Use Amazon SQS as an Event Source for AWS Lambda when you want more flexibility and
resilience for bursty traffic
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Related breakouts
Best Practices for Queue Processing in Serverless Applications
Aria West, Level 3, Starvine 2, T2
Wednesday, Nov 28, 2018 : 4:45 PM - 5:45 PM
Choosing the Right Messaging Service for your Distributed App
MGM, Level 1, Grand Ballroom 122, T2
Wednesday, Nov 28, 2018 : 3:15 PM - 4:15 PM
Inside AWS: Technology Choices for Modern Application Development
Aria East, Level 2, Mariposa 5, T1
Thursday, Nov 29: 2:30 PM - 3:30 PM
Securing Data in Serverless Applications and Messaging Services
Mirage, Martinique A, T2
Thursday, Nov 29, 2018 : 3:15 PM - 4:15 PM
Thank you!
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Robert Chow
Principal Product Manager
Amazon Web Services
Cristian García
VP of Infrastructure
Letgo
Luca Di Lieto
Solutions Architect – 2BEAT
Product Owner
Enel
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Más contenido relacionado

La actualidad más candente

Build a Website on AWS for Your First 10 Million Users
Build a Website on AWS for Your First 10 Million UsersBuild a Website on AWS for Your First 10 Million Users
Build a Website on AWS for Your First 10 Million UsersAmazon Web Services
 
SRV403_Serverless Authentication and Authorization
SRV403_Serverless Authentication and AuthorizationSRV403_Serverless Authentication and Authorization
SRV403_Serverless Authentication and AuthorizationAmazon Web Services
 
How to Design a Multi-Region Active-Active Architecture
How to Design a Multi-Region Active-Active ArchitectureHow to Design a Multi-Region Active-Active Architecture
How to Design a Multi-Region Active-Active ArchitectureAmazon Web Services
 
AWS Application Discovery Service
AWS Application Discovery ServiceAWS Application Discovery Service
AWS Application Discovery ServiceAmazon Web Services
 
Real-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS LambdaReal-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS LambdaAmazon Web Services
 
Layers and types of cloud
Layers and types of cloudLayers and types of cloud
Layers and types of cloudANUSUYA T K
 
Building Data Lakes for Analytics on AWS
Building Data Lakes for Analytics on AWSBuilding Data Lakes for Analytics on AWS
Building Data Lakes for Analytics on AWSAmazon Web Services
 
Software As A Service Presentation
Software As A Service PresentationSoftware As A Service Presentation
Software As A Service Presentational95iii
 
Challenges in building a Data Pipeline
Challenges in building a Data PipelineChallenges in building a Data Pipeline
Challenges in building a Data PipelineHevo Data Inc.
 
Deep Dive on Amazon Aurora - Covering New Feature Announcements
Deep Dive on Amazon Aurora - Covering New Feature AnnouncementsDeep Dive on Amazon Aurora - Covering New Feature Announcements
Deep Dive on Amazon Aurora - Covering New Feature AnnouncementsAmazon Web Services
 
Tackle Your Dark Data Challenge with AWS Glue - AWS Online Tech Talks
Tackle Your Dark Data  Challenge with AWS Glue - AWS Online Tech TalksTackle Your Dark Data  Challenge with AWS Glue - AWS Online Tech Talks
Tackle Your Dark Data Challenge with AWS Glue - AWS Online Tech TalksAmazon Web Services
 
Introduction to AWS and Cloud Computing - Module 1 Part 1 - AWSome Day 2017
Introduction to AWS and Cloud Computing - Module 1 Part 1 - AWSome Day 2017Introduction to AWS and Cloud Computing - Module 1 Part 1 - AWSome Day 2017
Introduction to AWS and Cloud Computing - Module 1 Part 1 - AWSome Day 2017Amazon Web Services
 
Building Advanced Analytics Pipelines with Azure Databricks
Building Advanced Analytics Pipelines with Azure DatabricksBuilding Advanced Analytics Pipelines with Azure Databricks
Building Advanced Analytics Pipelines with Azure DatabricksLace Lofranco
 
Using Spark Streaming and NiFi for the next generation of ETL in the enterprise
Using Spark Streaming and NiFi for the next generation of ETL in the enterpriseUsing Spark Streaming and NiFi for the next generation of ETL in the enterprise
Using Spark Streaming and NiFi for the next generation of ETL in the enterpriseDataWorks Summit
 

La actualidad más candente (20)

Build a Website on AWS for Your First 10 Million Users
Build a Website on AWS for Your First 10 Million UsersBuild a Website on AWS for Your First 10 Million Users
Build a Website on AWS for Your First 10 Million Users
 
SRV403_Serverless Authentication and Authorization
SRV403_Serverless Authentication and AuthorizationSRV403_Serverless Authentication and Authorization
SRV403_Serverless Authentication and Authorization
 
AWS Simple Storage Service (s3)
AWS Simple Storage Service (s3) AWS Simple Storage Service (s3)
AWS Simple Storage Service (s3)
 
BDA311 Introduction to AWS Glue
BDA311 Introduction to AWS GlueBDA311 Introduction to AWS Glue
BDA311 Introduction to AWS Glue
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
How to Design a Multi-Region Active-Active Architecture
How to Design a Multi-Region Active-Active ArchitectureHow to Design a Multi-Region Active-Active Architecture
How to Design a Multi-Region Active-Active Architecture
 
Building Data Lakes with AWS
Building Data Lakes with AWSBuilding Data Lakes with AWS
Building Data Lakes with AWS
 
AWS Application Discovery Service
AWS Application Discovery ServiceAWS Application Discovery Service
AWS Application Discovery Service
 
Real-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS LambdaReal-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS Lambda
 
Layers and types of cloud
Layers and types of cloudLayers and types of cloud
Layers and types of cloud
 
Building Data Lakes for Analytics on AWS
Building Data Lakes for Analytics on AWSBuilding Data Lakes for Analytics on AWS
Building Data Lakes for Analytics on AWS
 
Software As A Service Presentation
Software As A Service PresentationSoftware As A Service Presentation
Software As A Service Presentation
 
Amazon Aurora
Amazon AuroraAmazon Aurora
Amazon Aurora
 
Challenges in building a Data Pipeline
Challenges in building a Data PipelineChallenges in building a Data Pipeline
Challenges in building a Data Pipeline
 
Deep Dive on Amazon Aurora - Covering New Feature Announcements
Deep Dive on Amazon Aurora - Covering New Feature AnnouncementsDeep Dive on Amazon Aurora - Covering New Feature Announcements
Deep Dive on Amazon Aurora - Covering New Feature Announcements
 
Tackle Your Dark Data Challenge with AWS Glue - AWS Online Tech Talks
Tackle Your Dark Data  Challenge with AWS Glue - AWS Online Tech TalksTackle Your Dark Data  Challenge with AWS Glue - AWS Online Tech Talks
Tackle Your Dark Data Challenge with AWS Glue - AWS Online Tech Talks
 
Introduction to AWS and Cloud Computing - Module 1 Part 1 - AWSome Day 2017
Introduction to AWS and Cloud Computing - Module 1 Part 1 - AWSome Day 2017Introduction to AWS and Cloud Computing - Module 1 Part 1 - AWSome Day 2017
Introduction to AWS and Cloud Computing - Module 1 Part 1 - AWSome Day 2017
 
Azure Lab Services
Azure Lab ServicesAzure Lab Services
Azure Lab Services
 
Building Advanced Analytics Pipelines with Azure Databricks
Building Advanced Analytics Pipelines with Azure DatabricksBuilding Advanced Analytics Pipelines with Azure Databricks
Building Advanced Analytics Pipelines with Azure Databricks
 
Using Spark Streaming and NiFi for the next generation of ETL in the enterprise
Using Spark Streaming and NiFi for the next generation of ETL in the enterpriseUsing Spark Streaming and NiFi for the next generation of ETL in the enterprise
Using Spark Streaming and NiFi for the next generation of ETL in the enterprise
 

Similar a Building High Throughput Apps with SNS, SQS & Lambda

Real-Time Web Analytics with Amazon Kinesis Data Analytics (ADT401) - AWS re:...
Real-Time Web Analytics with Amazon Kinesis Data Analytics (ADT401) - AWS re:...Real-Time Web Analytics with Amazon Kinesis Data Analytics (ADT401) - AWS re:...
Real-Time Web Analytics with Amazon Kinesis Data Analytics (ADT401) - AWS re:...Amazon Web Services
 
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...Amazon Web Services
 
Building Microservices with Containers (CON308-R1) - AWS re:Invent 2018
Building Microservices with Containers (CON308-R1) - AWS re:Invent 2018Building Microservices with Containers (CON308-R1) - AWS re:Invent 2018
Building Microservices with Containers (CON308-R1) - AWS re:Invent 2018Amazon Web Services
 
Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...
Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...
Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...Amazon Web Services
 
Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...
Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...
Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...Amazon Web Services
 
2019 03-13-implementing microservices by ddd
2019 03-13-implementing microservices by ddd2019 03-13-implementing microservices by ddd
2019 03-13-implementing microservices by dddKim Kao
 
Implementing Microservices by DDD
Implementing Microservices by DDDImplementing Microservices by DDD
Implementing Microservices by DDDAmazon Web Services
 
Introduction to Serverless computing and AWS Lambda - Floor28
Introduction to Serverless computing and AWS Lambda - Floor28Introduction to Serverless computing and AWS Lambda - Floor28
Introduction to Serverless computing and AWS Lambda - Floor28Boaz Ziniman
 
Introduction to Serverless computing and AWS Lambda | AWS Floor28
Introduction to Serverless computing and AWS Lambda | AWS Floor28Introduction to Serverless computing and AWS Lambda | AWS Floor28
Introduction to Serverless computing and AWS Lambda | AWS Floor28Amazon Web Services
 
SRV315 Building Enterprise-Grade Serverless Apps
 SRV315 Building Enterprise-Grade Serverless Apps SRV315 Building Enterprise-Grade Serverless Apps
SRV315 Building Enterprise-Grade Serverless AppsAmazon Web Services
 
How can your business benefit from going Serverless
How can your business benefit from going ServerlessHow can your business benefit from going Serverless
How can your business benefit from going ServerlessAmazon Web Services
 
Serverless Architectural Patterns - GOTO Amsterdam
Serverless Architectural Patterns - GOTO AmsterdamServerless Architectural Patterns - GOTO Amsterdam
Serverless Architectural Patterns - GOTO AmsterdamBoaz Ziniman
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesAmazon Web Services
 
The Future of Enterprise Applications is Serverless
The Future of Enterprise Applications is ServerlessThe Future of Enterprise Applications is Serverless
The Future of Enterprise Applications is ServerlessEficode
 
How can your business benefit from going serverless?
How can your business benefit from going serverless?How can your business benefit from going serverless?
How can your business benefit from going serverless?Adrian Hornsby
 
When, how and if to adopt Microservices, AWS Startup Day Cape Town 2018
When, how and if to adopt Microservices, AWS Startup Day Cape Town 2018When, how and if to adopt Microservices, AWS Startup Day Cape Town 2018
When, how and if to adopt Microservices, AWS Startup Day Cape Town 2018Amazon Web Services
 
Thirty serverless architectures in 30 minutes - MAD202 - Chicago AWS Summit
Thirty serverless architectures in 30 minutes - MAD202 - Chicago AWS SummitThirty serverless architectures in 30 minutes - MAD202 - Chicago AWS Summit
Thirty serverless architectures in 30 minutes - MAD202 - Chicago AWS SummitAmazon Web Services
 
Serverless Streams, Topics, Queues, & APIs! Pick the Right Serverless Applica...
Serverless Streams, Topics, Queues, & APIs! Pick the Right Serverless Applica...Serverless Streams, Topics, Queues, & APIs! Pick the Right Serverless Applica...
Serverless Streams, Topics, Queues, & APIs! Pick the Right Serverless Applica...Chris Munns
 
Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...
Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...
Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...Amazon Web Services
 

Similar a Building High Throughput Apps with SNS, SQS & Lambda (20)

Real-Time Web Analytics with Amazon Kinesis Data Analytics (ADT401) - AWS re:...
Real-Time Web Analytics with Amazon Kinesis Data Analytics (ADT401) - AWS re:...Real-Time Web Analytics with Amazon Kinesis Data Analytics (ADT401) - AWS re:...
Real-Time Web Analytics with Amazon Kinesis Data Analytics (ADT401) - AWS re:...
 
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...
 
Building Microservices with Containers (CON308-R1) - AWS re:Invent 2018
Building Microservices with Containers (CON308-R1) - AWS re:Invent 2018Building Microservices with Containers (CON308-R1) - AWS re:Invent 2018
Building Microservices with Containers (CON308-R1) - AWS re:Invent 2018
 
Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...
Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...
Vonage & Aspect: Transform Real-Time Communications & Customer Engagement (TL...
 
Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...
Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...
Leadership Session: Using DevOps, Microservices, and Serverless to Accelerate...
 
2019 03-13-implementing microservices by ddd
2019 03-13-implementing microservices by ddd2019 03-13-implementing microservices by ddd
2019 03-13-implementing microservices by ddd
 
Implementing Microservices by DDD
Implementing Microservices by DDDImplementing Microservices by DDD
Implementing Microservices by DDD
 
Introduction to Serverless computing and AWS Lambda - Floor28
Introduction to Serverless computing and AWS Lambda - Floor28Introduction to Serverless computing and AWS Lambda - Floor28
Introduction to Serverless computing and AWS Lambda - Floor28
 
Introduction to Serverless computing and AWS Lambda | AWS Floor28
Introduction to Serverless computing and AWS Lambda | AWS Floor28Introduction to Serverless computing and AWS Lambda | AWS Floor28
Introduction to Serverless computing and AWS Lambda | AWS Floor28
 
SRV315 Building Enterprise-Grade Serverless Apps
 SRV315 Building Enterprise-Grade Serverless Apps SRV315 Building Enterprise-Grade Serverless Apps
SRV315 Building Enterprise-Grade Serverless Apps
 
How can your business benefit from going Serverless
How can your business benefit from going ServerlessHow can your business benefit from going Serverless
How can your business benefit from going Serverless
 
Serverless Architectural Patterns - GOTO Amsterdam
Serverless Architectural Patterns - GOTO AmsterdamServerless Architectural Patterns - GOTO Amsterdam
Serverless Architectural Patterns - GOTO Amsterdam
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 
Serverless - State of the Union
Serverless - State of the UnionServerless - State of the Union
Serverless - State of the Union
 
The Future of Enterprise Applications is Serverless
The Future of Enterprise Applications is ServerlessThe Future of Enterprise Applications is Serverless
The Future of Enterprise Applications is Serverless
 
How can your business benefit from going serverless?
How can your business benefit from going serverless?How can your business benefit from going serverless?
How can your business benefit from going serverless?
 
When, how and if to adopt Microservices, AWS Startup Day Cape Town 2018
When, how and if to adopt Microservices, AWS Startup Day Cape Town 2018When, how and if to adopt Microservices, AWS Startup Day Cape Town 2018
When, how and if to adopt Microservices, AWS Startup Day Cape Town 2018
 
Thirty serverless architectures in 30 minutes - MAD202 - Chicago AWS Summit
Thirty serverless architectures in 30 minutes - MAD202 - Chicago AWS SummitThirty serverless architectures in 30 minutes - MAD202 - Chicago AWS Summit
Thirty serverless architectures in 30 minutes - MAD202 - Chicago AWS Summit
 
Serverless Streams, Topics, Queues, & APIs! Pick the Right Serverless Applica...
Serverless Streams, Topics, Queues, & APIs! Pick the Right Serverless Applica...Serverless Streams, Topics, Queues, & APIs! Pick the Right Serverless Applica...
Serverless Streams, Topics, Queues, & APIs! Pick the Right Serverless Applica...
 
Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...
Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...
Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...
 

Más de Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

Más de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Building High Throughput Apps with SNS, SQS & Lambda

  • 1.
  • 2. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Building High Throughput, Bursty Data Apps with Amazon SQS, SNS & AWS Lambda Robert Chow Principal Product Manager Amazon Web Services A P I 3 0 6 Cristian García VP of Infrastructure Letgo Luca Di Lieto Solutions Architect – 2BEAT Product Owner Enel
  • 3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Scenarios Publishing at a media company Processing financial transactions at a bank Order processing at a retailer
  • 4. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Serverless technologies No infrastructure to provision or manage Scales automatically by unit of consumption Don’t pay for idle (pay per invocation) Built-in security highly available compute
  • 5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS modern application development SERVERLESS COMPUTE AND DATASTORES AWS Lambda AWS Fargate Amazon API Gateway Amazon SNS Amazon SQS AWS Step Functions SERVERLESS INTEGRATION DEVELOPER TOOLS SECURITY AND COMPLIANCE Amazon Aurora Serverless Amazon S3 Amazon DynamoDB AWS AppSync AWS IAM AWS Firewall Manager Amazon Cognito Amazon Inspector Amazon VPC Amazon GuardDuty Amazon Macie Amazon CloudFormation AWS Cloud9 AWS CloudTrail AWS CloudWatch AWS X-Ray AWS Serverless App RepositoryFPO AWS CodePipeline
  • 6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon SNS, SQS and AWS Lambda Amazon SNS (Simple Notification Service) Amazon SQS (Simple Queue Service) AWS Lambda
  • 7. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Event-driven architecture Lambda function topicAmazon SNS User generated events Application or job triggered events Amazon RDS traditional server Amazon SQS queue Lambda function Message filters Amazon DynamoDB Amazon S3 Amazon EC2 SNS Message Filtering 1. 2. SQS as an event source for Lambda
  • 8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Event distribution Event Sources Lambda function topicAmazon SNSApplication or job triggered events traditional server Amazon SQS Message filters Amazon EC2 Message Filters Fan-Out
  • 9. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Event distribution and bursty loads Throughput Fan-Out ratio Lambda function topicAmazon SNSApplication or job triggered events traditional server Amazon SQS Message filters Amazon EC2 Filters
  • 10. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Event processing Amazon SQS queue Lambda function Amazon RDS 1. Message inserted into to a queue 2. Lambda polls queue and invokes function 3. Lambda removes message from queue Lambda Processing Message Processing AWS Lambda
  • 11. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Event processing and bursty loads Amazon SQS queue Lambda function Amazon RDS 1. Message inserted into to a queue 2. Lambda polls queue and invokes function 3. Lambda removes message from queue AWS Lambda
  • 12. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Lambda automatic scaling • 5 concurrent functions to start + 60/minute • Message batching • Long polling Queue
  • 13. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Lambda cold starts Your Function Warm Start
  • 14. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon SNS or SQS as event sources for AWS Lambda Comparison SNS -> Lambda SNS -> SQS -> Lambda Scenario Downstream consumers are rate not constrained Downstream consumers are rate constrained Message Deletion Once delivered, message is deleted (even if processing is not successful) Lambda deletes message upon successful processing Retention/ Retries Delivery retry - up to 13 hours Message retention up to 14 days.
  • 15. Cristian García VP of Infrastructure
  • 16. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Letgo • 100M downloads • 400M products • 6B messages • 65% listing growth in 2018
  • 17. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. The Letgo project • >5Pb of monthly data • >72K requests/sec • Data oriented • Squad modeled
  • 18. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Transactions and usage • Exponential growth and usage of many AWS services • Delivering close to 1 trillion monthly SQS/SNS messages • But… • Not everything was a bed of roses in 2016... • Because we used REST API’s for our microservice communications
  • 19. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. This seems good when it runs, but…
  • 20. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. …but not as good we thought
  • 21. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. REST API constraints Infrastructure: • High latency average • Handle sudden traffic spikes • Data loss in case a service is down • Not affordable cost escalation Coding: • Complexity coding for HTTP having better options  • Not microservice-able
  • 22. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Domain-driven migration challenge • Each service publishes to its own SNS topic, other services interested on the data can subscribe to the topic • In case service B needs the data and changes from service A, just needs to subscribe one of its own queues to the service • Usage of database projections for storing data subsets • Stage 1 • Stage 2 • Stage 3
  • 23. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Domain events
  • 24. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Outage in consumer tier
  • 25. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Why message filtering improved our services? Without: Filtering via code, high discarded messages ratio (>90%), waste of compute resources With: Only the correct message is sent to to queue, then the consumer can scale just for this kind of events
  • 26. Money talks Speed talks Filtered messages: real world results
  • 27. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Cost evolution
  • 28. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Tips and tricks • Compute: Squeeze your instance! • Scaling: Take a look at ApproximateNumberOfMessagesVisible • AWS Lambda: Means instant muscle, so use it carefully! • Dead_letter: 5 attempts + redrive policy • Data loss: The messages will be there
  • 29. Luca Di Lieto Solutions Architect – 2BEAT Product Owner
  • 30. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Enel group overview
  • 31. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. ENEL Smart Meters 2016 Open Meter: Smart Meters 2.0 2001 First digital meter installed 2006 Entire Italian Customer base 32 mn digital meters 2018 44 mn digital meters 10% Smart Meters 2.0 (~4 million) 2020 Strategic Plan 48 mn digital meters 36% Smart Meters 2.0 (~17 million)
  • 32. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Home Energy Box In Home Device Street-level sensors and actuators for Remote Control Low Voltage Manager BEAT Central System 3G/4G/Fiber Optic Narrow-Band Power Line Communication (PLC) W-MBUS 169 MHz Radio Communication Market SYSTEM ARCHITECTURE Enel Open Meter Smart Meters near site mgt Heat, Gas, Watermeter Meter
  • 33. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. KEY FEATURES AND BENEFITS Smart Meters 2.0
  • 34. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 2BEAT PROCESS, ANALYZE AND FORWARD ENERGY CONSUMPTION PROFILES
  • 35. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Consumption profiles PREVIOUS GENERATION SMART METERS 2.0 / 2BEAT • Records consumption at the end of month • Consumption is mainly relative to a single metric (Active Energy) and to three different bands • 32 mn messages per month • 3.2 GB data per month • Records one measure every 15 minutes • A number for each metric (3 different metrics) • Load profile for each user per day • 288 mn messages per day • 288 GB data per day • 96 mn raw data points per month • 12.5 bn raw data points per day
  • 36. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Architecture PREVIOUS GENERATION SMART METERS 2.0 / 2BEAT • Based on traditional technologies like Application Servers and RDBMS • Pay for the peak due to architectural constraints; there isn’t flexibility on cost • Quite monolithic • Limitations on scalability • Administration and deploy require in- depth skills • Redesign to make the application idem-potent and not monolithic • Pay per use • Reengineering with microservices based on AWS serverless components • Use of scalable solutions • Reduce administration and deployment effort
  • 37. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Current architecture Legacy Application Amazon Elastic Beanstalk Amazon Dynamo DB Amazon Kinesis Data Stream/Kinesis Data Firehose Devices EXTERNAL SYSTEM Amazon SQS Amazon SQS Amazon S3 Amazon Redshift Spectrum
  • 38. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Current architecture Legacy Application Get concentrators data Amazon Elastic Beanstalk Publish msg to external systems Amazon Dynamo DB Amazon Kinesis Data Stream/Kinesis Data Firehose Store messages as json flat files Load from S3 and perform SQL analisys Devices EXTERNAL SYSTEM Send JSON message obtained from SQS and entities events Store data for processing purposes. 60 Days Amazon SQS Amazon SQS Amazon S3 288 mn req/day Avg. 10k msg/s Peak 20k msg/s 288 mn req/day 10k msg/s (Twenty EC2 Instances) Read Capacity: 20k item/s Write Capacity: 20k item/s Retention 60 days: 17 TBs of data Record size: 1 KB Storage: 518 TBs for 5 yearsNote: Estimation for 32 mn meters; currently it manages 5 mn meters. Re-execution of a request Amazon Redshift Spectrum Data processing
  • 39. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Evolution: Go fully serverless AWS Elastic Beanstalk is a platform based on EC2 instances and implies a different administration compared to serverless; it was a valuable solution when we started the project The availability of AWS Lambda polling SQS gives us the opportunity to go fully serverless.
  • 40. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Legacy Application AWS Lamba Amazon Dynamo DB Amazon Kinesis Data Stream/Kinesis Data Firehose Devices EXTERNAL SYSTEM Amazon SQS Amazon SQS Amazon S3 Amazon Redshift Spectrum To-be architecture
  • 41. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon SQS as an event source for AWS Lambda benefits • Easier to operate A fully serverless solution is well accepted by our Operations team. A mixed solution is deviation from company standards. • Easier to deploy We deploy it with a company CI/CD infrastructure based on AWS CloudFormation • Easier to scale Scales quickly with AWS Lambda • AWS Lambda is in the Enel “approved” AWS services portfolio • Simplified monitoring and logging using Amazon CloudWatch
  • 42. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Future Plans The legacy application supports proprietary protocol for device communication that requires long lived connection pulling data from devices. Requires a complete redesign with more suitable approaches. We are evaluating redesigning it by leveraging on AWS IoT Core and AWS Greengrass.
  • 44. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Summary • Amazon SNS, SQS, and AWS Lambda for high-throughput, bursty applications • Fully managed and serverless • Scale up or scale down, no pre-provisioning resources required, don’t pay for idle periods • Amazon SNS, SQS, and AWS Lambda for event driven designs • Native integration with AWS event sources • Pub/sub to decouple publishers from subscribers • New features improve handling of high-throughput, bursty traffic • Use message filtering to reduce processing load (and cost) of publishers and subscribers • Use Amazon SQS as an Event Source for AWS Lambda when you want more flexibility and resilience for bursty traffic
  • 45. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Related breakouts Best Practices for Queue Processing in Serverless Applications Aria West, Level 3, Starvine 2, T2 Wednesday, Nov 28, 2018 : 4:45 PM - 5:45 PM Choosing the Right Messaging Service for your Distributed App MGM, Level 1, Grand Ballroom 122, T2 Wednesday, Nov 28, 2018 : 3:15 PM - 4:15 PM Inside AWS: Technology Choices for Modern Application Development Aria East, Level 2, Mariposa 5, T1 Thursday, Nov 29: 2:30 PM - 3:30 PM Securing Data in Serverless Applications and Messaging Services Mirage, Martinique A, T2 Thursday, Nov 29, 2018 : 3:15 PM - 4:15 PM
  • 46. Thank you! © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Robert Chow Principal Product Manager Amazon Web Services Cristian García VP of Infrastructure Letgo Luca Di Lieto Solutions Architect – 2BEAT Product Owner Enel
  • 47. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.