ExpressionEngine Docs

Handling Extreme Traffic

Notice: This info is intended for Server Admins when dealing with high-volume traffic spikes or as a permanent solution for radically high volume sites.

These ExpressionEngine features will help Server Admins decrease server resource usage and keep an ExpressionEngine installation running smoothly in the event of a traffic spike or as a way of dealing with the day-to-day reality of radically high-volume sites.

Database Activity

In general, we recommend using the InnoDB storage engine for ExpressionEngine’s MySQL tables, and that is what is used by default when ExpressionEngine is installed. While ExpressionEngine will run fine with MyISAM, the MyISAM storage engine has to lock an entire table when it inserts a new row. Especially in extreme traffic events, this characteristic of MyISAM can bring a database server to its knees.

There are a few optional tracking features of ExpressionEngine that will update tables on every page load. These trackers are not enabled by default, but if you have enabled them, and experience an extreme traffic event, you may want to disable them to help ease the load on the server.

These can be disabled in your Control Panel Tracking Preferences. If you are unable to access your site due to the traffic, you or your server administrator can manually override these features in your config.php file as follows:

config.php Extreme Traffic Overrides

$config['enable_online_user_tracking']

(y/n) - Corresponds to Enable Online User Tracking?

$config['enable_hit_tracking']

(y/n) - Corresponds to Enable Template Hit Tracking?

$config['enable_entry_view_tracking']

(y/n) - Corresponds to Enable Channel Entry View Tracking?

$config['log_referrers']

(y/n) - Corresponds to Enable Referrer Logging?

$config['dynamic_tracking_disabling']

(numeric) - Corresponds to Suspend ALL tracking when number of online visitors exceeds:

$config['disable_all_tracking']

(y/n) - config.php only preference which can be set to y in an emergency, which will disable all of the above. This is useful for server administrators who need a way to respond immediately and can’t access the control panel.

Disk I/O

ExpressionEngine’s caching mechanisms can help reduce database load in most situations. However if you use file-based caching, that may transfer some of the resources saved from the database server to the web server. Thus, it is recommended that you use either the Memcached or Redis caching driver instead of the file driver, especially on high-traffic sites. The increased disk i/o from file caches being created and destroyed during a high traffic event consumes significantly more server resources than the memory-based caching drivers.

If you are running in a PHP environment without Opcode caching, saving templates as files can marginally increase disk i/o as each template must be retrieved from disk. We recommend running PHP 7 or greater so that this type of file activity is managed better by the server.

Using Load Balancers

Using a load balancer or reverse proxy is a popular solution to mitigate DDoS attacks and make handling large amounts of traffic easier.

When a server is placed behind a reverse proxy or load balancer ExpressionEngine might not know the user’s real IP address because it would be substituted with the proxy’s IP address. Most proxies however will preserve the real user’s IP address and forward it through a request header. In order to use the data in those headers to obtain the real user’s IP address you need to configure the system to recognize and trust the proxy IP addresses. This can be done using the proxy.php configuration file.