I gave a presentation to the Dallas PHP user group on May 11, 2010 on Creating Scalable PHP Web Applications.
Download the presentation in PDF.
Here is a basic outline:
- Introduction
- Traditional Single Server and Dedicated DB-2 Server data flows.
- What does it mean to be Scalable, Available and Redundant?
- Planning your Delivery Architecture.
- Delivery Resource Types – html/image/pdf/email/rss
- URL types and origins for main text/html, static images, user generated media
- Delivery Architecture Components
- Web Servers
- Database Systems
- Load Balancers
- Caching systems
- PHP Application Code
- Web Server systems
- Make fast and agile and identical
- Key concept: Web systems must be thought of as being Disposable.
- Storage of source and non-source delivery resources
- Deployment of web servers – OS/PHP Load, Code Deployment/Updates
- Database systems
- Hardest to Scale, throw money at this problem
- Replication and caching layers can extend life/performance of primary database.
- Make a plan to deal with Primary Failure – what in site will/won’t work.
- Make a plan to deal with Primary Recovery
- TEST THAT PLAN
- Redundant MySQL Overview
- Caching Layers Overview
- Load Balancers
- Hardware/Software List
- Primary Features
- Secondary Features
- Example Service/Content rule Pseudo-Config
- PHP Component Code changes
- Sessions
- Custom Session Data Handler
- Basics and Gotchas
- Example Session SQL Table
- Non-Source File & Data Storage
- Uploaded images/documents (avatars/photos)
- System generated files (chart images for emails)
- System Generated Data (calculated results data)
- Data pulled from external system (RSS feed cache)
- Store into shared system accessible by all front-ends
- Admin system for forced pushes/cleanouts. Monitoring.
- Resource Delivery
-
- Simple and complex examples.
- Code for abstracting URL generation – App::URL(‘logo.jpg’, ‘branded’)
- Example of complex URL structures.
- Delivery issues with CSS and JavaScript
- Serving SSL protected content with references to external static media; needs SSL too!
- Using ErrorDocument to create a Just-In-Time delivery system to media servers.
- Periodic Process Execution
- Using Queues and Semaphores to control execution.
- Sessions