glassfish can support multiple ruby frameworks ... really ?

40
GlassFish can support multiple Ruby frameworks ... really ? Arun Gupta, Oracle Corp blogs.sun.com/arungupta, @arungupta

Upload: arun-gupta

Post on 15-May-2015

2.650 views

Category:

Technology


2 download

DESCRIPTION

"GlassFish can support multiple Ruby frameworks ... really ?" preso at Ruby Conf India 2010

TRANSCRIPT

Page 1: GlassFish can support multiple Ruby frameworks ... really ?

GlassFish can support multiple Ruby frameworks ... really ?

Arun Gupta, Oracle Corpblogs.sun.com/arungupta, @arungupta

Page 2: GlassFish can support multiple Ruby frameworks ... really ?

What is GlassFish ?

Page 3: GlassFish can support multiple Ruby frameworks ... really ?

What is GlassFish ?

Page 4: GlassFish can support multiple Ruby frameworks ... really ?

GlassFish: It's a Community!

Page 5: GlassFish can support multiple Ruby frameworks ... really ?

GlassFish: Lives on java.net

Since 2005

Page 6: GlassFish can support multiple Ruby frameworks ... really ?

GlassFish: Reference Implementation

Page 7: GlassFish can support multiple Ruby frameworks ... really ?

GlassFish v3

Page 8: GlassFish can support multiple Ruby frameworks ... really ?
Page 9: GlassFish can support multiple Ruby frameworks ... really ?
Page 10: GlassFish can support multiple Ruby frameworks ... really ?
Page 11: GlassFish can support multiple Ruby frameworks ... really ?

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%)

Page 12: GlassFish can support multiple Ruby frameworks ... really ?

• 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!

Page 13: GlassFish can support multiple Ruby frameworks ... really ?

Ruby Frameworks on GlassFish

Page 14: GlassFish can support multiple Ruby frameworks ... really ?

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

Page 15: GlassFish can support multiple Ruby frameworks ... really ?

Why Ruby on GlassFish ? - Agile

Page 16: GlassFish can support multiple Ruby frameworks ... really ?

Why ? - Easy prototyping, yet powerful

Page 17: GlassFish can support multiple Ruby frameworks ... really ?

Why ? - Best of both worlds

Page 18: GlassFish can support multiple Ruby frameworks ... really ?

Why ? - Database Connection Pooling

Page 19: GlassFish can support multiple Ruby frameworks ... really ?

Why ? - Management

Page 20: GlassFish can support multiple Ruby frameworks ... really ?

Why ? - Monitoring

Page 21: GlassFish can support multiple Ruby frameworks ... really ?

Rails Deployment choicesDirectory, WAR, Gem

Page 22: GlassFish can support multiple Ruby frameworks ... really ?
Page 23: GlassFish can support multiple Ruby frameworks ... really ?

jruby -S gem install glassfish

http://blogs.sun.com/arungupta/entry/totd_70_jruby_and_glassfi sh

jruby -S rails helloworldcd helloworldjruby -S glassfish

Page 24: GlassFish can support multiple Ruby frameworks ... really ?

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)

Page 25: GlassFish can support multiple Ruby frameworks ... really ?

asadmin start-domainasadmin deploy --property "jruby.home=JRUBY_HOME" helloworld

CompleteAbsolute

Path

Page 26: GlassFish can support multiple Ruby frameworks ... really ?

http://wiki.glassfi sh.java.net/Wiki.jsp?page=GlassFishV3CapistranoRecipes

Page 27: GlassFish can support multiple Ruby frameworks ... really ?

jruby -S gem install warblerjruby -S warble

http://blogs.sun.com/arungupta/entry/totd_73_jruby_and_glassfi sh

Page 28: GlassFish can support multiple Ruby frameworks ... really ?

WAR Deployment: Packaging

Page 29: GlassFish can support multiple Ruby frameworks ... really ?

http://blogs.sun.com/arungupta/entry/totd_80_sinatra_crud_application

Page 30: GlassFish can support multiple Ruby frameworks ... really ?

Any Rack-based framework ...

http://weblogs.java.net/blog/vivekp/archive/2009/04/plugin_any_ruby.html

Page 31: GlassFish can support multiple Ruby frameworks ... really ?

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

Page 32: GlassFish can support multiple Ruby frameworks ... really ?

NetBeans: Develop with Pleasure

http://blogs.sun.com/arungupta/entry/screencast_26_develop_run_debug

Page 33: GlassFish can support multiple Ruby frameworks ... really ?

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, ...

Page 34: GlassFish can support multiple Ruby frameworks ... really ?

jConsole

http://blogs.sun.com/arungupta/tags/rubyonrails+jmx

Page 35: GlassFish can support multiple Ruby frameworks ... really ?
Page 36: GlassFish can support multiple Ruby frameworks ... really ?
Page 37: GlassFish can support multiple Ruby frameworks ... really ?

Who loves Ruby on GlassFish ?

Page 38: GlassFish can support multiple Ruby frameworks ... really ?

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

Page 39: GlassFish can support multiple Ruby frameworks ... really ?

Resources

• glassfish.org• blogs.sun.com/theaquarium• glassfish-scripting.dev.java.net• @glassfish

Page 40: GlassFish can support multiple Ruby frameworks ... really ?

GlassFish can support multiple Ruby frameworks ... really ?

Arun Gupta, Oracle Corpblogs.sun.com/arungupta, @arungupta