SlideShare a Scribd company logo
1 of 66
JRuby on
                          Rails




                        fabio.kung@caelum.com.br
Monday, March 2, 2009
http://www.robert-tolksdorf.de/vmlanguages.html




Monday, March 2, 2009
DSLs


Monday, March 2, 2009
DSLs
                           Externa
         Interna (host)


Monday, March 2, 2009
HAPPY INTERNATIONAL
                        INVOKEDYNAMIC DAY




                                           JSR-292


                            http://openjdk.java.net/projects/mlvm/
Monday, March 2, 2009
Monday, March 2, 2009
Mas e por que
                           Java?




                                        “por que?”
Monday, March 2, 2009
Memória
                          Heap


                          objeto


                          objeto
                          objeto


                          objeto


                          objeto
                          objeto


                          objeto


Monday, March 2, 2009
Memória
                          Heap


                          objeto


                          objeto
                          objeto


                          objeto


                          objeto
                          objeto


                          objeto


Monday, March 2, 2009
Memória
                          Heap


                          objeto


                          objeto
                          objeto


                          objeto


                          objeto
                          objeto


                          objeto


Monday, March 2, 2009
Memória
                          Heap


                          objeto


                          objeto
                          objeto


                          objeto


                          objeto
                          objeto


                          objeto


Monday, March 2, 2009
Memória
                          Heap


                          objeto


                          objeto
                          objeto


                          objeto


                          objeto
                          objeto


                          objeto


Monday, March 2, 2009
95% dos
       objetos tem vida
            curta




Monday, March 2, 2009
Mortalidade Infantil
                               Memória Heap

                    Eden                      Tenured




Monday, March 2, 2009
Mortalidade Infantil
                               Memória Heap

                    Eden                      Tenured




Monday, March 2, 2009
Mortalidade Infantil
                                     Memória Heap

                    Eden                            Tenured



           objeto


                        objeto


                            objeto
           objeto



Monday, March 2, 2009
Mortalidade Infantil
                                     Memória Heap

                    Eden                            Tenured



           objeto


                        objeto


                            objeto
           objeto



Monday, March 2, 2009
Mortalidade Infantil
                                 Memória Heap

                    Eden                        Tenured



           objeto


                        objeto
                                                objeto



           objeto



Monday, March 2, 2009
Flexibilidade
               • Serial
               • ParNew
               • Parallel Scavenge
               • Serial Old
               • CMS
               • Parallel Old
               • G1
   http://blogs.sun.com/jonthecollector/entry/our_collectors
Monday, March 2, 2009
Ea
                        performance?



Monday, March 2, 2009
http://headius.blogspot.com/2008/02/jruby-rc2-released-whats-next.html




         JRuby's performance
      regularly exceeds Ruby
     1.8.6, and in many cases has
     started to exceed Ruby 1.9




http://www.flickr.com/photos/diathesis/2115578333/
Monday, March 2, 2009
JIT Compiler




Monday, March 2, 2009
Startup


               • -X:bootclasspath
               • Nailgun:
                        http://www.martiansoftware.com/nailgun/




Monday, March 2, 2009
Startup
               • -X:bootclasspath
               • Nailgun:
                        http://www.martiansoftware.com/nailgun/

                               Nailgun
                                         tcp/ip
                               Client

                               Nailgun
                                         tcp/ip   JVM Server
                               Client

                               Nailgun
                                         tcp/ip
                               Client

Monday, March 2, 2009
Rails não
                     escala!




Monday, March 2, 2009
http://www.akitaonrails.com/2008/4/19/di-rio-de-bordo-do-fisl-9




                                           Sim! Rails
                                            escala!



http://picasaweb.google.com/leo.torres84/FISL2008
Monday, March 2, 2009
Ruby on Rails



                        http   WebServer         Rails
                                           CGI




                                                         “como?”
Monday, March 2, 2009
Ruby on Rails

                                                 Rails
                                           CGI



                        http   WebServer         Rails
                                           CGI



                                           CGI   Rails



                                                         “como?”
