Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

How to reduce database load using Memcache


Published on

Configuring Memcache with Drupal 8 helps to reduce database load by caching DB objects in RAM. In this presentation, Ajay Reddy of Valuebound has explained how to install Memcache on the server and configure it with Drupal 8.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

How to reduce database load using Memcache

  1. 1. How to reduce database load using Memcache A Ajay Kumar Reddy
  2. 2. ● What is Memcache? ● Why do we need Memcache? ● How to install Memcache? ● How to configure Memcache in Drupal? ● Merits and demerits of Memcache. Agendas
  3. 3. ● Memcache is an in-memory Key-Value pairs data store. ● The Memcached server itself stores all the actual data in area of allocated RAM on the server (configurable). What is Memcache?
  4. 4. ● Well, having a storage frequently in RAM uses less time to fetch DATA. ● Can split upon Multiple applications based on “PREFIX”. Why do we need Memcache?
  5. 5. ● Open the terminal on your local machine and run the following codes: ○ sudo apt-get update ○ sudo apt install memcached ○ sudo apt install php-memcached ● Make sure Memcache daemon is working fine by running the following command: ○ “ps aux | grep memcached” ● Also, check whether the Memcached extension is properly configured in PHP7 by creating info.php page. How to install Memcache?
  6. 6. How to install Memcache? ● sudo nano /var/www/html/memcache/info.php ● And enter the below code ● <?php phpinfo(); ?> ● Now restart both Memcached and php7-fpm services ● service memcached restart ● service php7.0-fpm restart ● Go to any web browser and access info.php as “http://localhost/memcache/info.php”.
  7. 7. ● Download and Install Memcache and Memcache Storage modules from ○ drush en memcache memcache_storage -y ● Here we are using Memcache storage module to integrate Drupal and Memcached. ● Memcache Storage module used to store data in Memcache and also to show statistics. How to configure Memcache in Drupal?
  8. 8. Configure settings.php ● // Set’s default cache storage as Memcache and excludes database connection for cache $settings['cache']['default'] = 'cache.backend.memcache_storage'; ● // Set’s Memcache key prefix for your site and useful in working sites with same memcache as backend. $settings['memcache_storage']['key_prefix'] = ''; ● // Set’s Memcache storage server’s. $settings['memcache_storage']['memcached_servers'] = ['' => 'default'];
  9. 9. How memcache works in Drupal?
  10. 10. ● It is open source. ● Perfectly efficient for websites with huge database load/page hits. ● An client server application over TCP and/or UDP. Merits and Demerits of Memcache ● Loss of data is system reboots. ● RAM usage. ● Removes least data first. ● Shares data all over server if not configured with application key.
  11. 11. Thank you