• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Gear6 and Scaling Website Performance:  Caching Session and Profile Data with Memcached
 

Gear6 and Scaling Website Performance: Caching Session and Profile Data with Memcached

on

  • 6,453 views

This is a presentation given on April 14, 2009 to a select group of current memcached users. It includes survey results of how the dynamic web has given rise to the distributed caching tier, describes ...

This is a presentation given on April 14, 2009 to a select group of current memcached users. It includes survey results of how the dynamic web has given rise to the distributed caching tier, describes the growing popularity of memcached, provides poll results from memcached users and offers overview of the Gear6 Web Cache solution. Gear6 will be at the 2009 MySQL Conference at booth #218. Or visit us at Gear6.com.

Statistics

Views

Total Views
6,453
Views on SlideShare
6,442
Embed Views
11

Actions

Likes
14
Downloads
119
Comments
0

3 Embeds 11

http://www.slideshare.net 8
http://www.slashdocs.com 2
http://www.gear6.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Gear6 and Scaling Website Performance:  Caching Session and Profile Data with Memcached Gear6 and Scaling Website Performance: Caching Session and Profile Data with Memcached Presentation Transcript

    • Scaling Website Performance: Caching Session and Profile Data with Memcached Presented by: Joaquín Ruiz – EVP Products Perry Krug – Systems Engineer 14 April 2009
    • About Gear6 • First and leading provider of scalable Memcached solutions • Enabling high-growth web sites to deliver and scale dynamic high growth applications and content • Memcached contributor on Github and Google Code • Customers are leaders in media, social networking and content aggregation • Privately held; Headquartered in Mountain View, California 2 : Copyright 2009 Gear6 Inc.
    • The Web Has Changed • It’s Dynamic, It’s Mobile, It’s High Speed » Consumer internet traffic surpassed business traffic in 2008 » Dynamic (Social Aggregation Media) sites/services are the driving web growth (Social, Aggregation, So… • A distributed caching tier has become necessary and ubiquitous » Approximately 70% of websites are Linux-based (typically LAMP/Java) and are not scalable without a distributed caching tier Because… • Without a distributed caching tier you have no good options SCALE VERTICALLY: $$$ It’s very expensive to do this $$$ » ADD LARGE AMOUNTS OF WEB, APP AND DB SERVERS: $$$ OPEX $$$ » MOVE TO A DIFFENT STACK: “No way! No way!” » GET CRUSHED/SLOW RESPONSE TIMES: “It’s gone from bad to worse” » “Digital Consumer – Undermonetized social networks / video / VoIP driving powerful usage growth growth” – Morgan Stanley Tech Research, 5 Nov 2008, Web 2.0 Summit, San Francisco 3 : Copyright 2009 Gear6 Inc.
    • Web Architecture with No Cache Web / Application Servers MySQL Databases Ad Load Add Load dd d Web / Application Servers MySQL Databases Every request must hit the database servers and/or E t t th d t b d/ re- re-execute on application servers 4 : Copyright 2009 Gear6 Inc.
    • Memcached to the Rescue • Memcached: a distributed memory object caching system intended for use in speeding up dynamic web applications by alleviating database load • Memcached is an open source project that developed around the need for dynamic web sites to have a distributed caching tier » Technology: Memcached is a generic two stage hashing system (clients and servers). Clients are written for specific application languages. Server is written in C » U cases: HTML MySQL, Session/profile caching Use HTML, M SQL S i/ fil hi • Memcached is de facto solution » 85% of top 20 sites use memcached; 50%+ of top 5k sites uses Memcached » Memcached has client libraries in all major languages » Memcached has application level plug-ins for apps like WordPress and Drupal 5 : Copyright 2009 Gear6 Inc.
    • Why should I use Memcache? • Enables scale-out of dynamic websites • Faster page loads pg • Allows for efficient use of your database • Can utilize existing network infrastructure • Very flexible – architect for your workload & resources 6 : Copyright 2009 Gear6 Inc.
    • Web Architecture with Memcached Web / Application Servers Without Memcached MySQL Databases Web / Application Servers With Memcached Perfect for dynamic website Memcached that generate a Memcache Server(s) e cac ed Memcached high load on their hi h l d th i MySQL Memcached database Databases 7 : Copyright 2009 Gear6 Inc.
    • Challenges of Memcached Challenges: » Many web implementations require lots of memory and lots of servers for memcache: • Ad i i t ti Administration, power, cooling and li d rackspace challenge » No built-in failover or replication » Instances managed individually • Lack of consolidated management and aggregated statistic gathering • Can be challenging to troubleshoot client, service, instance and key relationships Source: “MySQL and memcached” May 2008 seminar 8 : Copyright 2009 Gear6 Inc.
    • What is a Session? • Al Almost always l tl larger th than 250 b t bytes, and almost dl t always smaller than 5 kilobytes • Read from datastore for every logged in user for every dynamic page load • Written to the datastore for every dynamic page load • Eventually reaped from the database after N minutes of inactivity Credits: “Cache your sessions. Don't piss off your users” by Dormando 9 : Copyright 2009 Gear6 Inc.
    • Example: Scaling the User Profile • Too many users creates a load on the database • Replicating the database will help this p g p » Will quickly experience DB replication lag Source: “”Scaling and Tuning MySQL.com” Jan 2009 10 : Copyright 2009 Gear6 Inc.
    • Where do you keep your Sessions? • Bad: Local sessions (on disk or in memory) » Can’t move users Can t » Can’t avoid hotspots » Not fault tolerant • Good: Centralized sessions (in a central database or in-memory) in memor ) » No porting around of session data » No need for sticky sessions » No hot spots Credits: “Scalable Web Architectures” by Cal Henderson 11 : Copyright 2009 Gear6 Inc.
    • Caching Sessions with Memcached • Common Wisdom: You Don’t » Users will get logged out if anything goes wrong with memcached » Evictions means that people are logged out of your site » If you upgrade memcached, OS, hardware etc., everyone will be logged off » Addi / Adding/removing memcached servers ki k people off site i hd kicks l ff it • BUT the benefit of caching sessions is HUGE » It is VERY FAST - Zero reads or writes to the database … so people do! Credits: “Cache your sessions. Don't piss off your users” by Dormando 12 : Copyright 2009 Gear6 Inc.
    • Session Caching Options Approach 1: » Memcached / MySQL hybrid ! Run batch/cron jobs to store session data in both database and memcached » Good for smaller sites or sites where it doesn’t matter as much if session data is lost (Gear6 Approach): Approach 2 » Store session in memcached space only » Provide sufficient memory space to eliminate evictions • Leverage flash density to reduce space and costs • Use DRAM to provide low latency » Use server-based replication to eliminate memcached misses b d l l hd 13 : Copyright 2009 Gear6 Inc.
    • Gear6: Session Caching Customer Case Production Customer Stats: Alexa rank: top 150 worldwide » 10’s of millions of page views per day » 28 million unique users per month in 2008 » Previously used memcached v 1.2.6 to cache sessions » About 120GB of memcache data used » Customer challenges: g » Need to provide very fast access to use profile information in order to present user with appropriate content (based on user ratings) » Customer: rack space limited and cost sensitive » Need to increase administrative efficiency for memcached tier » Memcached reload can take several hours if failure occurs during which DB load is very high and service latency increased 14 : Copyright 2009 Gear6 Inc.
    • Gear6: Session Caching Customer Case • Without Gear6: Zero High Availability / Redundancy Slower user experience » 4 U rack space » ~800W power consumption 800W » Zero configuration management » Minimal statistics (Cacti) » Cost per Gig = $100 for hardware only » Double everything for redundancy 32GB 32GB 32GB 32GB 15 : Copyright 2009 Gear6 Inc.
    • Gear6: Session Caching Customer Case • With Gear6: Fully redundant / cache data protection y p » 2 U rack space » ~400W power consumption » Single point for management gp g » Enhanced stream analysis and statistics » Cost per Gig = $70 for entire solution Savings & benefits of Gear6 solution vs. without Gear6: Over $8k/year in power savings » Immediately deployable with no code changes » 1/4th the rack space » Customers immediately presented with high-affinity content based » on profile and rating history p g y » Less expensive to deploy with Gear6 than without! 16 : Copyright 2009 Gear6 Inc.
    • Gear6 Web Cache Specifications Gear6 Web Cache Software Gear6 Web Cache Module • High memory density & advance memory allocation » Best-in-class hybrid RAM-Flash Best in class RAM Flash configurations » Advanced memory management » Most efficient object eviction implementation Gear6 software delivered on best-of-breed, » High bandwidth support industry standard servers, DRAM and Flash • High availability Module specs: » Rich cluster functionality •1 U rack profile with four flash drive bays » Failover configurations •Minimum of two modules per appliance » Cache replication options •Two power supplies per module • Advanced management •Four bonded GE ports per module » Hot key and client analysis •Two Quad Core processors » Service-wide diagnostics •Up to 300GB per rack unit » Aggregated physical and logical views 17 : Copyright 2009 Gear6 Inc.
    • Resources • www.gear6.com • Twitter » twitter.com/memcached • Github » http://github.com/zyounker/brutis/tree/master p //g /y / / / » http://github.com/rama/statsproxy/tree/master • Google code » http://code.google.com/p/brutis/wiki/Readme » http://code.google.com/p/statsproxy/ 18 : Copyright 2009 Gear6 Inc.
    • April 14, 2009 Webinar Poll Results If you do use memcached, do you use it for: None of the above 0% All of the above 8% Session and profile caching 0% Caching HTML web pages 42% MySQL or other data caching 67% What client are you using for memcached? Other 44% Perl 0% Java Based 11% PHP 44% 19 : Copyright 2009 Gear6 Inc.
    • Questions? Thank you for attending “Scaling Website Performance: Caching Session and Profile D P fil Data with Memcached” ihM h d” presented by Gear6 Joaquin Ruiz Gear6 salesinfo@gear6.com +1 650 587 7116 20 : Copyright 2009 Gear6 Inc.