One of the most important characteristics of modern web application is scalability. With the advent of the web 2.0 era your web application can grow up very fast to millions of users and almost all the now famous websites that experienced this rapid growt shared the same problems: how to design a web application to serve from hundredths to hundredths millions of user requests.
Some people would argue that some language is faster than others or some framework is better scalable than other but the real answer is that there’s no silver bullet for scalability.
What you have to do instead is to follow some simple rules while you write the application from the ground (even if someone says that performance is not an issue before performance is an issue).
This is far the most common issue in scaling. If you build a web application that is a big block of code, a huge monolitic tightly coupled mixture of code and HTML, you will loose the ability to optimize and separate what can run fast and what can be run more slowly.
Like a modern manufacturing system, your application must be built as separate and loosely coupled modules. By keeping each module small and independent you can optimize the usage of limited resources like CPU and memory and get the best performances.
By using standard RPC mechanisms (like SOAP or REST) or enterprise message busses (like ActiveMQ or XMPP servers) you can easily and transparently interconnect these modules while maintain the ability to optimize and scale each single module.
Some common features that can be separated from the main application are:
The last two items are very interesting from a Rails development. A simple cronjob pointing to “appropriate” task written for the application can save a lot of time (script/console?…). And IMHO Rails offers a nice environment to accomplish that..
Carlettos, yeah Rails is very good on running parts of an application from the command line. But doing this still goes against the rule of application modularity since you’re putting batch processing code into the main application thus making it heavier.
Instead, by just leveraing on ActiveRecord you can build very lite scripts that just do what you want without bringing up the whole application. ![]()