Performance and Scalability

Context Cache

Context Cache is module which lets you control caching and expiration through Context. For example, for one content type you can set its cache for two hours while for another content type you can set it for 30 minutes. In another use-case you can set an expiration of five minutes for the homepage and 30 minutes for any page in the news section. In case you use an external cache this module sets the proper headers for expiration.

Requirement

Installation

  • If using Drush, "drush dl context_cache" and then "drush en context_cache" otherwise unpack, place and enable just like any other module.
  • Navigate to Administration » Configuration » Development » Performance (admin/config/development/performance) and make sure page cache is enabled if you're looking to control your Drupal cache with this module. If you are using an external cache you don't need to enable page caching.
  • Navigate to Administration » Structure » Context (admin/structure/context) and click on a context or create a new one. Under Reactions the Add Reaction pull-down menu will give you a new option, Cache.
Read more

Display Cache

Display Cache provides a simple way to cache the html of a specific entity endered in a specific view mode.

The idea is to let each entity handle its own cache independent of external caching strategies. So the cache only refreshes if the displayed entity is actually changed in any way.

Comparision to other caching methods

Panels and Views

Panels and views provide a time-based caching mechanism. You can configure the time to elapse before the cache is rebuilt.

Panels

If a cached pane in Panels is used to display an entity and something is changed on this entity, the user has to wait until the configured caching time is elapsed before he gets the results displayed.

Views

If a cached view is used to display serveral entities and a new entity is added, which should be displayed within the view, the user has to wait also, before he gets the new Views results.

External caching mechanisms

External caching mechanisms like Varnish provide a good caching method unless the project works with logged in users. The request will not be cached bacause of the cookies sent within the call.

Conclusion

You need Diplay Cache if you need a caching mechanism and

Read more

Asynchronous JavaScript

Load JavaScript asynchronously using the most browser compatible method. The element for each JavaScript file to be loaded asynchronously will be generated dynamically after the window load event using the following basic method:

(function() {
  var s = document.createElement('script');
  s.type = 'text/javascript';
  s.async = true;
  s.src = script.data;
  var x = document.getElementsByTagName('script')[0];
  x.parentNode.insertBefore(s, x);
})();

How to load a JavaScript file asynchronously

Using this module, you can specify a script to be loaded asynchronously in two basic ways:

  1. By adding "async_js" => TRUE to the options array in drupal_add_js().
  2. By calling async_js_add_js("path/to/your/script.js") which bypasses drupal_add_js(), gets you the same result, and may be a touch faster.

Additional functionality

Callback functions: Specify a callback function to be fired once the script has loaded. This can be done by adding "async_callback" => "your_function_name" to the options array in either drupal_add_js() or async_js_add_js(). The function must exist in the global scope.

Read more

UI Cache Clear

UI Cache Clear

Adds contextual link “Clear cache” for:

  • Blocks
  • Views
  • Panels

Adds link for clearing current page cache (Boost supported too).

Features:

  • Clears specific cache bin without flushing the whole site cache.
  • Allows to clear cache without full administrator permissions.
  • Provides setting to clear current page cache automatically when clearing Block, Views or Panels cache.
  • Admin menu and Shortcut integration

To access “Clear cache” link user needs permissions “Use contextual UI Cache Clear links” and “Use contextual links” of course!

Designed for both development and production.

#D8CX: I pledge that UI Cache Clear will have a full Drupal 8 release on the day that Drupal 8 is released.
Last tested with 8.x core: see in README.txt

Dependencies:

  • Contextual links (core)

Other modules which can be useful (not alternatives):

Read more

KwsN Purge

This is a demo module to for the upcoming Purge 2.x api. This module enables Purging of reverse proxy caches for the Drupal Shrubberies platform.
This is module is currently incomplete and should not be used on production shrubberies.

Simple Cache

before cache

A Simple cache module that works for Anonymous & Authenticated users.

Stores the HTML of the whole page in cache table and serves it after Drupal core functions are executed, not requiring to process theme functions and thus saving time.

Pages are cached by URL & user role.

XHProf Callgraph of functions called
before cache: before_callgraph.png
after cache: after_callgraph.png

Advantages:

  1. All code that does things like setting sessions($_SESSION) will work, for example: quiz module.
  2. easy to install & configure.
  3. can work along with other caching modules(example: exclude node/*/take pages in boost and use simple_cache for those pages)
  4. will cause no harm if you know what you are getting.(cached page source code is same for users of that role, irrespective of page logic)

Use cases:

  1. For pages which can't be cached by any other means because of sessions, or drupal_page_is_cacheable() is FALSE.
  2. If the page logic has to be executed and the page view doesn't depend on that logic.(example: Quiz module)

TODO:

    Read more
    Subscribe with RSS Syndicate content
    nobody click here