SlideShare una empresa de Scribd logo
1 de 46
Launch with Confidence
Improving Website
Performance and Scalability
with Memcached
Presented by: Shawn Smiley [Lead Architect]
About Me
•
•

15+ years experience
in Internet software
and hosting

•

5+ years with Drupal

•

3

Lead Architect at
Achieve Internet

•

LinkedIn: www.linkedin.com/in/shawnsmiley/
Twitter: @shawnsmiley

Shawn S. Smiley

Recently married
Agenda
About Achieve

At a Glance

Key Clients

Achieve Services
Intro to Caching

How it Works?
What is Memcached?
When and Why You Should Use It?

Performance and Stats
Minimal Setup

Components of a Memcache Solution

PECL Memcache vs Memcached

Commands
Verifying and Troubleshooting

Minimal Install Verification
Distributed Configurations

When to Use It

Types

Configuration

Tuning Tips
Are There Alternatives?
Conclusion
Q&A

4
Achieve at a Glance
legal name

founded
headquarters
leadership

mission
primary
contact info

Achieve Internet, Inc.
1998

1767 Grand Avenue, Suite #2 | San Diego, CA 92109 | U.S.A.
Ron Huber, Chief Executive Officer
Achieve leverages best-in-class Open Source web application development experience, and tools to create
optimized platforms for enterprise clients.

800.618.8777 | info@achieveinternet.com

Achieve is a leading software development company that leverages Drupal to develop advanced
enterprise web and mobile solutions for an array of clients in varying verticals. Achieve has a singular
goal: To help you launch your advanced digital platforms with confidence.
Our ethos is “it‟s not magic, it‟s excellence,” and our all-star developers deliver on that promise
with every new project we take on by consistently exceeding client expectations.

5
Key Clients: Media & Entertainment

clients

6
Additional Key Clients

clients

7
Achieve Services
Achieve builds custom enterprise IT management systems to solve the most complex business challenges.
Application
Development

Achieve makes integration easy so you can focus on what is most important to your business – your customers.
Platform
Integration

Optimize the performance of your web site or application to increase productivity and streamline operations.
Infrastructure
Services

Achieve has vast experience in creating global web solutions that far out perform the competition.
Globalization
Services

„Going Mobile‟ is no longer an option. With Achieve you won‟t have to compromise design for utility.
Mobility & End User
Services

8
Intro to Caching

9
Intro to Caching
• A cache is a system that stores the results of some
processing for repeated later use.
• Example in Drupal is the page cache.
• Utilized via the cache_set() and cache_get() Drupal API
calls.
• Caches in Drupal are Key/Value pairs.

10
Intro to Caching: How it Works?
REQUEST

CACHE_
GET()

CHECK CACHE

RETURN
CACHED
DATA

11

QUERY CACHE
Intro to Caching: How it Works?
REQUEST

CACHE_
GET()

CHECK CACHE

QUERY CACHE

GENERAT
E DATA

RETURN
CACHED
DATA

CACHE_SET()

12

SAVE CACHE
What is Memcached?

13
What is Memcached?
• “Memcached is an in-memory key-value store for small
chunks of arbitrary data (strings, objects) from results of
database calls, API calls, or page rendering.” –
memcached.org
• A system to cache data in RAM rather than in database.
• Replaces Drupal‟s default database cache.

• Just one component of your high performance scalable
architecture.

14
When & Why Should You Use
It?

15
Why Use Memcached?
• Improves cache read/write performance
• Reduces the number of database queries
• Reduces database load

• Can improve page load performance*
• Allows distributing the cache load to separate servers

• Moves the threshold for performance degradation to a higher
number of concurrent users.
* By itself, Memcache.d won‟t provide a significant performance improve on low traffic sites. The page load performance
boost comes mostly from offloading work from your database server so that the system can handle more requests.

16
Performance Stats
• Performance & Scalability
• Cache read performance: 4X Faster

• Cache write performance: 60X Faster

• Actual statistics* (Drupal core vs. Memcached)
• 1000 Cache write operations: 12 seconds vs. 0.2 seconds
• 1000 Cache read operations: 0.4 seconds vs. 0.1 seconds
• DB queries: 3028 vs. 13
* Cache Read/Write stats are for performing 2,000 operations (1,000 write, 1,000 read)
* Your results will vary, tests performed on a single AWS instance with default D7 install

17
Performance Stats
Caching Performance Comparison: 2,000 Operations

Execution time (seconds)

12

Core DB
1

Memcache

0.083333
Cache Set

Cache Get

18
Performance Degradation Threshold

20
When to (or not) use Memcached
• Use Memcached when:
• Significant portion of site traffic is authenticated users or when
static page caching isn’t an option.
• Have adequate server resources to allocate to Memcached
without negatively impacting other services.
• Have enough traffic to make a difference.

• Don‟t use Memcached when:
• Site is completely anonymous traffic
•

Static caching is better for this (such as Varnish or Boost)

• Low traffic sites that are not straining server resources
•

Probably won’t see any noticeable benefit and have increased the
complexity of the system.

• Severely resource constrained single server hosting
•

Can negatively impact performance/scalability in this case.

21
Setup

22
Components of Memcached Solution
• Memcached Daemon (v 1.4.x)
• PHP Extension
• PECL Memcache (> 3.x)
• PECL Memcache.d (> 2.x)
• TIP: Use the setting “memcache_extension” to select
which library to use if you have both installed.

• Memcache Module

• Drupal 8, Drupal 7.9+, Pressflow 6, or Drupal
6 with core patch
24
PECL Memcache vs. Memcached
PECL Memcache

