It's not always necessary to mega scale Ruby on Rails projects to make them enterprise grade applications. And if you've poked around the Internet a bit, you may already be discouraged by the news that "Rails doesn't scale", but that's not entirely true.
If you want to finesse your app on a small scale first and then grow it, Rails is actually a perfectly good way to go. Scaling an app should start with good architecture (and databases, caching, event queues, disk IO, CDNs, et al.) When it comes to runtime or framework, worry about augmenting your build to support these after all of the other elements are taken care of first, unless your purchases are off the charts right off the bat.
Rails is a fantastic platform to get your app built quickly, efficiently and with fewer bugs. But the fraction of the time that you do, there is a fairly clear-cut way of doing things without suffering major re-writes.
What Does "Enterprise Grade" Mean?
Most programmers would say that the title is given to applications that prove themselves to be consistently secure, reliable and high-performing. That is technically correct, albeit vague, but there seems to be more to the Enterprise name than just the functionality of the application. Enterprise Grade is about delivering a product that has a strong and consistent enough architecture that it can service and support the growth of a business.
What makes an app "Enterprise Grade"?
Security: Not just for protection against hackers but the protection of the app's content—your content and the content of your users. Users expect a whole other level of security when they connect and plug their information into an Enterprise Grade app.
Support: An effective way of managing all users, from the enterprises themselves to their own online ecosystems.
Administration: A granular management system for all aspects of the enterprise mobile app experience.
Full-Integration: Extensions are made without disrupting the experience of your clients or their customers.
Content: Supports entire content life-cycle and is just as comprehensive to use for the content creators as it is for the content producers, editors and consumers.
What You Will Need
To scale applications built with Ruby on Rails so that they meet the needs of your enterprise, you will need:
- You languages (Java, C/C++, Scala)
- Custom or no frameworks
- Data Center
- Large Team
- Continuous Integration server
- Note: Don't get so hung up on the language, because it's applicable design that will be the key to getting you to the finish line of this project.
How to Divide and Conquer
Just as your app evolves, so should your build team dynamic. This doesn't necessarily mean, however, that your team needs to build in numbers.
Your ideal team will consist of:
2-3 Ruby on Rails experts
Graphic Designer/UX expert
Tip 1: Create an OS account for everyone on the team to use. Share and pair your tools on there.
Tip 2: Use a Git repository hosting service, like any of these trusty providers.
Using Paired Programming
Pair programming: (an agile app development technique) two programmers working together at one station. The "driver", writes code while the "observer" (or "navigator"), does quality control by reviewing each line of code as it is added. The programmers switch roles to avoid fatigue which could result in mistakes.
What can Paired Programming do for you, your team and your app?
It will help form bonds between members of your team.
It forces programmers to "do reps" of code writing and editing, strengthening their skills in both at the same time.
It results in a more robust code that has passed through two sets of expert eyes.
Knowledge is shared and collaborations are created in the process.
The build is generally faster when done using Paired Programming.
Tips for Enterprise App Success
Tip 1: Do your test-driven development (TDD) right from the beginning.
Tip 2: Don't cut out your daily stand-up just for the sake of saving some time. The time you save does not equal in value the chance to revive your team with your mission, bring them together as a unit before they go off to work independently, and to let them express questions or concerns. The same goes for your weekly sprint planning.
Tip 3: Use a consistent tool set throughout the process (RubyMine IDE, VIM, TextMate, etc.).
Tip 4: Keep a team chat open 24/7 to keep the lines of communication open and allow team members to catch up on new developments that were discussed while they were away or on break.
Tip 5: Not all Git repository services are made equal. Some offer issue management, time tracking, wikis (or some other collaboration tool) and a messaging system, while others offer a different set of tools. The right setup for you may take some trial and error.
Tip 6: Optimize your database and remove bottlenecks.
- Index your entire database because Ruby on Rails doesn't do this.
- Use EXPLAIN to identify slow queries so you can fix them.
- Don't use complex joins.
- Don't scan large data sets.
Case Study: World's Biggest Ruby on Rails Application
Twitter's move from Ruby on Rails to Scala occurred years ago, but it was a very public scaling process that demonstrates some significant lessons enterprise app architects can learn from today. Several articles available online document the events in a "Behind Baseball" kind of way, which helps us to zero in on some of the key takeaways from a successful enterprise app update.
VIDEO: Blaine Cook on Scaling Twitter > As one of the largest Ruby on Rails application in production today, the build revealed some not-so-obvious tips that Blaine Cook reveals here.
Scaling Twitter Slides > Slides from a presentation on scaling Twitter, from the SDForum Silicon Valley Ruby Conference (2007).
Twitter API Traffic is 10x Twitter's Site > Exerpt from an Twitter co-founder Biz Stone, Sean Ammirati at Read/WriteTalk.
Tip 1: Be as strategic about how you architect your enterprise grade applications as you are about your business—very!
Tip 2: Protect your systems by integrating user limits (reasonable ones) and detection mechanisms so you can cut users that are trying to bust into your system off at the pass.
Tip 3: Use creative thinking to get around being bogged down by the database.
Tip 4: Start with a Ruby on Rails build that is easily partionable and you will have an easier time scaling in the future.
Ultimately, the best way to ensure your Ruby on Rails project is properly scaled into an enterprise grade application is to follow best practices and arm yourself with the right tools for you and your team. But it also helps to know in advance how you would like your app to ultimately evolve so that you may build it with that intention from the start—at least that's what Twitter would tell you.