SlideShare une entreprise Scribd logo
1  sur  52
Friday, September 10, 2010
Extreme Performance
             with
       Mirah and Dubious


Friday, September 10, 2010
•       JRuby on AppEngine
              • Mirah
              • Dubious
              • Hack

Friday, September 10, 2010
•       JRuby on AppEngine
              • Mirah
              • Dubious
              • Hack

Friday, September 10, 2010
Friday, September 10, 2010
JRuby on AppEngine
                               It rocks, but has some limitations.




Friday, September 10, 2010
Limitations

                     • Not as supported as Java & Python
                     • Long spin up times
                     • Uses more CPU(more expensive)
                     • getting more performance requires writing
                             Java



Friday, September 10, 2010
Spin Up


                     • Rails app instances take a long time to spin
                             up
                     • you can’t keep app instances running (yet)


Friday, September 10, 2010
Long Spin Up Times


                     • Rails instances take 16 seconds or more to
                             spin up
                     • AppEngine limits requests to 30 seconds
                     • Users will hit cold instances

Friday, September 10, 2010
Spin Up Workarounds
                       DeferredDispather
                     • Splits Initialization into three requests(two
                             redirect back)
                             • runtime & rack
                             • require app
                             • dispatch normally

Friday, September 10, 2010
Friday, September 10, 2010
CPU Usage


                     • On AppEngine CPU == $$$$
                     • JRuby uses more CPU than Java or Python


Friday, September 10, 2010
CPU Usage


                     • On AppEngine CPU == $$$$
                     • JRuby uses more CPU than Java or Python


Friday, September 10, 2010
JRuby on AppEngine
                                Optimization

                     1. Write app in Rails
                     2. Find parts that are slow/get heavy traffic
                     3. Rewrite them with Java Servlets



Friday, September 10, 2010
Kinda Sucks, Right?



Friday, September 10, 2010
Enter Mirah & Dubious



Friday, September 10, 2010
•       JRuby on AppEngine
              • Mirah
              • Dubious
              • Hack

Friday, September 10, 2010
•       JRuby on AppEngine
              • Mirah
              • Dubious
              • Hack

Friday, September 10, 2010
Mirah
                             (Duby)




Friday, September 10, 2010
Mirah - Ruby in Javanese



Friday, September 10, 2010
“Charles Oliver Nutter wanted to create
                a language that essentially looked like
                Ruby, but was statically typed and
                compiled to fast JVM bytecode.
                Mirah is the result.”
                                                - mirah.org



Friday, September 10, 2010
Mirah

                     • Uses Ruby syntax+types
                     • Behaves like Java
                     • Extensible through macros


Friday, September 10, 2010
Features From Ruby
                     • Optional arguments ✓
                     • Internal iteration ✓
                     • Closures ✓
                     • Literals ✓
                     • String interpolation ✓
                     • Mixins, “open” classes (soon)
Friday, September 10, 2010
Ruby
                   def fib(a)
                     if a < 2
                       a
                     else
                       fib(a - 1) + fib(a - 2)
                     end
                   end


Friday, September 10, 2010
Mirah
                       github.com/mirah/mirah/examples/fib.mirah
                   def fib(a:int)
                     if a < 2
                       a
                     else
                       fib(a - 1) + fib(a - 2)
                     end
                   end


Friday, September 10, 2010
Macros



Friday, September 10, 2010
•       JRuby on AppEngine
              • Mirah
              • Dubious
              • Hack

Friday, September 10, 2010
•       JRuby on AppEngine
              • Mirah
              • Dubious
              • Hack

Friday, September 10, 2010
Dubious




Friday, September 10, 2010
Dubious

                             A Web Framework
                                 in Mirah


Friday, September 10, 2010
Friday, September 10, 2010
High Performance,
                Light weight,
                Rails like


Friday, September 10, 2010
High Performance,
                Light weight,
                Rails like


Friday, September 10, 2010
Written in Mirah, so it’s
                as fast as Java.



Friday, September 10, 2010
App Instances Spin Up
                           in ~1 sec


Friday, September 10, 2010
High Performance,
                Light weight,
                Rails like


Friday, September 10, 2010
Few Dependencies




Friday, September 10, 2010
Examples



Friday, September 10, 2010
High Performance,
                Light weight,
                Rails like


