SlideShare uma empresa Scribd logo
1 de 90
Baixar para ler offline
Crescimento
e performance
em uma aplicação em Rails
Full stack engineer
@andrehjr
andre.junior@resultadosdigitais.com.br
ANDRÉ JUNIOR
500+ clientes
5000+ clientes
100M+ de emails/mês
2 Billion Docs on mongodb
4M+ jobs every day
6 times de dev
~10 deploys diariamente
< Response Time
> Workers
Completed 200 OK in 245ms
(Views: 33.7ms | ActiveRecord: 70.4ms)
gem 'rack-mini-profiler'
gem 'flamegraph'
Heavy Operations
Background Jobs
100.000 jobs
~1 segundos
10 workers
>2 horas
100.000 jobs
~100 ms
10 workers
16 minutos
Time equals Money
Caching
<% cache(object) do %>
<%# Do something expensive %>
<% end %>
Page/Fragment Caching
Rails.cache.fetch(cache_key) do
DailyStatistics.report
end
Low Level Caching
"There are only two hard
things in Computer Science:
Cache Invalidation and
naming things"
- Phil Karlton
Databases
gem 'bullet'
# N+1 Queries
# Unused Eager Loading
Person.all.pluck(:name)
# (1.1ms) SELECT "users"."name" FROM "users"
Slow Queries
> EXPLAIN SELECT * FROM PEOPLE
WHERE company_id = $1;
Limit (cost=102.06..102.06 rows=1 width=115)
-> Sort (cost=102.06..102.06 rows=1 width=115)
Sort Key: id
-> Seq Scan on people (cost=0.00..102.06 rows=1
width=115)
Filter: (company_id = 1)
Know your data
Know your Indexes
Slow Queries
Slow Queries
Data keeps growing
Cold Data
Index Size
Sharding Collections
sh.shardCollection("people.addresses", { "state": "SC"} )
require 'benchmark'
gem 'benchmark-ips'
Know your Gems
Migrações
Reversíveis
Confiáveis
Fast.
Monitoramento
Know what's happening
+
Microservices
Split Responsibilities
UPGRADE RAILS!!
New Features
Avoid Monkeypatching
Refactor
Dead Gems
Decision Making
@andrehjr
andre.junior@resultadosdigitais.com.br
shipit.resultadosdigitais.com.br
We're hiring! ;)
QUESTIONS?

Mais conteúdo relacionado

Destaque

Destaque (19)

Maiswebmarketing trello
Maiswebmarketing trelloMaiswebmarketing trello
Maiswebmarketing trello
 
That one time in Basecamp
That one time in BasecampThat one time in Basecamp
That one time in Basecamp
 
Pivotal tracker presentation 10-13-2010
Pivotal tracker presentation   10-13-2010Pivotal tracker presentation   10-13-2010
Pivotal tracker presentation 10-13-2010
 
Trello - Uma visão geral
Trello - Uma visão geralTrello - Uma visão geral
Trello - Uma visão geral
 
Gestão de Produto - Direcionando e Medindo Sucesso do RD Station
Gestão de Produto - Direcionando e Medindo Sucesso do RD StationGestão de Produto - Direcionando e Medindo Sucesso do RD Station
Gestão de Produto - Direcionando e Medindo Sucesso do RD Station
 
Trello
TrelloTrello
Trello
 
Apresentação Trello
Apresentação TrelloApresentação Trello
Apresentação Trello
 
GURU-SC: Case RD Station
GURU-SC: Case RD StationGURU-SC: Case RD Station
GURU-SC: Case RD Station
 
De programador a cto na sua startup
De programador a cto na sua startupDe programador a cto na sua startup
De programador a cto na sua startup
 
Trello
TrelloTrello
Trello
 
Agile Brazil 2014 - Case RD Station: escalando agile e lean na gestão compl...
Agile Brazil 2014  - Case RD Station: escalando agile e lean na gestão compl...Agile Brazil 2014  - Case RD Station: escalando agile e lean na gestão compl...
Agile Brazil 2014 - Case RD Station: escalando agile e lean na gestão compl...
 
Pivotal Tracker Overview
Pivotal Tracker OverviewPivotal Tracker Overview
Pivotal Tracker Overview
 
Apresentação sobre Rails - 2010
Apresentação sobre Rails - 2010Apresentação sobre Rails - 2010
Apresentação sobre Rails - 2010
 
Trello
TrelloTrello
Trello
 
Apresentação RD Station
Apresentação RD StationApresentação RD Station
Apresentação RD Station
 
Trello
TrelloTrello
Trello
 
