There are lots of resources on the entanglement that devise obvious how to prorate increase entanglement applications and how to prorate increase Rails. Here’s a instantaneous laconic of decent five of the schoolboy strategies in the direction of a scalable Ruby on Rails entanglement germaneness. Some of them are special to to Ruby on Rails; others generalize to any shared-nothing germaneness server architecture.
1) Cache, bury, bury and more bury.
Cache at the firm and interest Ajax libraries like JQuery to shoot in demonstrate to the browser on desire. Take firm interest of Rails’ built-in front, leaf and fragment caching. Use gateway /reverse surrogate caches to bury HTTP responses at your website, and learn how to interest perpetual old-fashioned and etags. Use memcache to bury results that you’d below other circumstances reach from your database.
2) Segregate demonstrate and demonstrate serving
Don’t munge all your demonstrate storage into a fix database for convenience. Datasets that are unaffiliated should favour into unyoke databases. Serve difficulty assets from a unyoke stratum, or interest Amazon S3 or a CDN like Akamai to one’s duty those assets. Relational databases prorate increase up, not old-fashioned, so sub down and sire a pith to pith talk with your DBA above whether you honestly necessity a relational demonstrate archetypal in the direction of all your demonstrate stores. It’s more excessive, but it simplifies scaling. Maybe you can pique away with a simpler key-value demonstrate cumulate in the direction of some of your simpler demonstrate. There are ruby clients, so interest Hadoop in the direction of scaling the storage and unravelling of large amounts of unstructured demonstrate. Also certain the scalability limitations of whatever data group you’re using.
If a services isn’t responding or can’t cope with your growing call capabilities, devise trusty that you sire a fallback scheme. If you sire weighed down demonstrate reporting needs, do your reporting from a representation of your pure database, not from your putting out database!
3) Minimize & cope with external dependencies
Watch in the direction of dependencies on external services like ad serving networks or RSS feeds.
4) Tend your database and your feat handlers
Any ORM, including Rails’ ActiveRecord can beget SQL queries that marred database conduct issues. Make trusty you’re looking at your past it dispute log after each worst integration to devise trusty you don’t sire missing database indices, and haven’t written disconsonant find-all’s in your Rails orthodoxy. Scrub your database periodically in the direction of indices that are no longer being second-hand. These frequently broaden non-linearly because you’ve written O(n^2) or O(n^3) scripts.
Similarly, care for the resource consumption of your unremarked and scheduled jobs. This indulgent of orthodoxy can be honestly obvious to ignore searching botch. Ideally, segment your jobs in a unyoke stratum. And, as you broaden, look at impelling to a demonstration based feat handler.
Sharding involves breaking up your datasets into unaffiliated pieces based on a description.
5) Shard your unavoidably relational data
At exuberant scaling levels, your MySQL database choose sire to be sharded.