Monday, March 2, 2009
Ruby on Rails


                               Proxy Reverso
                                                      Mongrel
                        http         /         http    Rails
                               Load Balancer




Monday, March 2, 2009
Ruby on Rails

                                                      Mongrel
                                               http    Rails


                               Proxy Reverso          Mongrel
                        http         /         http    Rails
                               Load Balancer


                                                      Mongrel
                                               http
                                                       Rails




Monday, March 2, 2009
JRuby on Rails
                                  container




                        http     Servlet




Monday, March 2, 2009
JRuby on Rails
                                         container

                               Thread

                               Thread

                               Thread
                        http            Servlet

                               Thread

                               Thread




Monday, March 2, 2009
JRuby on Rails
                                         container

                               Thread

                               Thread

                                                       Rails
                               Thread
                        http            Servlet
                                                     (JRuby)

                               Thread

                               Thread




Monday, March 2, 2009
JRuby on Rails
                                         container

                                                       Rails
                               Thread
                                                     (JRuby)
                               Thread

                                                       Rails
                               Thread
                        http            Servlet
                                                     (JRuby)

                               Thread

                                                       Rails
                               Thread
                                                     (JRuby)




Monday, March 2, 2009
JRuby on Rails
                                                      container

                                                                    Rails
                                     Thread
                                                                  (JRuby)
                                     Thread


                        Goldspike                                   Rails
                                     Thread
                        http                        Servlet
                                                                  (JRuby)
                           http://wiki.jruby.org/wiki/Goldspike
                                      Thread

                                                                    Rails
                                     Thread
                                                                  (JRuby)




Monday, March 2, 2009
JRuby Rack

                                                             Rails
                                 Thread             rack
                                                           (JRuby)
                                 Thread
                                          Filter
                                                             Rails
                                 Thread
                        http              Servlet   rack
                                           JRuby           (JRuby)
                                            Rack
                                 Thread

                                                             Rails
                                 Thread             rack
                                                           (JRuby)




Monday, March 2, 2009
JRuby Rack

                                                                    Rails
                                   Thread                  rack
                                                                  (JRuby)
                                   Thread


                                Merb?
                                                  Filter
                                                                    Rails
                                   Thread
                        http                     Servlet   rack
                                                  JRuby           (JRuby)
                                                   Rack
                                http://merbivore.com/
                                   Thread

                                                                    Rails
                                   Thread                  rack
                                                                  (JRuby)




Monday, March 2, 2009
I agree, the
                        memory situation
                         is not the best




                                                but compared to
                                          MRI, JRuby deployments are
                                        actually favorable. We're seeing
                                        around 20MB per runtime
                                             in our deployment, ...




    http://www.flickr.com/photos/nicksieger
Monday, March 2, 2009
Rails 2.2 is

                 thread-safe!




             http://joshpeek.com/
Monday, March 2, 2009
-server -Xmx1024m

            httperf --num-conns 100 --rate 10


         class HomeController < ApplicationController
           def index
             render :text =>
               quot;<html>fibonnaci(29) = #{fibonacci(29)}</html>quot;
           end

           private
           def fibonacci(number)
             return number if number < 2
             fibonacci(number - 1) + fibonacci(number - 2)
           end
         end


Monday, March 2, 2009
Tomcat
                  1 runtime, thread-safe: 176 MB
                       3 runtimes: 200 MB
                       5 runtimes: 244 MB

                                              Jetty
                                   1 runtime, thread-safe: 193 MB
                                        3 runtimes: 204 MB
                                        5 runtimes: 245 MB

                        Glassfish
     1 runtime, thread-safe: 315 MB
          3 runtimes: 370 MB
          5 runtimes: 417 MB
Monday, March 2, 2009
jruby -S gem install mongrel
     cd railsapp
     jruby script/server


                        Glassfish v3 (gem)
                        http://wiki.jruby.org/wiki/JRuby_on_Rails_in_GlassFish



     jruby -S gem install glassfish
     jruby -S glassfish

Monday, March 2, 2009
Warbler
                        http://wiki.jruby.org/wiki/Warbler




                jruby -S gem install warbler
                cd railsapp
                jruby -S warble




