Oshyn Home Page
  • expertise
    • Overview
    • Contact Us |
    • Latest work: www.miramax.com
  • solutions
    • Overview
    • Content Management
      • Choosing a CMS
      • Site Migration
      • Sitecore Consulting
      • EPiServer CMS Consulting
      • Jahia Integration
      • Legacy CMS Solutions
      • Drupal Development
      • Common Issues
      • Training
    • Web Strategy
    • Mobile Platforms
    • Social Media
    • E-commerce
    • Portals & Collaboration
    • SOA
    • Contact Us |
    • Latest work: www.miramax.com
  • work
    • Overview
    • Client Quotes
    • Contact Us |
    • Latest work: www.websense.com
  • resources
    • Overview
    • News & Events
    • Newsletters
    • Blog
    • White Papers
    • Success Stories
    • Press Kit
    • Contact Us |
    • Latest work: www.disneydvd.com
  • partners
    • Overview
    • Agency Partner Program
    • Technology Partners
    • Contact Us |
    • Latest work: www.nea.org
  • company
    • Overview
    • Contact
    • Careers
    • Leadership Team
    • News & Events
    • Social Responsibility
    • Contact Us |
    • Latest work: www.icon4x4.com
  • Tweet
Wednesday, May 27, 2009  /   Glenn Korban Glenn Korban
Author Page
close

Glenn Korban


A Summary of Scaling Options for MySQL

Unfortunately, there isn’t one silver bullet scaling solution that best suits all projects. Each project has unique requirements that should be considered when choosing a scaling strategy. This is a topic that comes up often, so after many trips through the analysis, I thought I’d write up a high-level summary of the options.

 

For the attention deficit, here are the shortcuts to the good stuff:

  1. Benefits of Scaling
  2. Costs of Scaling
  3. Project Considerations
  4. Scaling Options
  5. Scaling Vertically
  6. Scaling Horizontally
  7. Active-Passive
  8. Master-Slave
  9. Cluster
  10. Sharding

 

Benefits of Scaling

Scaling a database can become necessary for a variety of reasons:

  1. Support a higher volume of users
  2. Provide better performance for existing users
  3. Store a larger volume of data
  4. Improve system availability
  5. Geographic dispersion (generally related to performance and availability)

Costs of Scaling

Of course all these benefits of scaling a database come at a cost. Some of the costs to consider include the following:

  1. Cost of hardware – It goes without saying that upgrading existing servers or adding new servers to a system will incur hardware and/or hosting costs
  2. Deployment effort – whether it’s time spent by in-house developers or the cost of external contractors, you should consider the effort to install and configure hardware, software, and networking. In some cases, application code changes might even be required.
  3. Maintenance – As the system becomes more complex, the maintenance costs grow in a variety of areas: documentation, training, backups, deploying application enhancements, etc.

Project Considerations

Every project has its own unique requirements and characteristics that will shape the selection of the appropriate scaling option. Here are some things to think about before selecting a strategy for scaling your application database:

  1. What is the anticipated database load?
  2. What are the requirements for availability?
  3. What are the requirements for performance?
  4. What are the requirements for failover and recoverability?
  5. What is the ratio of write operations vs. read operations?
  6. Where are your users physically located?
  7. Does the database create higher than normal processing load (like for heavy usage of stored procedures)?
  8. If this is an upgrade for an existing system, what is the utilization of the existing hardware (CPU, RAM, network I/O, disk I/O)? Where is the bottleneck?

Scaling Options

Options for scaling a database can be grouped into two major categories: Vertical and Horizontal. Scaling vertically generally describes adding capacity to the existing database instance(s) without increasing the number of servers or database instances. Horizontal Scaling, on the other hand, refers the alternative approach of adding servers and database instances.

Scaling Vertically

The easiest way to increase the capacity of a MySQL database is to upgrade the server hardware. Most often, this means adding CPU and/or RAM, but can also include disk I/O capacity. Scaling vertically can be done by upgrading existing server hardware or by moving to a new server.

  1. Easiest, simplest option for scaling your MySQL database
  2. Doesn’t improve availability (db is still running on a single box)
  3. Good for boosting CPU and RAM, but limited potential for improving network I/O or disk I/O
  4. Beefy hardware is expensive
  5. There is a finite limit to the capacity achievable with vertical scaling

Scaling Horizontally

For projects with requirements for high availability or failover, adding additional servers can be the right solution. Horizontal scaling can be done with a variety of configurations: Active-Passive, Master-Slave, Cluster, or Sharding.

Active-Passive

