Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Railswaycon 2009 - Summary

1,700 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Railswaycon 2009 - Summary

  1. 1. begin RailsWayCon.new ... Zusammenfassung der Ruby on Rails Konferenz 2009 in Berlin Daniel Mattes, 4. Juni 2009
  2. 2. Über mich Daniel Mattes Angestellter bei der BurdaWireless GmbH email: dm@actsasblog.de http://www.xing.com/profile/Daniel_Mattes2 http://www.actsasblog.de 04.06.2009 RailsWayCon 2009 2
  3. 3. Agenda Asynchronous Processing in Ruby HAML/SASS/COMPASS JRuby Rails Performance Frontend Optimization jQuery …others 04.06.2009 RailsWayCon 2009 3
  4. 4. Asynchronous Processing in Ruby Title: The State of Asynchronous Processing in Ruby - Mathias Meyer Slides: http://www.paperplanes.de/2009/5/27/rails waycon_slides.html Links http://github.com/ezmobius/nanite/tree/master http://www.rabbitmq.com/ http://github.com/tobi/delayed_job/tree/master 04.06.2009 RailsWayCon 2009 4
  5. 5. Asynchronous Processing in Ruby When? Requests are taking too long Tasks on a certain time Longer running tasks 04.06.2009 RailsWayCon 2009 5
  6. 6. Asynchronous Processing in Ruby Nanite (the big one) Using RabbitMQ Scalling Build in error/exceptions reports Recommendations simple delayed_jobs distributed When using EC2 -> Amazon SQS heavy load, scalable Nanite/RabbitMQ 04.06.2009 RailsWayCon 2009 6
  7. 7. HAML/SASS/COMPASS Title: Show the Frontend some Love: HAML and SASS - Jan Krutisch Slides: http://www.slideshare.net/jan_mindmatters /haml-sass-and-compass Links http://haml.hamptoncatlin.com/ http://haml.hamptoncatlin.com/docs/rdoc 04.06.2009 RailsWayCon 2009 7
  8. 8. HAML ERB HAML <div id='content'> #content <div class='left column'> .left.column <h2>Welcome to our %h2 Welcome to our site! site!</h2> %p= print_information <p> .right.column= render <%= print_information %> :partial => quot;sidebarquot; </p> </div> <div class=quot;right columnquot;> <%= render :partial => quot;sidebarquot; %> </div> </div> 04.06.2009 RailsWayCon 2009 8
  9. 9. HAML HAML outputs beautiful code gem install haml automatically creates self-closing tags for img, br,... attributes ruby hash syntax: %head{ :language => 'german'} & html_escape can be set as default == interpolates ruby strings -= don't output, e. g. for .each automated id generation: %li[obj] <li id=obj.id..... / output html comments you can migrate your erb step by step 04.06.2009 RailsWayCon 2009 9
  10. 10. SASS SASS CSS !main_bg= #46ar12 !main_width= 40em #main { background-color: #46a312; #main width: 40em; } :background-color= !main_bg #main .sidebar { :width= !main_width background-color: #79d645; .sidebar width: 15em; } :background-color= !main_bg + #333333 :width= !main_width - 25em 04.06.2009 RailsWayCon 2009 10
  11. 11. SASS SASS installation: its included in haml you can create nested styles you can create constants can do calculations mixins, by using = for definition, + for usage you can use loops 04.06.2009 RailsWayCon 2009 11
  12. 12. COMPASS COMPASS = CSS-Framework 04.06.2009 RailsWayCon 2009 12
  13. 13. Migration to JRuby Title: The Pleasure and Pain of Migrating to jRuby - Steven Bristol Why switch? performance scalability java api 04.06.2009 RailsWayCon 2009 13
  14. 14. Migration to JRuby Problems: Gems like ferret, file_column take other solutions Deployment with Glassfish Complicated much slower than with mongrel Recommendation If you don‘t need to convert your hole app, just build a small application which exposes a rest interface. 04.06.2009 RailsWayCon 2009 14
  15. 15. Rails Performance Title: Rails Performance - Michael Koziarski first focus to frontend performance yslow: http://developer.yahoo.com/yslow/ javascript_include_tag:defaults, :cache => true My suggestion http://github.com/yolk/rucksack/tree/master It‘s a packer like asset_package, asset_compressor sprite your images: http://websitetips.com/articles/css/sprites/ 04.06.2009 RailsWayCon 2009 15
  16. 16. Rails Performance 1. What is slow? heavily used? cache etags last updated header Expires header browser don't look for a specific time fresh_when 04.06.2009 RailsWayCon 2009 16
  17. 17. Rails Performance 2. Why is it slow? performance tests rake test:benchmark NewRelic RPM: http://www.newrelic.com/ Fiveruns Tuneup: http://www.fiveruns.com/ http://github.com/dsboulder/query_reviewer/tree/m aster 04.06.2009 RailsWayCon 2009 17
  18. 18. Rails Performance 3. Improve it often used image create image tag manually look at url generators look at garbage collection RUBY_HEAP_MIN_SLOTS RUBY_GC_MALLOC_LIMIT RUBY_HEAP_FREE_MIN 04.06.2009 RailsWayCon 2009 18
  19. 19. Rails Performance At least… you can start to cache, scale, db partitioning,… http://railslab.newrelic.com/scaling-rails 04.06.2009 RailsWayCon 2009 19
  20. 20. Frontend Optimazation Title: Boost your Website's Performance with Frontend Optimization - Ralph von der Heyden Slides: http://www.slideshare.net/ralphvdh/front- end-performance-railswaycon-2009-short- talk 04.06.2009 RailsWayCon 2009 20
  21. 21. Frontend Optimazation Why? e. g. Amazon sells 1% less stuff per 100ms more loading time Backend: 10 % loading time Frontend: 90 % loading time Who? Fewer Requests Smaller Requests Speed up Requests 04.06.2009 RailsWayCon 2009 21
  22. 22. Frontend Optimazation Fewer requests Join CSS/Javascripts Sprite images expires header 04.06.2009 RailsWayCon 2009 22
  23. 23. Frontend Optimazation Smaller requests gzip your text Apache: mod_deflate minify js and css images png is usually smaller than gif strip JPG meta data http://smush.it/ 04.06.2009 RailsWayCon 2009 23
  24. 24. Frontend Optimazation Speed up requests most browsers load 2 files per host Multiple domains for static content Rails: Set 4 asset hosts 8 parallel downloads config.action_controller.asset_host = „http://assets%d.foobar.com“ Content Delivery Networks for static files 04.06.2009 RailsWayCon 2009 24
  25. 25. Frontend Optimazation Tools? Firebug YSlow 04.06.2009 RailsWayCon 2009 25
  26. 26. jQuery Title: jQuery with Rails - Yehuda Katz Slides: http://yehudakatz.com/wp- content/uploads/2009/05/jquerytutorial.pdf Links http://docs.jquery.com/Main_Page Why? Write less, do more! Separation of JavaScript and HTML A lot of plugins 04.06.2009 RailsWayCon 2009 26
  27. 27. jQuery Observer $(“h1”).click(function() { $(this).fadeIn(); }); Selectors #id, element, .class, class.class parent, child, prev, next :first, :last, :not(..) [attribute=value] $(quot;input[name='newsletter']quot;).next().text(quot; is newsletterquot;); 04.06.2009 RailsWayCon 2009 27
  28. 28. jQuery Traversal $(“div”).attr(“id”, “hello”) $(“div”).removeAttr(“id”); $(“div”).addClass(“foo”) $(“div”).toggleClass(“foo”) $(“div”).html(“<p>Hello</p>”) Manipulation $(“div”).append(“<p>Hello</p>”) $(“<p>Hello</p>”).insertAfter(“div”) 04.06.2009 RailsWayCon 2009 28
  29. 29. jQuery $(document).ready(function() { ... }) $(“div”).bind(“click”, function() { ... }) Alias: $(“div”).click(function() { ... }) $(“div”).hover(function() { ... }, function() { ... }) $(“div”).toggle(function() { ... }, function() { ... }) $(“div”).live(“click”, function() { ... }) 04.06.2009 RailsWayCon 2009 29
  30. 30. jQuery $(“div”).fadeIn() $(“div”).fadeOut(“slow”) $(“div”).slideUp(200) $(“div”).slideDown(“slow”) $(“div”).animate({height: “toggle”, opacity: “toggle”}) $(“div”).animate({fontSize: “24px”, opacity: 0.5}, {easing: “expo”}) 04.06.2009 RailsWayCon 2009 30
  31. 31. Others Ruby sittin on the Couch - Alexander Lang http://www.slideshare.net/langalex/ruby-sittin- on-the-couch it uses javascript restful http interface it scales optimistic locking replication written in erlang it saves json 04.06.2009 RailsWayCon 2009 31
  32. 32. Others From Rails to Rack: Making Rails 3 a better Ruby Citizen - Yehuda Katz http://pivotallabs.com/users/woosley/blog/artic les/878-from-rails-to-rack-making-rails-3-a- better-ruby-citizen-yehuda-katz- Features Middleware rack-tests different ORMs (ActiveRecord, DataMapper,…) Javascript no more Prototype-specefic (jQuery, Mootools,…) faster Filters and Controllers 04.06.2009 RailsWayCon 2009 32
  33. 33. Others Ruby/Rails in the Enterprise - Maik Schmidt xml use libxml for xml operations implemented in c very fast you can validate by schema internationalization 04.06.2009 RailsWayCon 2009 33
  34. 34. ... rescue TimeLimitExceeded puts quot;...habe fertig!quot; puts quot;danke ;-)quot; end 04.06.2009 RailsWayCon 2009 34

×