Monday, March 2, 2009
Monday, March 2, 2009
jruby -S gem install jetty-rails
         cd railsapp
         jruby -S jetty_rails




                        http://jetty-rails.rubyforge.org/
Monday, March 2, 2009
Eu ouvi dizer
                        que Jruby é
                          lento!




Monday, March 2, 2009
Monday, March 2, 2009
httperf --num-conns 2500 --rate 25




            guj2: ~20 resp/s


Monday, March 2, 2009
httperf --num-conns 8000 --rate 140




Monday, March 2, 2009
httperf --num-conns 8000 --rate 140




         guj3: ~140 resp/s

                                                              vs 20 resp/s
Monday, March 2, 2009
“como?”
Monday, March 2, 2009
Cache!



Monday, March 2, 2009
Cache!
                                   container
                          Rails
                        (JRuby)          Servlet Context

                                       fragmento
                                                   fragmento
                          Rails      fragmento
                                          fragmento
                        (JRuby)
                                                   fragmento
                                       fragmento
                                                   fragmento
                                     fragmento
                          Rails
                        (JRuby)




Monday, March 2, 2009
Conexões ao banco



Monday, March 2, 2009
Mongrel
                         http    Rails



                                Mongrel
                         http    Rails


         Proxy Reverso          Mongrel
               /         http    Rails
         Load Balancer


                                Mongrel
                         http    Rails



                                Mongrel
                         http    Rails

Monday, March 2, 2009
Mongrel
                         http    Rails



                                Mongrel
                         http    Rails


         Proxy Reverso          Mongrel
               /         http    Rails


                            Pool?
         Load Balancer


                                Mongrel
                         http    Rails



                                Mongrel
                         http    Rails

Monday, March 2, 2009
JRuby
                                            Connection Pool
                        Runtime



                         JRuby
                        Runtime


                                   JDBC
                         JRuby
       JRuby Rack                 Adapter
                        Runtime
          Filter                   (jndi)


                         JRuby
                        Runtime



                         JRuby
                        Runtime

Monday, March 2, 2009
“”             Não importa a tecnologia,




Monday, March 2, 2009
“”             Não importa a tecnologia,
        desde que você a
      conheça muito bem!
Monday, March 2, 2009
+

Monday, March 2, 2009
http://code.google.com/p/activehibernate/


  class Person
    include Hibernate
    primary_key_accessor :id, :long
    h_component :address, [[:street,:string], [:city,:string]]
  end


Monday, March 2, 2009
No. Ribs!

      class Blog
        Ribs! :table => :fox_blog do |r|
          r.id.primary_key!
          r.title :column => :blog_title
          r.body :column => :content_text

          r.something.avoid!
        end
      end

Monday, March 2, 2009
Spring
    <beans xmlns=quot;...quot;>
      <lang:jruby id=quot;messageServicequot;
                  script-interfaces=quot;br.com.caelum.Messengerquot;
                  script-source=quot;classpath:ruby_messenger.rbquot;>
        <lang:property name=quot;messagequot; value=quot;Hello World!quot;/>
      </lang:jruby>

      <bean id=quot;businessLogicquot; class=quot;br.com.caelum.Logicquot;>
        <constructor-arg ref=quot;messageServicequot; />
      </bean>
    </beans>




Monday, March 2, 2009
MagLev




Monday, March 2, 2009
(J)MagLev




Monday, March 2, 2009
Dúvidas?




                                               Obrigado!


                        fabio.kung@caelum.com.br
Monday, March 2, 2009

More Related Content

Similar to JRuby on Rails

iPod iLearn
iPod iLearniPod iLearn
iPod iLearnjjash
 
RefreshPhilly Presentation February 09
RefreshPhilly Presentation February 09RefreshPhilly Presentation February 09
RefreshPhilly Presentation February 09Johnny Bilotta
 
Carrington CMS Theme Framework for WordPress
Carrington CMS Theme Framework for WordPressCarrington CMS Theme Framework for WordPress
Carrington CMS Theme Framework for WordPressalexkingorg
 
