SlideShare une entreprise Scribd logo
1  sur  108
Getting the most of your
applications


Ruby on
Rails
Getting the most of your
applications


Web
my dad
                is at
             about.me/

left right
I HAVE A   AND I HAVE A
 DAY JOB   NIGHT JOB
BUT FIRST!
A PERSONAL
OPINION.
Ruby   DOESN’T SCALE!!!11
WELL! THAT’S
BECAUSE
program
    ming
         DON’T
language SCALE
       s .
unless your website
is
HELLO
WORLD
o
YOU WORK AT
FACEBOOK
<
 PROGRAMMING LANGUAGE
APPLICATION ARCHITECTURE
SO.
TIPS,
TRICKS &
GOOD
THIS TALK

NO
GOLDEN
BULLETS
ABOUTAPPL
ICATION
NOTARCHIT
MONITORING
ORM
CACHING
OTHER
MONITORING
ORM
CACHING
OTHER
monitor
monitor
        everyth
        ing
TOOLS
left right
request-log-analyzer
github.com/wvanbergen/request-log-analyzer
EE
EE
so you have no reason not to
    monitor your application
profile
profile
       everyth
       ing
ruby-prof
github.com/rdp/ruby-prof
perftools.rb
github.com/tmm1/perftools.rb
rack-
perftools_profiler
github.com/bhb/rack-perftools_profiler
KNOW YOUR
APPLICATION!
MONITORING
ORM
CACHING
OTHER
queries queries queries   queries
 queries queries queries   queries
 queries queries queries   queries
 queries queries queries   queries
 queries queries queries   queries
queries queries queries    queries
 queries queries queries   queries
                           queries
IT IS WHAT

ORMS         DO
LET RAILS DO ITS JOB
t.references
LET RAILS DO ITS JOB
includes
REAL LIFE EXAMPLE
REAL LIFE EXAMPLE
class Subscription < ActiveRecord::Base
  belongs_to :user
  belongs_to :follower
end

class User < ActiveRecord::Base
  has_many :subscriptions_from
  has_many :subscriptions_to

  has_one    :avatar
  has_one    :background

  has_many   :update
  has_one    :current_update
end
FETCH USER’S
SUBSCRIPTIONS
USER HAS 2000
FOLLOWERS
USER FOLLOWS 30
USERS
A QUERY THAT
FETCHES IT ALL
LET’S DO THE MATH

@subscriptions = Subsciption.where(
  "`user_id` = ? OR `follower_id` = ?", @user.id, @user.id
)
2030 SUBSCRIPTIONS
+ 2030 * 2 USERS
+ 2030 * 2 AVATARS
+ 2030 * 2 BACKGROUNDS
+ 2030 * CURRENT UPDATES
= 16241 QUERIES
LET’S USE
include
@subscriptions = Subsciption.where(
  "`user_id` = ? OR `follower_id` = ?", @user.id, @user.id
).include({
  :user => [:avatar, :background, :current_status],
  :follower => [:avatar, :background, :current_status]
})
2030 SUBSCRIPTIONS
+ 2030 * 2 USERS
+ 2030 * 2 AVATARS
+ 2030 * 2 BACKGROUNDS
+ 2030 * CURRENT UPDATES
= 5 QUERIES
bullet
github.com/flyerhzm/bullet
LET RAILS DO ITS JOB
pluck
MONITORING
ORM
CACHING
OTHER
RAILS
HAS GREAT CACHING
BUT!
HTTP CACHING
IS ALWAYS BETTER
THAN APPLICATION
CACHING
NO CODE THAT YOU
WRITE
IS FASTER
THAN NO CODE



                                  


        

                         

                                                        

                                                            

                         

    


                                  

                                                   



       


          

       


       


CACHING IN RAILS

