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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:49:28+00:00 2026-05-14T23:49:28+00:00

Last night I did a load test on a site. I found that one

  • 0

Last night I did a load test on a site. I found that one of my shared caches is a bottleneck. I’m using a ReaderWriterLockSlim to control the updates of the data. Unfortunately at one point there are ~200 requests trying to update the data at approximately the same time. This also coincided with CPU usage spikes.

The data being updated is in the ASP.NET Cache. What I’d like to do is if the CPU usage is around 75%, I’d like to just skip the cache and hit the database on another machine.

My problem is that I don’t know how expensive it is to create a new performance counter to check the cpu usage. Also, if I would probably like the average cpu usage over the last 2 or 3 seconds. However, I can’t sit there and calculate the cpu time as that would take longer than it’s taking to update the cache currently.

Is there an easy way to get the average CPU usage? Are there any drawbacks to this?

I’m also considering totaling the wait count for the lock and then at a certain threshold switch over to the database. The concern I had with this approach would be that changing hardware might allow more locks with less of a strain on the system. And also finding the right balance for the threshold would be cumbersome and it doesn’t take into account any other load on the machine. But it’s a simple approach, and simple is 99% of the time better.

  • 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-14T23:49:29+00:00Added an answer on May 14, 2026 at 11:49 pm

    This article from Microsoft covers Tuning .Net Application Performance and highlights which counters to collect and compare to determine CPU and I/O bound applications.

    You sound like you want to monitor this during execution and bypass your cache when things get intensive. Would this not just move the intensive processing from the cache calls to your database calls? Surely you have the cache to avoid expensive DB calls.

    Are you trying to repopulate an invalidated cache? What is the affect of serving stale data from the cache? You could just lock on the re-populating function and serve stale data to other requests until the process completes.

    Based on the above article, we collect the following counter objects during our tests and that gives us all the necessary counters to determine the bottlenecks.

    • .NET CLR Exceptions
    • .NET CLR Memory
    • ASP.NET Applications
    • ASP.NET
    • Memory
    • Paging File
    • Processor
    • Thread

    The sections in the article for CLR Tuning and ASP.NET Tuning highlight the bottlenecks that can occur and suggest configuration changes to improve performance. We certainly made changes to the thread pool settings to get better performance.

    Changing and Retrieving Performance Counter Values might help with accessing the existing Processor counter via code but this isn’t something I’ve tried personally.

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

Sidebar

Related Questions

Last night I was messing around with Piglatin using Arrays and found out I
I was asked a question in C last night and I did not know
I just did File -> New Project last night on a new project. Ah,
I posted last night stating that I was creating a Windows Service with the
Last night I was thining that programming languages can have a feature in which
Last night I was at a Boston Python Meetup that described various Python implementations.
Last night I added a parameter to a stored procedure in a mySQL database.
Last night I decided to add HTML fragment links in my computer listing page.
This caught my attention last night. On the latest ALT.NET Podcast Scott Bellware discusses
I read this post last night, and I noticed it was from 2006. I

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.