Internationalization of your homepage
Internationalization of your homepageInternationalization of your homepage
Internationalization of your homepagegutskun
 
OpenID DrupalCon 2009
OpenID DrupalCon 2009OpenID DrupalCon 2009
OpenID DrupalCon 2009James Walker
 
Web2.0 - wat is dat beest?
Web2.0 - wat is dat beest?Web2.0 - wat is dat beest?
Web2.0 - wat is dat beest?Bart De Waele
 
Ruby On Rails Presentation Barcamp Antwerp.Key
Ruby On Rails Presentation Barcamp Antwerp.KeyRuby On Rails Presentation Barcamp Antwerp.Key
Ruby On Rails Presentation Barcamp Antwerp.KeyBert Goethals
 
Building Apis That Rock
Building Apis That RockBuilding Apis That Rock
Building Apis That RockJeff Eaton
 
Speak To Win08(No Video)
Speak To Win08(No Video)Speak To Win08(No Video)
Speak To Win08(No Video)NarrativePros
 

Similar to JRuby on Rails (11)

Desk To Mobile
Desk To MobileDesk To Mobile
Desk To Mobile
 
iPod iLearn
iPod iLearniPod iLearn
iPod iLearn
 
RefreshPhilly Presentation February 09
RefreshPhilly Presentation February 09RefreshPhilly Presentation February 09
RefreshPhilly Presentation February 09
 
Carrington CMS Theme Framework for WordPress
Carrington CMS Theme Framework for WordPressCarrington CMS Theme Framework for WordPress
Carrington CMS Theme Framework for WordPress
 
Internationalization of your homepage
Internationalization of your homepageInternationalization of your homepage
Internationalization of your homepage
 
OpenID DrupalCon 2009
OpenID DrupalCon 2009OpenID DrupalCon 2009
OpenID DrupalCon 2009
 
Web2.0 - wat is dat beest?
Web2.0 - wat is dat beest?Web2.0 - wat is dat beest?
Web2.0 - wat is dat beest?
 
Ruby On Rails Presentation Barcamp Antwerp.Key
Ruby On Rails Presentation Barcamp Antwerp.KeyRuby On Rails Presentation Barcamp Antwerp.Key
Ruby On Rails Presentation Barcamp Antwerp.Key
 
Building Apis That Rock
Building Apis That RockBuilding Apis That Rock
Building Apis That Rock
 
Communicatie 2.0
Communicatie 2.0Communicatie 2.0
Communicatie 2.0
 
Speak To Win08(No Video)
Speak To Win08(No Video)Speak To Win08(No Video)
Speak To Win08(No Video)
 

More from Fabio Kung

DockerCon 2014: Thoughts on interoperable containers
DockerCon 2014: Thoughts on interoperable containersDockerCon 2014: Thoughts on interoperable containers
DockerCon 2014: Thoughts on interoperable containersFabio Kung
 
Linux Containers at scale: challenges in a very dense environment
Linux Containers at scale: challenges in a very dense environmentLinux Containers at scale: challenges in a very dense environment
Linux Containers at scale: challenges in a very dense environmentFabio Kung
 
Dicas e truques para ser um bom inquilino no Cloud
Dicas e truques para ser um bom inquilino no CloudDicas e truques para ser um bom inquilino no Cloud
Dicas e truques para ser um bom inquilino no CloudFabio Kung
 
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to ProductionRuby and Rails Packaging to Production
Ruby and Rails Packaging to ProductionFabio Kung
 
Ruby 2.0: to infinity... and beyond!
Ruby 2.0: to infinity... and beyond!Ruby 2.0: to infinity... and beyond!
Ruby 2.0: to infinity... and beyond!Fabio Kung
 
Cloud IaaS - Detalhes da Infraestrutura como Serviço
Cloud IaaS - Detalhes da Infraestrutura como ServiçoCloud IaaS - Detalhes da Infraestrutura como Serviço
Cloud IaaS - Detalhes da Infraestrutura como ServiçoFabio Kung
 