PAGE
ACTION
FRAGMENT
RAILS CACHE IS
KEY-BASED
RAILS CACHE IS
EASY!
IN GENERAL
CACHE EXPIRATION IS
HARD
THERE ARE ONLY
TWO HARD THINGS
IN COMPUTER
SCIENCE: CACHE
INVALIDATION AND
NAMING THINGSyou’ve never seen this,
             right? :-)
WHAT IF YOU DIDN’T
HAVE TO
EXPIRE CACHE?
<%= cache @record do %>
  <div>
    <%= @record.expensive_to_render %>
  </div>
<% end %>
CACHE KEY:
RECORD/
1-123456789123
DON’T EXPIRE!
LET KEYS AUTO-
EXPIRE
WITH LRU
USE MEMCACHED,
REDIS & OTHERS
WOULD YOU RATHER
WASTE SOME
MEMORY?
OR WOULD YOU
RATHER WASTE
HOURS OF CODING?
AND YOU CAN EXPIRE
RELATED OBJECTS
WITH
touch
WILL YOU EVER USE
PAGE CACHING? OR
ACTION CACHING?
YOU MIGHT.

Buy I don’t recommend.
USE VARNISH
FETCH WITH
JAVASCRIPT
USE VARNISH
PROCESS WITH
JAVASCRIPT
MONITORING
ORM
CACHING
OTHER
C EXTENSIONS
RUBY
IS SLOW
BUT C IS

VERY FAST
YOU ARE USING C
EXTENSIONS
ALREADY!
DATABASE DRIVERS
IT’S EASY TO WRITE C
EXTENSIONS
if you know C, that is!
MOST C EXTENSIONS
REQUIRE A LINE IN
GEMFILE
home_run
github.com/jeremyevans/home_run
07/MAY/
2012:06:26:56
+0200
* 1 000 000
RUBY: 53 SECONDS
HOME_RUN: 18
SECONDS
THINK   SCALE
nokogiri
github.com/tenderlove/nokogiri
hiredis
github.com/pietern/hiredis-rb
IT’S HARD TO WRITE
C EXTENSIONS
BACKGROUND
PROCESSING
background
    process
background  everyth
    process
            ing
delayed_job
github.com/collectiveidea/delayed_job
resque
github.com/defunkt/resque
sidekiq
github.com/mperham/sidekiq
COMMING SOON!
Rails.queue

In Ruby on Rails 4, due...
START SMALL AND
GROW
GO LIGHT
WHOLE STACK?
WHO NEEDS IT?!
FEATURE BLOAT?
the smallest rails app
thesmallestrailsapp.com
%w(action_controller/railtie coderay).map &method(:require)

run TheSmallestRailsApp ||= Class.new(Rails::Application) {
  config.secret_token = routes.append { root to: 'hello#world' }.inspect
  initialize!
}

class HelloController < ActionController::Base
  def world
    render inline: "
      <!DOCTYPE html>
      <title>The Smallest Rails App</title>
      <h3>I am the smallest rails app!</h3>
      <p>Here is my source code:</p>
      #{CodeRay.scan_file(__FILE__, :ruby).div(line_numbers: :table)}
      <a href='https://github.com/artemave/thesmallestrailsapp.com'>Small!</a>
    "
  end
end
HOW ABOUT
SINATRA?
HOW ABOUT RAILS-
API?
QUESTIONS?
https://joind.in/6473

Contenu connexe

Similaire à Getting the most out of your Ruby on Rails applications: from zero to hero

Android reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skypeAndroid reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skypeMário Almeida
 
Socket applications
Socket applicationsSocket applications
Socket applicationsJoão Moura
 
Ruby on Rails - The Best Track for your Start Up
Ruby on Rails - The Best Track for your Start UpRuby on Rails - The Best Track for your Start Up
Ruby on Rails - The Best Track for your Start UpPrateek Saxena
 
User Tracking with Google Analytics and how it survives the break of the Glo...
 User Tracking with Google Analytics and how it survives the break of the Glo... User Tracking with Google Analytics and how it survives the break of the Glo...
User Tracking with Google Analytics and how it survives the break of the Glo...Rafael Biriba
 
