SlideShare uma empresa Scribd logo
1 de 49
Baixar para ler offline
Daniele Ra)
CEO & Founder
Before e-invoicing hype
E-invoicing hype
Some tech numbers
• 350K paying customers
• 80-100 running instances simultaneously
• 10 MySQL databases
• 1 redis
• Handling 110M requests/day
• 88M requests/day on CDN
• 22M requests/day on EC2s
• Rendering 1.5M+ invoices/day
It all started with…
Landing page
Single dedicated server
Platform
Storage
Database
~100s of users
Server
Code
SFTP
Reliability was like…
Reliability was like…
Moving the storage outside!
Landing page
Single dedicated server
Platform
Storage on S3
Database
Moving the database outside!
Landing page
Single dedicated server
Platform
Storage on S3
Database on
separated instance
Moving everything in the cloud and decoupling
instances 🚀
Landing page
Platform
Storage on S3
Database on RDS
MySQL (then
Aurora)
Background Jobs
How could we be more fault tolerant?
Load balancing the requests
AutoScaling Group
Instance
Instance
Instance
Load Balancer
Autoscaling
CDN to cache staIc resources
AutoScaling Group
Instance
Instance
Instance
Load Balancer
CDN
What about versioning?
<CDN_url>/main.js?version=<commit id / checksum>
CDN miss (new version!)
<ALB_url>/main.js?version=<commit id / checksum>
⚠ Not that easy when you handle million of
requests…
A step back to the (old) deployment system…
Server
Code
SFTP
The new deployment system…
GIT Codebase
Push / merge branch to master
Build on Jenkins
Webhook
Deploy via AWX
(Ansible Tower)
EC2 EC2 EC2
Package (on S3)
newborn
EC2
What could possibly go wrong with the CDN?
Look at the deploy Imes…
Build
Deploy on instance 1
Deploy on instance 2
Deploy on instance 3
Deploy on instance 4
Deploy on instance 5
<ALB_url>/page
LoadBalancer
EC2 (updated) EC2 (updated) EC2 (outdated)
<ALB_url>/page
LoadBalancer
EC2 (updated) EC2 (updated) EC2 (outdated)
<CDN_url>/main.js?version=new
LoadBalancer
EC2 (updated) EC2 (updated) EC2 (outdated)
CDN
miss (new version!)
(Thinking is the latest version!)
<ALB_url>/page
LoadBalancer
EC2 (updated) EC2 (updated) EC2 (outdated)
<CDN_url>/main.js?version=new
LoadBalancer
EC2 (updated) EC2 (updated) EC2 (outdated)
CDN
miss (new version!)
(Thinking is the latest version!)
Our soluIon (full blue/green was too slow)
Build
Deploy on instance 1
Deploy on instance 2
Deploy on instance 3
Deploy on instance 4
Deploy on instance 5
Padding time to update the package
Padding time to update the package
Padding time to update the package
Padding time to update the package
Padding time to update the package
The same moment for every instance
(The clocks are synchronized)
Users
Platform
Amazon ELB
Load balancer
RDS - Multi A-Z
MySQL
Storage
(expenses…)
Amazon S3
“storage” bucket
secure.fattureincloud.it
storage.fattureincloud.it
SSL
Landing page
www.fattureincloud.it
API
api.fattureincloud.it
Compute
compute.fattureincloud.it
Amazon ELB
Load balancer
cron runnings
Amazon SES
SMTP Server
Redis (caching)
Background
workers
* private IP *
EC2
SSL SSL SSLSSL
EC2 EC2
CDN
Amazon
CloudFront
SSL
cdn.fattureincloud.it
EC2
Autoscaling
Group
Autoscaling
Group
EC2 EC2
Amazon ELB
Load balancer
Autoscaling
Group
EC2 EC2
Amazon ELB
Load balancer
Autoscaling
Group
EC2 EC2
BoPleneck
Database issues & goals
• Reliability (single point of failure)
• Scaling
• Alter table on big tables
• Query analysis / opPmizaPon
What we found useful
Master (write) and slaves (read)
• Decouple read/write operaPons
• Uses 2+ different instances
Auto scaling & MulI-AZ
• Reduce the probability of failure
• Scaling of read replicas based on usage
• The master (write) instance become the new boWleneck as the write
instances can scale up to 15
Auto scaling
Specific-user per cluster and Performance Insights
• IdenPfy exactly where the slow queries come from
• IdenPfy which clusters are using more resources (both in read and write)
Specific-user per cluster and Performance Insights
Further performance analysis with NewRelic
Redis for query caching (and more…)
SELECT * FROM table WHERE …
Search valid md5(query) on redis
Response
found
Query the DB
not found
Save on Redis with a TTL (based
on the single query)
Altering big tables
Percona Toolkit is the best soluPon we found
Here’s what happen:
• Creates a new table with the altered structure
• Adds 3 triggers to the original table (INSERT, UPDATE, DELETE)
• Copies chunk by chunk the rows from the original table to the desPnaPon
• Atomically removes the triggers and switches the names of the tables
• [opPonal] delete the old table
Benchmarking ALTER TABLE vs Percona Toolkit
Technology: Aurora 1.17.8 - MySQL 5.6.10-log
RDS Aurora Instance: db.r4.8xlarge (244GB RAM - 32 vCPU)
Benchmarking ALTER TABLE vs Percona Toolkit
Benchmarking ALTER TABLE vs Percona Toolkit
Benchmarking ALTER TABLE vs Percona Toolkit
Conclusion:
Percona toolkit is 6,5X slower than ALTER TABLE with INPLACE algorithm and 4X
slower than ALTER TABLE with COPY algorithm but it’s predictable and safe.
It can be stopped without any consequences and it affect the DB CPU (on the
tesPng machine) by ~6%
CuriosiIes
We have a Ime machine to rollback in seconds 😎
We know the average lunch Ime thanks to the AutoScaling
* Minimum peak for lunch Pme @ 1:30PM
hWps://bit.ly/2WZzts5
Never stop learning
Daniele Ra)
CEO & Founder
FaWure in Cloud

