glassfish can support multiple ruby frameworks ... really ?
DESCRIPTION
"GlassFish can support multiple Ruby frameworks ... really ?" preso at Ruby Conf India 2010TRANSCRIPT
GlassFish can support multiple Ruby frameworks ... really ?
Arun Gupta, Oracle Corpblogs.sun.com/arungupta, @arungupta
What is GlassFish ?
What is GlassFish ?
GlassFish: It's a Community!
GlassFish: Lives on java.net
Since 2005
GlassFish: Reference Implementation
GlassFish v3
JRuby
• Ruby interpreter written in Java• Current Version: 1.4.0
• 1.5 RC coming soon
• Ruby 1.8.7 compatible• Some Ruby 1.9 support
• --1.9 flag (80%)
• Solid performance (~Ruby 1.9)• Startup is poor, execution usually better than 1.9
• Runs native threads• Foreign Function Interface (FFI)for C
libraries• Adopted from Rubinius, CRuby gem
• Runs Rails great!
Ruby Frameworks on GlassFish
GlassFish v3 Architecture
JVM
V3 Kernel
Django ...
Jython Container
Grizzly
WSGI
JSF
Web Container
Servlet Spec
Grails ...
GlassFish v3 Modules
Web Framework Interface
GlassFish v3 Modules Java Framework
Ruby Framework
Python Framework
JRuby Container
Rack
Rails Merb ...
Key
Why Ruby on GlassFish ? - Agile
Why ? - Easy prototyping, yet powerful
Why ? - Best of both worlds
Why ? - Database Connection Pooling
Why ? - Management
Why ? - Monitoring
Rails Deployment choicesDirectory, WAR, Gem
jruby -S gem install glassfish
http://blogs.sun.com/arungupta/entry/totd_70_jruby_and_glassfi sh
jruby -S rails helloworldcd helloworldjruby -S glassfish
jruby -S glassfish -h
-c: change the context root-e: environment-d: Runs as daemon-P: location of PID file-l: log file location-log-level: Logging level (0-7)
asadmin start-domainasadmin deploy --property "jruby.home=JRUBY_HOME" helloworld
CompleteAbsolute
Path
http://wiki.glassfi sh.java.net/Wiki.jsp?page=GlassFishV3CapistranoRecipes
jruby -S gem install warblerjruby -S warble
http://blogs.sun.com/arungupta/entry/totd_73_jruby_and_glassfi sh
WAR Deployment: Packaging
http://blogs.sun.com/arungupta/entry/totd_80_sinatra_crud_application
Any Rack-based framework ...
http://weblogs.java.net/blog/vivekp/archive/2009/04/plugin_any_ruby.html
Deployment Options
http://blogs.sun.com/arungupta/entry/totd_81_how_to_usehttp://blog.headius.com/2009/04/apache-jruby-rails-glassfi sh-easy.html
NetBeans: Develop with Pleasure
http://blogs.sun.com/arungupta/entry/screencast_26_develop_run_debug
Ruby Monitoring
• Basic Monitoring• jinfo: System properties and VM CLI flags• jmap: Shared object memory map• jstack: Stack traces of Java threads• jstat: Performance statistics on class, JIT compiler, GC, ...
• Advanced• jconsole / Visual VM• NewRelic, FiveRuns, ...
jConsole
http://blogs.sun.com/arungupta/tags/rubyonrails+jmx
Who loves Ruby on GlassFish ?
Turbo charging your JRuby Startup
• “-client” or “-server” ? (Upto 50%)• Faster startup or solid runtime ?• export JAVA_OPTS=”-client -D32”• Upto 50% improvement
• For Linux: Class Data Sharing• Delay or disable JRuby's JIT (Upto 10%)
• -X-C• jruby.compile.mode=OFF
• Avoid spawning “sub-Rubies”• Nailgun for small JRuby CLI invocations• Favorite JVM Flags
http://blog.headius.com/2010/03/jruby-startup-time-tips.html
Resources
• glassfish.org• blogs.sun.com/theaquarium• glassfish-scripting.dev.java.net• @glassfish
GlassFish can support multiple Ruby frameworks ... really ?
Arun Gupta, Oracle Corpblogs.sun.com/arungupta, @arungupta