First of all, i don't wish to try to start a flame war. Just want to share some of my experience with RoR.
RoR, to me, is the pinnacle of web programming orgasm. It's fun, it's fast, it's super productive. Hell, i never enjoyed web programming till i tried RoR.
Unfortunately, RoR is slow, or specifically ActiveRecord is slow. No matter how many machines you throw at your app, there is still a noticeable page loading time lag compared to a straightforward PHP script. People hate it. Yes. They do. Users will complain and the only way you can improve the loading time drastically is if you stop using ActiveRecord. But heck, half of the joy in using RoR is with ActiveRecord. Either that or you cache page fragments. But trust me, caching page fragments is not fun. You need to keep track of which fragments to invalidate based on which model actions. Multiply that with many models and you get the same PHP messiness.
So what's my point? My point is that i'm looking for a new FAST mini-framework to replace RoR. Any recommendations :)?
First thing, when you use activerecord, do you know and use the include option when doing find?
An example, suppose you have two models Professor, and Lessons
A lesson belongs to a professor and a professor has many lessons.
Now, a common mistake is to do things like
@professors = Professor.find(:all)
and later to have some code that does something like
@professors.each do |professor|
...
professor.lessons
...
end
What happens? well you have one request to the database and then one request for each professor. (so the number of request is equal to the number of professors + 1).
If however you do Professor.find(:all, :include = "lessons")
it will fetch the lessons right from the beginning and your code will only do one request....
There are a lot of small mistakes like that that beginners do.... And while rails isolate you from the database stuff, you still need to understand what it does if you want things to work well
Active record is also use in Hibernate/nHibernate for java and .net as an o/r (object relational) mapper. There are a number of things someone can do to speed/ or tweek the way that data is accessed. From what I have seen about the web.
You want to design your functions in such a way that you are not doing anything complicated at first. This means that you should focus your API, webservice, or website around operations that perform a single DB call, and are linear in their search time, sometimes page-ation can help too. If you have an api that, for instance tries to find friends of friends, you are opening yourself up to disaster if you are going to do that in real time for a web service. You would be better off offering a service that gives you the friends of a user, pending you have the rights to see that users friends.
Something else we discovered was that if you are using MySQL on a different box in the cloud, your data access times are going to be SLOW, but if you have the DB running on a machine connected through a 1Gb connection you might be alright, but if you have MySQL running on the same dedicated box, then DB calls are almost as fast a calls to memory. Especially if you set up your db connection to connect through some sort of piped call or something similar in linux. At that point your call avoids going through your network interface and you skip the TCP/IP stack, which is a huge latency boost.
What name are you submitting patches for AR under (I'm not finding any under your username here, http://dev.rubyonrails.org/search?q=keiretsu&wiki=on&changeset=on&ticket=on) ? I'd like to check some of them out to see what your doing. I'm assuming your not just complaining about a free open source project and that your actually doing something about it, since just complaining is pretty bad for your karma.
It's no longer okay to complain? If I didn't like something, I'd prefer to complain and not use it than waste my time fixing something I find fundamentally flawed.
No, It's not ok to just go around complaining. If you don't like it, that's fine, don't use it, but to just go around posting completely unproven slander about a completely free project is another matter completely.
I love that there are some people here that seem to think they are entitled to something or that 37s or DHH owes you something. It's open source, you have 3 options:
1. Fix it and get kudos.
2. Don't fix it (because your either too dumb or too lazy) and work around it.
3. Don't use it.
But coming on here and making some generalized proclamation that RoR is slow is irresponsible and unacceptable, IMO.
While Open Source, I think Ruby on Rails is still a commercial project. Just think about the buzz it generates for 37signals, which probably converts directly to revenue. So I don't see why somebody shouldn't have the right to "complain" about it, or have an opinion about it, or decide to use something else.
Maybe the 37signals don't give a damn about who is using their framework. That would also be an indicator against using it, because it would mean bad support. If they do care about who is using it, then they might also care about people's opinions about it. I think Open Source projects DO compete - just think about the submissions you request. If an open source project is not popular, nobody will submit patches or features for it, either. Then it won't grow, and eventually die.
Since when is it up to 37 Signals to provide support for their framework? (Which by the way they do a pretty good job of - RailsConf anyone?) Its OPEN SOURCE so instead of whining you should go fix it, and if you don't want to fix it then go use something else.
RoR is not a panacea, but it certainly is "good enough" for a lot of things, think of all the 37 Signals apps.
I guess we just think differently about what makes a venture or business successful. Whatever... By support I didn't mean the "send a guy in to fix our bugs kind of support", just the level of trust you can put into a framework. You know, the "will there be anyone around in two years to still work on that" issue that seems to matter to some companies. You can just open source some random chunks of code that have been lieing around on your hard disk. Or you can "publish" something open source, which means that you will polish it a bit, add some documentation, generalise some things to make them more useful etc.
I wonder, though, if this case of Open Source fury is directly related to the Twitter vs RoR debate, and also to DHHs attitude? Serious question - I don't know about DHH well enough to judge his attitude, it's just a feeling that is in the air.
It would be very nice if Ruby would be taken in similar approach as PHP is. mod_ruby for apache and templating system like smarty. that's my orgasm. no frameworks no orm. oh my! :)
I read your comment yesterday in another thread Salvatore :) and tried to find some contact on you, but without success. Yes I can but it's not widely supported by hosting providers. That's pity.
Screw 'hosting providers':-) If you're going to do anything serious, you need to be root on the machine yourself. You can get a dedicated box for under $100 a month. If that's too much initially, you can split it with a few friends - I did that for one machine, and it came to something like $20 a month, for a machine that I have root on and can do basically what I want with.
We've got a GoDaddy dedicated host for $79/month. Bottom of the line model: I believe it's a 1.6GHz Celeron with 1G of RAM or something like that. It's perfect for straightening out the last few deployment issues and seeing if we can get traction before investing a lot in the site, though. We've got full root access to the box.
Slicehost is a Xen-based VPS, not dedicated. The difference between them and other VPS providers is that they do not oversell each box so you get a good price/performance ratio.
This is common. I've heard that some are waiting many weeks (or even months) to be granted a slice. The slicehost folks have recently introduced an option to prepay for your slice, bumping you up the queue.
I was lucky to get a slice the moment I signed up for it (early adopter I suppose). I have been very happy with their service.
Hello Ivan, many info about me at http://invece.org , recent news at http://antirez.com but only if you read italian... btw antirez [at] gmail d o t com
I've been enjoying web programming for 13 years, most especially the past 10 using BRL, which I wrote. If you're totally in love with ORM it's not for you, though. Basically it's SQL, HTML and as little in between as possible. If you like SQL and Scheme, you'll love BRL.
Dunno how to edit my own comments but....Code Igniter comes with excellent documentation I might add. Initially I loved Rails but migrated to Code Igniter cuz it's lightweight and loosely coupled(You don't even need to run with a model if you choose to but it follows the MVC structure quite well).
Plus it outperforms Rails in the speed department. It doesn't sport much magic compared to Rails. But that's ok if you're like me and you want to keep looking under the hood and see how stuff runs on CI. And it doesn't constrain you as much if you want to stretch out and really make it run.
It actually made PHP fun to learn(if you don't mind the fugly syntax). It also supports Active Record btw.
I agree with another poster--try to speed it up first. You've got a couple caching levels to try, at the page/fragment level and at the ActiveRecord level with memcached.
tried caching at the activerecord level with memcached.
Yes, there was a speed increase but still there is a noticeable page loading time lag. It doesn't load craigslist fast.
What have you tried doing to speed it up? Granted, RoR is no speed demon, but it seems to be "fast enough" for quite a few people. Perhaps you are doing something wrong?
RoR, to me, is the pinnacle of web programming orgasm. It's fun, it's fast, it's super productive. Hell, i never enjoyed web programming till i tried RoR.
Unfortunately, RoR is slow, or specifically ActiveRecord is slow. No matter how many machines you throw at your app, there is still a noticeable page loading time lag compared to a straightforward PHP script. People hate it. Yes. They do. Users will complain and the only way you can improve the loading time drastically is if you stop using ActiveRecord. But heck, half of the joy in using RoR is with ActiveRecord. Either that or you cache page fragments. But trust me, caching page fragments is not fun. You need to keep track of which fragments to invalidate based on which model actions. Multiply that with many models and you get the same PHP messiness.
So what's my point? My point is that i'm looking for a new FAST mini-framework to replace RoR. Any recommendations :)?