Home › Forums › Calendar Products › Events Calendar PRO › Calendar's memory use crashing server
- This topic has 5 replies, 2 voices, and was last updated 8 years, 8 months ago by
crharrison.
-
AuthorPosts
-
July 21, 2017 at 7:57 am #1324328
crharrison
ParticipantWe’re running 20+ installations of Pro in 5 multisite installations on a dedicated server.
Our hosting support team has identified processes run by the calendar that cause the server to run out of 16 GB of memory:
I have also checked the script execution logs from the same time period and noticed that at several points, a few of your applications have executed multiple simultaneous wp-cron.php requests. For example, all of these requests were started in only 5 minutes:
(he then listed them)
There are multiple wp-cron requests which are executed on a constant basis and appear to be the main cause for the large consumption of memory.
These tasks are part of the Events Calendar plugin which is present in each of the installations I tested. What we can suggest you to try for now is to try increasing the time period needed for execution of these events. There are several ways to do that.
The first one is to make sure that each cron process cannot run more than once during the predefined cron lock timeout period. Such value can be defined by adding this code in the wp-config file of each of your WordPress installations:
Code:
define( ‘WP_CRON_LOCK_TIMEOUT’, 120 );The shown example sets this period for 2 minutes, but you can modify this value to a larger one.
NOTE: We tried this, and the calendar hangs in the dashboard. It stopped hanging after we reversed this solution.
THIS ALSO WAS SUGGESTED:
Another approach you may take is to enable the alternate cron functionality of WordPress:
Code:
define( ‘ALTERNATE_WP_CRON’, true );After that you can navigate to the Cron jobs tool in cPanel and define the timeframe at which the wp-cron script to be executed.
QUESTION: Do you recommend this solution? Will it also cause performance issues in the dashboard? Or do you have another solution?
July 25, 2017 at 6:14 am #1325694Patricia
MemberHey Cheryl,
Thanks for contacting us! As already mentioned in this thread, unfortunately our plugins don’t have a built-in feature that would help you to optimize the cron tasks.
One solution that I would personally recommend is to replace wp-cron with a real cron job. WordPress developers have created wp-cron.php file because WordPress has to work on all sort of different platforms, OS’s and configurations, so it can’t rely that there will be a cron job service on the server that can handle scheduled tasks.
The wp-cron.php file is hit every time someone access your site. It then checks if there’s a scheduled task to be done and executes it if necessary. With a real Cron, triggers are set via time interval, not via site visits, thus lessening the load on the server dramatically.
You can ask your hosting provider to disable wp-cron by adding the following line in your wp-config.php file:
/** Disable the default WordPress Cron */ define('DISABLE_WP_CRON', true);After that, they will have to access the server crontab and add the following:
*/10 * * * * curl http://unitychapel-hemet.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
The above will run wp-cron every 10 minutes. You can change */10 to */5 to make it run every 5 minutes.
PS: please note that this is just an example, your hosting provider might have to adjust this cron depending on their settings.
I hope this helps!
Let me know if you need anything else and I’ll be happy to assist.
Regards,
Patricia
July 26, 2017 at 4:51 am #1326264crharrison
ParticipantWill the solution you suggest have any impact on calendar performance? For example, when our clients are creating or updating recurring events, will that process hang?
July 26, 2017 at 10:45 am #1326491Patricia
MemberHi Cheryl!
No, this action won’t affect the process of creating and/or updating recurring events at all. My own site runs with real cron and everything works as expected.
Cron is used by The Events Calendar pro to basically constrain recurring events with too many instances to only create instances within a configured time around the current date. Cron is also used to filter the interval at which to process import records on Events Aggregator.
You can expect an overall improvement in performance, but if for some reason you find any problem after this change, you can simply revert to wp-cron.php in a few seconds.
The solution suggested by your hosting support team might be a good option as well. At this point the best approach is to run some tests and try to identify the best solution for your problem.
Let me know if you have any other questions and I’ll be happy to assist!
Regards,
Patricia
August 17, 2017 at 9:35 am #1336863Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Calendar's memory use crashing server’ is closed to new replies.
