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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:09:27+00:00 2026-05-11T13:09:27+00:00

I have a scheduled task that runs a script on a regular basis (every

  • 0

I have a scheduled task that runs a script on a regular basis (every hour). This script does some heavy interaction with the database and filesystem and regularly takes several minutes to run. The problem is, the server’s cpu-usage spikes while the script is running and slows down normal operations. Is there a way to throttle this process so that it takes longer but does not consume as many resources?

I’ve looked at different configuration options for PHP but there does not appear to be any that fit my needs.

Setting memory_limit in php.ini to something lower causes my data objects to overflow quite easily.

I’ve seen similar posts where people suggested using sleep() at certain points in the script but that does not prevent the script from spiking the server.

The optimal solution would be some way to tell the Lamp (in this case Wamp) stack to only use 10% max cpu utilization. I’m not concerned at all about runtime and would prefer that it take longer if it means saving cpu cycles per second. My alternate solution would be to setup a different server with database replication so the cron could go to town without slowing everything else down.

Environment: Windows Server 2k3, Apache 2.2.11, PHP 5.2.9, MySQL 5.1

I appreciate any insight to this situation.

EDIT: I appreciate all the answers, even the ones that are *nix-specific. It’s still early enough in my situation to change the hosting environment. Hopefully this question will help others out regardless of the OS.

  • 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. 2026-05-11T13:09:28+00:00Added an answer on May 11, 2026 at 1:09 pm

    This is a tricky problem. If you’re running the PHP script via the command line, you can set the process’s scheduling priority to low (start /low php.exe myscript.php I believe). If your PHP script itself is actually doing most of the processing that’s eating your CPU, this might work. However, you said you are doing some heavy database and filesystem interaction, which this solution will not help. It looks like there is a MySQL hint ‘LOW_PRIORITY’ for INSERT and UPDATE queries that may help you there, but I have not tried those.

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

Sidebar

Related Questions

I currently have an ASP Classic script that runs every 15 minutes (via scheduled
I have a scheduled task on my server which runs a PHP script every
I have a scheduled task that runs once a day that builds an XML
I have a batch file that creates a scheduled task using schtasks like this:
I have a backroundrb scheduled task that takes quite a long time to run.
I have a Scheduled Task on a WinXP SP2 machine that is set up
I have a script that appends some rows to a table. One of the
I have an Oracle database that runs a PL/SQl job once every week to
I have a task that needs to be executed on a schedule. (It basically
I have a task that launches several child tasks. (e.g., Task A creates B,C,D,E,F).

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.