Usando o Cloud
Usando o CloudUsando o Cloud
Usando o CloudFabio Kung
 
Storage para virtualização
Storage para virtualizaçãoStorage para virtualização
Storage para virtualizaçãoFabio Kung
 
Automacao devops
Automacao devopsAutomacao devops
Automacao devopsFabio Kung
 
DSLs Internas e Ruby
DSLs Internas e RubyDSLs Internas e Ruby
DSLs Internas e RubyFabio Kung
 
Onde mora a produtividade do Ruby on Rails?
Onde mora a produtividade do Ruby on Rails?Onde mora a produtividade do Ruby on Rails?
Onde mora a produtividade do Ruby on Rails?Fabio Kung
 
Ruby, muito mais que reflexivo
Ruby, muito mais que reflexivoRuby, muito mais que reflexivo
Ruby, muito mais que reflexivoFabio Kung
 
SOA não precisa ser buzzword
SOA não precisa ser buzzwordSOA não precisa ser buzzword
SOA não precisa ser buzzwordFabio Kung
 

More from Fabio Kung (13)

DockerCon 2014: Thoughts on interoperable containers
DockerCon 2014: Thoughts on interoperable containersDockerCon 2014: Thoughts on interoperable containers
DockerCon 2014: Thoughts on interoperable containers
 
Linux Containers at scale: challenges in a very dense environment
Linux Containers at scale: challenges in a very dense environmentLinux Containers at scale: challenges in a very dense environment
Linux Containers at scale: challenges in a very dense environment
 
Dicas e truques para ser um bom inquilino no Cloud
Dicas e truques para ser um bom inquilino no CloudDicas e truques para ser um bom inquilino no Cloud
Dicas e truques para ser um bom inquilino no Cloud
 
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to ProductionRuby and Rails Packaging to Production
Ruby and Rails Packaging to Production
 
Ruby 2.0: to infinity... and beyond!
Ruby 2.0: to infinity... and beyond!Ruby 2.0: to infinity... and beyond!
Ruby 2.0: to infinity... and beyond!
 
Cloud IaaS - Detalhes da Infraestrutura como Serviço
Cloud IaaS - Detalhes da Infraestrutura como ServiçoCloud IaaS - Detalhes da Infraestrutura como Serviço
Cloud IaaS - Detalhes da Infraestrutura como Serviço
 
Usando o Cloud
Usando o CloudUsando o Cloud
Usando o Cloud
 
Storage para virtualização
Storage para virtualizaçãoStorage para virtualização
Storage para virtualização
 
Automacao devops
Automacao devopsAutomacao devops
Automacao devops
 
DSLs Internas e Ruby
DSLs Internas e RubyDSLs Internas e Ruby
DSLs Internas e Ruby
 
Onde mora a produtividade do Ruby on Rails?
Onde mora a produtividade do Ruby on Rails?Onde mora a produtividade do Ruby on Rails?
Onde mora a produtividade do Ruby on Rails?
 
Ruby, muito mais que reflexivo
Ruby, muito mais que reflexivoRuby, muito mais que reflexivo
Ruby, muito mais que reflexivo
 
SOA não precisa ser buzzword
SOA não precisa ser buzzwordSOA não precisa ser buzzword
SOA não precisa ser buzzword
 

Recently uploaded

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Recently uploaded (20)

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

