-1

I have the following cache enabled:

  • Memcached
  • Normal Page cache enabled (from Drupal performance settings)
  • Enabled optimize Javascript files (through Drupal performance settings)
  • Gzip via Apache

Then I have the following enabled as well:

  • Cloudflare (normal paid setting)

Should I disable some settings to improve speed and any conflicts/redundancies, or will they all work together fine?

closed as primarily opinion-based by Shawn Conn, Adrian Cid Almaguer, Pierre.Vriens, DRUPWAY, mradcliffe Jan 22 '17 at 15:41

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • I don't think that mod_gzip for Apache is doing any caching. It is compressing the served files, if the browser supports compressed files. – kiamlaluno Jan 21 '17 at 13:00
  • 1
    Everything you've listed will work happily together, but you'll probably need to configure each component based on your available server resources, nature of your content, anticipated traffic, etc – Clive Jan 21 '17 at 20:40
3

All of those modules should play nicely together, but if you are using mod_deflate to compress text files on the wire, then there is a Drupal setting you should disable.

On admin/config/development/performance, disable the "Compress cached pages" setting. This will prevent Drupal from compressing HTML. If this setting is on, and you are using mod_deflate, then there can be some instances where pages get compressed twice (once by Drupal and then again by Apache). In the case, the browser will decompress the response once, and garbage is displayed to the user.

I typically override this in settings.php.

$conf['page_compression'] = FALSE;

I then implement hook_form_alter() to add a note under that field and disable the input element.

/**
 * Implements hook_form_FORM_ID_alter for form_system_performance_settings().
 */
function MYMODULE_form_system_performance_settings_alter(&$form, $form_state) {
  $form['bandwidth_optimization']['page_compression']['#default_value'] = 0;
  $form['bandwidth_optimization']['page_compression']['#disabled'] = TRUE;
  $form['bandwidth_optimization']['page_compression']['#description'] = t('Handled by Apache.');
}

I also tend to pair this with the following lines, to let Apache handle it.

$conf['css_gzip_compression'] = FALSE;
$conf['js_gzip_compression'] = FALSE;

After you implement all this with your Apache compression, test it out with the network analyzer in Chrome or Firefox to make sure the files are compressed on the wire.

As a side note, I typically use the mod_deflate and mod_header caching rules from the HTML5 Boilerplate Server Config with good success with and without a CDN. (I usually use CloudFront.)

  • Is it a bad thing to compress the pages twice? I understand it takes processing power etc. and there is probably nothing to reduce the second time, but can it break the page? – Neograph734 Jan 21 '17 at 22:20
  • 1
    @Neograph734 It breaks the page. Server compresses twice, browser decompresses once, and garbage is displayed to user. – mpdonadio Jan 21 '17 at 22:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.