Achieving Massive Scalability and High Availability for PHP Applications in the Cloud
-
Upload
rightscale -
Category
Technology
-
view
1.944 -
download
1
description
Transcript of Achieving Massive Scalability and High Availability for PHP Applications in the Cloud
©All rights reserved. Zend Technologies, Inc.
PHP in the Cloud: Achieving True High Availability
Joshua Solomin
Senior Product Marketing Manager, Zend [email protected]
©All rights reserved. Zend Technologies, Inc.2
Who is Zend?
• Leader in software and services for development, deployment and management of enterprise PHP applications
• RightScale Partner jointly producing the RightScale Zend Dev & Test Pack (2010) and RightScale Zend Solution Pack (2011)
• Co-founders Andi Gutmans and Zeev Suraski created PHP3
• PHP community leader & contributor through PHP advisory boards, core dev contributions, Zend Framework, SimpleCloud
• Zend solutions are deployed at more than 40,000 organizations
©All rights reserved. Zend Technologies, Inc.3
Realizing IaaS scalability at the platform level
Particularly for platforms…
But IaaS doesn’t automatically handle application-level HA
We all love the cloud!
©All rights reserved. Zend Technologies, Inc.4
What does high availability require?
1) No single points of failureMultiple web servers
Multiple load balancers
Database replication
Provided by the cloud, managed by RightScale
2) Graceful failover when individual components DO fail
But how does the PHP platform fail over – what about running applications?
©All rights reserved. Zend Technologies, Inc.5
A closer look at application user sessions
• HTTP is a stateless protocol – there is no “user session”
The good news: this makes HTTP highly scalable and versatile
The bad news: representing user state is left to the implementation
• A basic use case: identifying logged in usersIf I get two consecutive HTTP requests, how can I know
that they are from the same user?
How can I know if that user has logged in or not, before I authorize some actions?
PHP sessions to the rescue!
©All rights reserved. Zend Technologies, Inc.6
Session Handling in PHP
©All rights reserved. Zend Technologies, Inc.7
But when a node fails, how do you prevent session loss?
©All rights reserved. Zend Technologies, Inc.8
Different Session Handling Mechanisms
• Default: stored in local files… but doesn’t easily scale >1 node
A sticky load balancer can help, but has downsides
NFS is a bad idea
• Can switch to other save handlers Database
Memcached
or …
©All rights reserved. Zend Technologies, Inc.9
Zend’s Session Clustering
• A PHP Session storage mechanism designed to be:
Scalable
Fault-tolerant
Fast
Cloud ready
• Sessions stored either in memory or on disk
• Daemons in a cluster talk to each other to share sessions
• Each session stored on two servers: master and backup
©All rights reserved. Zend Technologies, Inc.10
Architectural Overview
©All rights reserved. Zend Technologies, Inc.11
How does it work?
• New session created on the server that receives request (master)
• Master server picks a backup, and copies the session to it
• Session IDs identify the session’s master and backup servers
• If the request ends up at any non-master server, session is requested from the master
©All rights reserved. Zend Technologies, Inc.12
Normal Operation
©All rights reserved. Zend Technologies, Inc.13
Failure Handling
©All rights reserved. Zend Technologies, Inc.14
Scalability & Cloud Readiness
• Session Clustering provides a Graceful Shutdown mechanism
At shut down, a node transfers all its sessions to a different server
All cluster members notified to use the replacement server
Rarely takes more than 30 seconds
• Graceful Shutdown allows spinning down machines without losing sessions
• Allows simple scaling down as well as scale up – ideal for the cloud!
©All rights reserved. Zend Technologies, Inc.15
Enterprise PHP in the Cloud: IaaS + PaaS
• New service co-developed by RightScale and Zend
• Instant provisioning of a pre-configured, multi-server PHP runtime environment in the cloud
• Portable across cloud providers – Amazon, Rackspace, Cloud.com
• Automated scaling at the server and PHP levels
• Management, monitoring and diagnostics
• Usage-based pricing
©All rights reserved. Zend Technologies, Inc.16
High Availability PHP Solutionfrom RightScale & Zend
©All rights reserved. Zend Technologies, Inc.17
Application Monitoring
• Watches your application for:
PHP Errors (including warnings, notices, uncaught exceptions...)
Failing functions
Failing DB queries
Slow functions or DB queries
Slow request executions
High memory consumption
• When an issue is detected, an event is reported
©All rights reserved. Zend Technologies, Inc.18
Diagnostics: Code Tracing
• Reproducing problems is often difficult and time-consuming
• Zend Server captures the full execution flow in testing or production
• Allows the developer to “step back in time” and quickly determine root cause
• Integrated with Zend Studio
©All rights reserved. Zend Technologies, Inc.19
DEMO
©All rights reserved. Zend Technologies, Inc.20
Next Steps
• Learn more about Zend Server:http://www.zend.com/server
• Learn more about the Rightscale-Zend solution:http://
www.rightscale.com/products/plans-pricing/zend-solution-pack.php
• Watch the RightScale-Zend webinar: http://
www.rightscale.com/info_center/webinars/paas-in-a-box-zend.php
©All rights reserved. Zend Technologies, Inc.
Q&A