PECL Memcached

Stable, not as frequently updated

Newer, more features

Easy to install

More complicated install with multiple
dependencies

Lower PHP memory footprint in some
cases.

Can be slightly faster in some cases

Slightly better for single server
Memcached daemon installations.

Slightly better for distributed or
clustered Memcached daemon
installations.
Igbinary support

* Generally, we default to PECL Memcache unless a project can take
advantage of the additional features provided by PECL Memcached.

25
Minimal Install: Commands (Ubuntu)
• Enable apt multiverse repositories

• sudo apt-get install php-pear build-essential
• sudo apt-get install memcached
• sudo apt-get install php5-memcache

• drush dl memcache devel

26
Minimal Install: Daemon Configuration
/etc/memcached.conf (or /etc/default/memcached)
• Configuration file for the memcached daemon
• Important settings:
• -m 64
•

Amount of memory in MB to allocate.

• -p 11211
•

TCP/IP Port to listen for cache requests on.

• -l 127.0.0.1
•

IP Address to listen for cache requests on.

27
Determining Memcached size
• Look at the data size of all cache* tables in your DB.
• Use this handy query to get the total size:
SELECT count(*) TABLES,
sum(table_rows) ROWS,
concat(round(sum(data_length)/(1024*1024),2),'MB') DATA,
concat(round(sum(index_length)/(1024*1024),2),'MB') idx,

concat(round(sum(data_length+index_length)/(1024*1024),2),'MB') total_size
FROM information_schema.TABLES
WHERE TABLE_SCHEMA=’dbname' AND TABLE_NAME LIKE "cache%"

• Total memory allocated to Memcached should be at least
the size returned in the “DATA” column.
• I usually like to add at least 50% to this size to start with.

28
Note about Memcached security
• Basically there are no security controls in Memcached.
• Any user or application that can establish a TCP
connection to the Memcached daemon can access all
data stored within Memcached.
• Security Best Practices:
• Always set the daemon to listen on a specific IP
address/network interface.
• Use 127.0.0.1 if there is only 1 Memcached server and it is
running on the same server as the web server.
• Use iptables or other firewall to restrict access to the
Memcached TCP/IP Port(s).

