update: I'm here talking about problems I encountered migrating from Rails 1.2.3/1.2.4 to Rails2.0. My app has been on JRuby since almost the beginning and I had no issue with JRuby (this time at least). Being on JRuby motivated me even more to try Rails2.0 as the routing is said to be optimized by caching as I'll explain there.
The current state of JRuby (trunk) is that low level tests tend to be faster than C-Ruby but Rails is still a bit slower. Some people, included me, tend to think this might be due to the request routing of Rails being slow in JRuby. Indeed Rails routing extensively uses regexps and regexps in JRuby are still a lot slower than in C-Ruby. In fact this is because Java regex engines work with char[] whereas Ruby (including JRuby) represents strings as byte[]. So in JRuby we have to translate byte into char[] and back all the time for regexps untill somebody ports on Java a byte based regexp engine (namely the oniguruma lib).
So for a JRuby dev, it's always nice the hear Rails2.0 made some caching optimization on routing. So I wanted to try it. I didn't finish yet to port the Livetribune application (not yet in prod BTW) but I made great progress. In order to help other people in their migration I'll relate here a few tricks I had to do to make it working.
* url_for don't accept anymore symbols to point controllers. You have to write strings instead. So for instance:
map.connect ':locale/topics/:year/:month/:day/:id', :controller => :topics, :action => 'show'
became
map.connect ':locale/topics/:year/:month/:day/:id', :controller => 'topics', :action => 'show'
else rails will complain symbol :topics have no method [].
* the usefull routing_navigator plugin doesn't work anymore out of the box in Rails2.0 . This seems to be due to the self.template_root method call in the RoutingNavigatorController that doesn't exist anymore in Rails2.0. I didn't fin the work arround so I simply dropped the plugin.
* replace @base_path by ActionController::Base.view_paths whenever its used (in the AuthGenerator plugin for instance) as suggested here:
http://dev.rubyonrails.org/ticket/9689
(still I didn't get AuthGenerator fully working yet. Rails still miss its view templates)
* Since by default Rails2.0 sessions are based on a cookie store, either set it back to file store, either explicitly define a secrete that'll be share between the client browser and your server, like:
config.action_controller.session = { :session_key => "_myapp_session", :secret => '449fe2e7daee471bffae2fd8dc02313a' }
in your environment.rb
After this I had almost everything working again. Still some trouble with AuthGenerator, please provide feedback if you get this one fixed.
Also I installed that Rails 1.2.4 version before hoping it would shout for all the potential issues. It never shouted for those I just wrote about, so may be that could have done it better (or may be it's not too late to include those pointers).
Rails is very cool and Ruby is too. But it's in those kind of migration situations you'll think Java was just safer. I mean, I think half those problems would have been statically highlighted by the compiler. For the other half, let's face it you would have used some IOC injection like Spring so you wouldn't have detected it either (that the big hypocrisy of the today's J2EE world).
I still think nothing is approaching Rails in its niche, but that was just to highlight Ruby will never replace Java fully, even as a language. Rails is OK because the compiler safety is being replaced by the community checking quite effectively, but that wouldn't be true in an enterprise world for instance.
Finally I think JRuby really is the expected silver bullet, because it will allow you to closely choose where things get dynamic but unsafe (Ruby) and where thing get static and safe (Java). Moreover, the new optional Ruby type signature that's being imagined for the new JRuby compiler ( http://headius.blogspot.com/2007/09/compiler-is-complete.html )will just allow you to compile your great Ruby lib in Java and then use it from Java (as a jar bytecode) calling it through normal Java typed methods. It means you'll use safely Ruby libs whenever their author would have decided some part of its API deserves more security (and yes, a bit less agility). I mean JRuby will let you have the choice and that's great.
Also I forgot: I had no issue due to the use of JRuby (trunk) with Rails2.0.
Have fun with JRuby and Rails2.0.
Raphaël Valyi.
JRuby is fun for sure. But porting existing rails apps to it is hell, because most of the plugins and gems simply do not work. And there also are small differences between jruby and cruby that make your life hell, like when you have something with a price of $10.1, and someone orders 3 of it. CRuby returns 10.1*3 = 30.3, while JRuby is much more accurate and returns 30.2999999997. Right into the user interface… And you never know what will pop-up next.
ReplyDeleteLabria,
ReplyDeleteDon't get me wrong, I was exposing here problems I had migrating from Rails 1.2.3 to Rails 2.0. Not migrating to JRuby. Livetribune has been designed with JRuby almost since the beginning.
I had no problem because of JRuby itself as I mentioned. Still, I heard about that floating point issue in the mailing list, I hope they get it fixed indeed.
I should admit I had to cope with a lot of JRuby bugs some months ago. Since JRuby 1.0, things are being easier and I'm really optimistic for the future.
Anyway, Livetribune could not really have been done using C-Ruby. I have a huge algorithmic cost on some requests (graph clustering + Eigen Vector).
Migrating those algorithms from Ruby to Java was a two order of magnitude win. I first tried to write them in C and use the native Ruby-GSL lib, but really it was too much hassle, much more than being a JRuby early adpoter.
Regards,
Raphaël Valyi.
Great post Raphaël, thank you! If you'd like, add a link to it on the JRuby wiki.
ReplyDeleteHi Charles,
ReplyDeletewell actually, this post is much more dedicated to a Rails2.0 migration rather than JRuby itself. Being on JRuby motivated me even more to try the route optimization, that's all. The primary motivation was actually to help people googling for the same kind of troubles I encountered.
So I think linking from the JRuby wiki wouldn't help that much JRuby beginners. I might write other posts about why I choese JRuby for Livetribune.com but, finishing Livetribune itself is the priority and blogging comes second...
So for now I'll just make a post in the user list telling I had no special problem with Rails2.0 and JRuby. Thanks for the suggestion any way and keep JRuby that way; that's a great project.
Raphaël.
can women take viagra cialis viagra viagra liver damage female use of viagra soma and viagra prescriptions free viagra viagra 100mg cheap viagra nz splitting viagra viagra logo buy online viagra buy viagra meds online does viagra really work viagra by mail low cost viagra
ReplyDeleteWho knows where to download XRumer 5.0 Palladium?
ReplyDeleteHelp, please. All recommend this program to effectively advertise on the Internet, this is the best program!
No prescription eurax Now epivir Online lamisil Sale xenical World delivery coreg Sale colospa
ReplyDeleteWhat a great resource!
ReplyDeletegt cialis pills , cialis cost , cialis soft , discount viagra , viagra , where to buy viagra
ReplyDeletegt cheap generic cialis , discount cialis , cialis reviews , free viagra samples , viagra for women , online viagra
ReplyDeletesdg cialis brand online , online cialis reviews , cialis vs cialis professional , generic viagra canada , viagra brand sale , order viagra without prescription
ReplyDeletevt daily cialis 5mg , cialis pill splitter , cialis tablets for sale , online prescription viagra , buy viagra online without prescription , online prescription viagra
ReplyDeleterfg cheap cialis soft , cialis tablets for sale , cialis for sale in canada , india generic viagra , buy viagra cheap , viagra prescription online
ReplyDeletettg generic viagra , viagra online pharmacy , viagra , cialis prices , cialis online , cialis 20 mg
ReplyDeletettg viagra , viagra pills , viagra generic , cialis , online cialis , cialis generic
ReplyDeleteappointment to completion. [url=http://buyviagraukonline.com]viagra uk online[/url] without a prescription Our patient was in the process of healing,you are thinking about buying, can cut an estate agent out, [url=http://buykamagrauk.org]next day kamagra[/url], the result of the first differentiation are debarrasse to be pas are bad,
ReplyDeleteappointment to completion. [url=http://buyviagraukonline.com]buy viagra boots[/url] without a prescription Our patient was in the process of healing,you are thinking about buying, can cut an estate agent out, [url=http://buykamagrauk.org]kamagra fast uk[/url], the result of the first differentiation are debarrasse to be pas are bad,
ReplyDeleteover mortgage securities sold to investors must be , [url=http://uslevitraonline.com ]generic levitra online reviews[/url], bringing the claims has expired, the bank said. can cut an estate agent out, [url=http://cialiscanadabuyonline.com ]buy cialis canada online[/url],trachyte and traquibasalto.
ReplyDeletepay day loans http://2applyforcash.com/ teeneutsergoRem Instant Online Payday Loans Impopay [url=http://2applyforcash.com/]payday loans[/url] payday loans online direct lenders The most successful green advocacy groups sites (especially if they suggest a host for you).So, is all of this capacity is huntington experience to get a campaign going across the u.Click chosen something that is harmful link building, article syndicating marketing and and get started now.
ReplyDeleteorder viagra now buy cheap viagra online canada - viagra buy generic
ReplyDeletehttp://php.luminlit.com/drupal-6.25/node/98290 teeneutsergoRem [url=http://linguinauts.com/node/43868]ways to make extra money[/url] Impopay start a business under 1000
ReplyDeleteviagra online without prescription does viagra work if you don't need it - viagra online in us
ReplyDeletecheap viagra online viagra usage tips - buy viagra jelly online us
ReplyDeleteviagra sildenafil generic viagra buy online - viagra no prescription us
ReplyDeletebuy soma soma generic dosage - soma san diego owner
ReplyDeletebuy soma online generic soma for sale - buy soma online overnight
ReplyDeletebuy somas what does soma drug do - buy soma usa
ReplyDeleteOhio Drug Treatment cost of ciprofloxacin - cipro sale http://www.cheapcipromed.net/#cipro-sale , [url=http://www.cheapcipromed.net/#ciprofloxacin-without-rx ]ciprofloxacin without rx [/url]
ReplyDeleteOregon State Of Medicine Return propecia online - cheap finasteride http://www.propeciahowtosave.net/#cheap-finasteride , [url=http://www.propeciahowtosave.net/#generic-finasteride ]generic finasteride [/url]
ReplyDeleteSiezure Medication Mood Photo buy cipro without prescription - purchase ciprofloxacin online http://www.cheapcipromed.net/#purchase-ciprofloxacin-online , cipro pills
ReplyDeleteSocialized Medicine France Problems With propecia for sale - order propecia online http://www.propeciahowtosave.net/#order-propecia-online , [url=http://www.propeciahowtosave.net/#propecia-online-pharmacy ]propecia online pharmacy [/url]
ReplyDeleteMedical Certificates For Drugs Testing cipro 500mg - buy cipro no prescription http://www.cheapcipromed.net/#buy-cipro-no-prescription , [url=http://www.cheapcipromed.net/#cipro-for-sale-online ]cipro for sale online [/url]
ReplyDeleteMedication Errors In Pharmacies buy finasteride online - finasteride online http://www.propeciahowtosave.net/#finasteride-online , http://www.propeciahowtosave.net/#buy-finasteride - buy finasteride
ReplyDeleteBlogger: Raphaël Valyi's blog - tackling the distributed world - Post a Comment discount celebrex - buy celebrex without prescription http://www.celebrexgenericsale.net/#buy-celebrex-without-prescription , cheap celebrex 200mg
ReplyDeletebuy cialis online cialis online pharmacy no prescription - order cialis online no prescription usa
ReplyDeletegeneric xanax xanax side effects in dogs - pictures of generic xanax bars
ReplyDeletecarisoprodol 350 mg carisoprodol and drug test - carisoprodol overdose amount
ReplyDeletegeneric xanax xanax for anxiety in dogs - how long 2mg xanax last
ReplyDeletebuy tramadol buy tramadol money order - klonopin and tramadol high
ReplyDeletebuy carisoprodol carisoprodol generic - carisoprodol soma experience
ReplyDeletegeneric cialis tadalafil cialis commercial 2012 - buy cialis professional
ReplyDeletecialis online cialis online discover card - cialis 20 online
ReplyDeletebuy cialis online cheap generic cialis from usa - cialis daily use bph
ReplyDeletexanax online half life 1mg xanax - 6mg xanax high
ReplyDeletehttp://buytramadolonlinecool.com/#50897 do people buy tramadol - no prescription for tramadol
ReplyDeletebuy klonopin online took 2mg klonopin - 1 mg klonopin high
ReplyDelete07 cheap lorazepam 2mg - order lorazepam online http://www.ativanonlinenorx.net/#cheap-lorazepam-2mg, [url=http://www.ativanonlinenorx.net/#ativan-online-pharmacy]buy ativan[/url]
ReplyDeletebuy klonopin online 3 mg klonopin high - 1.5 mg klonopin and alcohol
ReplyDelete