Drupal 8 Cache

Caching is the process of storing copies of files in a cache, or temporary storage location, so that they can be accessed more quickly.

Drupal 8 enables two modules: Internal Page Cache and Internal Dynamic Page Cache. Internal Page Cache caches pages for anonymous users. 

Internal Page Caching

The Internal Page Caching module when enabled, stores the complete page information even if the user visiting the site hasn’t logged in. Future anonymous visitors will then observe that the same content is loaded extremely fast since the page wasn’t put together from scratch. This module is useful for websites with a lot of unregistered users.

Internal Dynamic Page Cache

The Internal Dynamic Page Cache module is designed to cache small sections of each page for all users whether they are logged in or not. Whenever the page content is requested by the same or different user, the module can pull in those individual parts to speed up the building of the page on the fly.

Basic configuration

Drupal offers basic performance tuning at
Administration > Configuration > Development > Performance (admin/config/development/performance)

It is recommended that block and page caching be enabled. Instead of Drupal dynamically performing complex SQL queries it caches these for quick retrieval.
If you enabled caching, remember, you may need to Flush Cache (Clear all caches button) to see any changes made to your site. The Devel module has a block named “Development” you can enable that gives easy access to quick cache flushing. If you're a more technical user look at Drush. You can flush cache with one shell command drush cc all.
Typically during development, caching should be disabled. On production sites, caching should always remain enabled for best performance.
Page and block caching is not always available. For example, page caching will not be available when a component of the page has marked the page as explicitly not cacheable, such as using sessions. Block caching will not be available when using a module that utilizes node access, such as Organic Groups or Taxonomy Access Control Lite.

Opcode Caching (PHP - high CPU)

PHP out of the box is a dynamic language and can lead to heavy CPU usage on web servers. There are multiple types of opcode caching add-ons for PHP available that will convert your .php page into memory (byte code) to provide a major benefit in load time and reduced CPU usage. Each of these will require root access to install and have their own specific configurations that will need some attending before using. Once configured and enabled they can provide a substantial benefit to a slow site and greatly reduce CPU usage from PHP.

Database Caching

Database caching can be provided by a distributed memory object caching system, such as Memcache. Memcached allows you to allocate memory where you have more than you need and make it accessible to areas where you have less than you need. When implemented with Drupal, Memcached can store the result of your database query’s in the memory for a specified time, reducing database traffic.

Web Server (Proxy) Caching

HTTP acceleration, or Web Server (Proxy) Caching, will significantly reduce resource requirements and page load times. Varnish Cache, is a widely-used HTTP accelerator for Drupal sites.
HTTP acceleration is handled by a reverse proxy. A reverse proxy is a type of proxy server that retrieves resources (pages, images, files, etc.) prior to being requested by a website visitor. These resources are stored in virtual memory and are quickly retrieved by the proxy server when requested. Reverse proxies are heavily threaded and optimized for data retrieval.

Twig cache

Twig is used for Drupal 8 theming, and it relies on having its own cache of compiled Twig templates, which is separate from other caches that are cleared with the drush cache:rebuild command in Drupal 8. 

1 comment:

Vin Diesel said...

Web Development in Dubai
https://www.nsreem.com/ourservices/web-development/
If you are looking for develop customized Dynamic Web Development in Dubai, E-Commerce Web Development in Dubai then NSREEM is #1 Web Development Company in India.
1634534539538-7

Write a program in PHP to reverse a number

A number can be written in reverse order. For example 12345 = 54321 <?php   $ num = 23456;   $ revnum = 0;   while ($ num > 1)   {   $...