PHP in the Cloud: Achieving True High Availability<br />Joshua Solomin<br />Senior Product Marketing Manager, Zend Technol...
Who is Zend?<br />Leader in software and services for development, deployment and management of enterprise PHP application...
Realizing IaaS scalability at the platform level<br />We all love the cloud!<br />Particularly for <br /> platforms…<br />...
What does high availability require?<br />No single points of failure<br />Multiple web servers<br />Multiple load balance...
A closer look at application user sessions<br />HTTP is a stateless protocol – there is no “user session”<br />The good ne...
Session Handling in PHP<br />
But when a node fails, how do you prevent session loss?<br />
Different Session Handling Mechanisms<br />Default: stored in local files…  but doesn’t easily scale >1 node<br />A sticky...
Zend’s Session Clustering<br />A PHP Session storage mechanism designed to be:<br />Scalable<br />Fault-tolerant<br />Fast...
Architectural Overview<br />
How does it work?<br />New session created on the server that receives request (master)<br />Master server picks a backup,...
Normal Operation<br />
Failure Handling<br />
Scalability & Cloud Readiness<br />Session Clustering provides a Graceful Shutdown mechanism<br />At shut down, a node tra...
Enterprise PHP in the Cloud: IaaS + PaaS<br />New service co-developed by RightScale and Zend<br />Instant provisioning of...
High Availability PHP Solutionfrom RightScale & Zend<br />
Application Monitoring<br />Watches your application for:<br />PHP Errors (including warnings, notices, uncaught exception...
Diagnostics: Code Tracing<br />Reproducing problems is often difficult and time-consuming<br />Zend Server captures the fu...
Demo<br />
Next Steps<br />Learn more about Zend Server:<br />http://www.zend.com/server<br />Learn more about the Rightscale-Zend so...
Q&A<br />
Upcoming SlideShare
Loading in …5
×

Achieving Massive Scalability and High Availability for PHP Applications in the Cloud

2,961 views

Published on

RightScale User Conference NYC 2011 -

Joshua Solomin - Senior Product Marketing Manager, Zend Technologies

It's a common pain point among PHP developers: How do you achieve application-level elasticity while never losing a user session when you scale down servers? Now there's a push-button solution from Zend and RightScale that enables persistent sessions and allows you to readily triage problems with your business-critical PHP applications. This session will introduce you to an auto-scaling PaaS solution specifically designed to make it easier for you to deploy and manage cloud-based, highly available PHP server clusters.

Published in: Technology
  • Be the first to comment

Achieving Massive Scalability and High Availability for PHP Applications in the Cloud

  1. 1. PHP in the Cloud: Achieving True High Availability<br />Joshua Solomin<br />Senior Product Marketing Manager, Zend Technologies<br />joshua.s@zend.com<br />
  2. 2. Who is Zend?<br />Leader in software and services for development, deployment and management of enterprise PHP applications<br />RightScale Partner jointly producing the RightScaleZendDev & Test Pack (2010) and RightScaleZend Solution Pack (2011)<br />Co-founders Andi Gutmans and Zeev Suraski created PHP3<br />PHP community leader & contributor through PHP advisory boards, core dev contributions, Zend Framework, SimpleCloud<br />Zendsolutions are deployed at more than 40,000 organizations<br />
  3. 3. Realizing IaaS scalability at the platform level<br />We all love the cloud!<br />Particularly for <br /> platforms…<br /> But IaaS doesn’t automatically handle application-level HA<br />
  4. 4. What does high availability require?<br />No single points of failure<br />Multiple web servers<br />Multiple load balancers<br />Database replication<br />Provided by the cloud, managed by RightScale<br />Graceful failover when individual components DO fail<br /> But how does the PHP platform fail over – what about <br />running applications?<br />
  5. 5. A closer look at application user sessions<br />HTTP is a stateless protocol – there is no “user session”<br />The good news: this makes HTTP highly scalable and versatile<br />The bad news: representing user state is left to the implementation<br />A basic use case: identifying logged in users<br />If I get two consecutive HTTP requests, how can I know that they are from the same user?<br />How can I know if that user has logged in or not, before I authorize some actions?<br />PHP sessions to the rescue!<br />
  6. 6. Session Handling in PHP<br />
  7. 7. But when a node fails, how do you prevent session loss?<br />
  8. 8. Different Session Handling Mechanisms<br />Default: stored in local files… but doesn’t easily scale >1 node<br />A sticky load balancer can help, but has downsides<br />NFS is a bad idea<br />Can switch to other save handlers <br />Database<br />Memcached<br />or …<br />
  9. 9. Zend’s Session Clustering<br />A PHP Session storage mechanism designed to be:<br />Scalable<br />Fault-tolerant<br />Fast<br />Cloud ready<br />Sessions stored either in memory or on disk<br />Daemons in a cluster talk to each other to share sessions<br />Each session stored on two servers: master and backup<br />
  10. 10. Architectural Overview<br />
  11. 11. How does it work?<br />New session created on the server that receives request (master)<br />Master server picks a backup, and copies the session to it<br />Session IDs identify the session’s master and backup servers<br />If the request ends up at any non-master server, session is requested from the master<br />
  12. 12. Normal Operation<br />
  13. 13. Failure Handling<br />
  14. 14. Scalability & Cloud Readiness<br />Session Clustering provides a Graceful Shutdown mechanism<br />At shut down, a node transfers all its sessions to a different server<br />All cluster members notified to use the replacement server<br />Rarely takes more than 30 seconds<br />Graceful Shutdown allows spinning down machines without losing sessions<br />Allows simple scaling down as well as scale up – ideal for the cloud!<br />
  15. 15. Enterprise PHP in the Cloud: IaaS + PaaS<br />New service co-developed by RightScale and Zend<br />Instant provisioning of a pre-configured, multi-server PHP runtime environment in the cloud<br />Portable across cloud providers – Amazon, Rackspace, Cloud.com<br />Automated scaling at the server and PHP levels<br />Management, monitoring and diagnostics<br />Usage-based pricing<br />
  16. 16. High Availability PHP Solutionfrom RightScale & Zend<br />
  17. 17. Application Monitoring<br />Watches your application for:<br />PHP Errors (including warnings, notices, uncaught exceptions...)<br />Failing functions<br />Failing DB queries <br />Slow functions or DB queries<br />Slow request executions<br />High memory consumption<br />When an issue is detected, an event is reported<br />
  18. 18. Diagnostics: Code Tracing<br />Reproducing problems is often difficult and time-consuming<br />Zend Server captures the full execution flow in testing or production<br />Allows the developer to “step back in time” and quickly determine root cause<br />Integrated with Zend Studio<br />
  19. 19. Demo<br />
  20. 20. Next Steps<br />Learn more about Zend Server:<br />http://www.zend.com/server<br />Learn more about the Rightscale-Zend solution:<br />http://www.rightscale.com/products/plans-pricing/zend-solution-pack.php<br />Watch the RightScale-Zendwebinar: <br />http://www.rightscale.com/info_center/webinars/paas-in-a-box-zend.php<br />
  21. 21. Q&A<br />
  22. 22. Backup slides<br />
  23. 23. PHP sessions to the Rescue!<br />PHP provides a built-in mechanism for handling user sessions<br />A Session ID identifies a series requests as belonging to a specific user session<br />The Session ID is sent by the browser to the server through a Cookie or a GET/POST parameter<br />A Session Save Handler is used by PHP to store semi-persistent session data<br />There are multiple Session Save Handlers out there, and switching between them usually requires no code changes<br />
  24. 24. Sessions vs. Cookies<br />HTTP Cookies can also be used to store user-specific semi-persistent data and through this represent state<br />Unlike PHP Sessions, Cookies are stored on the client side<br />Data stored in a cookie should not be trusted by the application <br />Cookie data is sent back and forth between the browser and the server on each request<br />Storing larger amounts of data in a cookie is impractical <br />Cookies are a very good way to pass a session ID<br />
  25. 25. How Zend’s Session Clustering Works<br />Session Clustering is composed of two main parts:<br />The Session Clustering Extension (mod_clustersave handler)<br />The Session Clustering Daemon (“SCD”)<br />Most of the work is done by the daemon<br />The extension is mostly responsible for getting PHP to talk to the daemon<br />Sessions are stored either in memory or on disk<br />Daemons in a cluster talk to each other to share sessions<br />Each session is stored on two servers: a master and a backup serve<br />
  26. 26. High Availability<br />If the Master Server goes down…<br />The server receiving the request will get the session from the backup server instead<br />The backup server will designate itself as the new master<br />The backup server will pick a new backup server<br />If the Backup Server goes down…<br />The master server will pick a new backup server<br />The user’s Session ID is changed to reflect these changes<br />
  27. 27. Zend PHP Cloud Platform Components<br />Portable Cloud<br />Services<br />Native Cloud<br />Services<br />App/Platform<br />Monitoring<br />Resource<br />Management<br />Cloud Platform Services<br />Developer Tooling<br />Optimized PHP<br />Runtime<br />App<br />Deployment<br />Configuration<br />Management<br />Application<br />Awareness<br />Cloud Infrastructure<br />

×