In developing The Events Calendar we’ve worked hard to build a solution with enviable performance characteristics that can scale to meet the needs of nearly any website.
The Events Calendar and its associated plugins can handle large numbers of events and work well even in very high traffic websites. However, it is important to understand that performance is dependent on many environmental factors that the plugin itself is often unable to manage automatically.
For that reason, it is worth developing a working knowledge of common pinch-points and ways of helping to alleviate them—sometimes a small tweak to your settings can make a world of difference.
We wholeheartedly recommend following WordPress' recommended server configuration. If you do not have their recommended minimums (e.g. PHP 7), the suggestions we share below will likely still fall short.
The More Events You Show, the Costlier it Gets!
Just like regular blog posts, events are stored in the database.
For example, by default, WordPress displays only the latest 10 blog posts on your homepage. It doesn’t normally take too long for such a page to load. Imagine, though, if you change the relevant setting so that 100 (or even 10,000) posts are listed all on the same page! To handle this, WordPress needs to work much harder and consume more resources, so it’s quite likely you would see a slowdown.
This concept transfers nicely to events. Take The Events Calendar's Month View, where you may have something like 35 days' worth of events being displayed all at once. If an average day contains 10 events, and up to or more than 10 events are listed per day, then that is a whole lot of events to display. Building up a view with this event configuration becomes much more costly and time-consuming process than if, for example, only 3 events were displayed per day.
Similarly, list-type views like the List and Photo views can be configured to show as many events as you would like. Just keep in mind that the number of events you want to show in each view has an attached cost in terms of performance.
Strategies for Scaling
Right off the bat, the easiest way to manage this problem is head over to Events → Settings and change the following settings:
- The number of events to show per page—this affects list-style views like List View, Photo View, etc.
- The number of events to show per day in Month View.
☝ In addition to increasing performance, reducing the number of events in the above settings can also make it easier for your visitors to absorb all of the event information on the calendar views.
If project requirements force you to keep the number of events showing per page/day on the high side, then you will need to look at alternatives.
Caching is the first avenue worth exploring. It's a complex subject in its own right, and there are in fact many different types of caching. The essence of caching, however, is that instead of rebuilding each view from scratch every time someone looks at them, the complete view and/or its constituent building blocks can be stored in such a way that makes it easier and faster to serve up the same view on subsequent requests.
We’ve added an option under our Display settings that makes it easy for you to use caching for Month View. Checking the Enable the Month View Cache option can help an event-filled calendar load faster for visitors.
Again, depending on your requirements, it may be that caching by itself won’t be the complete solution, and you ultimately may need to bolster the server resources available to your website.
Remove past Events
With The Events Calendar version 4.6.13, we introduced a new feature to purge expired events. This feature allows you to automatically move to trash or permanently delete past events based on their end date. Enabling this option is a good strategy to improve performance as it frees up space in the database.
You can enable this option on Events > Settings > General Settings