With two database instances, one is the active instance and the other is the passive. All queries (reads and writes) are directed to the active instance. Write operations are replicated to the passive instance to keep it in sync. In the event of failure of the active instance, query and update traffic is redirected to the passive instance. For more information on MySQL replication, look here: http://dev.mysql.com/doc/refman/5.1/en/replication.html.

  1. Improves availability and failover
  2. Doesn’t improve capacity or performance (over a single instance of the same size)
  3. Redirecting traffic from the active instance to the passive can be done automatically (recommended) with a load-balancer or switch, or can be done manually using a VIP or internal DNS configuration change

Master-Slave

Using two or more database instances, one instance is the master and the others are slaves. All writes are routed to the master instance, then replicated to the slaves. Read operations are routed to the slave instances. In the event of failure of the master, one of the slave instances must be designated as the new master and update operations rerouted. 

  1. An unlimited number of slave instances can be added, but only one instance can be the master
  2. Great for applications with mostly READ operations
  3. Good for addressing I/O (network or disk) bottlenecks
  4. Good for geographic dispersion
  5. Requires application logic to separate read and write operations
  6. Replication is asynchronous, so instances are not guaranteed to be in sync
  7. Master instance can be scaled vertically

Cluster

MySQL 5.0 first introduced native clustering capability which has since been improved in subsequent releases. The cluster distributes query processing and data storage across multiple nodes to eliminate single points of failure and allow almost unlimited scaling. The cluster is made up of three types of nodes: storage nodes, SQL nodes (query processing), and management nodes. For more detail on the function and configuration of the cluster nodes, please refer to the MySQL documentation. To realize the full high-availability potential, a cluster should contain at least two of each type of node. The recommended minimum configuration includes six servers, although 3-box configuration is possible (see details).

  1. Good solution for high-availability
  2. In-memory storage provides high-performance
  3. Good for scaling applications with heavy write loads
  4. Can scale specific portions of the cluster (query processing or storage) to target bottlenecks (CPU, RAM, I/O, storage volume)
  5. Synchronous replication between nodes makes cluster inappropriate for geographic dispersion
  6. Not a good fit for hosting environments with SAN
  7. Requires lots of RAM for storage nodes (roughly double the db size)
  8. High complexity

Sharding

Sharding comes in many forms.  In the most basic sense, it describes breaking up a large database into many smaller databases. Sharding can include strategies like carving off tables, or cutting up tables vertically (by columns).  I'm mostly referring to the strategy of “horizontal table partitioning” - dividing large tables by row.  This is a relatively exotic configuration and generally used only by the most demanding applications.

  1. Good strategy for handling extreme database loads
  2. Easiest/most appropriate when most load is accessing a few tables and JOIN operations across shards are not required
  3. Success depends largely of sharding strategy and shard sizing
  4. May require painful periodic shard resizing
  5. Very high complexity
  6. Improves availability - The impact of a shard failure is small (affects only a portion of data), but sharding must be coupled with an additional strategy (like active-passive) to provide complete high-availability
 I recommend considering sharding only as a scaling strategy of last resort.  Before going down the path, I would consider any and all of the scaling strategies above.  If sharding really looks like the best option, the good news is that several sharding solutions have emerged, so you shouldn't have to roll your own.

