Home

patch

Path Cache patch


Description:
This patch can greatly reduce the number of database queries on every page load caused by URL path aliases. Groups of paths are cached together for each page and language allowing optimal cache retrieval of cached paths. Furthermore, a whitelist is built for uncached paths to intelligently limit the necessary database queries.

This patch was backported from Drupal 7.

Page-cache-memcache Lock

Tagged with

Description:
This patch should be applied to memcache after the pagecache_lock patch has been applied to Drupal core, preventing cache stampedes when updating pages in the Drupal page cache. Refer to the README for that patch for full details on how this patch works.

Load Cache patch


Description:
This patch introduces caching for both nodes and users. While it will still help performance without using memcache, it is recommended that you enable the memcache module to cache this data in memory for optimal performance. Both tables can be manually flushed along with Drupal's standard caches by clicking the 'Clear cached data' button on the Performance administrator site configuration page.

Replication patch


Description:
This patch modifies Drupal core so it can be configured to send specified queries to a one or more MySQL replication slaves, helping to distribute the database load. This patch alone does not change where any queries are run.

An optional 'replication-slave.patch' utilizes the changes made in the first patch. It causes all temporary tables to be created on the slaves, sends all pager queries to the slaves, and sends some queries from node_load to the slaves.

Page-cache Lock


Description:
This patch is designed to prevent cache stampedes when updating pages in the Drupal page cache. When serving cached pages, logic checks the timestamp of the cached page -- if older than the global timestamp we try to grab a lock. Only one user can grab the lock for a given page at a time. If the user fails to grab the lock, a stale version of the cached page is returned. Once the page is rebuilt, the new version is returned on subsequent requests.

Drupal Performance and Scalability Patches

Tagged with

The following collection of patches are useful performance and scalability tweaks that can be applied to Drupal websites. This collection will continue to grow, and is being maintained as a reference page for our online performance and scalability book. As new versions of Drupal are released, updated version of these patches will be added to this page.

To learn more about how these patches work, where they came from, and if they've been merged upstream, you can click the readme link following each patch's brief description. We welcome all feedback, and suggestions for other patches that should be included in this collection.

Drupal to js

Tagged with

Description:
If using PHP 5.2 or later (as required by Drupal 7+), drupal_to_js() can be simplified by using PHP's built-in json_encode() function.

Status:
Committed to Drupal 7 on March 17, 2008.
http://drupal.org/node/222578#comment-772769

Patch:
http://tag1consulting.com/patches#drupal_to_js

Original patch source:
http://drupal.org/node/222578
http://drupal.org/files/issues/improve-drupal_to_js-222578-2.patch

Drupal lookup path


Description:
The drupal_lookup_path function unnecessarily counts all rows of the url_alias table to determine if any aliases are defined. This can be expensive on a transactional database such as MySQL with the InnoDB Storage Engine or PostgreSQL when a website has a lot of aliases. This patch modifies the query to always only return one row, possible because any existing pid will be greater than 0. If no aliases are defined, it will return 0.

Status:
This patch has not been merged into any release of Drupal.

Patch

External page-cache


Description:
Re-order Drupal core's bootstrap process so anonymous pages can be served from an external cache (such as memcache) without hitting the database.

Drupal's default bootstrap order is as follows:

    DRUPAL_BOOTSTRAP_CONFIGURATION
    DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE
    DRUPAL_BOOTSTRAP_DATABASE
    DRUPAL_BOOTSTRAP_ACCESS
    DRUPAL_BOOTSTRAP_SESSION
    DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE

This patch changes it as follows:

    DRUPAL_BOOTSTRAP_CONFIGURATION
    DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE
    DRUPAL_BOOTSTRAP_SESSION

CDN patch

Tagged with

Description:
Patch Drupal core to serve static content from a CDN. This patch will serve user-uploaded files (if using public downloads), CSS files, JavaScripts, and theme images from a CDN.

To serve all of the above content from a single CDN path, set the 'cdn_base_url' variable. To serve one or more of the above from a different path, set one or more of the following variables: 'file_base_url', 'css_base_url', 'js_base_url', and 'theme_base_url'.

Syndicate content