2. 411
● I use CakePHP, Lithium, Doctrine2, Python, Node.js,
C++
– … Yes. C++
● I like beer
● I have 4 dogs, 4 cats, and a horse
– … Yes. A horse
● I cofounded WORKANA
– https://www.workana.com
3. GIT & deploys
● I shouldn't even have to say this
● Master branch should be 100% pushable
– Feature branches like there's no tomorrow
● Code reviews
● Python scripts, but you could use Capistrano or
whatever
● Could have hundred deploys per day
– Yes, you do need UT
5. Monit
● Don't PINGmonitor me, please
● Monit the heck out of your servers
● Track the PHP logs (say what?)
● Be preemptive with your actions
6. Monit
# Redis
check process redis with pidfile /var/run/redis/redis-server.pid
start program = "/etc/init.d/redis-server start"
stop program = "/etc/init.d/redis-server stop"
if failed port 6379 protocol http then restart
if loadavg(5min) greater than 10.0 for 8 cycles then stop
if 3 restarts within 5 cycles then timeout
depends on redis_bin
# Redis binary
check file redis_bin with path /usr/bin/redis-server
if failed checksum then unmonitor
if failed permission 755 then unmonitor
if failed uid root then unmonitor
if failed gid root then unmonitor
if changed timestamp then alert
# log parser
check program log_parser_app with path
"/var/www/scripts/log_parser.sh"
if status != 0 then alert
8. Statsd
● Built on Node.js (what else)
● Works through UDP (UDP you say?)
● Easy from PHP: StatsD::timing("grue.dinners",
(microtime(true) - $start) * 1000);
● Integrate with Graphite for even more coolness
10. Google Analytics
● Tracking (force URLs)
● Conversions (get the paths)
● Real Time (loose the little free time you have)
● A/B testing (of everything)
11. Varnish
● Speed: do I need to say more?
● Home page and signup: should be superfast
● Base caching rules on URLs
● Ideal for nonregistered content
● Cache invalidation from PHP through socket
13. Parse incoming email
● Stop making me go to your F** website
● No need for different replyto
– Message ID to the rescue!
notification+a48sa@workana.com
● Sendgrid hits your server on each reply
– You get the $_FILES too!
● Avoids sending emails to bounces, good
reporting!
14. Real time notifications
● It's not rocket science
● PHP (gearman?) → Redis pub/sub
● Redis pub/sub → Node.js
● Client ↔ Node.js through Socket.io
● Socket.io channels (per user hash)
15. Sphinx
● RU doin' fulltext search? What's wrong with you?
● Ridiculously fast and highly scalable
● Indexes right out of your RDBMS
– Delta indexes
● More than just text fields
● PECL extension or SQL (say what?)
● Real time indexing (comes with some gotchas)
* SHIT HAPPENS * QA is nice, Unit Testing is nice, but monitoring is GREAT
* You POST your data through REST (increment, discrete value) * Realtime updates * Built-in widgets (facebook, twitter, pingdom, everything)
* Node.js: super-easy deployment and high availability (MONIT) * UDP: Super fast, not guaranteed delivery. The idea is for the site (and statsd) to always be available * Graphite: storage backend, you HTTP post to it from Statsd data
* Check the lighting talk from MAN 2011 * Speed: can get you a 1000x speed increase * Non-registered: check for session vars. MAKE SURE you are not sending non-cache session headers, Varnish listens to that (PHP sends non-cache headers when sessions are enabled by default. In varnish rules you can check for specific HTTP cookies * Cache invalidation: https://github.com/timwhitlock/php-varnish
* CLOUD FRONT: Invalidation works, but still use ?version numbers. Today they added CROSS (Cross Origin Resource Sharing) support * EBS: SSL termination * Sessions on central storage like Redis * Separate ELB for notifications * Get pre-paid instances when possible
* Delta indexes: one index for “old” stuff, one index for newer (less) stuff. You can then merge the two which is faster than full reindex * More FIELDS: you can take into your index stuff that you would normally need MySQL for (calculated stuff for example?) * RT: no prefix/infix indexing. You use the MySQL protocol to INSERT rows