More in-depth discussions can be found here:
  1. http://highscalability.com/unorthodox-approach-database-design-coming-shard
  2. http://www.codefutures.com/database-sharding/
  3. http://blog.maxindelicato.com/2008/12/scalability-strategies-primer-database-sharding.html
  4. http://www.jurriaanpersyn.com/archives/2009/02/12/database-sharding-at-netlog-with-mysql-and-php/
  5. http://www.addsimplicity.com/adding_simplicity_an_engi/2008/08/shard-lessons.html
  6. And many, many more…

    Trackback Link
    http://www.oshyn.com/BlogRetrieve.aspx?BlogID=1906&PostID=66896&A=Trackback
    Trackbacks
    Post has no trackbacks.

    Pages: Previous Next

    TwitterFacebookLinkedIn
    ajax rotator

    Blog Authors

    Christian Burne   Christian Burne  
    Subscribe Subscribe Subscribe Subscribe Subscribe
    OTHER CATEGORIES
    • ALL

    • General

    • Web Content Management

    • Sitecore CMS

    • Open Text

    • Jahia

    • Drupal

    • EpiServer

    • SOA

    • Social Media and Mobile

    • Software Development

    • Visit Bloggers Profiles

    RELATED POSTS
    • Creativity is Not Enough: 3 Reasons Why
    • Managing Complexity in the Web Design Process
    • Why you don't have to rank #1 in search
    • 5 Ways a Discovery Phase can help keep your web design projects sane
    • Top 3 Mistakes Agencies and In-House Departments Make on Web Projects
    • Foundation Framework: A responsive front-end framework for your site
    • Introduction to Responsive Web Design
    • LESS Beginner’s Guide – A look into the CSS Preprocessor
    • Pros and Cons of using jQuery Mobile for your site
    • Seven Predictions for 2013 from Oshyn

    WHITE PAPERS

      Web Content Management, Social Media, Content: Three Kings for Your Website Web Content Management, Social Media, Content: Three Kings for Your Website (846 KB)
      Companies pursuing online marketing success, including Social Media, can increase the power of their online presence with right strategy and technology to maximize online visibility and engagement. Download this FREE white paper on the WCM, Social Media, and Content triad.

      Drupal Performance Tuning Drupal Performance Tuning (1213 KB)
      In this Free White Paper Oshyn evaluates Drupal Performance Tuning, sharing the results of testing response time and Requests Per Second (RPS) that a server can hold before the response rate becomes unacceptable. In this paper you will learn about optimizing performance of a website through changes to settings and the server.

      Enterprise Drupal: Social Media, Mobile, and Rich Media in your Website Enterprise Drupal: Social Media, Mobile, and Rich Media in your Website (1015 KB)
      In this free WCM white paper, Oshyn examines advanced Drupal capabilities: Multisite Environment, Access Control and Security, Enhanced User Profiles, Custom Breadcrumbs, Mobile Support, Podcasts, Advanced Multimedia, Locations and Maps, Internationalization and Locale based content, Events and Scheduled Tasks, Rules Actions and E-Commerce Solutions.

      Drupal Multilingual Drupal Multilingual (636 KB)
      There are several multilingual installation methods for Drupal. In this free white paper Oshyn evaluates and recommends several methods of using Drupal Open Source CMS to manage websites in multiple languages.

      Drupal Social Media Drupal Social Media (1297 KB)
      Looking for an Open Source CMS to for “Social Media Optimization” of your website? Download this free white paper, “Drupal and Social Media”, to learn about the extensive Social Media this Open Source CMS offers to create a dynamic and engaging website and online community.

      Drupal Multisite Options Drupal Multisite Options (427 KB)
      There are several multisite installation methods for Drupal. In this free white paper Oshyn evaluates and recommends several methods of using Drupal Open Source CMS to manage multiple sites.

      Open Source CMS: Is It Right for your Organization Open Source CMS: Is It Right for your Organization (496 KB)
      In this free white paper, “Open Source CMS: Is It Right for your Organization?” we share an in-depth look at the pros and cons of using Open Source Content Management Systems (CMS) or Open Source Web Content Management (WCM) platforms. Oshyn helps clients select CMS/WCM solutions based on the specific requirements of each client.

      Affiliate Content Sharing in a CMS/WCM World Affiliate Content Sharing in a CMS/WCM World (273 KB)
      The Content Editors at your company have created GREAT content! Now how do you share it? In this Free white paper learn several methods for using a Content Syndication tool to automatically repurpose content and how Content Sharing can generate business value.

      Sitecore and Social Media - An Interactive Web Content Management Platform Sitecore and Social Media - An Interactive Web Content Management Platform (898 KB)
      Social Media has revolutionized how people interact with business. In this white paper Oshyn’s Lead Sitecore Developer, Prasanth Nittala, discusses key points from the perspectives of marketing and Web development that make Sitecore a compelling choice for engaging in Social Media via your website. This Sitecore white paper draws from Oshyn’s expertise as a certified Sitecore partner, helping organizations understand the distinct capabilities offered by Sitecore CMS.

      The Business Case for Leveraging Open Text Web Solutions Delivery Manager The Business Case for Leveraging Open Text Web Solutions Delivery Manager (451 KB)
      This free white paper explores the evolving needs of small and medium size businesses and explains how the Open Text Web Solutions Delivery Manager (formerly RedDot LiveServer) can help businesses build their brand, reputation, and client base. This white paper examines strategies, key points and tips to leverage the features available in Open Text Web Solutions (RedDot CMS) to achieve an impactful user experience and to maximize visitor engagement through a reliable and powerful implementation.

      Open Text Best Practices: Part One Open Text Best Practices: Part One (763 KB)
      Authored by Oshyn Senior Consultant, Adaeze Okorie, this free CMS white paper draws from Oshyn’s vast experience as an Open Text Certified Partner, in helping organizations define strategies to meet business goals while implementing Open Text Web Solutions (RedDot CMS). Specifically in this free white paper Adaeze Okorie discusses strategies, key points and tips to leverage the features available in Open Text Web Solutions (RedDot CMS) to achieve an effective, reliable and robust implementation.

      Improving the ROI of Business Software: Service Oriented Architecture from a Business Perspective Improving the ROI of Business Software: Service Oriented Architecture from a Business Perspective (398 KB)
      Software selection and technology decision making should no longer be left to the IT department alone. By gaining an understanding of Service-Oriented Architecture, business people outside of the IT department will be better positioned to maximize the ROI of the company's technology platforms. Download this free white paper to learn more.

      Getting Over Social Media Marketing Paralysis for B2B Getting Over Social Media Marketing Paralysis for B2B (2254 KB)
      Many companies are well aware that Social Media has become critically important to engaging audiences and promoting online "presence" while some wonder how to approach their C-level executives and prove that it is not all hype. With so many ways to engage in Social Media, how can they get buy-in and begin execution with so many different venues and tools available? Staying on the sidelines and becoming a latecomer might make it more difficult to create a convincing "social" presence. Put the ove

      Performance Tuning Open Text Web Solutions Management Server and Delivery Server Performance Tuning Open Text Web Solutions Management Server and Delivery Server (235 KB)
      If you've made an investment in Open Text Web Solutions (formerly RedDot) Web Content Management products, you’ve undoubtedly experienced performance issues. While every CMS requires tuning, Open Text Web Solutions - RedDot is especially susceptible to mis-configuration and poor performance as the out-of-the-box installation comes untuned and ready for Development Environments only. In this FREE white paper we share performance tuning expertise as an Open Text Certified Partner that has optimize

      The Business Case for Leveraging Open Text Web Solutions Within Higher Education The Business Case for Leveraging Open Text Web Solutions Within Higher Education (430 KB)
      Academic institutions have a long reputation for being slower to adopt new technologies for their audiences. However, many schools are taking serious steps in improving the online experience they are providing. This white paper explores the unique needs of the higher education market, applying new tools & trends and specifically how the Open Text Web Solutions’ Delivery Manager (formerly known as RedDot LiveServer) can be leveraged to achieve those goals.

      SEO Best Practices within a Content Management System SEO Best Practices within a Content Management System (712 KB)
      In this free white paper, we share Search Engine Optimization (SEO) tips and best practices to follow when implementing a Content Management System (CMS). Certain features and functionality will help your content editors make website changes faster while minimizing the risk of human error. Download this free white paper to learn strategies to improve search engine rankings.

      Best Practices for Sitecore CMS Best Practices for Sitecore CMS (1121 KB)
      Sitecore CMS is an extensive Web Content Management (WCM) platform for the mid-market. It offers reduced IT expenditures, a streamlined content lifecycle, and a return of content control to the subject matter experts. The newest incarnation of Sitecore CMS version 6.0 is a mature product that incorporates standard social media components such as wikis, blogs, RSS syndication and “e-mail a friend” features.

      Optimizing SEO in your CMS (WCM) Optimizing SEO in your CMS (WCM) (3108 KB)
      Oshyn's Christian Burne spoke in depth about SEO in CMS at the Gilbane San Francisco Conference on June 3rd, 2009. Christian discussed the pressues of keyword competition and how the CMS can add tremendous power to climbing Google SERPs and other search engine rankings. The presentation was later part of a featured article on CMSWire. We've made the presentation available in PDF format. Download now to learn more about strategies for using your CMS to optimize SEO.

      The Best CMS for You: Tips on How to Select Your Next CMS The Best CMS for You: Tips on How to Select Your Next CMS (909 KB)
      As websites continue to grow in size, features and functionality, the visitors to these websites are also becoming more demanding and have higher expectations than ever before. Companies who committed valuable time and resources to web strategies just five years ago are finding they must re-evaluate and explore new options as their content, features and online offerings must keep pace with the constant and rapid movement in the digital marketplace. For many of these companies, there is a strong.

      Oshyn Sample Voluntary Product Accessibility Template (VPAT) Oshyn Sample Voluntary Product Accessibility Template (VPAT) (741 KB)
      Section 508 requires that when federal government and agencies procure, develop, and maintain or use electronic and information technology (EIT), they must ensure that it is accessible and in compliance with Section 508 standards developed by the Architectural and Transportation Barriers Compliance Board (Access Board). Oshyn understands these requirements and has delivered reports like these countless times.

      G SEO Best Practices Guide G SEO Best Practices Guide (349 KB)

      Sitecore CMS Implementation Best Practices Sitecore CMS Implementation Best Practices (481 KB)

      Twitter Facebook LinkedIn Featured in Alltop
      Oshyn, Inc.17785 Center Court Drive N Cerritos, CA 90703    1.888.483.1770 newbusiness@oshyn.com
      2013 Copyright Oshyn. All rights reserved.
      • View Mobile Version
      • Terms of Use
      • Privacy Policy
      • Contact Us
      x
      • Contact Us Oshyn 1.888.483.1770
        Have Oshyn Call Me Have Oshyn call you
        Request Further Information Request further information

        Submit an RFP Submit an RFP