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 1115453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T03:09:26+00:00 2026-05-17T03:09:26+00:00

I’m building a poll widget using ASP.NET controls and Linq-to-Sql for a high traffic

  • 0

I’m building a poll widget using ASP.NET controls and Linq-to-Sql for a high traffic site. The widget is, actually, already built. But, it does not use caching yet.

This poll can work in a multi-poll mode which means that each page load the control will hit the database to find any polls that the current user has not taken. There are also several database hits on the postback: a check to make sure the user has not taken the poll, a hit to write the result to the database, and a final series of hits to tally the results.

Update, I’ve re-worded these questions:

  1. Would it be appropriate for a control such as a Poll to hit the database on every page hit? How would this performance scale up to a size of say 20,000 users. Assume the server has 2 servers, a load balancer, modern multiple core cpu, and 2 gig of ram.

  2. What type of caching for this scenario would you look to employ? Take into account that for example any number of people could take the poll over any interval of time and the total number of people who have taken the poll is needed to compute the results. More problematically, on every load the code must hit the database to find the polls that the user hasn’t taken.

I’ve some ideas but wanting to get some additional expert feedback. Thanks.

Update:

So, let us go over a scenario for caching. One could cache the Polls (the questions) but would still need to probably hit the database for the PollsTaken (the users responses). One possibility would be to create a shadow, writing both to an in-memory storage and to the database storage.

One could use a refresh scheme to dump the cache when a user submits a successful poll (when it changes). A cookie could be used to prevent multiple-takes, although it would be susceptible to gaming.

I want to go into and see more details on the scheme offered. For example, how you would use output caching, caching the linq-to-sql, etc. Not just generalities.

  • 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-17T03:09:27+00:00Added an answer on May 17, 2026 at 3:09 am

    I would cache the following:

    • A list of all poll id’s (key would be something like “all_polls”)
    • All polls with their results (key would be “poll_<ID>”)
    • Lists of IDs of poll users have completed (key would be “users_polls_<USER_ID>”)

    On page load get the list of all poll id’s, filter it with the list of id’s for polls this user have completed, and then request the polls from cache by the id’s.

    On postback I would expire the key for the poll, and the key for the user, as well as submitting to the database. On next request, the keys would be missing in the cache and they will be recreated from the database with the updated results. If you want to you can also update the results in cache, directly on the postback but the normal solution is to just expire the keys.

    The problem with this is mainly that you are using two webservers, so you cannot just cache these items in memory. A poll updated on one webserver, would not be expired on the other webserver unless you are employing some form of communication between the servers to synchronize their cache.

    I would recommend using an external cache, and cases like this I use memcached myself. If you install a memcached server on each of the webserver hosts, and configure the application to use both memcaches, then you will always have a synchronized cache.

    For C# you can use the Enyim Memcached Client (http://memcached.enyim.com/) to connect to the server, and the Northscale Memcached Server (http://www.northscale.com/products/memcached.html) for the servers.

    Both the Enyim and Northscale tools are free (open source) and both are very stable and very usable in production. And, no, I’m not employed by either company 🙂

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

Sidebar

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.