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

  • SEARCH
  • Home
  • 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 6098315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:08:39+00:00 2026-05-23T13:08:39+00:00

I am writing a ruby on rails application and one of the most important

  • 0

I am writing a ruby on rails application and one of the most important featuers of the website is live voting. We fully expect that we will get 10k voting requests in as little as 1 minutes. Along with other requests that means we could be getting a ton of requests.

My initial idea is to set up the server to use apache + phusion, however, for the voting specifically I’m thinking about writing a php script on side and to write/read the information in memcached. The data only needs to persist for about 15 minutes, so writing to the database 10,000 times in 1 minute seems pointless. We also need to mark the ip of the user so they don’t vote twice thus being extra complicated in memcached.

If anyone has any suggestions or ideas to make this work as best as possible, please help.

  • 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. Editorial Team
    Editorial Team
    2026-05-23T13:08:39+00:00Added an answer on May 23, 2026 at 1:08 pm

    If you’re architecting an app for this kind of massive influx, you’re going to need to strip down the essential components of it to the absolute minimum.

    Using a full Rails stack for that kind of intensity isn’t really practical, nor necessary. It would be much better to build a very thin Rack layer that handles the voting by making direct DB calls, skipping even an ORM, basically being a wrapper around an INSERT statement. This is something Sinatra and Sequel, which serves as an efficient query generator, might help with.

    You should also be sure to tune your database properly, plus run many load tests against it to be sure it performs as expected, with a healthy margin for higher loading.

    Making 10,000 DB calls in a minute isn’t a big deal, each call will take only a fraction of a millisecond on a properly tuned stack. Memcached could offer higher performance especially if the results are not intended to be permanent. Memcached has an atomic increment operator which is exactly what you’re looking for when simply tabulating votes. Redis is also a very capable temporary store.

    Another idea is to scrap the DB altogether and write a persistent server process that speaks a simple JSON-based protocol. Eventmachine is great for throwing these things together if you’re committed to Ruby, as is NodeJS if you’re willing to build out a specialized tally server in JavaScript.

    10,000 operations in a minute is easily achievable even on modest hardware using a specialized server processes without the overhead of a full DB stack.

    You will just have to be sure that your scope is very well defined so you can test and heavily abuse your implementation prior to deploying it.

    Since what you’re describing is, at the very core, something equivalent to a hash lookup, the essential code is simply:

    contest = @contest[contest_id]
    
    unless (contest[:voted][ip])
      contest[:voted][ip] = true
      contest[:votes][entry_id] += 1
    end
    

    Running this several hundred thousand times in a second is entirely practical, so the only overhead would be wrapping a JSON layer around it.

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

Sidebar

Related Questions

I am writing a web based application using Ruby on Rails. In one of
I am writing ruby on rails application, which will have 2 different users types
I am writing a ruby on rails application that has large file uploads. (20-100MB).
I am writing a ruby on rails 3 application that is very simple: users
I'm currently writing unit tests for my Ruby on Rails application, and one of
I am writing a Ruby on Rails(3) application that relies on an xml feed
I’m writing an application with Ruby on Rails. This application will be delivered to
I'm currently writing an application in ruby on rails that uses AWS. I see
I'm writing a non-Rails ruby application (gasp!) and would like to be able to
Background: I'm writing a 'standard' (nothing special) web application in Ruby (not Rails) and

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.