Random tips that will save your project's life

1,808 views

Published on

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,808
On SlideShare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
6
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide
  • * 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
  • Random tips that will save your project's life

    1. 1. CakeFest 2012 – Manchester, UK Random tips They will save your life (for real) @mgiglesias    
    2. 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 co­founded WORKANA – https://www.workana.com   
    3. 3. GIT & deploys ● I shouldnt even have to say this ● Master branch should be 100% pushable – Feature branches like theres no tomorrow ● Code reviews ● Python scripts, but you could use Capistrano or  whatever ● Could have hundred deploys per day – Yes, you do need UT   
    4. 4. Monit   
    5. 5. Monit ● Dont PING­monitor me, please ● Monit the heck out of your servers ● Track the PHP logs (say what?) ● Be pre­emptive with your actions   
    6. 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  
    7. 7. Ducksboard   
    8. 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   
    9. 9. Statsd   
    10. 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. 11. Varnish ● Speed: do I need to say more? ● Home page and signup: should be super­fast ● Base caching rules on URLs ● Ideal for non­registered content ● Cache invalidation from PHP through socket   
    12. 12. On AWS   
    13. 13. Parse incoming email ● Stop making me go to your F** website ● No need for different reply­to – 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. 14. Real time notifications ● Its 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. 15. Sphinx ● RU doin fulltext search? Whats 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)   
    16. 16. CakeFest 2012 – Manchester, UK Questions? @mgiglesias    

    ×