Mais conteúdo relacionado

Mais procurados

Red hat storage server replication past, present, & future
Red hat storage server replication  past, present, & futureRed hat storage server replication  past, present, & future
Red hat storage server replication past, present, & future
Taline Felix
 

Mais procurados (20)

RedisConf17 - Doing More With Redis - Ofer Bengal and Yiftach Shoolman
RedisConf17 - Doing More With Redis - Ofer Bengal and Yiftach ShoolmanRedisConf17 - Doing More With Redis - Ofer Bengal and Yiftach Shoolman
RedisConf17 - Doing More With Redis - Ofer Bengal and Yiftach Shoolman
 
LLAP: Locality is dead (in the cloud)
LLAP: Locality is dead (in the cloud)  LLAP: Locality is dead (in the cloud)
LLAP: Locality is dead (in the cloud)
 
Seastar / ScyllaDB, or how we implemented a 10-times faster Cassandra
Seastar / ScyllaDB,  or how we implemented a 10-times faster CassandraSeastar / ScyllaDB,  or how we implemented a 10-times faster Cassandra
Seastar / ScyllaDB, or how we implemented a 10-times faster Cassandra
 
Lab Manual Managed Database Basics
Lab Manual Managed Database BasicsLab Manual Managed Database Basics
Lab Manual Managed Database Basics
 
Terraform
TerraformTerraform
Terraform
 
Making KVS 10x Scalable
Making KVS 10x ScalableMaking KVS 10x Scalable
Making KVS 10x Scalable
 
Amazon RDS for PostgreSQL - PGConf 2016
Amazon RDS for PostgreSQL - PGConf 2016 Amazon RDS for PostgreSQL - PGConf 2016
Amazon RDS for PostgreSQL - PGConf 2016
 
Asynchronous Orchestration DSL on squbs
Asynchronous Orchestration DSL on squbsAsynchronous Orchestration DSL on squbs
Asynchronous Orchestration DSL on squbs
 
ACS & vSphere Draft
ACS & vSphere DraftACS & vSphere Draft
ACS & vSphere Draft
 
Configuring MongoDB HA Replica Set on AWS EC2
Configuring MongoDB HA Replica Set on AWS EC2Configuring MongoDB HA Replica Set on AWS EC2
Configuring MongoDB HA Replica Set on AWS EC2
 
