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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:37:54+00:00 2026-06-10T23:37:54+00:00

I’ve been tasked with finding a solution to some performance issues we’ve been having

  • 0

I’ve been tasked with finding a solution to some performance issues we’ve been having with our PHP web application (basically, we’re reaching a “failure” point when combining high-volume users with peak traffic/load hours). What I’ve found so far is that the bottleneck is occurring when trying to access the MS SQL Server database. Our sysadmin suggested that it’s probably due to SQL Server having to do too much context switching, because of the amount that the code queries the database.

Upon looking more into context switching and how to reduce it, though, I’ve only been able to find vague mentions of how to actually do so at the application code level, mostly along the lines of “refactor your code so it doesn’t make so many calls,” or .Net-specific tips.

We’re dealing with a large, complex codebase, so we can’t do things like completely rewrite the system, and we also have pretty well optimized (as best we could) the individual queries that we can, so what other refactoring opportunities can we look for to help make our code not bring our database server to its knees?

I don’t currently know the full stats on our database server, but it’s beefy enough to run MS SQL Server 2008 and was doing well until recently.

ETA: I’m simply a developer and don’t have any authoritative power, so I can’t do things like hire consultants. While I’m willing to make the suggestion to my superiors, I’m primarily looking for things that we can do in-house to further work toward solving the underlying issue.

As I explained in a comment, I understand that the context switching is more a symptom of something else, which is then causing the issues we’re actually seeing (slow responses from the database; just like in an OS, doing a lot of swapping results in slow response from an application, but is itself a symptom of other things taking up too much RAM). What is causing the context switching? A lot of database access from the application code. The problem is, the individual queries are already as good as we can get them right now, as indicated by our monitoring software, so what else can we do to help this problem?

My admin’s use of context switching has since been clarified. It seems that the issue, given his clarification, is that there are a lot of relatively small calls being made, which would require the database server to enqueue them as it handles each one in turn, driving up the response time as the scripts wait for their requested data. Are there any strategies, then, for combining these database calls, or otherwise adjusting how an MVC-structured PHP application makes calls to the database so that the scripts aren’t constantly waiting on the database?

  • 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-10T23:37:56+00:00Added an answer on June 10, 2026 at 11:37 pm

    You have a SQL Server performance problem, approach it as a SQL Server performance troubleshooting. There are some well known methodologies like Waits and Queues. The SQL Server Performance Troubleshooting Flowchart is a great syntheses of the various articles, tools, methodologies and metrics at your disposal to identify the bottleneck.

    Saying that the problem is ‘context switching’ is non-informative, unhelpful and unactionable. For the record, there is not even such concept as ‘context switching’ in SQL Server troubleshooting because of the very specific way SQL Server scheduling architecture works. This is not how SQL Server performance troubleshooting is done, it is not even close to true root cause analysis. You need to identify the problem before you can attempt a solution. If your admin cannot help you, seek specialized help from qualified consultants.

    And yes, if you can cache anything in the client and avoid querying the server is always, by definition, good. If the client and proxies can cache the page and avoid even hitting your HTTP server, is even better. These are true with any technology stack.

    there are a lot of relatively small calls being made, which would
    require the database server to enqueue them as it handles each one in
    turn, driving up the response time as the scripts wait for their
    requested data. Are there any strategies, then, for combining these
    database calls

    There is no silver bullet. Consider though that a well tuned database can drive a lot of small requests per second (many thousands per second) w/o problems. Did you measure metrics in:

    • SQL Server, Databases Object
    • SQL Server, Transactions Object
    • SQL Server, Wait Statistics Object
    • SQL Server, General Statistics Object
    • SQL Server, Access Methods Object
    • SQL Server, Buffer Manager Object

    These are interesting metrics that can tell a lot where you should focus your effort.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
We're building an app, our first using Rails 3, and we're having to build
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has

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.