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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:13:30+00:00 2026-05-30T03:13:30+00:00

I have a PHP script that in every run, inserts a new row to

  • 0

I have a PHP script that in every run, inserts a new row to a Mysql db (with a relative small amount of data..)
I have more than 20 requests per second, and this is causing my CPU to scream for help..

I’m using the sql INSERT DELAYED method with a MyISAM engine (although I just notice that INSERT DELAYED is not working with MyISAM).

My main concern is my CPU load and I started to look for ways to store this data with more CPU friendly solutions.

My first idea was to write this data to an hourly log files and once an hour to retrieve the data from the logs and insert it to the DB at once.

Maybe a better idea is to use NoSQL DB instead of log files and then once an hour to insert the data from the NoSQL to the Mysql..

I didn’t test yet any of these ideas, so I don’t really know if this will manage to decrease my CPU load or not. I wanted to ask if someone can help me find the right solution that will have the lowest affect over my CPU.

  • 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-30T03:13:31+00:00Added an answer on May 30, 2026 at 3:13 am

    Ok guys, I manage to lower the CPU load dramatically with APC-cache

    I’m doing it like so:

    storing the data in memory with APC-cache, with TTL of 70 seconds:

    apc_store('prfx_SOME_UNIQUE_STRING', $data, 70);
    

    once a minute I’m looping over all the records in the cache:

    $apc_list=apc_cache_info('user');
    
    foreach($apc_list['cache_list'] as $apc){
        if((substr($apc['info'],0,5)=='prfx_') && ($val=apc_fetch($apc['info']))){
            $values[]=$val;
            apc_delete($apc['info']);
        }
    }
    

    inserting the $values to the DB

    and the CPU continues to smile..

    enjoy

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

Sidebar

Related Questions

I have some php script that I would like to run on EVERY row
I have a PHP script that I need to run every minute. I have
i have a php script that should be run automatically every day. as the
I have a PHP script that needs to be run at certain times every
I have a php script that needs to run once every 5 minutes. Currently
I have a html_headers.inc.php script that I want to include in every script on
I would like run a PHP script that runs every second to update a
I have a very painful slow script that gets lots of data from MySQL
I have made a script that run various loops and does some SQL inserts.
I have a php script I want to run every minute to see if

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.