(SDD403) Amazon RDS for MySQL Deep Dive | AWS re:Invent 2014
(SDD403) Amazon RDS for MySQL Deep Dive | AWS re:Invent 2014(SDD403) Amazon RDS for MySQL Deep Dive | AWS re:Invent 2014
(SDD403) Amazon RDS for MySQL Deep Dive | AWS re:Invent 2014
 
Flink Forward SF 2017: James Malone - Make The Cloud Work For You
Flink Forward SF 2017: James Malone - Make The Cloud Work For YouFlink Forward SF 2017: James Malone - Make The Cloud Work For You
Flink Forward SF 2017: James Malone - Make The Cloud Work For You
 
Flink Forward SF 2017: Malo Deniélou - No shard left behind: Dynamic work re...
Flink Forward SF 2017: Malo Deniélou -  No shard left behind: Dynamic work re...Flink Forward SF 2017: Malo Deniélou -  No shard left behind: Dynamic work re...
Flink Forward SF 2017: Malo Deniélou - No shard left behind: Dynamic work re...
 
Clickhouse at Cloudflare. By Marek Vavrusa
Clickhouse at Cloudflare. By Marek VavrusaClickhouse at Cloudflare. By Marek Vavrusa
Clickhouse at Cloudflare. By Marek Vavrusa
 
Red hat storage server replication past, present, & future
Red hat storage server replication  past, present, & futureRed hat storage server replication  past, present, & future
Red hat storage server replication past, present, & future
 
RedisConf17 - Redis Graph
RedisConf17 - Redis GraphRedisConf17 - Redis Graph
RedisConf17 - Redis Graph
 
Terraform
TerraformTerraform
Terraform
 
(DAT402) Amazon RDS PostgreSQL:Lessons Learned & New Features
(DAT402) Amazon RDS PostgreSQL:Lessons Learned & New Features(DAT402) Amazon RDS PostgreSQL:Lessons Learned & New Features
(DAT402) Amazon RDS PostgreSQL:Lessons Learned & New Features
 
An overview of Amazon Athena
An overview of Amazon AthenaAn overview of Amazon Athena
An overview of Amazon Athena
 
Scylla Summit 2018: Keeping Your Latency SLAs No Matter What!
Scylla Summit 2018: Keeping Your Latency SLAs No Matter What!Scylla Summit 2018: Keeping Your Latency SLAs No Matter What!
Scylla Summit 2018: Keeping Your Latency SLAs No Matter What!
 

Semelhante a Scaling an invoicing SaaS from zero to over 350k customers

Semelhante a Scaling an invoicing SaaS from zero to over 350k customers (20)

What’s New in Amazon Aurora
What’s New in Amazon AuroraWhat’s New in Amazon Aurora
What’s New in Amazon Aurora
 
What’s New in Amazon Aurora
What’s New in Amazon AuroraWhat’s New in Amazon Aurora
What’s New in Amazon Aurora
 
Redshift overview
Redshift overviewRedshift overview
Redshift overview
 
Fighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with EmbulkFighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with Embulk
 
NEW LAUNCH! Introducing PostgreSQL compatibility for Amazon Aurora
NEW LAUNCH! Introducing PostgreSQL compatibility for Amazon AuroraNEW LAUNCH! Introducing PostgreSQL compatibility for Amazon Aurora
NEW LAUNCH! Introducing PostgreSQL compatibility for Amazon Aurora
 
Announcing Amazon Aurora with PostgreSQL Compatibility - January 2017 AWS Onl...
Announcing Amazon Aurora with PostgreSQL Compatibility - January 2017 AWS Onl...Announcing Amazon Aurora with PostgreSQL Compatibility - January 2017 AWS Onl...
Announcing Amazon Aurora with PostgreSQL Compatibility - January 2017 AWS Onl...
 
Getting Started with Amazon Redshift
Getting Started with Amazon RedshiftGetting Started with Amazon Redshift
Getting Started with Amazon Redshift
 
Getting Started with Amazon Redshift
Getting Started with Amazon RedshiftGetting Started with Amazon Redshift
Getting Started with Amazon Redshift
 
What's New in Amazon Aurora
What's New in Amazon AuroraWhat's New in Amazon Aurora
What's New in Amazon Aurora
 
SRV407 Deep Dive on Amazon Aurora
SRV407 Deep Dive on Amazon AuroraSRV407 Deep Dive on Amazon Aurora
SRV407 Deep Dive on Amazon Aurora
 
