alex brie . net

bloghez din 2003 despre mine, internet, prieteni si altele.
  • Blog
  • About
  • Contact
  • Articole preferate
  • Publicitate
  • Blogs
« Tot despre twitter
How to import Textpattern into Wordpress »

Ruby on Rails - 1-2-3 to performance analysis

March 28th, 2007 |

My cool colleagues from Trex Global gave me an unusual assignment this week: profile the current implementation of our first two apps, DeferEm and DepreciateEm.

Among the requests, the usual ones:

Request response duration
Execution profile of flow (path taken, time in methods)
SQL Queries made
Analyze and Identify performance bottlenecks - in-memory, sql query exec

After the initial despair of meeting the first time such a task, I remembered: after all, the development.log file records every controller method, action, view, SQL request as well as their execution times. So my first thought was to start digging into the log/development.log file and start grepping the heck out of it.

Wait. Don’t rush into it. There are other ways to do this.

So, after A LOT of googling, I found out about the cool and great Rails-Analyzer Rails performance analysis suite.

  • Step 1: gem install production_log_analyzer and gem install rails_analyzer_tools;
    try running pl_analyze log/development.log and see some weird errors related to logging.
  • Step 2: check out Geoffrey’s article over here ; download his logger replacement and add the two lines
    require 'hodel_3000_compliant_logger'
    config.logger = Hodel3000CompliantLogger.new(config.log_path)

    in the config/environment.rb file ; so now you get something like


    Rails::Initializer.run do |config|
    # Settings in config/environments/* take precedence those specified here
    require 'hodel_3000_compliant_logger'
    config.logger = Hodel3000CompliantLogger.new(config.log_path)

  • Step 3: Run again the pl_analyze command:
    pl_analyze log/development.log and enjoy the coolness of a beautiful report

Now I’m a happy man. But I still have work to do: ho do I find, for instance, the worst performing SQL requests?

We’ll see about that soon..
[tags]Rails, Ruby, performance, profiling, benchmark[/tags]

Daca esti nou pe aici, nu uita sa te abonezi la feedul meu RSS . Iti multumesc pentru vizita!


Postata in Rails, Tutorials | RSS 2.0 feed comentarii | Comenteaza; Trackback.

5 Responses to “Ruby on Rails - 1-2-3 to performance analysis”

  1. Gravatar mofturos:
    April 27th, 2007 at 11:35 am

    http://blog.cbcg.net/articles/2007/04/22/python-up-ruby-down-if-that-runtime-dont-work-then-its-bound-to-drizzown

  2. Gravatar Alex:
    April 27th, 2007 at 11:48 am

    thanks for the link, but let’s not start a flame over python vs ruby: i agree, python is faster than ruby; but one must also acknowledge that rails is years ahead of django productivity-wise; simply put, the Rails community is HUGE.

    Sure, once you become as famous as twitter you’re bound to have make some major performance tweaks, or else you’re doomed; still, there are some major websites out there running rails, and it seems like there’s nothing some perf tuning and extra servers won’t manage…

  3. Gravatar Alex:
    April 27th, 2007 at 11:49 am

    from the article you pointed above:

    : I think Rails is great for what it is and I’ve had nothing but good experiences with it precisely because it is so “opinionated”. Its a very productive environment and manages to successfully avoid the runtime problems that I’ve personally hit in the past. I hope that the Ruby community can really bang out a worthwhile runtime in the coming year and if they do, I’m back on board. If I get some time, I might even help out where I can.

  4. Gravatar juantomas:
    May 11th, 2007 at 1:29 pm

    I was mad about that. Thanks for the post and the reference about Rails Analyzer tools!!!

  5. Gravatar ruby on rails - the learn blog » Blog Archive » A few more days …:
    November 3rd, 2007 at 3:29 pm

    […] write code like here. Filed in […]

