Thursday 12 September 2013

Filled Under:

PHP And MySQL Scaling: Preparing A Startup For Growth

MySQL and PHP are an excellent foundation for startups that plan to scale their infrastructure from the inception of their business.
Online businesses start as a concept in the mind of an entrepreneur and they are often implemented on a single server or a small cluster in the beginning — there’s not much point paying for a large cluster of servers before you have even one user. Even the giants of the data center world started off this way: Google’s original hardware wouldn’t have impressed anyone.
googleservers
We all know what happened to Google: in less than five years they dominated the search engine market and occupied huge data centers with bespoke server designs.
Something similar, albeit on a smaller scale, is the dream of most entrepreneurs, but to get there smoothly they need to think about scaling from their original servers to something that can handle far greater loads. The scaling plan should be laid out well in advance of any need to grow, because if there’s no plan, when the time comes, scaling will be both more difficult and more expensive than necessary.

Scalable By Design

One way to scale is to progressively load a server up with more hardware or move to gradually more powerful machines, but that has obvious limitations and can be needlessly expensive. When we talk about scaling, we mean horizontal scaling, which is the process of scaling out with clustered and load balanced servers.
MySQL and PHP are well-suited for building applications that can smoothly scale. The are three major concerns when planning for scaling a startup’s infrastructure.

Software Stack

Choosing the right software stack is crucial for smooth scaling. For example, if you choose to base your web application on MySQL and PHP but fail to use a control panel that will allow for the easy addition of extra MySQL server nodes and load balancing between them, your business will have considerable difficulty growing without replacing key parts of its stack.

Caching

Caching can be implemented at various points in a site or application’s infrastructure to improve the performance of existing hardware. Users of MySQL and PHP should investigate:
  • Memcached — Memcached is a distributed memory object caching system. It caches data objects from a backing store, like a MySQL database, and can be distributed across multiple servers, allowing for a large performance boost when compared to running queries in the database for frequently accessed data.
  • APC (Alternative PHP Cache) — APC is an opcode cache for PHP that increases the performance of PHP applications by caching the operation codes of frequently executed PHP functions.

Clustering

At the heart of any scaling strategy is the ability to quickly add relatively low cost nodes and load balance between them. MySQL can be easily configured to use a number of servers as slaves for reading and master for writing, so if you plan for a horizontal scaling strategy, MySQL + PHP is an excellent combination.
Planning in the early stages of a startup is essential for ensuring that performance and availability remain constant throughout the growth phase without incurring unnecessary expense.




0 comments:

Post a Comment