Friday, September 10, 2010
import dubious.*
                import models.*

                class ContactsController < ApplicationController

                  # GET /contacts
                  def index
                    @contacts = Contact.all.run
                    render index_erb, main_erb
                  end

                  # GET /contacts/1
                  def show
                    @contact = Contact.get(params.id)
                    render show_erb, main_erb
                  end

                  # GET /contacts/new
                  def new
                    @contact = Contact.new
                    render new_erb, main_erb
                  end

                  # GET /contacts/1/edit
                  def edit
                    @contact = Contact.get(params.id)
Friday, September 10, 2010
import dubious.*
                import models.*

                class ContactsController < ApplicationController

                  # GET /contacts
                  def index
                    @contacts = Contact.all.run
                    render index_erb, main_erb
                  end

                  # GET /contacts/1
                  def show
                    @contact = Contact.get(params.id)
                    render show_erb, main_erb
                  end

                  # GET /contacts/new
                  def new
                    @contact = Contact.new
                    render new_erb, main_erb
                  end

                  # GET /contacts/1/edit
                  def edit
                    @contact = Contact.get(params.id)
Friday, September 10, 2010
import dubious.*
                import models.*

                class ContactsController < Appli

                  # GET /contacts
                  def index
                    @contacts = Contact.all.run
                    render index_erb, main_erb
                  end
