JRuby on Grizzly 1.5 now ready.....with asynchronous request processing support and soon Comet!
The very tiny JRuby on Grizzly module is now shipping and will soon be part of the Grizzly official distribution.
You can now start testing it and eventually replace your Mongrel or WEBrick native WebServer with the pure Java Ruby Bear :-). You can download the JRuby on Grizzly ready server here. Then just do:
% unzip jruby-on-grizzly-1.5-SNAPSHOT.jar
% cd jruby-on-grizzly
% java -jar ruby-1.5-SNAPSHOT.jar [port] [jruby applications] [number of runtime] \
[asyncExecution=true|false]But wait, this release also have new features other JRuby server doesn't have :-)! It support asynchronous request processing(ARP). The server ship with a default AsyncFilter that park the request for 10 seconds. Nothing fancy, but it give a good start for people interested about JRuby + ARP. And wrinting an AsyncFilter is quite easy so I suspect we should see asynchronous JRuby web application soon.
To enable APR, just do:
% java -jar ruby-1.5-SNAPSHOT.jar 8888 /jruby-apps/ 1 trueOn the server console, you should see the parking/resume message every time you sent a request:
$ java -jar jruby-1.5-SNAPSHOT.jar 8080 /jruby-examples/ 1 true
May 30, 2007 3:06:00 PM com.sun.grizzly.standalone.StaticResourcesAdapter
INFO: Servicing page from: /ruby-examples/bs/public
May 30, 2007 3:06:00 PM com.sun.grizzly.http.SelectorThread displayConfiguration
INFO:
Grizzly configuration for port 8080
maxThreads: 20
minThreads: 5
ByteBuffer size: 8192
useDirectByteBuffer: false
useByteBufferView: false
maxHttpHeaderSize: 8192
maxKeepAliveRequests: 256
keepAliveTimeoutInSeconds: 30
Static File Cache enabled: false
Stream Algorithm : com.sun.grizzly.standalone.StaticStreamAlgorithm
Pipeline : com.sun.grizzly.http.LinkedListPipeline
Round Robin Selector Algorithm enabled: false
Round Robin Selector pool size: 0
recycleTasks: true
Asynchronous Request Processing enabled: true
Parking the request for 10 seconds
Resuming the request
May 30, 2007 3:06:13 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO:
Processing SayController#hello (for 192.168.0.105 at 2007-05-30 15:06:13) [GET]
May 30, 2007 3:06:13 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Session ID: 0f21bd287851f72e1b0db90180053c7d
May 30, 2007 3:06:13 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Parameters: {"action"=>"hello", "controller"=>"say"}
May 30, 2007 3:06:13 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Rendering say/hello
May 30, 2007 3:06:13 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Completed in 0.02100 (47 reqs/sec) | Rendering: 0.01500 (71%)
| 200 OK [http://localhost/say/hello] It doesn't yet support Comet, but its only because I don't have enough time to learn JRuby. But from this page, I suspect the Grizzly Comet API can be called from a JRuby application. What needs to be done is to write a re-usable JRuby based CometHandler JRuby applications can reuse for doing Comet based request. I think I need to start pinging the JRuby community for help as I really think JRuby + Comet will be popular.
When will be the official release? The Grizzly community will vote this week about the next release (1.5.1) and the good news is JRuby will be part of it. Also, Grizzly 1.5.1 will soon make its way to GlassFish v3, so you will get extra functionalities when deploying JRuby web application. As usual, feedback are welcome...by sending emails to users@grizzly.dev.java.net!
technorati: grizzly comet web server asynchronous request processing jruby glassfish
- Login or register to post comments
- Printer-friendly version
- jfarcand's blog
- 2494 reads





