I was wondering if anyone could direct me on how to use Rails to create a social networking site such as facebook/friendster/myspace etc... What would I need to do in order to control high volume traffic via the server and database?
Thanks for all the help.
The "RailsSpace":http://railsspace.com/ book specifically targets creating a social networking site with Rails. That should get you started building a site WHILE you learn some Rails by example.
As far as scaling up to meet high traffic demands, there are many sources:
"Deploying Rails Applications":http://pragprog.com/titles/fr_deploy and many blog posts around the net. I think this book is an excellent start though and will have you asking the right questions (on forums or Google) should they arise on your deployment journey.
Well, you'll need a team of experienced folks that understand web scalability :-)
Seriously, this is not a simple task that you can just learn from a few tutorials and books. You either can hire others that know how or work with just a team so you can learn.
I would first and foremost encourage you to check out http://lovdbyless.com/ which is an open source social networking framework created in Rails. The idea is that 90% of all these social networking sites are all the same, so, build all that functionality into it and then let people customize it from there. Probably a fantastic option.
After that, check out Apress's book, "Practical Rails Social Networking Sites" (June 2007 I believe).
And my personal plea, please please please don't create another social networking site! :)
Best of luck, Matt
Thanks for all the help everyone, my main concern would be understanding web scalability. I know it is not an easy task, but I am always up for a challenge. I'm assuming i'll need a lot of servers with load balancing and clustered DBs.
Thanks for the help everyone.
Vince, if its scaling you're really focusing on and not so much social networking then have a look at some scaling specific articles. For example:
Obviously your application design is going to play in heavily with scaling. But it doesn't matter if you're building a social networking site or a simple forum. You will need to implement things like caching to help speed up the website and using smart design to not overload the app wherever possible. Read some of these articles on that website. Your first goal is to build the app right, scaling from there should be a breeze! :)
First, simply "throwing hardware" at the problem is a terrible way to handle growth problems -- it's a last resort for any top-tier engineer. For the kinds of questions you're asking, you really should seek out information on good, Enterprise-Capable Software Architecture. There's no shame in looking to Microsoft, Sun, or IBM for technical articles, despite what the FOSS GNU-Hippies would have you think about the Evil Corporations.
If you want to design for REAL scalability, don't ever start out with a web app as your guide, as there are too many wannabe amateurs who are more interested in making pretty sites than they are in making Rock-Solid infrastructure. Instead, take a close look at how the Fortune 500 companies like Citibank have built their infrastructures.
It's "old skool" stuff that might get you exposed to Mainframes, Message Queues, and Sarbanes-Oxley compliance.. but if you start there and learn those basics, you will be a MUCH better software designer than 90% of your colleagues.
To answer your original question, though.. the Rails Framework is nowhere NEAR enterprise capable scalability without some serious help, and that's the sad, honest truth. If you want scalability and you need to develop in Rails, then yeah, you will probably end up throwing hardware at it. I suggest looking at more capable Ruby engines like JRuby and IronRuby, as well as a more capable server -- Old-Skool Mongrel and WebBrick won't cut it. You might also want to read the blog articles of Zed Shaw (original author of Mongrel), as he has good technical details that go down to the (Linux) kernel and back up.
We are all looking forward to the day when the drama of Rails and scaling may no longer be such a drama. I think that Laurance makes some very valid points, especially when it comes to software design, a lot of scaling issues won't come from hardware so much as software design. Careful you don't make a resource hungry beast, you may want to look at ways of offloading processes (handling file uploads with another server, for example... Merb anyone?) But hey, maybe with some of the new players coming into the field (mod_rails for example) we might just see some improvement in the Rails scaling issue.
I just want to clarify one point, while it may be true that the Rails Framework is not as easy to scale, it IS being used in enterprise situations and with great success. One such place to confirm this is here with the famous "high profile" rails list: http://www.workingwithrails.com/high-profile-organisations or Obie's list: http://blog.obiefernandez.com/content/2008/03/big-name-compan.html
The point I'd like to make is that it is far from impossible, good software design, the right choice of tools and the will to do it will all get you there. I'm sure the people at twitter may not have imagined that their site would be as successful as it was, or that they would necessarily run into the scaling problems they did. They are not an enterprise organizations and are one of the top 1000 websites for traffic with millions and millions of hits a day.