42. HTTP Load Balancing:
Session Afļ¬nity
ā¢ (+) Sessions can be stored on the web server
ā¢ (+) Different code on different web servers
ā¢ Useful for testing new code on a subset of users
ā¢ (-) If any web server goes down, need to migrate sessions
ā¢ (-) Not easy to take a web server out-of-rotation
44. HTTP Load Balancer:
Session Non-afļ¬nity
ā¢ Sessions stored in a common session-store
ā¢ (+) Easy to manage -- all web servers have identical state
ā¢ (+) If a web server goes down -- no problem
ā¢ (+) Can take any web server out-of-rotation
ā¢ (-) Canāt deploy to a subset of servers for testing
ā¢ (-) Central session-store could be slower
66. On the Web Servers
ā¢ PHP5
ā¢ Apache/mod_php
67. On the Web Servers
ā¢ PHP5
ā¢ Apache/mod_php
68. On the Web Servers
ā¢ PHP5
ā¢ Apache/mod_php
ā¢ Apache/mod_fcgid (FastCGI)
69. On the Web Servers
ā¢ PHP5
ā¢ Apache/mod_php
ā¢ Apache/mod_fcgid (FastCGI)
70. On the Web Servers
ā¢ PHP5
ā¢ Apache/mod_php
ā¢ Apache/mod_fcgid (FastCGI)
ā¢ PHP-FPM
71. On the Web Servers
ā¢ PHP5
ā¢ Apache/mod_php
ā¢ Apache/mod_fcgid (FastCGI)
ā¢ PHP-FPM
ā¢ PHP FastCGI Process Manager
ā¢ Great process management
ā¢ Security
ā¢ Conļ¬gurability & control
ā¢ Adaptive process spawning (5.3.3RC1+)
73. On the Web Server:
fk-w3-agent
ā¢ Simple Java āmiddlewareā daemon
74. On the Web Server:
fk-w3-agent
ā¢ Simple Java āmiddlewareā daemon
ā¢ Deployed on each web server
75. On the Web Server:
fk-w3-agent
ā¢ Simple Java āmiddlewareā daemon
ā¢ Deployed on each web server
ā¢ Communicates with PHP through local socket
76. On the Web Server:
fk-w3-agent
ā¢ Simple Java āmiddlewareā daemon
ā¢ Deployed on each web server
ā¢ Communicates with PHP through local socket
ā¢ Hosts pluggable āhandlersā
77. On the Web Server:
fk-w3-agent
ā¢ Simple Java āmiddlewareā daemon
ā¢ Deployed on each web server
ā¢ Communicates with PHP through local socket
ā¢ Hosts pluggable āhandlersā
88. fk-w3-agent: Logging
ā¢ We like to log, a lot
ā¢ Logs need to be ļ¬ushed to disk
ā¢ PHP resources wasted
ā¢ waiting for disk I/O
ā¢ waiting for lock on log ļ¬les
ā¢ or logs go missing
92. fk-w3-agent:
Connection Pooling
ā¢ Many service calls / request
93. fk-w3-agent:
Connection Pooling
ā¢ Many service calls / request
ā¢ Cost of recreating connections high
94. fk-w3-agent:
Connection Pooling
ā¢ Many service calls / request
ā¢ Cost of recreating connections high
ā¢ PHP does not support connection pools*
103. fk-w3-agent:
Conļ¬g & Discovery
ā¢ Change conļ¬g without deployment?
104. fk-w3-agent:
Conļ¬g & Discovery
ā¢ Change conļ¬g without deployment?
ā¢ Simple: store conļ¬g in a database
105. fk-w3-agent:
Conļ¬g & Discovery
ā¢ Change conļ¬g without deployment?
ā¢ Simple: store conļ¬g in a database
ā¢ But: reloading conļ¬g on each request: expensive
109. fk-w3-agent:
Running Statistics
ā¢ PHP sends basic stats to fk-w3-agent for every
request
ā¢ fk-w3-agent aggregates these stats
ā¢ Used for monitoring
112. To Cache or not to
Cache?
ā¢ āThere are only two hard things in Computer
Science: cache invalidation and naming thingsā. --
Tim Bray quoting Phil Karlton
113. To Cache or not to
Cache?
ā¢ āThere are only two hard things in Computer
Science: cache invalidation and naming thingsā. --
Tim Bray quoting Phil Karlton
ā¢ āThere are only two hard problems in Computer
Science: cache invalidation, naming things and off-by-1
errors.ā