Getting Started with Amazon Redshift
Getting Started with Amazon RedshiftGetting Started with Amazon Redshift
Getting Started with Amazon Redshift
 
Deep Dive on Amazon Aurora
Deep Dive on Amazon AuroraDeep Dive on Amazon Aurora
Deep Dive on Amazon Aurora
 
Getting Started with Amazon Redshift
Getting Started with Amazon RedshiftGetting Started with Amazon Redshift
Getting Started with Amazon Redshift
 
Building Your Data Warehouse with Amazon Redshift
Building Your Data Warehouse with Amazon RedshiftBuilding Your Data Warehouse with Amazon Redshift
Building Your Data Warehouse with Amazon Redshift
 
Deep Dive on Amazon Aurora
Deep Dive on Amazon AuroraDeep Dive on Amazon Aurora
Deep Dive on Amazon Aurora
 
Melhores práticas de data warehouse no Amazon Redshift
Melhores práticas de data warehouse no Amazon RedshiftMelhores práticas de data warehouse no Amazon Redshift
Melhores práticas de data warehouse no Amazon Redshift
 
10 tips to improve the performance of your AWS application
10 tips to improve the performance of your AWS application10 tips to improve the performance of your AWS application
10 tips to improve the performance of your AWS application
 
데이터 마이그레이션 AWS와 같이하기 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming
데이터 마이그레이션 AWS와 같이하기 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming데이터 마이그레이션 AWS와 같이하기 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming
데이터 마이그레이션 AWS와 같이하기 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming
 
Getting Maximum Performance from Amazon Redshift (DAT305) | AWS re:Invent 2013
Getting Maximum Performance from Amazon Redshift (DAT305) | AWS re:Invent 2013Getting Maximum Performance from Amazon Redshift (DAT305) | AWS re:Invent 2013
Getting Maximum Performance from Amazon Redshift (DAT305) | AWS re:Invent 2013
 
Amazon Athena (April 2017)
Amazon Athena (April 2017)Amazon Athena (April 2017)
Amazon Athena (April 2017)
 

Mais de Speck&Tech

What should 6G be? - 6G: bridging gaps, connecting futures
What should 6G be? - 6G: bridging gaps, connecting futuresWhat should 6G be? - 6G: bridging gaps, connecting futures
What should 6G be? - 6G: bridging gaps, connecting futures
Speck&Tech
 
Creare il sangue artificiale: "buon sangue non mente"
Creare il sangue artificiale: "buon sangue non mente"Creare il sangue artificiale: "buon sangue non mente"
Creare il sangue artificiale: "buon sangue non mente"
Speck&Tech
 

Mais de Speck&Tech (20)

What should 6G be? - 6G: bridging gaps, connecting futures
What should 6G be? - 6G: bridging gaps, connecting futuresWhat should 6G be? - 6G: bridging gaps, connecting futures
What should 6G be? - 6G: bridging gaps, connecting futures
 
Creare il sangue artificiale: "buon sangue non mente"
Creare il sangue artificiale: "buon sangue non mente"Creare il sangue artificiale: "buon sangue non mente"
Creare il sangue artificiale: "buon sangue non mente"
 
AWS: gestire la scalabilità su larga scala
AWS: gestire la scalabilità su larga scalaAWS: gestire la scalabilità su larga scala
AWS: gestire la scalabilità su larga scala
 
Praticamente... AWS - Amazon Web Services
Praticamente... AWS - Amazon Web ServicesPraticamente... AWS - Amazon Web Services
Praticamente... AWS - Amazon Web Services
 
Data Sense-making: navigating the world through the lens of information design
Data Sense-making: navigating the world through the lens of information designData Sense-making: navigating the world through the lens of information design
Data Sense-making: navigating the world through the lens of information design
 
Data Activism: data as rhetoric, data as power
Data Activism: data as rhetoric, data as powerData Activism: data as rhetoric, data as power
Data Activism: data as rhetoric, data as power
 
Delve into the world of the human microbiome and metagenomics
Delve into the world of the human microbiome and metagenomicsDelve into the world of the human microbiome and metagenomics
Delve into the world of the human microbiome and metagenomics
 
