Upload
others
View
12
Download
0
Embed Size (px)
Citation preview
Rails powered by GlassFish
Arun Guptablogs.sun.com/[email protected]
What is GlassFish ?
! A Community
- Users, Partners, Testers, Developers, ...
- Started in 2005 on java.net
! Application Server
- Enterprise Quality and Open Source
- Java EE 5 Reference Implementation
- Full Commercial support from Sun
! Growing Organically into other Middleware Areas
State of GlassFish
! GlassFish v2 – Fast, Easy, Reliable
- Java EE 5 compliant with advanced enterprise features
- Centralized Administration
- .NET 3.0 Interoperability
- High Availability, Clustering, Load Balancing
- NetBeans, Eclipse, IntelliJ integration
! GlassFish v3 – Modular, Embeddable, Extensible
- Modular: OSGi compliant, Maven 2
- Embeddable: Runs in-VM
- Extensible: Pluggable Container
! Enterprise Support and Services in “Sun GlassFish Enterprise Server”
GlassFish v3 Gem
jruby -S gem install glassfishjruby -S glassfish_rails <RAILS_APP>
http://blogs.sun.com/arungupta/entry/jruby_1_1_3_released
Gem Internals
2.68 MB
0.3.1
Development & Deployment
v3 NucleusGrizzly Rails
AdapterRails Connector
Auto-configurable Runtime Pool *
GlassFish Rails Runtime Pooling
CreateJRuby
Runtime
GemStartup
Load RailsEnvironment
Add toRuntime
Pool
JRuby
Rails
JRuby
Rails
Auto-configure Runtime Pool
GrizzlyListener
RailsAdapter
RuntimePool
borrows / add
Heuristic: Upto 2x CoreUser specified: jruby.runtime.min/max
Scalabilit
y
JRuby
Rails
Efficie
ncy
http://blogs.sun.com/Jacobkessler/entry/it_s_dynamic
GlassFish v3
asadmin deploy <RAILS_APP>
http://blogs.sun.com/arungupta/entry/jruby_1_1_3_releasedhttp://blogs.sun.com/arungupta/entry/netbeans_6_5_m1_glassfish
GlassFish v3 Runtime
Grizzly Listener
RailsAdapter
WebAdapter
XXXAdapter
RuntimePoolJRuby
Rails
. . .
Concurrency Level: 2Time taken for tests: 58.227726 secondsComplete requests: 1000Failed requests: 0Write errors: 0Total transferred: 4200000 bytesHTML transferred: 3675000 bytesRequests per second: 17.17 [#/sec] (mean)Time per request: 116.455 [ms] (mean)Time per request: 58.228 [ms] (mean, across all concurrent requests)Transfer rate: 70.43 [Kbytes/sec] receivedConcurrency Level: 2
Time taken for tests: 59.395294 secondsComplete requests: 1000Failed requests: 0Write errors: 0Total transferred: 4309000 bytesHTML transferred: 3795000 bytesRequests per second: 16.84 [#/sec] (mean)Time per request: 118.791 [ms] (mean)Time per request: 59.395 [ms] (mean, across all concurrent requests)Transfer rate: 70.85 [Kbytes/sec] received
WAR-based Deployment
! JRuby CLI
- jruby -S gem install warbler
- jruby -S warble
! NetBeans IDE
- Goldspike in NB 6.1, Warbler in NB 6.5
! Deploy Directly on GlassFish v2 or v3
c
http://blogs.sun.com/arungupta/entry/rails_and_java_ee_integration1
JDBC Connection Pooling
production: adapter: mysql database: jndi_rails_production username: root password: host: localhost
production: adapter: jdbc jndi: jdbc/jndi_rails driver: com.mysql.jdbc.Driver
production: adapter: mysql database: jndi_rails_production username: root password: host: localhost
http://blogs.sun.com/arungupta/entry/totd_9_using_jdbc_connection
Rails and Comet - Tic Tac Toe
! Multi-player game
! Using GlassFish Comet
http://blogs.sun.com/arungupta/entry/tic_tac_toe_using_rails
Some tested apps ...
Project Management
E-Commerce Platform
Blogging System
Blogging Engine
Gem2 load-balanced T2000, Solaris
10, AS 9.1 UR1, MySQL
AS 9.1 UR1, Dell 1750, CentOS 4.5
4 AS 9.1 UR2 instances, 16 runtimes
Ubuntu 8.04, 2 instances of GlassFish UR1 on quad-
core Xeons, Master/Slave, nginx for static files
Warbler, GlassFish v2
Warbler, GlassFish v2
http://wiki.glassfish.java.net/Wiki.jsp?page=JRuby#section-JRuby-SuccessStories
Hudson and JRuby
Credits: David Calavera
Credits: blog.huikau.com
Endorsements
Look like the best deploying option I ever
found for Rails, GREAT!
The combination of Rails 2.0.2 (stable), JRuby 1.1 RC2, the Glassfish gem, and JDK 1.6 is not only breaking down enterprise barriers but speeding
up apps all over the place
leading the way to simple, scalable, no-hassle hosting for Ruby
web applications.
No mongrel packs to manage, no cluster of apps to monitor, and no WAR file relics to slow you down. "glassfish_rails myapp" and you're done; it's true one-step
deployment.
had no reliability and performance issues with
Glassfish
money is on JRuby (and Glassfish) for the long haul; if you haven't checked
out Glassfish yet, you're doing yourself a disservice!
Rails Monitoring ?
! Basic Monitoring
- jinfo – Prints Java System properties and VM CLI flags
- jmap – Shared object memory map or heap memory details
- jstack – Stack traces of Java threads
- jstat – Performance statistics on class, JIT compiler, GC
! Deep Dive
- jconsole / VisualVM
- NewRelic
- Five Runs
jconsole
jconsole
GlassFish Deployment
blogs.sun.com/stories
Some GlassFish Adoption Indicators
! 2.5m+ hits in 13 months
! 310k+ different IPs
! 150k registrations in 7 months
! 4.5m+ downloads in 12 months
Host Your Rails Apps on
GlassFish, Free for 12 Months! Cloud computing
environment powered by Sun and Solaris OS- 1/16th of a quad-core
CPU- 512MB RAM- 50 GB of storage- Unmetered bandwith
data transferring- Pre-installed and
configured GlassFish and MySQL
! Free for 12 months for Sun Startup Essentials members! sun.com/startup/glassfish
Rails 2.2
! Simple Rails App (1 Model, 1 Controller)
- 1000 requests with 10 concurrent users
10 instances Multi-threaded
200 Mb 50 Mb
233 Mb 55 Mb
Startup
Heap (at end)
Why Rails on GlassFish ?
! Java EE is tested platform – Co-host Java and Rails
- Known Deployment and Management
- Clustering, Load Balancing and High Availability
! “Green” alternative – One command, One instance, One process
! Multiple Requests by a Single Application
! Multiple Applications in One Container
! Database Connection Pooling
http://developers.sun.com/appserver/reference/techart/rails_gf/
Rails powered by GlassFish
Arun Guptablogs.sun.com/[email protected]