How to build a social
network on #serverless
Yan Cui
@theburningmonk
Yan Cui
http://theburningmonk.com
@theburningmonk
Independent Consultant
Yan Cui
http://theburningmonk.com
@theburningmonk
Developer Advocate @
How to build a social network on serverless
How to build a social network on serverless
How to build a social network on serverless
apr, 2016
nov, 2016
WHY?
How to build a social network on serverless
hey guys, vote on this post
and I’ll announce a winner at
10PM tonight
10PM
traffic
10PM
traffic
70-100x
low utilisation to leave room for spikes
EC2 scaling is slow, so scale earlier
lots of $$$ for unused resources
up to 30 mins for deployment
deployment required downtime
features took months to develop
- Dan North
“lead time to someone saying
thank you is the only reputation
metric that matters.”
How to build a social network on serverless
WHY?
to deliver better UX
WHY?
to deliver better UX
to deliver value faster
WHY?
to deliver better UX
to deliver value faster
to be more cost efficient
WHY?
to deliver better UX
to deliver value faster
to be more cost efficient
HOW?
what would good look like for us?
small
fast
zero downtime
no lock-step
deployments should be…
features should be…
deployable independently
loosely-coupled
we want to…
minimise cost for unused resources
we want to…
minimise cost for unused resources
minimise ops effort
we want to…
minimise cost for unused resources
minimise ops effort
reduce tech mess
we want to…
minimise cost for unused resources
minimise ops effort
reduce tech mess
deliver visible improvements faster
WHY?
to deliver better UX
to deliver value faster
to be more cost efficient
HOW?
microservices
WHY?
to deliver better UX
to deliver value faster
to be more cost efficient
HOW?
microservices
event-driven
WHY?
to deliver better UX
to deliver value faster
to be more cost efficient
HOW?
microservices
event-driven
serverless
WHY?
to deliver better UX
to deliver value faster
to be more cost efficient
HOW?
microservices
event-driven
serverless
WHAT?
this talk!
WHY?
to deliver better UX
to deliver value faster
to be more cost efficient
HOW?
microservices
event-driven
serverless
WHAT?
this talk!
170 Lambda functions in prod
95% cost saving vs. EC2
15x no. of prod releases per month
15x no. of prod releases per month
(features were sometimes shipped on the same day)
time
is a good fit
1st function in prod!
time
is a good fit
?
time
is a good fit
1st function in prod!
CI/CD?
CI/CD?
testing?
CI/CD?
testing?
logging, monitoring, alerting?
time
is a good fit
1st function in prod!
CI/CD, testing, logging,
monitoring, alerting
170 functions
?
time
is a good fit
1st function in prod!
CI/CD, testing, logging,
monitoring, alerting
tracing?
tracing?
config management?
tracing?
config management?
security?
170 functions
time
is a good fit
1st function in prod!
CI/CD, testing, logging,
monitoring, alerting
tracing, config
management, security
API Gateway and Kinesis
Authentication & authorisation (IAM, Cognito)
Testing
Running & Debugging functions locally
Log aggregation
Monitoring & Alerting
X-Ray
Correlation IDs
CI/CD
Performance and Cost optimisation
Error Handling
Configuration management
VPC
Security
Leading practices (API Gateway, Kinesis, Lambda)
Canary deployments
http://bit.ly/production-ready-serverless
get 40% off
with: ytcui
evolving the PLATFORM
Legacy Monolith Amazon Kinesis
Step 1.
ALL state changes!
events are an enabler for
COMPOSABILITY
AWS LAMBDA
is the...
Kinesis
Kinesis
API Gateway AWS Lambda API GatewayAWS Lambda
service-A service-B
Kinesis
API Gateway AWS Lambda API GatewayAWS Lambda
service-A service-B
Kinesis
API Gateway AWS Lambda API GatewayAWS Lambda
service-A service-B
AWS Lambda
AWS Lambda
AWS Lambda
Kinesis
API Gateway AWS Lambda API GatewayAWS Lambda
service-A service-B
AWS Lambda
AWS Lambda
AWS Lambda DynamoDBIOT
Kinesis
API Gateway AWS Lambda API GatewayAWS Lambda
service-A service-B
AWS Lambda
AWS Lambda
AWS Lambda DynamoDBIOT
Kinesis
API Gateway AWS Lambda API GatewayAWS Lambda
service-A service-B
AWS Lambda
AWS Lambda
AWS Lambda DynamoDBIOT
AWS Lambda AWS Lambda
build loosely-coupled system
through events
service A service B
service C service D
bounded context
bounded context
service A service B
service C service D
bounded context
bounded context
service A service B
service C service D
How to build a social network on serverless
there are no silver bullets
service A service B
service C service D
service A service B
service C service D
service A service B
service C service D
update!
service A service B
service C service Dbackward-compatible?
update!
How to build a social network on serverless
bounded context
DON’T use events to
orchestrate workflows
within the same
bounded context
bounded context
adds unnecessary
complexity to logging,
tracing, and end-to-end
reporting
bounded context
the workflow doesn’t exist
as a standalone concept,
but as the sum of a series of
loosely connected parts
Step Functions
use Step Functions instead
Step Functions
don’t forget to emit events
from the workflow
Step Functions
so others can react to state
changes that happened as
part of the workflow
“how do I organize my functions
into code repositories?”
one repo per function?
github
repo
github
repo
github
repo
github
repo
github
repo
github
repo
github
repo
github
repo
github
repo
github
repo
github
repo
github
repo
github
repo
github
repo
github
repo
github
repo
github
repo
github
repo
monorepo?
github
repo
https://lumigo.io/blog/mono-repo-vs-one-per-service/
one repo per service?
How to build a social network on serverless
How to build a social network on serverless
How to build a social network on serverless
How to build a social network on serverless
How to build a social network on serverless
How to build a social network on serverless
How to build a social network on serverless
github
repo
github
repo
github
repo
github
repo
user-api
timeline-api
relationship-api
search-api
CI/CD pipeline per service
functions are deployed
together, as a stack
Strangler Pattern
incrementally migrate the legacy system by
gradually replacing pieces of functionalities
to the new system
How to build a social network on serverless
rebuilt search
Legacy Monolith Amazon Kinesis Amazon Lambda
Amazon CloudSearch
Legacy Monolith Amazon Kinesis Amazon Lambda
Amazon CloudSearchAmazon API Gateway Amazon Lambda
proxy requests from monolith
to new service
new analytics pipeline
expensive ($3000/month)
don’t understand our domain
JS based query language
Legacy Monolith Amazon Kinesis Amazon Lambda
Google BigQuery
Legacy Monolith Amazon Kinesis Amazon Lambda
Google BigQuery
1 developer, 2 days
design production
(his 1st serverless project)
Legacy Monolith Amazon Kinesis Amazon Lambda
Google BigQuery
“nothing ever got done
this fast at Skype!”
- Chris Twamley
- Dan North
“lead time to someone saying
thank you is the only reputation
metric that matters.”
$3000/month $0.03/month
How to build a social network on serverless
Kinesis
sink
Kinesis Kinesis Firehose
batch Kinesis events
Kinesis Kinesis Firehose S3
data lake
Kinesis Kinesis Firehose S3
Glue
analyze data schema,
catalog data into tables
Kinesis Kinesis Firehose S3
Athena
Glue
query engine
Kinesis Kinesis Firehose S3
AthenaQuickSight
Glue
visualization, dashboards
Kinesis Kinesis Firehose S3
AthenaQuickSight
Glue
no code is required!
Kinesis Kinesis Firehose S3
AthenaQuickSight
Glue
no code is required!
pay-per-use!
user action business intelligence
user action business intelligence
How to build a social network on serverless
How to build a social network on serverless
Problem
didn’t work…
Problem
didn’t work…
over-engineered…
How to build a social network on serverless
try figure out what’s
going on here…
Problem
didn’t work…
over-engineered…
didn’t scale…
How to build a social network on serverless
Rebuilt
with Lambda
How to build a social network on serverless
How to build a social network on serverless
How to build a social network on serverless
How to build a social network on serverless
How to build a social network on serverless
built-in retry
and DLQ
built-in retry
and DLQ
avoid repeating expensive
work of fetching mils of
relationships
How to build a social network on serverless
How to build a social network on serverless
How to build a social network on serverless
github
repo
timeline-api
service: timeline-api
provider:
name: aws
runtime: nodejs6.10
stage: dev
region: us-east-1
functions:
distribute-yubl:
…
undistribute-yubl:
…
How to build a social network on serverless
Problem
didn’t work…
“it returns the first 30 users in the
database, by creation time…”
How to build a social network on serverless
Rebuilt
with Lambda
BigQuery
BigQuery
grapheneDB
BigQuery
grapheneDB
BigQuery
grapheneDB
BigQuery
grapheneDB
BigQuery
mostly built in one sleepless night…
How to build a social network on serverless
more Scalable
(and scales faster!)
Cheaper
(don’t pay for idle servers)
Resilience
(built-in redundancy and multi-AZ)
Secure
request
blue-green deployment
req/s
auto-scaling
us-east-1a
us-east-1b
us-east-1c
multi-AZ
idea production
greater Velocity from idea to product
WHY?
to deliver better UX
to deliver value faster
to be more cost efficient
@theburningmonk
theburningmonk.com
github.com/theburningmonk