Web Technologies
Web TechnologiesWeb Technologies
Web Technologiesdynamis
 
Free The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own DomainFree The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own DomainKen Collins
 
Unleashing the Power of Automated Refactoring with JDT
Unleashing the Power of Automated Refactoring with JDTUnleashing the Power of Automated Refactoring with JDT
Unleashing the Power of Automated Refactoring with JDTNaresh Jain
 
Intro To Django
Intro To DjangoIntro To Django
Intro To DjangoUdi Bauman
 
Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with CucumberBen Mabey
 
Offline of web applications
Offline of web applicationsOffline of web applications
Offline of web applicationsFDConf
 
Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014Jan Jongboom
 
Open event (show&tell april 2016)
Open event (show&tell april 2016)Open event (show&tell april 2016)
Open event (show&tell april 2016)Jorge López-Lago
 
Infrastructure is development
Infrastructure is developmentInfrastructure is development
Infrastructure is developmentstahnma
 
WordCamp Belfast DevOps for Beginners
WordCamp Belfast DevOps for BeginnersWordCamp Belfast DevOps for Beginners
WordCamp Belfast DevOps for BeginnersStewart Ritchie
 
Mobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B ExperimentsMobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B Experimentslacyrhoades
 
Testing Adhearsion Applications
Testing Adhearsion ApplicationsTesting Adhearsion Applications
Testing Adhearsion ApplicationsLuca Pradovera
 

Similaire à Getting the most out of your Ruby on Rails applications: from zero to hero (20)

Android reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skypeAndroid reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skype
 
Automate Yo' Self
Automate Yo' SelfAutomate Yo' Self
Automate Yo' Self
 
Socket applications
Socket applicationsSocket applications
Socket applications
 
Ruby on Rails - The Best Track for your Start Up
Ruby on Rails - The Best Track for your Start UpRuby on Rails - The Best Track for your Start Up
Ruby on Rails - The Best Track for your Start Up
 
User Tracking with Google Analytics and how it survives the break of the Glo...
 User Tracking with Google Analytics and how it survives the break of the Glo... User Tracking with Google Analytics and how it survives the break of the Glo...
User Tracking with Google Analytics and how it survives the break of the Glo...
 
Web Technologies
Web TechnologiesWeb Technologies
Web Technologies
 
Free The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own DomainFree The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own Domain
 
Unleashing the Power of Automated Refactoring with JDT
Unleashing the Power of Automated Refactoring with JDTUnleashing the Power of Automated Refactoring with JDT
Unleashing the Power of Automated Refactoring with JDT
 
Intro To Django
Intro To DjangoIntro To Django
Intro To Django
 
Apache Lucene for Java EE Developers
Apache Lucene for Java EE DevelopersApache Lucene for Java EE Developers
Apache Lucene for Java EE Developers
 
Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with Cucumber
 
Offline of web applications
Offline of web applicationsOffline of web applications
Offline of web applications
 
Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014
 
redhat_intern
redhat_internredhat_intern
redhat_intern
 
Open event (show&tell april 2016)
Open event (show&tell april 2016)Open event (show&tell april 2016)
Open event (show&tell april 2016)
 
Infrastructure is development
Infrastructure is developmentInfrastructure is development
Infrastructure is development
 
WordCamp Belfast DevOps for Beginners
WordCamp Belfast DevOps for BeginnersWordCamp Belfast DevOps for Beginners
WordCamp Belfast DevOps for Beginners
 
Mobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B ExperimentsMobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B Experiments
 
Reusable Apps
Reusable AppsReusable Apps
Reusable Apps
 
Testing Adhearsion Applications
Testing Adhearsion ApplicationsTesting Adhearsion Applications
Testing Adhearsion Applications
 

Dernier

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
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 Processorsdebabhi2
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 