Home4MeAi: un progetto sociale che utilizza dispositivi IoT per sfruttare le ...
Home4MeAi: un progetto sociale che utilizza dispositivi IoT per sfruttare le ...Home4MeAi: un progetto sociale che utilizza dispositivi IoT per sfruttare le ...
Home4MeAi: un progetto sociale che utilizza dispositivi IoT per sfruttare le ...
 
Monitorare una flotta di autobus: architettura di un progetto di acquisizione...
Monitorare una flotta di autobus: architettura di un progetto di acquisizione...Monitorare una flotta di autobus: architettura di un progetto di acquisizione...
Monitorare una flotta di autobus: architettura di un progetto di acquisizione...
 
Why LLMs should be handled with care
Why LLMs should be handled with careWhy LLMs should be handled with care
Why LLMs should be handled with care
 
Building intelligent applications with Large Language Models
Building intelligent applications with Large Language ModelsBuilding intelligent applications with Large Language Models
Building intelligent applications with Large Language Models
 
Privacy in the era of quantum computers
Privacy in the era of quantum computersPrivacy in the era of quantum computers
Privacy in the era of quantum computers
 
Machine learning with quantum computers
Machine learning with quantum computersMachine learning with quantum computers
Machine learning with quantum computers
 
Give your Web App superpowers by using GPUs
Give your Web App superpowers by using GPUsGive your Web App superpowers by using GPUs
Give your Web App superpowers by using GPUs
 
From leaf to orbit: exploring forests with technology
From leaf to orbit: exploring forests with technologyFrom leaf to orbit: exploring forests with technology
From leaf to orbit: exploring forests with technology
 
Innovating Wood
Innovating WoodInnovating Wood
Innovating Wood
 
Behind the scenes of our everyday Internet: the role of an IXP like MIX
Behind the scenes of our everyday Internet: the role of an IXP like MIXBehind the scenes of our everyday Internet: the role of an IXP like MIX
Behind the scenes of our everyday Internet: the role of an IXP like MIX
 
Architecting a 35 PB distributed parallel file system for science
Architecting a 35 PB distributed parallel file system for scienceArchitecting a 35 PB distributed parallel file system for science
Architecting a 35 PB distributed parallel file system for science
 
Truck planning: how to certify the right route
Truck planning: how to certify the right routeTruck planning: how to certify the right route
Truck planning: how to certify the right route
 
Break it up! 5G, cruise control, autonomous vehicle cooperation, and bending ...
Break it up! 5G, cruise control, autonomous vehicle cooperation, and bending ...Break it up! 5G, cruise control, autonomous vehicle cooperation, and bending ...
Break it up! 5G, cruise control, autonomous vehicle cooperation, and bending ...
 

Último

From Luxury Escort Service Kamathipura : 9352852248 Make on-demand Arrangemen...
From Luxury Escort Service Kamathipura : 9352852248 Make on-demand Arrangemen...From Luxury Escort Service Kamathipura : 9352852248 Make on-demand Arrangemen...
From Luxury Escort Service Kamathipura : 9352852248 Make on-demand Arrangemen...
From Luxury Escort : 9352852248 Make on-demand Arrangements Near yOU
 
20240429 Calibre April 2024 Investor Presentation.pdf
20240429 Calibre April 2024 Investor Presentation.pdf20240429 Calibre April 2024 Investor Presentation.pdf
20240429 Calibre April 2024 Investor Presentation.pdf
Adnet Communications
 
VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...
VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...
VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...
dipikadinghjn ( Why You Choose Us? ) Escorts
 
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
dipikadinghjn ( Why You Choose Us? ) Escorts
 

Último (20)

Kharghar Blowjob Housewife Call Girls NUmber-9833754194-CBD Belapur Internati...
Kharghar Blowjob Housewife Call Girls NUmber-9833754194-CBD Belapur Internati...Kharghar Blowjob Housewife Call Girls NUmber-9833754194-CBD Belapur Internati...
Kharghar Blowjob Housewife Call Girls NUmber-9833754194-CBD Belapur Internati...
 
Stock Market Brief Deck (Under Pressure).pdf
Stock Market Brief Deck (Under Pressure).pdfStock Market Brief Deck (Under Pressure).pdf
Stock Market Brief Deck (Under Pressure).pdf
 
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
 
03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptx03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptx
 
