-1

I am running some set of CRON Jobs(every hour) to extract latest data from one DB and writing into CSVs using PHP.

Recently I have faced something unusual in my EC2 server. I could see CSV generated with header only, but then there was data. Also all my logger to track the process shown data extracted and count of extracted records as well. Only issue I found was CPU utilization was 100% during this scenario. Later everything went fine once CPU utilization become normal.

Then after 4 days, this time CSV generated with data twice. That means only one header but then same set of data repeated twice in the CSV. My logger to track the process shown correct count this time as well. Again only issue found was CPU utilization climbed up to 100% during this period of time.

Is there any connection between EC2 CPU utilization and this process, may be any memory related? Or anyone faced similar issues, even in different cloud?

Please advice.

Thanks

V-T
  • 756
  • 2
  • 9
  • 22

1 Answers1

0

If the jobs takes more than one hour (because of high CPU utilization for example), then there will be another instance of the job and likely you will get the duplicated results in the CSV file. So, you should prevent the CRON jobs from being executed if there is already a running one. More information can be found here and here.

Community
  • 1
  • 1
Mahdi
  • 3,199
  • 2
  • 25
  • 35
  • thats am already handling. It won't trigger the script unless previous completed. – V-T Jan 05 '17 at 12:39