This is very relative and will depend on the flow of users and the tables involved.
If there is no way to modify the game script so that it saves the data as the user moves forward, then I only see cronjob as a solution.
You have to analyze the following:
- What is the ideal period to run cronjob, that is, with less user flow?
- If the flow is large all the time, your server can handle all the processing?
- Your script that updates the database, consumes a lot of memory?
With the answer in hand, you’ll know:
- If your architecture is the best choice. Maybe it’s an exaggeration, but wouldn’t it be better to move to a distributed database;
- If your server needs an upgrade and this solution is enough;
- If your script (updating the database) needs to be optimized;
- Whether the database needs to be optimized.
As you can see, if you do not want to affect the performance of the application, you will have to take some care and not simply do a cron job, but only you who knows the system can respond.
Thanks for the reply Filipe, I was thinking, since I use SQL Server, I could leave these activities to the procedures of the database used, agree? I think the use would be less.
– Edgard Hufelande
@Edgardhufelande I’m not sure, but whenever I run an update in the database it’s always faster than in php itself, so I think yes, a Schedule in the database would be faster.
– Filipe Moraes