More Related Content

PDF
Troubleshooting serverless applications
PDF
How to build observability into a serverless application
PDF
The present and future of Serverless observability
PDF
Serverless observability - a hero's perspective
PDF
How to build a social network on Serverless (AWS Community Summit)
PDF
Debugging AWS Lambda Performance Issues
PDF
Lambda and DynamoDB best practices
PDF
Streams and serverless at DAZN
Troubleshooting serverless applications
How to build observability into a serverless application
The present and future of Serverless observability
Serverless observability - a hero's perspective
How to build a social network on Serverless (AWS Community Summit)
Debugging AWS Lambda Performance Issues
Lambda and DynamoDB best practices
Streams and serverless at DAZN

What's hot (20)

PDF
Why your next serverless project should use AWS AppSync
PDF
Serverless Architectural Patterns
PDF
Serveless Design Patterns (Serverless Computing London)
PDF
Serverless a superpower for frontend developers
PDF
Build social network in 4 weeks
PDF
How to build observability into a serverless application
PPTX
A. De Biase/C. Quatrini/M. Barsocchi - API Release Process: how to make peopl...
PDF
What makes me to migrate entire VPC JAWS PANKRATION 2021
PDF
Security in serverless world
PDF
You wouldn't build a toast, would you?
PDF
How to build observability into Serverless (O'Reilly Velocity 2018)
PDF
Patterns and practices for building resilient serverless applications.pdf
PDF
Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...
PDF
Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...
PDF
Serverless in production, an experience report (Going Serverless)
PDF
How to build a social network on serverless
PDF
Serverless is more FinDev than DevOps
PDF
Serverless in Production, an experience report (AWS UG South Wales)
PDF
Patterns and practices for building resilient serverless applications
PDF
Serverless in production, an experience report (FullStack 2018)
Why your next serverless project should use AWS AppSync
Serverless Architectural Patterns
Serveless Design Patterns (Serverless Computing London)
Serverless a superpower for frontend developers
Build social network in 4 weeks
How to build observability into a serverless application
A. De Biase/C. Quatrini/M. Barsocchi - API Release Process: how to make peopl...
What makes me to migrate entire VPC JAWS PANKRATION 2021
Security in serverless world
You wouldn't build a toast, would you?
How to build observability into Serverless (O'Reilly Velocity 2018)
Patterns and practices for building resilient serverless applications.pdf
Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...
Revolutionize DevOps with ML capabilities. Introduction to Amazon CodeGuru an...
Serverless in production, an experience report (Going Serverless)
How to build a social network on serverless
Serverless is more FinDev than DevOps
Serverless in Production, an experience report (AWS UG South Wales)
Patterns and practices for building resilient serverless applications
Serverless in production, an experience report (FullStack 2018)

Similar to How to build a social network on serverless (20)

PDF
How to build a social network on serverless
PDF
How to build a social network on serverless | Yan Cui
PDF
Serverless in production (O'Reilly Software Architecture)
PDF
Serverless in production, an experience report (Going Serverless, 28 Feb 2018)
PDF
Serverless in production, an experience report
PDF
AWS Lambda from the trenches (Serverless London)
PDF
Serverless in production, an experience report (IWOMM)
PDF
Serverless in production, an experience report (codemotion milan)
PDF
Yan Cui - Serverless in production, an experience report - Codemotion Milan 2017
PDF
Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs...
PDF
Serverless in production, an experience report (linuxing in london)
PDF
Serverless in production, an experience report (London js community)
PDF
Beware the potholes
PDF
Serverless in production, an experience report (CoDe-Conf)
PDF
Microservices, Microfrontends and Feature Teams
PDF
Serverless in production, an experience report (microservices london)
PPTX
Public v1 real world example of azure functions serverless conf london 2016
PDF
Serverless in production, an experience report (JeffConf)
PDF
Serverless in Production, an experience report (cloudXchange)
PDF
Serverless in production, an experience report (London DevOps)
How to build a social network on serverless
How to build a social network on serverless | Yan Cui
Serverless in production (O'Reilly Software Architecture)
Serverless in production, an experience report (Going Serverless, 28 Feb 2018)
Serverless in production, an experience report
AWS Lambda from the trenches (Serverless London)
Serverless in production, an experience report (IWOMM)
Serverless in production, an experience report (codemotion milan)
Yan Cui - Serverless in production, an experience report - Codemotion Milan 2017
Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs...
Serverless in production, an experience report (linuxing in london)
Serverless in production, an experience report (London js community)
Beware the potholes
Serverless in production, an experience report (CoDe-Conf)
Microservices, Microfrontends and Feature Teams
Serverless in production, an experience report (microservices london)
Public v1 real world example of azure functions serverless conf london 2016
Serverless in production, an experience report (JeffConf)
Serverless in Production, an experience report (cloudXchange)
Serverless in production, an experience report (London DevOps)

More from Yan Cui (20)

PDF
How to win the game of trade-offs
PDF
How to choose the right messaging service
PDF
How to choose the right messaging service for your workload
PDF
Lessons from running AppSync in prod
PDF
How to ship customer value faster with step functions
PDF
How serverless changes the cost paradigm
PDF
How to bring chaos engineering to serverless
PDF
Migrating existing monolith to serverless in 8 steps
PDF
Building a social network in under 4 weeks with Serverless and GraphQL
PDF
FinDev as a business advantage in the post covid19 economy
PDF
How to improve lambda cold starts
PDF
What can you do with lambda in 2020
PDF
A chaos experiment a day, keeping the outage away
PDF
How to debug slow lambda response times
PDF
What can you do with lambda in 2020
PDF
How to ship customer value faster with step functions
PDF
Debugging Lambda timeouts
PDF
Patterns and Practices for Building Resilient Serverless Applications
PDF
Serverless Security: Defence Against the Dark Arts
PDF
What can you do with lambda in 2020
How to win the game of trade-offs
How to choose the right messaging service
How to choose the right messaging service for your workload
Lessons from running AppSync in prod
How to ship customer value faster with step functions
How serverless changes the cost paradigm
How to bring chaos engineering to serverless
Migrating existing monolith to serverless in 8 steps
Building a social network in under 4 weeks with Serverless and GraphQL
FinDev as a business advantage in the post covid19 economy
How to improve lambda cold starts
What can you do with lambda in 2020
A chaos experiment a day, keeping the outage away
How to debug slow lambda response times
What can you do with lambda in 2020
How to ship customer value faster with step functions
Debugging Lambda timeouts
Patterns and Practices for Building Resilient Serverless Applications
Serverless Security: Defence Against the Dark Arts
What can you do with lambda in 2020

Recently uploaded (20)

PPTX
SGT Report The Beast Plan and Cyberphysical Systems of Control
PDF
Connector Corner: Transform Unstructured Documents with Agentic Automation
PDF
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
PDF
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
PDF
Lung cancer patients survival prediction using outlier detection and optimize...
PDF
Introduction to MCP and A2A Protocols: Enabling Agent Communication
PDF
LMS bot: enhanced learning management systems for improved student learning e...
PPTX
Training Program for knowledge in solar cell and solar industry
PDF
Rapid Prototyping: A lecture on prototyping techniques for interface design
PPTX
Module 1 Introduction to Web Programming .pptx
PPTX
Internet of Everything -Basic concepts details
PDF
Aug23rd - Mulesoft Community Workshop - Hyd, India.pdf
PDF
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
PDF
MENA-ECEONOMIC-CONTEXT-VC MENA-ECEONOMIC
PDF
zbrain.ai-Scope Key Metrics Configuration and Best Practices.pdf
PDF
Electrocardiogram sequences data analytics and classification using unsupervi...
PDF
Data Virtualization in Action: Scaling APIs and Apps with FME
PDF
Early detection and classification of bone marrow changes in lumbar vertebrae...
PDF
Auditboard EB SOX Playbook 2023 edition.
PDF
NewMind AI Weekly Chronicles – August ’25 Week IV
SGT Report The Beast Plan and Cyberphysical Systems of Control
Connector Corner: Transform Unstructured Documents with Agentic Automation
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
Lung cancer patients survival prediction using outlier detection and optimize...
Introduction to MCP and A2A Protocols: Enabling Agent Communication
LMS bot: enhanced learning management systems for improved student learning e...
Training Program for knowledge in solar cell and solar industry
Rapid Prototyping: A lecture on prototyping techniques for interface design
Module 1 Introduction to Web Programming .pptx
Internet of Everything -Basic concepts details
Aug23rd - Mulesoft Community Workshop - Hyd, India.pdf
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
MENA-ECEONOMIC-CONTEXT-VC MENA-ECEONOMIC
zbrain.ai-Scope Key Metrics Configuration and Best Practices.pdf
Electrocardiogram sequences data analytics and classification using unsupervi...
Data Virtualization in Action: Scaling APIs and Apps with FME
Early detection and classification of bone marrow changes in lumbar vertebrae...
Auditboard EB SOX Playbook 2023 edition.
NewMind AI Weekly Chronicles – August ’25 Week IV

How to build a social network on serverless