From Luxury Escort Service Kamathipura : 9352852248 Make on-demand Arrangemen...
From Luxury Escort Service Kamathipura : 9352852248 Make on-demand Arrangemen...From Luxury Escort Service Kamathipura : 9352852248 Make on-demand Arrangemen...
From Luxury Escort Service Kamathipura : 9352852248 Make on-demand Arrangemen...
 
The Economic History of the U.S. Lecture 26.pdf
The Economic History of the U.S. Lecture 26.pdfThe Economic History of the U.S. Lecture 26.pdf
The Economic History of the U.S. Lecture 26.pdf
 
Solution Manual for Principles of Corporate Finance 14th Edition by Richard B...
Solution Manual for Principles of Corporate Finance 14th Edition by Richard B...Solution Manual for Principles of Corporate Finance 14th Edition by Richard B...
Solution Manual for Principles of Corporate Finance 14th Edition by Richard B...
 
Top Rated Pune Call Girls Dighi ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Dighi ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Dighi ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Dighi ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
 
20240429 Calibre April 2024 Investor Presentation.pdf
20240429 Calibre April 2024 Investor Presentation.pdf20240429 Calibre April 2024 Investor Presentation.pdf
20240429 Calibre April 2024 Investor Presentation.pdf
 
VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...
VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...
VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...
 
Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )
Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )
Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )
 
The Economic History of the U.S. Lecture 23.pdf
The Economic History of the U.S. Lecture 23.pdfThe Economic History of the U.S. Lecture 23.pdf
The Economic History of the U.S. Lecture 23.pdf
 
The Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdfThe Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdf
 
Top Rated Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...
 
The Economic History of the U.S. Lecture 21.pdf
The Economic History of the U.S. Lecture 21.pdfThe Economic History of the U.S. Lecture 21.pdf
The Economic History of the U.S. Lecture 21.pdf
 
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
 
Indore Real Estate Market Trends Report.pdf
Indore Real Estate Market Trends Report.pdfIndore Real Estate Market Trends Report.pdf
Indore Real Estate Market Trends Report.pdf
 
WhatsApp 📞 Call : 9892124323 ✅Call Girls In Chembur ( Mumbai ) secure service
WhatsApp 📞 Call : 9892124323  ✅Call Girls In Chembur ( Mumbai ) secure serviceWhatsApp 📞 Call : 9892124323  ✅Call Girls In Chembur ( Mumbai ) secure service
WhatsApp 📞 Call : 9892124323 ✅Call Girls In Chembur ( Mumbai ) secure service
 
00_Main ppt_MeetupDORA&CyberSecurity.pptx
00_Main ppt_MeetupDORA&CyberSecurity.pptx00_Main ppt_MeetupDORA&CyberSecurity.pptx
00_Main ppt_MeetupDORA&CyberSecurity.pptx
 

