We have a php script which we execute in background using php command. In this script we have a data fetching logic from third party API and the content is huge JSON data. After fetching those data from API we process those data and insert it into our database.
Now my problem is when this data which are coming from API taking too long at that time my server consume 90% processing power as well as RAM and if data comes early then it executed within some short of time span. But if the data take too long from API then my php script held in background. So if php script running in background causing this issue of getting hanged of my server or there any other factor is also responsible for this ?
Please take note that my mysql server is separate from this server.
Well it seems your Php script is taking a lot of CPU and RAM. I think you should update your script so it fetches the data in pages and processes one page at a time