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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:53:57+00:00 2026-05-26T18:53:57+00:00

I built an app in php where a feature analyzes about 10000 text files

  • 0

I built an app in php where a feature analyzes about 10000 text files and extracts stuff from them and puts it into a mysql database. The code itself is just a for loop where every file is loaded through file_get_contents() and after the end of that iteration, its unset() from memory. The file analysis is a cron job and a single php file does all this processing.

The problem however is that the app was built (initially) entirely on a shared server everything worked seamlessly really well. I didn’t notice any delays or major lags neither did users however in order for it to be able to handle more of a load, I moved everything to an EC2 server (the micro instance).

The problem I am having now is that every time I run the cronjob (process the files on hourly basis) it slows the entire server down so much that a normal page takes about 5-8 seconds to load, which sort of defeats the purpose of moving it to EC2.

The cron itself is a very long process. Here are some tests results of the script process (every hr)

SQL Insertion Time: 23.138303995132 seconds
Memory Used: 10.05 MB
Execution: 411.00507092476 seconds

But on the top of every hour the server slows down so much for 7 minutes despite of having more dedicated hardware acceleration compared to a shared server (I think at least). The graphs from EC2 dashboard show that the CPU usage is close to 100% but I don’t understand how it gets to that level.

Can anyone help me determine the reason as to why this could be happening? I have noticed not even the slightest lag when the cron runs on the shared server but the case is completely different for EC2.

Please feel free to ask me anything I missed mentioning.

  • 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-26T18:53:58+00:00Added an answer on May 26, 2026 at 6:53 pm

    Micro instances are pretty slow. If you use a larger instance, it’ll run a lot faster.

    We use EC2 for all of our production boxes. I can’t say enough good things about that platform. I’ll never go back to another host.

    Also, if you want to write your code in C++, it’ll run A LOT faster. I wrote a simple mysql insert with this code here. It’s multi-threaded, so you can asyncronously run mysql updates or inserts.

    Please let me know if you need any help with it, but I’m sure you’ll be able to just use a micro instance still and get great speeds.

    Hope that helps…

    PS. I’d be willing to help you write a C++ version for your uses… just because it’s fun! 🙂

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

Sidebar

Related Questions

I've built one variable (horaires_lundi) in this file : app/code/community/Unirgy/StoreLocator/controllers/Adminhtml/Locationcontroller.php ->setTitle($this->getRequest()->getParam('title')) ->setNotes($this->getRequest()->getParam('notes')) ->setStreetAddress($this->getRequest()->getParam('street_address')) ->setHorairesLundi($this->getRequest()->getParam('horaires_lundi'))
I've a web app built in PHP with Zend on a LAMP stack. I
I built a very simple app using a PHP form with a bit of
I have a PHP app built on Codeigniter 1.7.2, currently in production and live,
I want to consume an XML-RPC service built in PHP for my WP7 app
I've built a php/codeigniter app which worked perfectly when I hosted it with rackspace
I've built a PHP app, and I've read that it's a best-practice to use
I have a Facebook app that is built in PHP and have added a
I am trying to build a Connect app using PHP and the Zend Framework.
I'm using CodeIgniter (a PHP framework) to build an app, and I have an

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.