HOW TO USE TRELLO TO ORGANIZE AND MANAGE TASKS AND TEAM PROJECTS
HOW TO USE TRELLO TO ORGANIZE AND MANAGE TASKS AND TEAM PROJECTSHOW TO USE TRELLO TO ORGANIZE AND MANAGE TASKS AND TEAM PROJECTS
HOW TO USE TRELLO TO ORGANIZE AND MANAGE TASKS AND TEAM PROJECTS
 
Palavras-chave RD Station
Palavras-chave RD StationPalavras-chave RD Station
Palavras-chave RD Station
 
Trello + metodologias ágeis
Trello + metodologias ágeisTrello + metodologias ágeis
Trello + metodologias ágeis
 

Semelhante a TDC São Paulo 2015 Ruby - Crescimento e performance em uma aplicação em Rails

Handling 20 billion requests a month
Handling 20 billion requests a monthHandling 20 billion requests a month
Handling 20 billion requests a month
Dmitriy Dumanskiy
 
App engine devfest_mexico_10
App engine devfest_mexico_10App engine devfest_mexico_10
App engine devfest_mexico_10
Chris Schalk
 

Semelhante a TDC São Paulo 2015 Ruby - Crescimento e performance em uma aplicação em Rails (20)

Tweaking performance on high-load projects
Tweaking performance on high-load projectsTweaking performance on high-load projects
Tweaking performance on high-load projects
 
Log everything! @DC13
Log everything! @DC13Log everything! @DC13
Log everything! @DC13
 
Handling 20 billion requests a month
Handling 20 billion requests a monthHandling 20 billion requests a month
Handling 20 billion requests a month
 
MongoDB Solution for Internet of Things and Big Data
MongoDB Solution for Internet of Things and Big DataMongoDB Solution for Internet of Things and Big Data
MongoDB Solution for Internet of Things and Big Data
 
Lab pratico per la progettazione di soluzioni MongoDB in ambito Internet of T...
Lab pratico per la progettazione di soluzioni MongoDB in ambito Internet of T...Lab pratico per la progettazione di soluzioni MongoDB in ambito Internet of T...
Lab pratico per la progettazione di soluzioni MongoDB in ambito Internet of T...
 
Celery: The Distributed Task Queue
Celery: The Distributed Task QueueCelery: The Distributed Task Queue
Celery: The Distributed Task Queue
 
MongoDB.local Paris Keynote
MongoDB.local Paris KeynoteMongoDB.local Paris Keynote
MongoDB.local Paris Keynote
 
App engine devfest_mexico_10
App engine devfest_mexico_10App engine devfest_mexico_10
App engine devfest_mexico_10
 
[PASS Summit 2016] Blazing Fast, Planet-Scale Customer Scenarios with Azure D...
[PASS Summit 2016] Blazing Fast, Planet-Scale Customer Scenarios with Azure D...[PASS Summit 2016] Blazing Fast, Planet-Scale Customer Scenarios with Azure D...
[PASS Summit 2016] Blazing Fast, Planet-Scale Customer Scenarios with Azure D...
 
#MBLTdev: Уроки, которые мы выучили, создавая Realm
#MBLTdev: Уроки, которые мы выучили, создавая Realm#MBLTdev: Уроки, которые мы выучили, создавая Realm
#MBLTdev: Уроки, которые мы выучили, создавая Realm
 
Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation
Scaling Rails for $5.50 per day  - October 2014 ATLRUG PresentationScaling Rails for $5.50 per day  - October 2014 ATLRUG Presentation
Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation
 
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
 
performance vamos dormir mais?
performance vamos dormir mais?performance vamos dormir mais?
performance vamos dormir mais?
 
Digdagによる大規模データ処理の自動化とエラー処理
Digdagによる大規模データ処理の自動化とエラー処理Digdagによる大規模データ処理の自動化とエラー処理
Digdagによる大規模データ処理の自動化とエラー処理
 
Mongodb beijingconf yottaa_3.3
Mongodb beijingconf yottaa_3.3Mongodb beijingconf yottaa_3.3
Mongodb beijingconf yottaa_3.3
 
Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Goo...
Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Goo...Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Goo...
Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Goo...
 
WebPerformance: Why and How? – Stefan Wintermeyer
WebPerformance: Why and How? – Stefan WintermeyerWebPerformance: Why and How? – Stefan Wintermeyer
WebPerformance: Why and How? – Stefan Wintermeyer
 
Cloud Security Monitoring and Spark Analytics
Cloud Security Monitoring and Spark AnalyticsCloud Security Monitoring and Spark Analytics
Cloud Security Monitoring and Spark Analytics
 
Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...
Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...
Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...
 
ACM BPM and elasticsearch AMIS25
ACM BPM and elasticsearch AMIS25ACM BPM and elasticsearch AMIS25
ACM BPM and elasticsearch AMIS25
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 

TDC São Paulo 2015 Ruby - Crescimento e performance em uma aplicação em Rails