Leave a Reply

  • Despre Alex Brie

    View Alexandru Brie's profile on LinkedIn

    Bloger pasionat din septembrie 2003.
    Software engineer; master in cercetare algoritmica la Ecole Polytechnique Paris; a lucrat in Paris in software bursier.

    Inapoi in Romania din 2006, programeaza Ruby on Rails pentru un startup american, este consultant independent, blogger si antreprenor cu diverse proiecte online
    [afla mai multe..]

    Aboneaza-te RSS(Romanian)

      
    Acum te poti abona si prin email.

    Subscribe(English)

    Twitter


  • Recomand

    eLiberatica 2008 - The Benefits of Open and Free Technologies Conference jurnal de fapte bune cele mai importante bloguri din .ro, pe o singura pagina
  • Articole recente

    • La Radio.. vreau sa ajung la Radio…
    • Hotii de cuvinte
    • BD cu Emo
    • 4 ponturi despre cum s-ar putea imbunatati Vodafone *222 si nu numai
    • Oscarul zilei la categoria bloguri
    • Publicitati pe bloguri si testari de produse
    • Scurte ale ultimelor zile
    • Videoclipuri facute de fani.. amatori?
    • De ce a devenit stupid sa-i injuri pe bloggeri.
    • Marius Tuca - onanist ca toti onanistii…
    • Vodafone steluta 222 si un glont in cap
    • Matrix pi dulsili grai basarabean
    • Bobby Yahoo
    • Blog Marketing Survey
    • Cauta pe Trilulilu direct din Firefox
  • Comentarii recente

    • A.Faith on La Radio.. vreau sa ajung la Radio…
    • Handy on Functional tests with login in Rails
    • sorecarul on Hotii de cuvinte
    • Janos on BD cu Emo
    • Ahilosu on BD cu Emo
    • Anal Avenger on The most amazing useless talent I ever saw
    • Kappacelu` on Hotii de cuvinte
    • Piku on Banca Transilvania
    • Alina on BD cu Emo
    • A.Faith on Videoclipuri facute de fani.. amatori?
    • A.Faith on Publicitati pe bloguri si testari de produse
    • bubu on BD cu Emo
    • alexandru petria on BD cu Emo
    • 4 ponturi despre cum s-ar putea imbunatati Vodafone *222 si nu numai | alex brie . net on Vodafone steluta 222 si un glont in cap
    • Alex on Continuare la C-net/Ilink - din ce in ce mai varza…
  • Archives

  • Categories

    • Blog (1268)
      • carcoteli (3)
      • English (12)
      • evenimente (3)
      • FILMS (33)
      • French (3)
      • fun (54)
      • intrebari (4)
      • jocuri (3)
      • matematica (1)
      • PHOTO (143)
        • desene (11)
        • flori (2)
        • oua rosii (1)
      • Projects (75)
        • business (29)
        • ROSI (11)
      • Romanian (114)
        • aici (46)
        • repat (33)
      • scurte (7)
      • Software (23)
        • .mac (20)
      • stiati ca (4)
      • Stiri IT Media si Internet (38)
      • Technicalities (65)
      • Web (447)
        • links (147)
        • Memes (54)
        • video (52)
    • dev (19)
      • Open Source (1)
      • Rails (7)
      • Ruby (7)
      • Textpattern (2)
      • Tips and Tricks (8)
      • Tutorials (6)
      • Wordpress (6)
    • Words (127)
      • essays (31)
      • Politice (38)
      • vss[very short stories] (5)
  • Poze recente

    IMG_0319 IMG_0287 IMG_0325 IMG_0330 IMG_0349 IMG_0326 IMG_0272 IMG_0318 IMG_0279 IMG_0290 IMG_0273 IMG_0270 IMG_0282 IMG_0350 IMG_0315 IMG_0276 IMG_0336 IMG_0286 IMG_0269 IMG_0348
    View more photos >
  • Tags

    Apple Blog blogging blogosfera bloguri blogvertising bucuresti business comics Digg FILMS fun Google internet intrebari iPhone iread jocuri Leopard links Manafu marketing myblog online OSX personal PHOTO Politice poze proiecte publicitate Rails roblogfest Romania Romanian Ruby spam stiri twitter viata video viral Web Wordpress youtube

Entries (RSS) and Comments (RSS).
Theme inspired by CrunchNotes, by Alex Brie.

Copyright © 2005-2008 alex brie . net. Unele articole pot contine tematici sau linkuri sponsorizate. Opiniile si idele sunt intodeauna ale autorului, care le imbratiseaza si le sustine.