29
Minimal Install: Drupal Settings.php
// Required minimum settings.
$conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
// Optional, but recommended settings.
$conf['memcache_key_prefix'] = 'ai_'; // Remember about 250 byte key size limit.
$conf['lock_inc'] = 'sites/all/modules/contrib/memcache/memcache-lock.inc';
$conf['memcache_stampede_protection'] = TRUE;
// The following are required only if Memcached is on a different server.
$conf['memcache_servers’] = array(’10.11.12.13:11211' => 'default');
$conf['memcache_bins’] = array('cache' => 'default');
// Only if both PECL Memcache and Memcached are installed.
$conf['memcache_extension'] = 'Memcache';

30
Minimal Install: Drupal Configuration
Drupal Performance Settings

31
Verifying & Troubleshooting

32
Minimal Install: Verifying
• Memcache Admin Module
• Adds configuration page at Configuration => Memcached

• Enable the option “Show Memcache statistics” to see a log of
all Memcached calls on each page.

• Devel Module
• Enable the Query Logging option.

• Memcache Admin UIs:
• https://code.google.com/p/phpmemcacheadmin/

• http://livebookmark.net/journal/2008/05/21/memcachephpstats-like-apcphp/

33
Minimal Install: Verifying - Memcache
• Enable the module “Memcache Admin”
• Config page at Configuration => Memcache
• Enable the option “Show Memcache statistics” to see a log of
all Memcached calls on each page.

34
Minimal Install: Verifying - Devel
• In Devel Settings, enable “Display query log”
• Reload pages, you‟ll see a list of all queries executed
• Ensure there are no calls to any “cache*” tables (other than
cache_form)
• Ensure there are no calls to the “semaphore” table (lock.inc)

35
Minimal Install: Verifying – Admin UIs
Demo

• Drupal Memcache Statistics
• memcache.php
• Memcache Admin

36
Distributed Configurations

37
Distributed Install: Overview
• When to use

• Types of distributed installs

• Configuration Steps

38
Distributed Install: When To Use It
• High traffic sites making more cache requests than a
single instance can efficiently handle.
• The default config of a Memcached daemon will support up to
1,024 simultaneous connection requests.

• Large caches where it makes sense to separate out cache
data by type or update frequency (e.g. cache_menu is
usually pretty static whereas the default cache could be
constantly changing)
• I start looking at this as an option when the memory allocation
for Memcached starts getting over 128MB.

39
Distributed Install: Types
• Multi-server/Clustered
• Distributes cache load across multiple Memcached servers.
• Allows for handling larger numbers of cache operations.
Useful for high traffic sites.
• NOTE: Caches are not replicated between multiple servers by
default.

• Multi-bin
• Segments different types of caches to different servers.
• Useful for very large caches with varying characteristics (e.g.
segmenting mostly read-only caches from caches that are
frequently updated)

• Hybrid
• You can combine both of the above approaches (e.g. have
multiple bins with each bin spread across multiple servers).
40
Distributed Install: Configuration
• Server configuration is same as the basic install, just on
multiple servers.
• Make sure the Memcached daemon is configured to listen on
each servers external IP address (not 127.0.0.1).
• All daemons within a cluster should be configured with the
same memory allocation.
• You can have multiple Memcached daemons running on a

single server. Just use different ports.

41
Distributed Install: Configuration
Additional settings needed in the site settings.php file
// Must be exactly the same on all web servers.
$conf['memcache_servers' = array(
'10.11.12.13:11211' => 'default',
'10.11.12.14:11211' => 'default',
'10.11.12.15:11211' => 'my_readonly_bin',
);
$conf['memcache_bins’] = array(
'cache' => 'default', // must specify if setting this variable.
'cache_bootstrap' => 'my_readonly_bin',
'cache_menu' => 'my_readonly_bin',
'cache_path' => 'my_readonly_bin',
);
// If using PECL Memcached.
$conf['memcache_options'] = array(
Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT,
);

42
Tuning Tips
• Watch the “Available Memory”, “Evictions” (==0), and
“reclaimed” (==0) stats to determine if memory allocation
needs to be adjusted.
• Watch “Max Connection Errors” (==0), “Accepting
Connections” (==1), “Connection Yields” (==0), and
“Listen Disabled Number” (==0) to determine when you
need to move from a single memcached server to
multiple servers.

Tip: See this page for a description of various stat counters:
http://www.pal-blog.de/entwicklung/perl/memcached-statistics-statscommand.html

43
Alternatives

44
Are There Alternatives?
Redis (https://drupal.org/project/redis)
• Great for persistent or replicated caches.
• Supports additional caching options such as structured data
caching.
• More efficient support for selective cache delete/expiration.
• Nice comparison to Memcache:
http://noblogdeffound.blogspot.com/2013/04/memcached-vsredis-comparison-name.html

MongoDB Cache (https://drupal.org/project/mongodb)
• Great for extremely large caches or when a large amount of
data must be stored in a single cache key.

45
Conclusion
By adding Memcached to our hosting solution we:
• Reduced the number of database queries.
• Reduced the load on our database servers.
• Reduced the amount of time the site spends accessing

cached data.
• Reduced the rendering time for page requests.
• Improved the overall scalability of the site.

46
Thank You
Shawn Smiley
 Lead Engineer
 shawn.smiley@achieveinternet.com
 Drupal: shawn_smiley
 800.618.8777
Connect with Achieve
If you have any further questions or would like to get in touch with
Achieve you can do so on these various channels:
info@achieveinternet.com
linkedin.com/company/Achieve-Internet
plus.google.com/101805819007866218919
@AchieveInternet
facebook.com/pages/Achieve-Internet

48
Q&A

49

Más contenido relacionado

La actualidad más candente

Postgres on OpenStack
Postgres on OpenStackPostgres on OpenStack
Postgres on OpenStackEDB
 
Ehcache3 — JSR-107 on steroids
Ehcache3 — JSR-107 on steroidsEhcache3 — JSR-107 on steroids
Ehcache3 — JSR-107 on steroidsAlex Snaps
 
Drupal performance optimization Best Practices
Drupal performance optimization Best PracticesDrupal performance optimization Best Practices
Drupal performance optimization Best PracticesRatnesh kumar, CSM
 
Distributed Caching Essential Lessons (Ts 1402)
Distributed Caching   Essential Lessons (Ts 1402)Distributed Caching   Essential Lessons (Ts 1402)
Distributed Caching Essential Lessons (Ts 1402)Yury Kaliaha
 
Session Handling Using Memcache
Session Handling Using MemcacheSession Handling Using Memcache
Session Handling Using MemcacheAnand Ghaywankar
 
Building low latency java applications with ehcache
Building low latency java applications with ehcacheBuilding low latency java applications with ehcache
Building low latency java applications with ehcacheChris Westin
 
Web session replication with Hazelcast
Web session replication with HazelcastWeb session replication with Hazelcast
Web session replication with HazelcastEmrah Kocaman
 
Give Your Site a Boost with Memcache
Give Your Site a Boost with MemcacheGive Your Site a Boost with Memcache
Give Your Site a Boost with MemcacheBen Ramsey
 
Achieving Massive Scalability and High Availability for PHP Applications in t...
Achieving Massive Scalability and High Availability for PHP Applications in t...Achieving Massive Scalability and High Availability for PHP Applications in t...
Achieving Massive Scalability and High Availability for PHP Applications in t...RightScale
 
VMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing DatabasesVMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing DatabasesVMworld
 
Moxi - Memcached Proxy
Moxi - Memcached ProxyMoxi - Memcached Proxy
Moxi - Memcached ProxyNorthScale
 
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...elliando dias
 
Memcached Code Camp 2009
Memcached Code Camp 2009Memcached Code Camp 2009
Memcached Code Camp 2009NorthScale
 
Optimizing Magento Performance with Zend Server
Optimizing Magento Performance with Zend ServerOptimizing Magento Performance with Zend Server
Optimizing Magento Performance with Zend Servervarien
 
Overview of the ehcache
Overview of the ehcacheOverview of the ehcache
Overview of the ehcacheHyeonSeok Choi
 
Cf Summit East 2018 Scaling ColdFusion
Cf Summit East 2018 Scaling ColdFusionCf Summit East 2018 Scaling ColdFusion
Cf Summit East 2018 Scaling ColdFusionmcollinsCF
 
vSphere APIs for performance monitoring
vSphere APIs for performance monitoringvSphere APIs for performance monitoring
vSphere APIs for performance monitoringAlan Renouf
 
Cloud computing 3702
Cloud computing 3702Cloud computing 3702
Cloud computing 3702Jess Coburn
 
WordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = SuccessWordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = SuccessAnthony Somerset
 

La actualidad más candente (19)

Postgres on OpenStack
Postgres on OpenStackPostgres on OpenStack
Postgres on OpenStack
 
Ehcache3 — JSR-107 on steroids
Ehcache3 — JSR-107 on steroidsEhcache3 — JSR-107 on steroids
Ehcache3 — JSR-107 on steroids
 
Drupal performance optimization Best Practices
Drupal performance optimization Best PracticesDrupal performance optimization Best Practices
Drupal performance optimization Best Practices
 
Distributed Caching Essential Lessons (Ts 1402)
Distributed Caching   Essential Lessons (Ts 1402)Distributed Caching   Essential Lessons (Ts 1402)
Distributed Caching Essential Lessons (Ts 1402)
 
Session Handling Using Memcache
Session Handling Using MemcacheSession Handling Using Memcache
Session Handling Using Memcache
 
Building low latency java applications with ehcache
Building low latency java applications with ehcacheBuilding low latency java applications with ehcache
Building low latency java applications with ehcache
 
Web session replication with Hazelcast
Web session replication with HazelcastWeb session replication with Hazelcast
Web session replication with Hazelcast
 
Give Your Site a Boost with Memcache
Give Your Site a Boost with MemcacheGive Your Site a Boost with Memcache
Give Your Site a Boost with Memcache
 
Achieving Massive Scalability and High Availability for PHP Applications in t...
Achieving Massive Scalability and High Availability for PHP Applications in t...Achieving Massive Scalability and High Availability for PHP Applications in t...
Achieving Massive Scalability and High Availability for PHP Applications in t...
 
VMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing DatabasesVMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing Databases
 
Moxi - Memcached Proxy
Moxi - Memcached ProxyMoxi - Memcached Proxy
Moxi - Memcached Proxy
 
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
 
Memcached Code Camp 2009
Memcached Code Camp 2009Memcached Code Camp 2009
Memcached Code Camp 2009
 
Optimizing Magento Performance with Zend Server
Optimizing Magento Performance with Zend ServerOptimizing Magento Performance with Zend Server
Optimizing Magento Performance with Zend Server
 
Overview of the ehcache
Overview of the ehcacheOverview of the ehcache
Overview of the ehcache
 
Cf Summit East 2018 Scaling ColdFusion
Cf Summit East 2018 Scaling ColdFusionCf Summit East 2018 Scaling ColdFusion
Cf Summit East 2018 Scaling ColdFusion
 
vSphere APIs for performance monitoring
vSphere APIs for performance monitoringvSphere APIs for performance monitoring
vSphere APIs for performance monitoring
 
Cloud computing 3702
Cloud computing 3702Cloud computing 3702
Cloud computing 3702
 
WordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = SuccessWordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = Success
 

Similar a Here are some key points about distributed Memcached configurations:- When to use: When you need more memory capacity than a single server can provide, or when you want to distribute the cache load across multiple servers for better performance and scalability. - Types: There are two main types - replication and sharding. Replication duplicates the entire cache to all servers. Sharding partitions the cache into "buckets" that are distributed across servers. - Configuration: You'll need to configure multiple Memcached servers in your Drupal settings.php and optionally configure replication/sharding. Tools like memcache-tool can help manage distributed configs.- Tuning: Consider server topology, consistent hashing algorithms, cache expiration policies

Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalabilityWim Godden
 
How to reduce database load using Memcache
How to reduce database load using MemcacheHow to reduce database load using Memcache
How to reduce database load using Memcachevaluebound
 
phptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialphptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialWim Godden
 
Presentation architecting a cloud infrastructure
Presentation   architecting a cloud infrastructurePresentation   architecting a cloud infrastructure
Presentation architecting a cloud infrastructurexKinAnx
 
Presentation architecting a cloud infrastructure
Presentation   architecting a cloud infrastructurePresentation   architecting a cloud infrastructure
Presentation architecting a cloud infrastructuresolarisyourep
 
12 Things about Oracle WebLogic Server 12c
12 Things	 about Oracle WebLogic Server 12c12 Things	 about Oracle WebLogic Server 12c
12 Things about Oracle WebLogic Server 12cGuatemala User Group
 
Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!WordCamp Cape Town
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Wim Godden
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalabilityWim Godden
 
Memcached B box presentation
Memcached B box presentationMemcached B box presentation
Memcached B box presentationNagesh Chinkeri
 
Configuring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web PerormanceConfiguring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web PerormanceSpark::red
 
Drupal 7 performance and optimization
Drupal 7 performance and optimizationDrupal 7 performance and optimization
Drupal 7 performance and optimizationShafqat Hussain
 
Lonestar php scalingmagento
Lonestar php scalingmagentoLonestar php scalingmagento
Lonestar php scalingmagentoMathew Beane
 
Caching objects-in-memory
Caching objects-in-memoryCaching objects-in-memory
Caching objects-in-memoryMauro Cassani
 
1049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 2016
1049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 20161049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 2016
1049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 2016panagenda
 
Zendcon scaling magento
Zendcon scaling magentoZendcon scaling magento
Zendcon scaling magentoMathew Beane
 
Performance and Scalability
Performance and ScalabilityPerformance and Scalability
Performance and ScalabilityMediacurrent
 

Similar a Here are some key points about distributed Memcached configurations:- When to use: When you need more memory capacity than a single server can provide, or when you want to distribute the cache load across multiple servers for better performance and scalability. - Types: There are two main types - replication and sharding. Replication duplicates the entire cache to all servers. Sharding partitions the cache into "buckets" that are distributed across servers. - Configuration: You'll need to configure multiple Memcached servers in your Drupal settings.php and optionally configure replication/sharding. Tools like memcache-tool can help manage distributed configs.- Tuning: Consider server topology, consistent hashing algorithms, cache expiration policies (20)

Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
How to reduce database load using Memcache
How to reduce database load using MemcacheHow to reduce database load using Memcache
How to reduce database load using Memcache
 
phptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialphptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorial
 
Presentation architecting a cloud infrastructure
Presentation   architecting a cloud infrastructurePresentation   architecting a cloud infrastructure
Presentation architecting a cloud infrastructure
 
Presentation architecting a cloud infrastructure
Presentation   architecting a cloud infrastructurePresentation   architecting a cloud infrastructure
Presentation architecting a cloud infrastructure
 
12 Things about Oracle WebLogic Server 12c
12 Things	 about Oracle WebLogic Server 12c12 Things	 about Oracle WebLogic Server 12c
12 Things about Oracle WebLogic Server 12c
 
Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Memcached B box presentation
Memcached B box presentationMemcached B box presentation
Memcached B box presentation
 
Configuring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web PerormanceConfiguring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web Perormance
 
Drupal 7 performance and optimization
Drupal 7 performance and optimizationDrupal 7 performance and optimization
Drupal 7 performance and optimization
 
Lonestar php scalingmagento
Lonestar php scalingmagentoLonestar php scalingmagento
Lonestar php scalingmagento
 
Caching objects-in-memory
Caching objects-in-memoryCaching objects-in-memory
Caching objects-in-memory
 
1049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 2016
1049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 20161049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 2016
1049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 2016
 
Zendcon scaling magento
Zendcon scaling magentoZendcon scaling magento
Zendcon scaling magento
 
Drupal performance
Drupal performanceDrupal performance
Drupal performance
 
Performance and Scalability
Performance and ScalabilityPerformance and Scalability
Performance and Scalability
 
MySQL NoSQL APIs
MySQL NoSQL APIsMySQL NoSQL APIs
MySQL NoSQL APIs
 
Drupal7 MEMCACHE
Drupal7 MEMCACHE Drupal7 MEMCACHE
Drupal7 MEMCACHE
 

Más de Achieve Internet

Planning & Executing Custom Drupal Integration Projects
Planning & Executing Custom Drupal Integration ProjectsPlanning & Executing Custom Drupal Integration Projects
Planning & Executing Custom Drupal Integration ProjectsAchieve Internet
 
Communicating Drupal: Documentation and Discovery
Communicating Drupal: Documentation and DiscoveryCommunicating Drupal: Documentation and Discovery
Communicating Drupal: Documentation and DiscoveryAchieve Internet
 
Advancing Healthcare Technology with Open Source Software
Advancing Healthcare Technology with Open Source SoftwareAdvancing Healthcare Technology with Open Source Software
Advancing Healthcare Technology with Open Source SoftwareAchieve Internet
 
Showcasing Human Capital: How to Effectively Market a Professional Services Firm
Showcasing Human Capital: How to Effectively Market a Professional Services FirmShowcasing Human Capital: How to Effectively Market a Professional Services Firm
Showcasing Human Capital: How to Effectively Market a Professional Services FirmAchieve Internet
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetAchieve Internet
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetAchieve Internet
 
Drupal secure code checklist
Drupal secure code checklistDrupal secure code checklist
Drupal secure code checklistAchieve Internet
 
Helping the LatinGRAMMYs Reach a Global Audience
Helping the LatinGRAMMYs Reach a Global Audience Helping the LatinGRAMMYs Reach a Global Audience
Helping the LatinGRAMMYs Reach a Global Audience Achieve Internet
 
Drupal and the Future of Healthcare
Drupal and the Future of HealthcareDrupal and the Future of Healthcare
Drupal and the Future of HealthcareAchieve Internet
 
Introduction to Puppet Scripting
Introduction to Puppet ScriptingIntroduction to Puppet Scripting
Introduction to Puppet ScriptingAchieve Internet
 
Responsive Web Design_2013
Responsive Web Design_2013Responsive Web Design_2013
Responsive Web Design_2013Achieve Internet
 

Más de Achieve Internet (11)

Planning & Executing Custom Drupal Integration Projects
Planning & Executing Custom Drupal Integration ProjectsPlanning & Executing Custom Drupal Integration Projects
Planning & Executing Custom Drupal Integration Projects
 
Communicating Drupal: Documentation and Discovery
Communicating Drupal: Documentation and DiscoveryCommunicating Drupal: Documentation and Discovery
Communicating Drupal: Documentation and Discovery
 
Advancing Healthcare Technology with Open Source Software
Advancing Healthcare Technology with Open Source SoftwareAdvancing Healthcare Technology with Open Source Software
Advancing Healthcare Technology with Open Source Software
 
Showcasing Human Capital: How to Effectively Market a Professional Services Firm
Showcasing Human Capital: How to Effectively Market a Professional Services FirmShowcasing Human Capital: How to Effectively Market a Professional Services Firm
Showcasing Human Capital: How to Effectively Market a Professional Services Firm
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve Internet
 
Drupal secure code checklist
Drupal secure code checklistDrupal secure code checklist
Drupal secure code checklist
 
Helping the LatinGRAMMYs Reach a Global Audience
Helping the LatinGRAMMYs Reach a Global Audience Helping the LatinGRAMMYs Reach a Global Audience
Helping the LatinGRAMMYs Reach a Global Audience
 
Drupal and the Future of Healthcare
Drupal and the Future of HealthcareDrupal and the Future of Healthcare
Drupal and the Future of Healthcare
 
Introduction to Puppet Scripting
Introduction to Puppet ScriptingIntroduction to Puppet Scripting
Introduction to Puppet Scripting
 
Responsive Web Design_2013
Responsive Web Design_2013Responsive Web Design_2013
Responsive Web Design_2013
 

Último

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 

Último (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

Here are some key points about distributed Memcached configurations:- When to use: When you need more memory capacity than a single server can provide, or when you want to distribute the cache load across multiple servers for better performance and scalability. - Types: There are two main types - replication and sharding. Replication duplicates the entire cache to all servers. Sharding partitions the cache into "buckets" that are distributed across servers. - Configuration: You'll need to configure multiple Memcached servers in your Drupal settings.php and optionally configure replication/sharding. Tools like memcache-tool can help manage distributed configs.- Tuning: Consider server topology, consistent hashing algorithms, cache expiration policies

  • 1. Launch with Confidence Improving Website Performance and Scalability with Memcached Presented by: Shawn Smiley [Lead Architect]
  • 2. About Me • • 15+ years experience in Internet software and hosting • 5+ years with Drupal • 3 Lead Architect at Achieve Internet • LinkedIn: www.linkedin.com/in/shawnsmiley/ Twitter: @shawnsmiley Shawn S. Smiley Recently married
  • 3. Agenda About Achieve  At a Glance  Key Clients  Achieve Services Intro to Caching  How it Works? What is Memcached? When and Why You Should Use It?  Performance and Stats Minimal Setup  Components of a Memcache Solution  PECL Memcache vs Memcached  Commands Verifying and Troubleshooting  Minimal Install Verification Distributed Configurations  When to Use It  Types  Configuration  Tuning Tips Are There Alternatives? Conclusion Q&A 4
  • 4. Achieve at a Glance legal name founded headquarters leadership mission primary contact info Achieve Internet, Inc. 1998 1767 Grand Avenue, Suite #2 | San Diego, CA 92109 | U.S.A. Ron Huber, Chief Executive Officer Achieve leverages best-in-class Open Source web application development experience, and tools to create optimized platforms for enterprise clients. 800.618.8777 | info@achieveinternet.com Achieve is a leading software development company that leverages Drupal to develop advanced enterprise web and mobile solutions for an array of clients in varying verticals. Achieve has a singular goal: To help you launch your advanced digital platforms with confidence. Our ethos is “it‟s not magic, it‟s excellence,” and our all-star developers deliver on that promise with every new project we take on by consistently exceeding client expectations. 5
  • 5. Key Clients: Media & Entertainment clients 6
  • 7. Achieve Services Achieve builds custom enterprise IT management systems to solve the most complex business challenges. Application Development Achieve makes integration easy so you can focus on what is most important to your business – your customers. Platform Integration Optimize the performance of your web site or application to increase productivity and streamline operations. Infrastructure Services Achieve has vast experience in creating global web solutions that far out perform the competition. Globalization Services „Going Mobile‟ is no longer an option. With Achieve you won‟t have to compromise design for utility. Mobility & End User Services 8
  • 9. Intro to Caching • A cache is a system that stores the results of some processing for repeated later use. • Example in Drupal is the page cache. • Utilized via the cache_set() and cache_get() Drupal API calls. • Caches in Drupal are Key/Value pairs. 10
  • 10. Intro to Caching: How it Works? REQUEST CACHE_ GET() CHECK CACHE RETURN CACHED DATA 11 QUERY CACHE
  • 11. Intro to Caching: How it Works? REQUEST CACHE_ GET() CHECK CACHE QUERY CACHE GENERAT E DATA RETURN CACHED DATA CACHE_SET() 12 SAVE CACHE
  • 13. What is Memcached? • “Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.” – memcached.org • A system to cache data in RAM rather than in database. • Replaces Drupal‟s default database cache. • Just one component of your high performance scalable architecture. 14
  • 14. When & Why Should You Use It? 15
  • 15. Why Use Memcached? • Improves cache read/write performance • Reduces the number of database queries • Reduces database load • Can improve page load performance* • Allows distributing the cache load to separate servers • Moves the threshold for performance degradation to a higher number of concurrent users. * By itself, Memcache.d won‟t provide a significant performance improve on low traffic sites. The page load performance boost comes mostly from offloading work from your database server so that the system can handle more requests. 16
  • 16. Performance Stats • Performance & Scalability • Cache read performance: 4X Faster • Cache write performance: 60X Faster • Actual statistics* (Drupal core vs. Memcached) • 1000 Cache write operations: 12 seconds vs. 0.2 seconds • 1000 Cache read operations: 0.4 seconds vs. 0.1 seconds • DB queries: 3028 vs. 13 * Cache Read/Write stats are for performing 2,000 operations (1,000 write, 1,000 read) * Your results will vary, tests performed on a single AWS instance with default D7 install 17
  • 17. Performance Stats Caching Performance Comparison: 2,000 Operations Execution time (seconds) 12 Core DB 1 Memcache 0.083333 Cache Set Cache Get 18
  • 19. When to (or not) use Memcached • Use Memcached when: • Significant portion of site traffic is authenticated users or when static page caching isn’t an option. • Have adequate server resources to allocate to Memcached without negatively impacting other services. • Have enough traffic to make a difference. • Don‟t use Memcached when: • Site is completely anonymous traffic • Static caching is better for this (such as Varnish or Boost) • Low traffic sites that are not straining server resources • Probably won’t see any noticeable benefit and have increased the complexity of the system. • Severely resource constrained single server hosting • Can negatively impact performance/scalability in this case. 21
  • 21. Components of Memcached Solution • Memcached Daemon (v 1.4.x) • PHP Extension • PECL Memcache (> 3.x) • PECL Memcache.d (> 2.x) • TIP: Use the setting “memcache_extension” to select which library to use if you have both installed. • Memcache Module • Drupal 8, Drupal 7.9+, Pressflow 6, or Drupal 6 with core patch 24
  • 22. PECL Memcache vs. Memcached PECL Memcache PECL Memcached Stable, not as frequently updated Newer, more features Easy to install More complicated install with multiple dependencies Lower PHP memory footprint in some cases. Can be slightly faster in some cases Slightly better for single server Memcached daemon installations. Slightly better for distributed or clustered Memcached daemon installations. Igbinary support * Generally, we default to PECL Memcache unless a project can take advantage of the additional features provided by PECL Memcached. 25
  • 23. Minimal Install: Commands (Ubuntu) • Enable apt multiverse repositories • sudo apt-get install php-pear build-essential • sudo apt-get install memcached • sudo apt-get install php5-memcache • drush dl memcache devel 26
  • 24. Minimal Install: Daemon Configuration /etc/memcached.conf (or /etc/default/memcached) • Configuration file for the memcached daemon • Important settings: • -m 64 • Amount of memory in MB to allocate. • -p 11211 • TCP/IP Port to listen for cache requests on. • -l 127.0.0.1 • IP Address to listen for cache requests on. 27
  • 25. Determining Memcached size • Look at the data size of all cache* tables in your DB. • Use this handy query to get the total size: SELECT count(*) TABLES, sum(table_rows) ROWS, concat(round(sum(data_length)/(1024*1024),2),'MB') DATA, concat(round(sum(index_length)/(1024*1024),2),'MB') idx, concat(round(sum(data_length+index_length)/(1024*1024),2),'MB') total_size FROM information_schema.TABLES WHERE TABLE_SCHEMA=’dbname' AND TABLE_NAME LIKE "cache%" • Total memory allocated to Memcached should be at least the size returned in the “DATA” column. • I usually like to add at least 50% to this size to start with. 28
  • 26. Note about Memcached security • Basically there are no security controls in Memcached. • Any user or application that can establish a TCP connection to the Memcached daemon can access all data stored within Memcached. • Security Best Practices: • Always set the daemon to listen on a specific IP address/network interface. • Use 127.0.0.1 if there is only 1 Memcached server and it is running on the same server as the web server. • Use iptables or other firewall to restrict access to the Memcached TCP/IP Port(s). 29
  • 27. Minimal Install: Drupal Settings.php // Required minimum settings. $conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc'; $conf['cache_default_class'] = 'MemCacheDrupal'; $conf['cache_class_cache_form'] = 'DrupalDatabaseCache'; // Optional, but recommended settings. $conf['memcache_key_prefix'] = 'ai_'; // Remember about 250 byte key size limit. $conf['lock_inc'] = 'sites/all/modules/contrib/memcache/memcache-lock.inc'; $conf['memcache_stampede_protection'] = TRUE; // The following are required only if Memcached is on a different server. $conf['memcache_servers’] = array(’10.11.12.13:11211' => 'default'); $conf['memcache_bins’] = array('cache' => 'default'); // Only if both PECL Memcache and Memcached are installed. $conf['memcache_extension'] = 'Memcache'; 30
  • 28. Minimal Install: Drupal Configuration Drupal Performance Settings 31
  • 30. Minimal Install: Verifying • Memcache Admin Module • Adds configuration page at Configuration => Memcached • Enable the option “Show Memcache statistics” to see a log of all Memcached calls on each page. • Devel Module • Enable the Query Logging option. • Memcache Admin UIs: • https://code.google.com/p/phpmemcacheadmin/ • http://livebookmark.net/journal/2008/05/21/memcachephpstats-like-apcphp/ 33
  • 31. Minimal Install: Verifying - Memcache • Enable the module “Memcache Admin” • Config page at Configuration => Memcache • Enable the option “Show Memcache statistics” to see a log of all Memcached calls on each page. 34
  • 32. Minimal Install: Verifying - Devel • In Devel Settings, enable “Display query log” • Reload pages, you‟ll see a list of all queries executed • Ensure there are no calls to any “cache*” tables (other than cache_form) • Ensure there are no calls to the “semaphore” table (lock.inc) 35
  • 33. Minimal Install: Verifying – Admin UIs Demo • Drupal Memcache Statistics • memcache.php • Memcache Admin 36
  • 35. Distributed Install: Overview • When to use • Types of distributed installs • Configuration Steps 38
  • 36. Distributed Install: When To Use It • High traffic sites making more cache requests than a single instance can efficiently handle. • The default config of a Memcached daemon will support up to 1,024 simultaneous connection requests. • Large caches where it makes sense to separate out cache data by type or update frequency (e.g. cache_menu is usually pretty static whereas the default cache could be constantly changing) • I start looking at this as an option when the memory allocation for Memcached starts getting over 128MB. 39
  • 37. Distributed Install: Types • Multi-server/Clustered • Distributes cache load across multiple Memcached servers. • Allows for handling larger numbers of cache operations. Useful for high traffic sites. • NOTE: Caches are not replicated between multiple servers by default. • Multi-bin • Segments different types of caches to different servers. • Useful for very large caches with varying characteristics (e.g. segmenting mostly read-only caches from caches that are frequently updated) • Hybrid • You can combine both of the above approaches (e.g. have multiple bins with each bin spread across multiple servers). 40
  • 38. Distributed Install: Configuration • Server configuration is same as the basic install, just on multiple servers. • Make sure the Memcached daemon is configured to listen on each servers external IP address (not 127.0.0.1). • All daemons within a cluster should be configured with the same memory allocation. • You can have multiple Memcached daemons running on a single server. Just use different ports. 41
  • 39. Distributed Install: Configuration Additional settings needed in the site settings.php file // Must be exactly the same on all web servers. $conf['memcache_servers' = array( '10.11.12.13:11211' => 'default', '10.11.12.14:11211' => 'default', '10.11.12.15:11211' => 'my_readonly_bin', ); $conf['memcache_bins’] = array( 'cache' => 'default', // must specify if setting this variable. 'cache_bootstrap' => 'my_readonly_bin', 'cache_menu' => 'my_readonly_bin', 'cache_path' => 'my_readonly_bin', ); // If using PECL Memcached. $conf['memcache_options'] = array( Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT, ); 42
  • 40. Tuning Tips • Watch the “Available Memory”, “Evictions” (==0), and “reclaimed” (==0) stats to determine if memory allocation needs to be adjusted. • Watch “Max Connection Errors” (==0), “Accepting Connections” (==1), “Connection Yields” (==0), and “Listen Disabled Number” (==0) to determine when you need to move from a single memcached server to multiple servers. Tip: See this page for a description of various stat counters: http://www.pal-blog.de/entwicklung/perl/memcached-statistics-statscommand.html 43
  • 42. Are There Alternatives? Redis (https://drupal.org/project/redis) • Great for persistent or replicated caches. • Supports additional caching options such as structured data caching. • More efficient support for selective cache delete/expiration. • Nice comparison to Memcache: http://noblogdeffound.blogspot.com/2013/04/memcached-vsredis-comparison-name.html MongoDB Cache (https://drupal.org/project/mongodb) • Great for extremely large caches or when a large amount of data must be stored in a single cache key. 45
  • 43. Conclusion By adding Memcached to our hosting solution we: • Reduced the number of database queries. • Reduced the load on our database servers. • Reduced the amount of time the site spends accessing cached data. • Reduced the rendering time for page requests. • Improved the overall scalability of the site. 46
  • 44. Thank You Shawn Smiley  Lead Engineer  shawn.smiley@achieveinternet.com  Drupal: shawn_smiley  800.618.8777
  • 45. Connect with Achieve If you have any further questions or would like to get in touch with Achieve you can do so on these various channels: info@achieveinternet.com linkedin.com/company/Achieve-Internet plus.google.com/101805819007866218919 @AchieveInternet facebook.com/pages/Achieve-Internet 48

Notas del editor

  1. Achieve has been involved with web development projects since our inception in 1998. We began leveraging Drupal as our primary tool of choice in 2005. We focus on the performance, infrastructure and foundation of web development. We focus on building high-end enterprise platforms that can scale to meet growing demands. Achieve is headquarter in San Diego, we have an office in Los Angeles and dispersed team members in Silicon Valley and the greater Philadelphia are. We have worked with a number of top tier Media and Entertainment clients, building them Enterprise solutions those clients include….[next slide]
  2. Along with the Media and Entertainment space we have worked with large healthcare and Life Sciences clients as well as…[next slide]
  3. Drupal.org for the Apache Solr implementation among others.
  4. Achieve focuses on 5 pillars of developmentWeb application development, building full infrastructures form the ground up as well as enhancing current platformsWe specialize in custom integrations with copious third party platforms from Oracle ERPs to Salesforce, Social Media, Marketing Software, along with many many othersThe focus of todays webinar is Memcache and is Infrastructure related- we can fine tune an environment to take on any type of traffic loadA 4th of our staff is bilingual and we have done tons of work helping clients expand their reach to an international and multilingual audience.We strive to build and architect our solutions in a way that adhere to UX best practices. We have been leveraging Responsive Design for many years to help our clients increase their online presence regardless of which device their users are on.
  5. Updated Perf Stats (1000 cache get/set operations each):DB Only: Set Time: 14s; Get Time: 0.4s; total DB queries: 3028DB Only: Set Time: 11s; Get Time: 0.4s; total DB queries: 3028DB Only: Set Time: 11s; Get Time: 0.4s; total DB queries: 3028PECLMemcache: Set Time: 0.2s; Get Time: 0.1s; total DB queries: 13PECLMemcache: Set Time: 0.2s; Get Time: 0.1s; total DB queries: 13PECLMemcache: Set Time: 0.2s; Get Time: 0.1s; total DB queries: 13PECL Memcached: Set Time: 0.1s; Get Time: 0.2s; total DB queries: 13PECL Memcached: Set Time: 0.1s; Get Time: 0.2s; total DB queries: 13PECL Memcached: Set Time: 0.1s; Get Time: 0.2s; total DB queries: 13PECL Memcached w/ igbinary:
  6. Update chart for latest versions, research blog post about some issue with peclmemcached…Article on excessive memory usage with Memcached: http://2bits.com/articles/drupal-site-excessive-memory-usage-traced-apc-and-php5-memcached.htmlUse PECL Memcached when:Doing clustered Memcached implementation with multiple instances.Site will be doing a lot of object serialization in the Caching layer, then make sure to enable lgbinary support.
  7. Assuming Ubuntu 12.04 or later.
  8. On some systems, these settings could be at /etc/default/memcached.
  9. The memcache module does NOT need to be enabled.If specifying the server address, all web servers must use the same address for each memcached server.
  10. First show what things look like without Memcached configured, then show the output with it enabled to illustrate the differences.