JRuby on Rails

  • 1. JRuby on Rails fabio.kung@caelum.com.br Monday, March 2, 2009
  • 4. DSLs Externa Interna (host) Monday, March 2, 2009
  • 5. HAPPY INTERNATIONAL INVOKEDYNAMIC DAY JSR-292 http://openjdk.java.net/projects/mlvm/ Monday, March 2, 2009
  • 7. Mas e por que Java? “por que?” Monday, March 2, 2009
  • 8. Memória Heap objeto objeto objeto objeto objeto objeto objeto Monday, March 2, 2009
  • 9. Memória Heap objeto objeto objeto objeto objeto objeto objeto Monday, March 2, 2009
  • 10. Memória Heap objeto objeto objeto objeto objeto objeto objeto Monday, March 2, 2009
  • 11. Memória Heap objeto objeto objeto objeto objeto objeto objeto Monday, March 2, 2009
  • 12. Memória Heap objeto objeto objeto objeto objeto objeto objeto Monday, March 2, 2009
  • 13. 95% dos objetos tem vida curta Monday, March 2, 2009
  • 14. Mortalidade Infantil Memória Heap Eden Tenured Monday, March 2, 2009
  • 15. Mortalidade Infantil Memória Heap Eden Tenured Monday, March 2, 2009
  • 16. Mortalidade Infantil Memória Heap Eden Tenured objeto objeto objeto objeto Monday, March 2, 2009
  • 17. Mortalidade Infantil Memória Heap Eden Tenured objeto objeto objeto objeto Monday, March 2, 2009
  • 18. Mortalidade Infantil Memória Heap Eden Tenured objeto objeto objeto objeto Monday, March 2, 2009
  • 19. Flexibilidade • Serial • ParNew • Parallel Scavenge • Serial Old • CMS • Parallel Old • G1 http://blogs.sun.com/jonthecollector/entry/our_collectors Monday, March 2, 2009
  • 20. Ea performance? Monday, March 2, 2009
  • 21. http://headius.blogspot.com/2008/02/jruby-rc2-released-whats-next.html JRuby's performance regularly exceeds Ruby 1.8.6, and in many cases has started to exceed Ruby 1.9 http://www.flickr.com/photos/diathesis/2115578333/ Monday, March 2, 2009
  • 23. Startup • -X:bootclasspath • Nailgun: http://www.martiansoftware.com/nailgun/ Monday, March 2, 2009
  • 24. Startup • -X:bootclasspath • Nailgun: http://www.martiansoftware.com/nailgun/ Nailgun tcp/ip Client Nailgun tcp/ip JVM Server Client Nailgun tcp/ip Client Monday, March 2, 2009
  • 25. Rails não escala! Monday, March 2, 2009
  • 26. http://www.akitaonrails.com/2008/4/19/di-rio-de-bordo-do-fisl-9 Sim! Rails escala! http://picasaweb.google.com/leo.torres84/FISL2008 Monday, March 2, 2009
  • 27. Ruby on Rails http WebServer Rails CGI “como?” Monday, March 2, 2009
  • 28. Ruby on Rails Rails CGI http WebServer Rails CGI CGI Rails “como?” Monday, March 2, 2009
  • 29. Ruby on Rails Proxy Reverso Mongrel http / http Rails Load Balancer Monday, March 2, 2009
  • 30. Ruby on Rails Mongrel http Rails Proxy Reverso Mongrel http / http Rails Load Balancer Mongrel http Rails Monday, March 2, 2009
  • 31. JRuby on Rails container http Servlet Monday, March 2, 2009
  • 32. JRuby on Rails container Thread Thread Thread http Servlet Thread Thread Monday, March 2, 2009
  • 33. JRuby on Rails container Thread Thread Rails Thread http Servlet (JRuby) Thread Thread Monday, March 2, 2009
  • 34. JRuby on Rails container Rails Thread (JRuby) Thread Rails Thread http Servlet (JRuby) Thread Rails Thread (JRuby) Monday, March 2, 2009
  • 35. JRuby on Rails container Rails Thread (JRuby) Thread Goldspike Rails Thread http Servlet (JRuby) http://wiki.jruby.org/wiki/Goldspike Thread Rails Thread (JRuby) Monday, March 2, 2009
  • 36. JRuby Rack Rails Thread rack (JRuby) Thread Filter Rails Thread http Servlet rack JRuby (JRuby) Rack Thread Rails Thread rack (JRuby) Monday, March 2, 2009
  • 37. JRuby Rack Rails Thread rack (JRuby) Thread Merb? Filter Rails Thread http Servlet rack JRuby (JRuby) Rack http://merbivore.com/ Thread Rails Thread rack (JRuby) Monday, March 2, 2009
  • 38. I agree, the memory situation is not the best but compared to MRI, JRuby deployments are actually favorable. We're seeing around 20MB per runtime in our deployment, ... http://www.flickr.com/photos/nicksieger Monday, March 2, 2009
  • 39. Rails 2.2 is thread-safe! http://joshpeek.com/ Monday, March 2, 2009
  • 40. -server -Xmx1024m httperf --num-conns 100 --rate 10 class HomeController < ApplicationController def index render :text => quot;<html>fibonnaci(29) = #{fibonacci(29)}</html>quot; end private def fibonacci(number) return number if number < 2 fibonacci(number - 1) + fibonacci(number - 2) end end Monday, March 2, 2009
  • 41. Tomcat 1 runtime, thread-safe: 176 MB 3 runtimes: 200 MB 5 runtimes: 244 MB Jetty 1 runtime, thread-safe: 193 MB 3 runtimes: 204 MB 5 runtimes: 245 MB Glassfish 1 runtime, thread-safe: 315 MB 3 runtimes: 370 MB 5 runtimes: 417 MB Monday, March 2, 2009
  • 42. jruby -S gem install mongrel cd railsapp jruby script/server Glassfish v3 (gem) http://wiki.jruby.org/wiki/JRuby_on_Rails_in_GlassFish jruby -S gem install glassfish jruby -S glassfish Monday, March 2, 2009
  • 43. Warbler http://wiki.jruby.org/wiki/Warbler jruby -S gem install warbler cd railsapp jruby -S warble Monday, March 2, 2009
  • 45. jruby -S gem install jetty-rails cd railsapp jruby -S jetty_rails http://jetty-rails.rubyforge.org/ Monday, March 2, 2009
  • 46. Eu ouvi dizer que Jruby é lento! Monday, March 2, 2009
  • 48. httperf --num-conns 2500 --rate 25 guj2: ~20 resp/s Monday, March 2, 2009
  • 49. httperf --num-conns 8000 --rate 140 Monday, March 2, 2009
  • 50. httperf --num-conns 8000 --rate 140 guj3: ~140 resp/s vs 20 resp/s Monday, March 2, 2009
  • 53. Cache! container Rails (JRuby) Servlet Context fragmento fragmento Rails fragmento fragmento (JRuby) fragmento fragmento fragmento fragmento Rails (JRuby) Monday, March 2, 2009
  • 54. Conexões ao banco Monday, March 2, 2009
  • 55. Mongrel http Rails Mongrel http Rails Proxy Reverso Mongrel / http Rails Load Balancer Mongrel http Rails Mongrel http Rails Monday, March 2, 2009
  • 56. Mongrel http Rails Mongrel http Rails Proxy Reverso Mongrel / http Rails Pool? Load Balancer Mongrel http Rails Mongrel http Rails Monday, March 2, 2009
  • 57. JRuby Connection Pool Runtime JRuby Runtime JDBC JRuby JRuby Rack Adapter Runtime Filter (jndi) JRuby Runtime JRuby Runtime Monday, March 2, 2009
  • 58. “” Não importa a tecnologia, Monday, March 2, 2009
  • 59. “” Não importa a tecnologia, desde que você a conheça muito bem! Monday, March 2, 2009
  • 61. http://code.google.com/p/activehibernate/ class Person include Hibernate primary_key_accessor :id, :long h_component :address, [[:street,:string], [:city,:string]] end Monday, March 2, 2009
  • 62. No. Ribs! class Blog Ribs! :table => :fox_blog do |r| r.id.primary_key! r.title :column => :blog_title r.body :column => :content_text r.something.avoid! end end Monday, March 2, 2009
  • 63. Spring <beans xmlns=quot;...quot;> <lang:jruby id=quot;messageServicequot; script-interfaces=quot;br.com.caelum.Messengerquot; script-source=quot;classpath:ruby_messenger.rbquot;> <lang:property name=quot;messagequot; value=quot;Hello World!quot;/> </lang:jruby> <bean id=quot;businessLogicquot; class=quot;br.com.caelum.Logicquot;> <constructor-arg ref=quot;messageServicequot; /> </bean> </beans> Monday, March 2, 2009
  • 66. Dúvidas? Obrigado! fabio.kung@caelum.com.br Monday, March 2, 2009

