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.
Subscribe to:
Post Comments (Atom)
48 comments:
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.
Labria,
Don'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.
Hi Charles,
well 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
Who knows where to download XRumer 5.0 Palladium?
Help, 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
What a great resource!
gt cialis pills , cialis cost , cialis soft , discount viagra , viagra , where to buy viagra
gt cheap generic cialis , discount cialis , cialis reviews , free viagra samples , viagra for women , online viagra
sdg cialis brand online , online cialis reviews , cialis vs cialis professional , generic viagra canada , viagra brand sale , order viagra without prescription
vt daily cialis 5mg , cialis pill splitter , cialis tablets for sale , online prescription viagra , buy viagra online without prescription , online prescription viagra
rfg cheap cialis soft , cialis tablets for sale , cialis for sale in canada , india generic viagra , buy viagra cheap , viagra prescription online
ttg generic viagra , viagra online pharmacy , viagra , cialis prices , cialis online , cialis 20 mg
ttg viagra , viagra pills , viagra generic , cialis , online cialis , cialis generic
appointment 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,
appointment 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,
over 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.
pay 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.
order viagra now buy cheap viagra online canada - viagra buy generic
http://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
viagra online without prescription does viagra work if you don't need it - viagra online in us
cheap viagra online viagra usage tips - buy viagra jelly online us
viagra sildenafil generic viagra buy online - viagra no prescription us
buy soma soma generic dosage - soma san diego owner
buy soma online generic soma for sale - buy soma online overnight
buy somas what does soma drug do - buy soma usa
Ohio 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]
Oregon State Of Medicine Return propecia online - cheap finasteride http://www.propeciahowtosave.net/#cheap-finasteride , [url=http://www.propeciahowtosave.net/#generic-finasteride ]generic finasteride [/url]
Siezure Medication Mood Photo buy cipro without prescription - purchase ciprofloxacin online http://www.cheapcipromed.net/#purchase-ciprofloxacin-online , cipro pills
Socialized 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]
Medical 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]
Medication Errors In Pharmacies buy finasteride online - finasteride online http://www.propeciahowtosave.net/#finasteride-online , http://www.propeciahowtosave.net/#buy-finasteride - buy finasteride
Blogger: 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
buy cialis online cialis online pharmacy no prescription - order cialis online no prescription usa
generic xanax xanax side effects in dogs - pictures of generic xanax bars
carisoprodol 350 mg carisoprodol and drug test - carisoprodol overdose amount
generic xanax xanax for anxiety in dogs - how long 2mg xanax last
buy tramadol buy tramadol money order - klonopin and tramadol high
buy carisoprodol carisoprodol generic - carisoprodol soma experience
generic cialis tadalafil cialis commercial 2012 - buy cialis professional
cialis online cialis online discover card - cialis 20 online
buy cialis online cheap generic cialis from usa - cialis daily use bph
xanax online half life 1mg xanax - 6mg xanax high
http://buytramadolonlinecool.com/#50897 do people buy tramadol - no prescription for tramadol
buy klonopin online took 2mg klonopin - 1 mg klonopin high
07 cheap lorazepam 2mg - order lorazepam online http://www.ativanonlinenorx.net/#cheap-lorazepam-2mg, [url=http://www.ativanonlinenorx.net/#ativan-online-pharmacy]buy ativan[/url]
buy klonopin online 3 mg klonopin high - 1.5 mg klonopin and alcohol
Post a Comment