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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:12:58+00:00 2026-06-09T08:12:58+00:00

I am looking to implement a page view counter in azure table storage. If

  • 0

I am looking to implement a page view counter in azure table storage. If say two users visit the page at the same time, and the current value on PageViews = 100, is it guaranteed that the PageViews = 102 after the update operation?

  • 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-06-09T08:13:01+00:00Added an answer on June 9, 2026 at 8:13 am

    The answer depends on how you implement your counter. 🙂

    Table storage doesn’t have an “increment” operator, so you’d need to read the current value (100) and update it to the new value (101). Table storage employs optimistic concurrency, so if you do what comes naturally when using the .NET storage client library, you’d likely see an exception when two processes tried to do this simultaneously. This would be the flow:

    1. Process A reads the value of PageViews and receives 100.
    2. Process B reads the value of PageViews and receives 100.
    3. Process A makes a conditional update to PageViews that means “set PageViews to 101 as long as it’s currently 100.” This succeeds.
    4. Process B performs the same operations and fails, because the precondition (PageViews == 100) is false.

    The obvious thing to do when you receive the error is to repeat the process. (Read the current value, which is now 101, and update to 102.) This will always (eventually) result in your counter having the correct value.

    There are other possibilities, and we did an entire Cloud Cover episode about how to implement a truly scalable counter: http://channel9.msdn.com/Shows/Cloud+Cover/Cloud-Cover-Episode-43-Scalable-Counters-with-Windows-Azure.

    What’s described in that video is probably overkill if collisions are unlikely. I.e., if your hit rate is one-per-second, the normal “read, increment, write” pattern will be safe and efficient. If, on the other hand, you receive 1000 hits per second, you’ll want to do something smarter.

    EDIT

    Just wanted to clarify for people who read this to understand optimistic concurrency… the conditional operation isn’t really “set PageViews to 101 as long as it’s currently 100.” It’s more like “set PageViews to 101 as long as it hasn’t changed since the last time I looked at it.” (This is accomplished by using the ETag that came back in the HTTP request.)

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

Sidebar

Related Questions

I am looking for a simple way to implement simple coming soon (pre-launch) page
I am looking to implement a mouseover event on my page for a menu
I'm looking to implement a chatroom interface for an ASP.NET page. I'm in the
Ok, I am looking to implement COMET, and I stumbled on this page comparing
Looking to implement a RIA (rich internet application) either as a java (JWS) application
I am looking to implement some throttling behavior into one of my viewmodels. It's
I'm looking to implement a warning if the user attempts to leave the order
I have been looking to implement a custom class of : IList<ArraySegment<byte>> this will
I'm looking to implement content negotiation on some resources in a Rails app. I'm
I'm looking to implement the jQuery UI so that the slider bar fills one

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.