Friday, September 10, 2010
  end

                  # GET /contacts/new
                  def new
                    @contact = Contact.new
                    render new_erb, main_erb
                  end

                  # GET /contacts/1/edit
                  def edit
                    @contact = Contact.get(param
                    render edit_erb, main_erb
                  end
Friday, September 10, 2010
  end

     # render templates
     def_edb(index_erb,
             'views/contacts/index.html.erb')
     def_edb(show_erb,
             'views/contacts/show.html.erb')
     def_edb(new_erb,
             'views/contacts/new.html.erb')
     def_edb(edit_erb,
             'views/contacts/edit.html.erb')
     def_edb(main_erb,
             'views/layouts/contacts.html.erb')
   end




Friday, September 10, 2010
import   com.google.appengine.ext.duby.db.Model
                             import   com.google.appengine.api.datastore.*
                             import   dubious.TimeConversion
                             import   java.util.Date

                             class Contact < Model
                               property :title,      String
                               property :birthday,   Date
                               property :url,        Link
                               property :platform,   String
                               property :editor,     String
                               property :summary,    Text
                               property :address,    PostalAddress
                               property :phone,      PhoneNumber
                               property :private,    Boolean

                               # timestamps
                               property :created_at, Date
                               property :updated_at, Date
                               def before_save
                                 @updated_at = Date.new
                                 @created_at = updated_at if @created_at.nil?
                               end

                               def coerce_date(o:Object)
                                 TimeConversion.new('jsdate').parse(String(o))
Friday, September 10, 2010     end
import   com.google.appengine.ext.duby.db.Model
                             import   com.google.appengine.api.datastore.*
                             import   dubious.TimeConversion
                             import   java.util.Date

                             class Contact < Model
                               property :title,      String
                               property :birthday,   Date
                               property :url,        Link
                               property :platform,   String
                               property :editor,     String
                               property :summary,    Text
                               property :address,    PostalAddress
                               property :phone,      PhoneNumber
                               property :private,    Boolean

                               # timestamps
                               property :created_at, Date
                               property :updated_at, Date
                               def before_save
                                 @updated_at = Date.new
                                 @created_at = updated_at if @created_at.nil?
                               end

                               def coerce_date(o:Object)
                                 TimeConversion.new('jsdate').parse(String(o))
Friday, September 10, 2010     end
<h1>New contact</h1>

                             <% f = form_for(@contact) %>
                               <%= f.start_form %>
                               <%= f.error_messages %>
                               <p>
                                 <%= f.label :title %><br />
                                 <%= f.text_field :title %>
                               </p>
                               <p>
                                 <%= f.label :summary %><br />
                                 <%= f.text_area :summary %>
                               </p>
                               <p>
                                 <%= f.label :birthday %><br />
                                 <%= f.date_select :birthday %>
                               </p>
                               <p>
                                 <%= f.label :platform %><br />
                                 <%= f.radio_button :platform, 'Mac'   %>Mac
                                 <%= f.radio_button :platform, 'PC'    %>PC
                                 <%= f.radio_button :platform, 'Linux' %>Linux
                               </p>
                               <p>
                                 <%= f.label :editor %><br />
                                 <%= f.select :editor, ['Vim','Emacs','TextMate','Other'
Friday, September 10, 2010
•       JRuby on AppEngine
              • Mirah
              • Dubious
              • Hack

Friday, September 10, 2010
•       JRuby on AppEngine
              • Mirah
              • Dubious
              • Hack

Friday, September 10, 2010
Get Started
                                Demo Time




Friday, September 10, 2010
Me

        Nick Howard

                Avid Rubyist
                Commiter on Dubious
                @baroquebobcat
                Work at Gnip in Boulder, CO




Friday, September 10, 2010
Contribute
            Mirah & Dubious
                mirah.org
                Code
                   github.com/mirah/mirah
                   github.com/mirah/dubious
                Examples
                   rails-annex.appspot.com
                   dubious-demo.appspot.com
                Mailing List
                    groups.google.com/group/mirah

Friday, September 10, 2010

Contenu connexe

Similaire à Mirah & Dubious Talk Ruby|Web 2010

BDD and Cucumber at barcampGZ
BDD and Cucumber at barcampGZBDD and Cucumber at barcampGZ
BDD and Cucumber at barcampGZleondu
 
DjangoCon 2009 Keynote
DjangoCon 2009 KeynoteDjangoCon 2009 Keynote
DjangoCon 2009 KeynoteTed Leung
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby ConferenceJohn Woodell
 
Web Development With Ruby - From Simple To Complex
Web Development With Ruby - From Simple To ComplexWeb Development With Ruby - From Simple To Complex
Web Development With Ruby - From Simple To ComplexBrian Hogan
 
Dojo Mobile
Dojo MobileDojo Mobile
Dojo Mobiledylanks
 
Oxente on Rails 2009
Oxente on Rails 2009Oxente on Rails 2009
Oxente on Rails 2009Fabio Akita
 
Akka scalaliftoff london_2010
Akka scalaliftoff london_2010Akka scalaliftoff london_2010
Akka scalaliftoff london_2010Skills Matter
 
The Twitter API: A Presentation to Adobe
The Twitter API: A Presentation to AdobeThe Twitter API: A Presentation to Adobe
The Twitter API: A Presentation to AdobeAlex Payne
 
Aloha on-rails-2009
Aloha on-rails-2009Aloha on-rails-2009
Aloha on-rails-2009John Woodell
 
Jenkins (war)stories
Jenkins (war)storiesJenkins (war)stories
Jenkins (war)storiesToomas Römer
 
HTML5: Toolkits and Gaps
HTML5: Toolkits and GapsHTML5: Toolkits and Gaps
HTML5: Toolkits and Gapsdylanks
 
dotnet-ug-iron-ruby
dotnet-ug-iron-rubydotnet-ug-iron-ruby
dotnet-ug-iron-rubyAmir Barylko
 

Similaire à Mirah & Dubious Talk Ruby|Web 2010 (20)

BDD and Cucumber at barcampGZ
BDD and Cucumber at barcampGZBDD and Cucumber at barcampGZ
BDD and Cucumber at barcampGZ
 
Ruby off Rails
Ruby off RailsRuby off Rails
Ruby off Rails
 
DjangoCon 2009 Keynote
DjangoCon 2009 KeynoteDjangoCon 2009 Keynote
DjangoCon 2009 Keynote
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby Conference
 
App Engine Meetup
App Engine MeetupApp Engine Meetup
App Engine Meetup
 
Ruby off Rails
Ruby off RailsRuby off Rails
Ruby off Rails
 
Web Development With Ruby - From Simple To Complex
Web Development With Ruby - From Simple To ComplexWeb Development With Ruby - From Simple To Complex
Web Development With Ruby - From Simple To Complex
 
Java to scala
Java to scalaJava to scala
Java to scala
 
Dojo Mobile
Dojo MobileDojo Mobile
Dojo Mobile
 
Oxente on Rails 2009
Oxente on Rails 2009Oxente on Rails 2009
Oxente on Rails 2009
 
JRuby in The Enterprise
JRuby in The EnterpriseJRuby in The Enterprise
JRuby in The Enterprise
 
Akka scalaliftoff london_2010
Akka scalaliftoff london_2010Akka scalaliftoff london_2010
Akka scalaliftoff london_2010
 
The Twitter API: A Presentation to Adobe
The Twitter API: A Presentation to AdobeThe Twitter API: A Presentation to Adobe
The Twitter API: A Presentation to Adobe
 
Aloha on-rails-2009
Aloha on-rails-2009Aloha on-rails-2009
Aloha on-rails-2009
 
RubyConf 2009
RubyConf 2009RubyConf 2009
RubyConf 2009
 
Rails 3 Internals
Rails 3 InternalsRails 3 Internals
Rails 3 Internals
 
Ruby
RubyRuby
Ruby
 
Jenkins (war)stories
Jenkins (war)storiesJenkins (war)stories
Jenkins (war)stories
 
HTML5: Toolkits and Gaps
HTML5: Toolkits and GapsHTML5: Toolkits and Gaps
HTML5: Toolkits and Gaps
 
dotnet-ug-iron-ruby
dotnet-ug-iron-rubydotnet-ug-iron-ruby
dotnet-ug-iron-ruby
 

Dernier

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 

Dernier (20)

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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...
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
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...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Mirah & Dubious Talk Ruby|Web 2010

  • 2. Extreme Performance with Mirah and Dubious Friday, September 10, 2010
  • 3. JRuby on AppEngine • Mirah • Dubious • Hack Friday, September 10, 2010
  • 4. JRuby on AppEngine • Mirah • Dubious • Hack Friday, September 10, 2010
  • 6. JRuby on AppEngine It rocks, but has some limitations. Friday, September 10, 2010
  • 7. Limitations • Not as supported as Java & Python • Long spin up times • Uses more CPU(more expensive) • getting more performance requires writing Java Friday, September 10, 2010
  • 8. Spin Up • Rails app instances take a long time to spin up • you can’t keep app instances running (yet) Friday, September 10, 2010
  • 9. Long Spin Up Times • Rails instances take 16 seconds or more to spin up • AppEngine limits requests to 30 seconds • Users will hit cold instances Friday, September 10, 2010
  • 10. Spin Up Workarounds DeferredDispather • Splits Initialization into three requests(two redirect back) • runtime & rack • require app • dispatch normally Friday, September 10, 2010
  • 12. CPU Usage • On AppEngine CPU == $$$$ • JRuby uses more CPU than Java or Python Friday, September 10, 2010
  • 13. CPU Usage • On AppEngine CPU == $$$$ • JRuby uses more CPU than Java or Python Friday, September 10, 2010
  • 14. JRuby on AppEngine Optimization 1. Write app in Rails 2. Find parts that are slow/get heavy traffic 3. Rewrite them with Java Servlets Friday, September 10, 2010
  • 15. Kinda Sucks, Right? Friday, September 10, 2010
  • 16. Enter Mirah & Dubious Friday, September 10, 2010
  • 17. JRuby on AppEngine • Mirah • Dubious • Hack Friday, September 10, 2010
  • 18. JRuby on AppEngine • Mirah • Dubious • Hack Friday, September 10, 2010
  • 19. Mirah (Duby) Friday, September 10, 2010
  • 20. Mirah - Ruby in Javanese Friday, September 10, 2010
  • 21. “Charles Oliver Nutter wanted to create a language that essentially looked like Ruby, but was statically typed and compiled to fast JVM bytecode. Mirah is the result.” - mirah.org Friday, September 10, 2010
  • 22. Mirah • Uses Ruby syntax+types • Behaves like Java • Extensible through macros Friday, September 10, 2010
  • 23. Features From Ruby • Optional arguments ✓ • Internal iteration ✓ • Closures ✓ • Literals ✓ • String interpolation ✓ • Mixins, “open” classes (soon) Friday, September 10, 2010
  • 24. Ruby def fib(a)   if a < 2     a   else     fib(a - 1) + fib(a - 2)   end end Friday, September 10, 2010
  • 25. Mirah github.com/mirah/mirah/examples/fib.mirah def fib(a:int)   if a < 2     a   else     fib(a - 1) + fib(a - 2)   end end Friday, September 10, 2010
  • 27. JRuby on AppEngine • Mirah • Dubious • Hack Friday, September 10, 2010
  • 28. JRuby on AppEngine • Mirah • Dubious • Hack Friday, September 10, 2010
  • 30. Dubious A Web Framework in Mirah Friday, September 10, 2010
  • 32. High Performance, Light weight, Rails like Friday, September 10, 2010
  • 33. High Performance, Light weight, Rails like Friday, September 10, 2010
  • 34. Written in Mirah, so it’s as fast as Java. Friday, September 10, 2010
  • 35. App Instances Spin Up in ~1 sec Friday, September 10, 2010
  • 36. High Performance, Light weight, Rails like Friday, September 10, 2010
  • 39. High Performance, Light weight, Rails like Friday, September 10, 2010
  • 40. import dubious.* import models.* class ContactsController < ApplicationController   # GET /contacts   def index     @contacts = Contact.all.run     render index_erb, main_erb   end   # GET /contacts/1   def show     @contact = Contact.get(params.id)     render show_erb, main_erb   end   # GET /contacts/new   def new     @contact = Contact.new     render new_erb, main_erb   end   # GET /contacts/1/edit   def edit     @contact = Contact.get(params.id) Friday, September 10, 2010
  • 41. import dubious.* import models.* class ContactsController < ApplicationController   # GET /contacts   def index     @contacts = Contact.all.run     render index_erb, main_erb   end   # GET /contacts/1   def show     @contact = Contact.get(params.id)     render show_erb, main_erb   end   # GET /contacts/new   def new     @contact = Contact.new     render new_erb, main_erb   end   # GET /contacts/1/edit   def edit     @contact = Contact.get(params.id) Friday, September 10, 2010
  • 42. import dubious.* import models.* class ContactsController < Appli   # GET /contacts   def index     @contacts = Contact.all.run     render index_erb, main_erb   end Friday, September 10, 2010
  • 43.   end   # GET /contacts/new   def new     @contact = Contact.new     render new_erb, main_erb   end   # GET /contacts/1/edit   def edit     @contact = Contact.get(param     render edit_erb, main_erb   end Friday, September 10, 2010
  • 44.   end   # render templates   def_edb(index_erb, 'views/contacts/index.html.erb')   def_edb(show_erb, 'views/contacts/show.html.erb')   def_edb(new_erb, 'views/contacts/new.html.erb')   def_edb(edit_erb, 'views/contacts/edit.html.erb')   def_edb(main_erb, 'views/layouts/contacts.html.erb') end Friday, September 10, 2010
  • 45. import com.google.appengine.ext.duby.db.Model import com.google.appengine.api.datastore.* import dubious.TimeConversion import java.util.Date class Contact < Model   property :title, String   property :birthday, Date   property :url, Link   property :platform, String   property :editor, String   property :summary, Text   property :address, PostalAddress   property :phone, PhoneNumber   property :private, Boolean   # timestamps   property :created_at, Date   property :updated_at, Date   def before_save     @updated_at = Date.new     @created_at = updated_at if @created_at.nil?   end   def coerce_date(o:Object)     TimeConversion.new('jsdate').parse(String(o)) Friday, September 10, 2010   end
  • 46. import com.google.appengine.ext.duby.db.Model import com.google.appengine.api.datastore.* import dubious.TimeConversion import java.util.Date class Contact < Model   property :title, String   property :birthday, Date   property :url, Link   property :platform, String   property :editor, String   property :summary, Text   property :address, PostalAddress   property :phone, PhoneNumber   property :private, Boolean   # timestamps   property :created_at, Date   property :updated_at, Date   def before_save     @updated_at = Date.new     @created_at = updated_at if @created_at.nil?   end   def coerce_date(o:Object)     TimeConversion.new('jsdate').parse(String(o)) Friday, September 10, 2010   end
  • 47. <h1>New contact</h1> <% f = form_for(@contact) %>   <%= f.start_form %>   <%= f.error_messages %>   <p>     <%= f.label :title %><br />     <%= f.text_field :title %>   </p>   <p>     <%= f.label :summary %><br />     <%= f.text_area :summary %>   </p>   <p>     <%= f.label :birthday %><br />     <%= f.date_select :birthday %>   </p>   <p>     <%= f.label :platform %><br />     <%= f.radio_button :platform, 'Mac' %>Mac     <%= f.radio_button :platform, 'PC' %>PC     <%= f.radio_button :platform, 'Linux' %>Linux   </p>   <p>     <%= f.label :editor %><br />     <%= f.select :editor, ['Vim','Emacs','TextMate','Other' Friday, September 10, 2010
  • 48. JRuby on AppEngine • Mirah • Dubious • Hack Friday, September 10, 2010
  • 49. JRuby on AppEngine • Mirah • Dubious • Hack Friday, September 10, 2010
  • 50. Get Started Demo Time Friday, September 10, 2010
  • 51. Me Nick Howard Avid Rubyist Commiter on Dubious @baroquebobcat Work at Gnip in Boulder, CO Friday, September 10, 2010
  • 52. Contribute Mirah & Dubious mirah.org Code github.com/mirah/mirah github.com/mirah/dubious Examples rails-annex.appspot.com dubious-demo.appspot.com Mailing List groups.google.com/group/mirah Friday, September 10, 2010