Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 161311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:11:27+00:00 2026-05-11T11:11:27+00:00

There is a good chance that we will be tech crunched in the next

  • 0

There is a good chance that we will be tech crunched in the next few days. Unfortunately, we have not gone live yet so we don’t have a good estimation of how our system handles a production audience.

Our production setup consists of 2 EngineYard slices each with 3 mongrel instances, using Postgres as the database server.

Obviously a huge portion of how our app will hold up is to do with our actual code and queries etc. However, it would be good to see if there are any tips/pointers on what kind of load to expect or experiences from people who have been through it. Does 6 mongrel instances (possibly 8 if the servers can take it) sound like it will handle the load, or are at least most of it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T11:11:27+00:00Added an answer on May 11, 2026 at 11:11 am

    I have worked on several rails applications that experienced high load due to viral growth on Facebook.

    Your mongrel count should be based on several factors. If your mongrels make API calls or deliver email and must wait for responses, then you should run as many as possible. Otherwise, try to maintain one mongrel per CPU core, with maybe a couple extra left over.

    Make sure your server is using a Fair Proxy Balancer (not round robin). Here is the nginx module that does this: http://github.com/gnosek/nginx-upstream-fair/tree/master

    And here are some other tips on improving and benchmarking your application performance to handle the load:

    ActiveRecord

    The most common problem Rails applications face is poor usage of ActiveRecord objects. It can be quite easy to make 100’s of queries when only one is necessary. The easiest way to determine if this could be a problem with your application is to set up New Relic. After making a request to each major page on your site, take a look at the newrelic SQL overview. If you see a large number of very similar queries sequentially (select * from posts where id = 1, select * from posts where id = 2, select * from posts…) this may be a sign that you need to use a :include in one of your ActiveRecord calls.

    Some other basic ActiveRecord tips (These are just the ones I can think of off the top of my head):

    1. If you’re not doing it already, make sure to correctly use indexes on your database tables.

    2. Avoid making database calls in views, especially partials, it can be very easy to lose track of how much you are making database queries in views. Push all queries and calculations into your models or controllers.

    3. Avoid making queries in iterators. Usually this can be done by using an :include.

    4. Avoid having rails build ActiveRecord objects for large datasets as much as possible. When you make a call like Post.find(:all).size, a new class is instantiated for every Post in your database (and it could be a large query too). In this case you would want to use Post.count(:all), which will make a single fast query and return an integer without instantiating any objects.

    5. Associations like User..has_many :objects create both a user.objects and user.object_ids method. The latter skips instantiation of ActiveRecord objects and can be much faster. Especially when dealing with large numbers of objects this is a good way to speed things up.

    6. Learn and use named_scope whenever possible. It will help you keep your code tiny and makes it much easier to have efficient queries.

    External APIs & ActionMailer

    As much as you can, do not make API calls to external services while handling a request. Your server will stop executing code until a response is received. Not only will this add to load times, but your mongrel will not be able to handle new requests.

    If you absolutely must make external calls during a request, you will need to run as many mongrels as possible since you may run into a situation where many of them are waiting for an API response and not doing anything else. (This is a very common problem when building Facebook applications)

    The same applies to sending emails in some cases. If you expect many users to sign up in a short period of time, be sure to benchmark the time it takes for ActionMailer to deliver a message. If it’s not almost instantaneous then you should consider storing emails in your database an using a separate script to deliver them.

    Tools like BackgroundRB have been created to solve this problem.

    Caching

    Here’s a good guide on the different methods of caching in rails.

    Benchmarking (Locating performance problems) If you suspect a method may be slow, try benchmarking it in console. Here’s an example:

    >> Benchmark.measure { User.find(4).pending_invitations } => #<Benchmark::Tms:0x77934b4 @cutime=0.0, @label='', @total=0.0, @stime=0.0, @real=0.00199985504150391, @utime=0.0, @cstime=0.0> 

    Keep track of methods that are slow in your application. Those are the ones you want to avoid executing frequently. In some cases only the first call will be slow since Rails has a query cache. You can also cache the method yourself using Memoization.

    NewRelic will also provide a nice overview of how long methods and SQL calls take to execute.

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 78k
  • Answers 78k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Here's the code I'm using. Sub MoveSelectedMessagesToFolder() 'Originally written by… May 11, 2026 at 3:42 pm
  • added an answer Vim clear last search highlighting May 11, 2026 at 3:42 pm
  • added an answer Indeed a regex/replace is the way to go as described… May 11, 2026 at 3:42 pm

Related Questions

I have been recently (and repeatedly) asked by customers about MIPS needed to run
As discussed in similar questions here and here I want to protect my code
I'm working with a small (4 person) development team on a C# project. I've
In our web applications, we seperate our Data Access Layers out into their own

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.