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

Ask A Question

Stats

  • Questions 74k
  • Answers 74k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer this should make it clear , Comparison of both codecs… May 11, 2026 at 2:29 pm
  • added an answer F12 on IE8 gets you to the developer tools which… May 11, 2026 at 2:28 pm
  • added an answer It is informal, but you can use it via reflection,… May 11, 2026 at 2:28 pm

Related Questions

The site I'm working on is running Windows Server 2003 and SQL Server 8
I have an interesting/annoying problem with some VBScripts running on Windows 2003 Server (they
I have written an HttpModule that spawns a background thread. I'm using the thread
What is the best way to backup VMWare Servers (1.0.x)? The virtual machines in

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.