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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:54:41+00:00 2026-05-16T07:54:41+00:00

I am developing a large web app and want it to alter itself dependent

  • 0

I am developing a large web app and want it to alter itself dependent on a factor that relates to the stress the database is currently under.

I am not sure what would me most accurate/effective/easiest. I am considering maybe the number of current connections or server response time or CPU useage?

What would be best suited and possible?

Thanks

  • 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-16T07:54:42+00:00Added an answer on May 16, 2026 at 7:54 am

    Interesting question. What you REALLY want is a way for PHP to ask the mySQL server two questions:

    server, are you using almost all your cpu capacity?

    server, are you using almost all your disk IO capacity?

    Based on the answers, I suppose you want to simplify the work your PHP web app does … perhaps by eliminating some kind of search capability, or caching some data more aggressively.

    If you have a shell to your (linux or bsd) mysql server, your two questions can be answered by eyeballing the output from these two commands.

       sar -u 1 10     # the %idle column tells you about unused cpu cycles
       sar -d 1 10     # the %util column tells you which disks are busy and how busy.
    

    But, there’s no sweet little query which fetches this data from mySQL to your app.

    Edit: one possibility is to write a little PERL hack or other simple program that runs on your server, connects to the local data base, and once every so often (once a minute, maybe) determines %idle and %util, and updates a little one-row table in your data base. You could, without too much trouble, also add stuff like how full your disks are, to this table, if you care. Then your PHP app can query this table. This is an ideal use of the MEMORY access method. At any rate, keep it simple: you don’t want your monitoring to weigh down your server.

    A second-best trick, that you CAN do from your client.

    Issue the command SHOW PROCESSLIST FULL, count the number of rows (mySQL processes) for which the Command is “Query”, and if you have a lot of them consider it to be a high workload.

    You might also add up the Time values for the processes which have status Query, and use a high value of that time as a threshold.

    EDIT: if you’re running on a mySQL 5 server, and your server account has access to the mySql-furnished information_schema, you can use a query directly to get the process data I mentioned:

    SELECT (COUNT(*)-1) P.QUERYCOUNT, SUM(P.TIME) QUERYTIME
    FROM information_schema.PROCESSLIST P
    WHERE P.COMMAND = 'Query'
    

    COUNT(*) – 1: because the above query itself counts as a query.

    You will need to fiddle with the threshold values to make this work right in production.

    It’s a good idea to have your PHP web app shed load when the data base server can’t keep up. Still, a better idea is to identify your long-running queries and optimize them.

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

Sidebar

Related Questions

I'm currently developing a moderately large sized web app with ASP.NET 2.0 that uses
I'm developing a web app that will access and work with large amounts of
I am currently developing a web app that uses Google's Static Map API, in
I'm developping a web app that deals with large strings and so I want
I'm currently developing a large site that handles user registrations. A social networking website
I am developing a Java web application that bases it behavior through large XML
Right now I'm developing the prototype of a web application that aggregates large number
I am developing an ASP.Net web app that needs to run in a Kiosk/Touch
Quick question: Will KnockoutJS provide a solid ground for developing a large web app?
I am developing a web app in Rails that needs to perform computationally intensive

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.