Scaling an invoicing SaaS from zero to over 350k customers

  • 1.
  • 3.
  • 6. Some tech numbers • 350K paying customers • 80-100 running instances simultaneously • 10 MySQL databases • 1 redis • Handling 110M requests/day • 88M requests/day on CDN • 22M requests/day on EC2s • Rendering 1.5M+ invoices/day
  • 7. It all started with… Landing page Single dedicated server Platform Storage Database ~100s of users Server Code SFTP
  • 10. Moving the storage outside! Landing page Single dedicated server Platform Storage on S3 Database
  • 11. Moving the database outside! Landing page Single dedicated server Platform Storage on S3 Database on separated instance
  • 12. Moving everything in the cloud and decoupling instances 🚀 Landing page Platform Storage on S3 Database on RDS MySQL (then Aurora) Background Jobs
  • 13. How could we be more fault tolerant?
  • 14. Load balancing the requests AutoScaling Group Instance Instance Instance Load Balancer
  • 16. CDN to cache staIc resources AutoScaling Group Instance Instance Instance Load Balancer CDN
  • 17. What about versioning? <CDN_url>/main.js?version=<commit id / checksum> CDN miss (new version!) <ALB_url>/main.js?version=<commit id / checksum>
  • 18. ⚠ Not that easy when you handle million of requests…
  • 19. A step back to the (old) deployment system… Server Code SFTP
  • 20. The new deployment system… GIT Codebase Push / merge branch to master Build on Jenkins Webhook Deploy via AWX (Ansible Tower) EC2 EC2 EC2 Package (on S3) newborn EC2
  • 21. What could possibly go wrong with the CDN?
  • 22. Look at the deploy Imes… Build Deploy on instance 1 Deploy on instance 2 Deploy on instance 3 Deploy on instance 4 Deploy on instance 5
  • 24. <ALB_url>/page LoadBalancer EC2 (updated) EC2 (updated) EC2 (outdated) <CDN_url>/main.js?version=new LoadBalancer EC2 (updated) EC2 (updated) EC2 (outdated) CDN miss (new version!) (Thinking is the latest version!)
  • 25. <ALB_url>/page LoadBalancer EC2 (updated) EC2 (updated) EC2 (outdated) <CDN_url>/main.js?version=new LoadBalancer EC2 (updated) EC2 (updated) EC2 (outdated) CDN miss (new version!) (Thinking is the latest version!)
  • 26. Our soluIon (full blue/green was too slow) Build Deploy on instance 1 Deploy on instance 2 Deploy on instance 3 Deploy on instance 4 Deploy on instance 5 Padding time to update the package Padding time to update the package Padding time to update the package Padding time to update the package Padding time to update the package The same moment for every instance (The clocks are synchronized)
  • 27. Users Platform Amazon ELB Load balancer RDS - Multi A-Z MySQL Storage (expenses…) Amazon S3 “storage” bucket secure.fattureincloud.it storage.fattureincloud.it SSL Landing page www.fattureincloud.it API api.fattureincloud.it Compute compute.fattureincloud.it Amazon ELB Load balancer cron runnings Amazon SES SMTP Server Redis (caching) Background workers * private IP * EC2 SSL SSL SSLSSL EC2 EC2 CDN Amazon CloudFront SSL cdn.fattureincloud.it EC2 Autoscaling Group Autoscaling Group EC2 EC2 Amazon ELB Load balancer Autoscaling Group EC2 EC2 Amazon ELB Load balancer Autoscaling Group EC2 EC2
  • 28.
  • 30.
  • 31. Database issues & goals • Reliability (single point of failure) • Scaling • Alter table on big tables • Query analysis / opPmizaPon
  • 32. What we found useful
  • 33. Master (write) and slaves (read) • Decouple read/write operaPons • Uses 2+ different instances
  • 34. Auto scaling & MulI-AZ • Reduce the probability of failure • Scaling of read replicas based on usage • The master (write) instance become the new boWleneck as the write instances can scale up to 15
  • 36. Specific-user per cluster and Performance Insights • IdenPfy exactly where the slow queries come from • IdenPfy which clusters are using more resources (both in read and write)
  • 37. Specific-user per cluster and Performance Insights
  • 39. Redis for query caching (and more…) SELECT * FROM table WHERE … Search valid md5(query) on redis Response found Query the DB not found Save on Redis with a TTL (based on the single query)
  • 40. Altering big tables Percona Toolkit is the best soluPon we found Here’s what happen: • Creates a new table with the altered structure • Adds 3 triggers to the original table (INSERT, UPDATE, DELETE) • Copies chunk by chunk the rows from the original table to the desPnaPon • Atomically removes the triggers and switches the names of the tables • [opPonal] delete the old table
  • 41. Benchmarking ALTER TABLE vs Percona Toolkit Technology: Aurora 1.17.8 - MySQL 5.6.10-log RDS Aurora Instance: db.r4.8xlarge (244GB RAM - 32 vCPU)
  • 42. Benchmarking ALTER TABLE vs Percona Toolkit
  • 43. Benchmarking ALTER TABLE vs Percona Toolkit
  • 44. Benchmarking ALTER TABLE vs Percona Toolkit Conclusion: Percona toolkit is 6,5X slower than ALTER TABLE with INPLACE algorithm and 4X slower than ALTER TABLE with COPY algorithm but it’s predictable and safe. It can be stopped without any consequences and it affect the DB CPU (on the tesPng machine) by ~6%
  • 46. We have a Ime machine to rollback in seconds 😎
  • 47. We know the average lunch Ime thanks to the AutoScaling * Minimum peak for lunch Pme @ 1:30PM
  • 49. Never stop learning Daniele Ra) CEO & Founder FaWure in Cloud