JRuby on Appengine

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    JRuby on Appengine - Presentation Transcript

    1. budapest.rb JRuby on AppEngine Janos Hardi janos@liligo.com
    2. Agenda JVM Scripting on the JVM JRuby Rack Google AppEngine/Java Experiences
    3. JVM Java Language != Java Platform Platform Independence Rich Class System Open Source
    4. JVM App App App JVM JVM JVM Java Runtime Environment
    5. JVM http://www.artima.com/insidejvm/ed2/jvm2.html
    6. JVM Fine tuneability Extensibility Stable Admin interfaces Safe code sharing
    7. Scripting on the JVM Python (Jython - http://www.jython.org) Ruby (JRuby - http://www.jruby.org) Lisp (Clojure - http://clojure.org) JavaScript (Rhino - http://www.mozilla.org/rhino/) PHP (IBM - P8 / Caucho - Quercus) Scala (http://www.scala-lang.org) And many many more
    8. Scripting on the JVM How?
    9. Scripting on the JVM JSR-223 import javax.script.* http://scripting.dev.java.net/ http://developers.sun.com/scripting/
    10. Scripting on the JVM App JRuby Scripting JVM Java Runtime Environment
    11. Scripting on the JVM Why?
    12. Scripting on the JVM Rapid app development Special needs, eg. at liligo.com ;) Integration
    13. JRuby Ruby for Java Ruby in Java
    14. JRuby Native Threads Garbage Collector Embeddability No fork No C extensions
    15. Rack Rails, Merb, Sinatra, Camping, Ramaze ... CGI, FCGI, Mongrel, Thin, Webrick, Litespeed ...
    16. Rack class HelloWorld def call(env) [200, {"Content-Type" => "text/plain"}, ["Hello world!"]] end end
    17. Rack Simple Ruby API modelling HTTP Standard interface between frameworks and handlers Interface for injecting middlewares
    18. Rack WSGI for Ruby http://chneukirchen.org/talks/#introducingrack http://wiki.github.com/rack/rack
    19. JRuby-Rack WSGI for JRuby Rack + Java Servlet Containers Tomcat, Glassfish, Jetty ...
    20. <context-param> <param-name>rackup</param-name> <param-value> require 'rubygems' require 'app' set :environment, :production set :run, false run Sinatra::Application </param-value> </context-param> <filter> <filter-name>RackFilter</filter-name> <filter-class>org.jruby.rack.RackFilter</filter-class> </filter> <filter-mapping> <filter-name>RackFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class> org.jruby.rack.RackServletContextListener </listener-class> </listener>
    21. <web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5"> <context-param> <param-name>public.root</param-name> <param-value>/</param-value> </context-param> <filter> <filter-name>RackFilter</filter-name> <filter-class> org.jruby.rack.RackFilter </filter-class> </filter> <filter-mapping> <filter-name>RackFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class> org.jruby.rack.merb.MerbServletContextListener </listener-class> </listener> </web-app>
    22. JRuby-Rack Framework R JRuby a c App k Servlet container JVM Java Runtime Environment
    23. Google AppEngine/Java What?
    24. Google AppEngine/Java App stack App hosting Development environment Great API system A bunch of services for free ...
    25. GAE/J – App stack Automatic scaling Write your App only Everything else happens on APIs External APIs with URL Fetch
    26. GAE/J – App hosting 10 app / google user Admin interface Cron Quota is OK Logging
    27. GAE/J – App hosting
    28. GAE/J – App hosting
    29. GAE/J – App hosting
    30. GAE/J – Dev environment App server Deployment App versions Multiple developer accounts Good examples SDK Plugins (Eclipse IDE)
    31. GAE/J – APIs / Services Memcache Datastore Mail Image Google account URL Fetch
    32. GAE/J - Datastore Schemaless Object oriented Key / Value Universal < Entity ( Story (1) ) >
    33. Experiences Slow warmup (JRuby + AppEngine) Nice performance after App cache CPU intensive operations Almost unusable Dev tools Rare libs for GAE/J APIs No migration (bulk loader is 404!)
    34. Experiences JRuby-AppEngine (low level wrapper for almost all APIs) Bumble (minimal lib for the Datastore) Datamapper (with JRuby-AppEngine) Warbler (for deployment)
    35. JRuby-AppEngine post '/story/add' do @story = Datastore::Entity.new('Story') @story['title'] = params[:title] @story['slug'] = params[:slug] @story['body'] = Datastore::Text.new( params[:body] ) Datastore.put(@story) redirect '/stories' end
    36. Bumble class Person include Bumble ds :given_name, :sur_name, :email has_many :blogs, Blog, :owner_id end class Blog include Bumble ds :name, :owner_id, :created_at belongs_to :owner, Person has_many :posts, :Post, :blog_id, :iorder => :created_at end class Post include Bumble ds :title, :content, :created_at, :blog_id belongs_to :blog, Blog end
    37. Warbler Warbler::Config.new do |config| config.dirs = %w(lib views models) config.includes = FileList["appengine-web.xml", "app.rb", "config.ru"] config.gems = ['sinatra', 'haml','appengine- apis','maruku'] config.gem_dependencies = true config.war_name = "test" config.webxml.booter = :rack config.webxml.jruby.min.runtimes = 1 config.webxml.jruby.max.runtimes = 1 config.webxml.jruby.init.serial = true config.java_libs = [] end
    38. Components Appengine account GAE/J SDK JRuby 1.3.1 JRuby-Rack Gems GAE/Merb Example Application ;) http://github.com/yaanno/gae-merb-example
    39. Merb flat app WEB-INF appengine-web.xml web.xml application.rb config framework.rb init.rb lib appengine-api-sdk.jar gems.jar jruby-complete.jar jruby-rack.jar views index.haml
    40. Thanks
    41. A few useful links http://www.infoq.com/presentations/nicholson-php-jvm http://www.artima.com/insidejvm/ed2/index.html http://code.google.com/appengine/ http://blog.headius.com http://blog.nicksieger.com http://olabini.com/blog/ http://isitjruby.com/ http://code.google.com/events/io/sessions.html#appengine

    + Janos HardiJanos Hardi, 4 months ago

    custom

    676 views, 1 favs, 1 embeds more stats

    A meetup talk given at budapest.rb http://www.meetu more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 676
      • 612 on SlideShare
      • 64 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 5
    Most viewed embeds
    • 64 views on http://domhackers.blogspot.com

    more

    All embeds
    • 64 views on http://domhackers.blogspot.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Tags