Dernier (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

Getting the most out of your Ruby on Rails applications: from zero to hero

Notes de l'éditeur

  1. \n
  2. i hope that everyone can learn something from this talk\nand I hope to learn something from you\n
  3. \n
  4. \n
  5. i want to get a little of the track\n
  6. my whole talk is build around this opinion\n
  7. well, it&amp;#x2019;s not a opinion, it&amp;#x2019;s a fact. or, a myth.\nruby is slow. ruby is slow COMPARED to.\nbut working with Rails is much effective than with any other framework\n
  8. \n
  9. they are not supposed to scale\nthey are only supposed to carry out the tasks that we learn them to do\n
  10. programming language matters (IN GENERAL) if you run a hello world benchmark\n
  11. or you run a website at a massive scale\nI mean thousands of server, where spinning down 10000 servers makes a hude difference in your budget\n
  12. and basically you almost always come to a conclusion that&amp;#x2019;s not your application that&amp;#x2019;s slow.\nand if it is it really simple to fix.\nit&amp;#x2019;s your architecture that&amp;#x2019;s failing\n
  13. \n
  14. and I hope to learn something from you too - feel free to interrupt at any time\n
  15. because every app is different\n
  16. this talk may help you solve some very obvious things with your application\nthis talk will not solve your architectural issues\n
  17. \n
  18. \n
  19. ASK: what do you want to monitor in your app?\nthere&amp;#x2019;s one thing that you want to monitor\n
  20. you want to monitor everything\nboth your application for bottlenecks and other issue\nand your server to simplify debugging - ie. your code won&amp;#x2019;t be fast if you disks are slow or you&amp;#x2019;re running out of memory\n
  21. some tools I can recommend\nthese tools are easy and FREE to start with\n
  22. monitors application performance\nbreaks down every aspect of your application - controller, database, templates, other\nit can monitor servers too!\n
  23. again - free to start and has a very nice graph set if you don&amp;#x2019;t want to roll out your own solution\nthough it gets expensive really fast so you might want to roll something on your own\n
  24. you what&amp;#x2019;s a great source of information?\nRails log files!\nyou might want to analyze them and create custom reports\n
  25. all these tools are free\n
  26. nagios, union station, munin, scout, plenty of others\n
  27. there&amp;#x2019;s one thing that you want to monitor\n
  28. you want to monitor everything\nboth your application for bottlenecks and other issue\nand your server to simplify debugging - ie. your code won&amp;#x2019;t be fast if you disks are slow or you&amp;#x2019;re running out of memory\n
  29. produces xdebug compatible output\n
  30. gets deeper into Ruby internals, based on Google perftools\n
  31. a droping for you rails application\n
  32. \n
  33. \n
  34. by default rails executes lots of queries\n
  35. that&amp;#x2019;s how orms work\nthat&amp;#x2019;s what keeps us, developers, happy &amp; productive\nthat&amp;#x2019;s what keeps our DBA loosing precious sleep\n
  36. you can use this shortcut when creating new tables\n
  37. always use includes when running queries\n
  38. always use includes when running queries\n
  39. always use includes when running queries\n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. replace distance of time in words with javascript counterpart\n
  74. \n
  75. \n
  76. \n
  77. \n
  78. do you know where?\n
  79. \n
  80. \n
  81. \n
  82. saves a lot on date parsing. and date / datetime parsing is incredibly slow in ruby\n
  83. \n
  84. \n
  85. \n
  86. this can become a huge number\n
  87. \n
  88. \n
  89. because of thread safety and other considerations\n
  90. \n
  91. there&amp;#x2019;s one thing that you want to monitor\n
  92. you want to monitor everything\nboth your application for bottlenecks and other issue\nand your server to simplify debugging - ie. your code won&amp;#x2019;t be fast if you disks are slow or you&amp;#x2019;re running out of memory\n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n
  100. \n
  101. \n
  102. \n
  103. \n
  104. \n
  105. \n
  106. \n
  107. so you can do plenty of stuff with Rails\nRails is amazing application development stack\nyou want to learn all its features - it definitely worth\n
  108. \n