Editor's Notes

  1. silver bullet escolher uma
  2. 2004, 2005, 2006, ...
  3. xml, html, css, js ferramenta certa, hora certa
  4. fragmenta&#xE7;&#xE3;o stop-the-world
  5. fragmenta&#xE7;&#xE3;o stop-the-world
  6. fragmenta&#xE7;&#xE3;o stop-the-world
  7. fragmenta&#xE7;&#xE3;o stop-the-world
  8. fragmenta&#xE7;&#xE3;o stop-the-world
  9. fragmenta&#xE7;&#xE3;o stop-the-world
  10. fragmenta&#xE7;&#xE3;o stop-the-world
  11. fragmenta&#xE7;&#xE3;o stop-the-world
  12. fragmenta&#xE7;&#xE3;o stop-the-world
  13. produtividade aposta fun
  14. + r&#xE1;pido compacta&#xE7;&#xE3;o adaptatividade
  15. + r&#xE1;pido compacta&#xE7;&#xE3;o adaptatividade
  16. + r&#xE1;pido compacta&#xE7;&#xE3;o adaptatividade
  17. + r&#xE1;pido compacta&#xE7;&#xE3;o adaptatividade
  18. + r&#xE1;pido compacta&#xE7;&#xE3;o adaptatividade
  19. + r&#xE1;pido compacta&#xE7;&#xE3;o adaptatividade
  20. + r&#xE1;pido compacta&#xE7;&#xE3;o adaptatividade
  21. + r&#xE1;pido compacta&#xE7;&#xE3;o adaptatividade
  22. + r&#xE1;pido compacta&#xE7;&#xE3;o adaptatividade
  23. + r&#xE1;pido compacta&#xE7;&#xE3;o adaptatividade
  24. funcionalidades
  25. jruby &#xE9; o + r&#xE1;pido
  26. CGI: processo por request FCGI: pool
  27. CGI: processo por request FCGI: pool
  28. CGI: processo por request FCGI: pool
  29. CGI: processo por request FCGI: pool
  30. CGI: processo por request FCGI: pool
  31. CGI: processo por request FCGI: pool
  32. http share-nothing mongrel per request 30Mb-80Mb
  33. http share-nothing mongrel per request 30Mb-80Mb
  34. http share-nothing mongrel per request 30Mb-80Mb
  35. http share-nothing mongrel per request 30Mb-80Mb
  36. http share-nothing mongrel per request 30Mb-80Mb
  37. http share-nothing mongrel per request 30Mb-80Mb
  38. concorrencia desde 97 share nothing? cache, session, jndi distribuido vai para terracotta, jboss tree, memcached
  39. concorrencia desde 97 share nothing? cache, session, jndi distribuido vai para terracotta, jboss tree, memcached
  40. concorrencia desde 97 share nothing? cache, session, jndi distribuido vai para terracotta, jboss tree, memcached
  41. concorrencia desde 97 share nothing? cache, session, jndi distribuido vai para terracotta, jboss tree, memcached
  42. concorrencia desde 97 share nothing? cache, session, jndi distribuido vai para terracotta, jboss tree, memcached
  43. concorrencia desde 97 share nothing? cache, session, jndi distribuido vai para terracotta, jboss tree, memcached
  44. concorrencia desde 97 share nothing? cache, session, jndi distribuido vai para terracotta, jboss tree, memcached
  45. concorrencia desde 97 share nothing? cache, session, jndi distribuido vai para terracotta, jboss tree, memcached
  46. concorrencia desde 97 share nothing? cache, session, jndi distribuido vai para terracotta, jboss tree, memcached
  47. concorrencia desde 97 share nothing? cache, session, jndi distribuido vai para terracotta, jboss tree, memcached
  48. protocolo leve filter desacopla o fw web rails requer bastante mem&#xF3;ria
  49. sem feedback instant&#xE2;neo
  50. glassfish_gem