United State: +1 (410) 202-8855 | India +91 708-282-5481 hi@satyapsharma.com

Scaling PHP using database structures

Sharing session data between multiple servers:

Cold fusion, Network File System, Database, Memcached, Redis, Zend server Cluster Manager, Varnish

Scaling PHP using NFS

Advantages: No changes in the PHP code

Disadvantages: Inefficient, not designed for read / write ratio and poor performance & data corruption

Scaling PHP using database

Session sharing using db

Db: MySQL, Ms SQL Server, Postgre SQL, Oracle, etc.


Solves scalability problems, wide installation base and DB is readily available


Sessions have 1: 1 read / write ratio, connection overhead, performance issues and single point of failure

Scaling PHP using Memcached

Advantages: Can store memory in RAM, high availability, works fast and can be clustered

Disadvantages: No persistent data and ability to create alternate memory when RAM is full

Scaling PHP using Redis

Redis is an open source NoSQL database, networked, in-memory, persistent, journaled, key value data store. Redis supports not only strings, but also updated data types such as lists, sets, sorted sets, hashes and more.

Advantages: Incredibly fast, persistent, reliable and non-blocking

Disadvantages: Custom PHP sessions handler, Not scalable and no high availability

Scaling PHP using Zend Server Cluster Manager

Zend is for large scale PHP deployments; Can build PHP cluster stack incorporating even hundreds of servers

Advantages: Fast, reliable, high availability, Scalable & No changes in PHP code

Disadvantages: Zend server support on each node of cluster

Scaling on cloud hosting

Scaling out

With "cloud-hosting", all of the above steps are redundant and handled internally. If you want to scale out from 1 to 5 servers, you can automatically carry out those 4 steps in just 30 seconds. From the management console you only have to move the scale-slider from 1 to 5 and hit the "Confirm" button. This is called "easy scaling" in our parlance.

Scaling down

Deploying a new version is also easy, you just push a new version via git push and your code automatically gets distributed to all the servers in just 30 seconds.

Scaling on Cloud using Amazon DynamoDB

Amazon DynamoDB is the fully managed NoSQL database service offered by Amazon Web Services – as a scalable session store.

Advantages: Native session handling, Create table to store sessions, easy, fast, high performance, scalable, data storage and data transfer fee applicable depending on size and capacity, designed for read / write ratio with session locking capacity

Disadvantages: SQL database at high abstraction level

Scaling on Cloud using Windows Azure

Successfully manage sessions across multiple instances requires a common data store. Session handling via Windows Azure Table and Blob storage

Advantage: distributed, in-memory, high speed, scalable, secure, read only data, and flexible caching

Disadvantages: No support for SQL Azure store for session handling; reading, writing, and deleting of session data is only slightly more complicated;

Source by Shriram S.