Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Designing systems to scale

Michael Heap
October 06, 2012

Designing systems to scale

Talk given at PHPNW12 in Manchester, England

Michael Heap

October 06, 2012
Tweet

More Decks by Michael Heap

Other Decks in Technology

Transcript

  1. Write programs that do one thing and do it well.

    Write programs to work together. Write programs to handle text streams, because that is a universal interface. - Doug McIlroy
  2. V1

  3. V1 • Codeigniter Application • No (working) indices on the

    database • Used the REST API and pulled data on demand
  4. V1 • Codeigniter Application • No (working) indices on the

    database • Used the REST API and pulled data on demand • PHP for realtime parsing
  5. V1 • Codeigniter Application • No (working) indices on the

    database • Used the REST API and pulled data on demand • PHP for realtime parsing • All stored in one git repo
  6. V1 • Codeigniter Application • No (working) indices on the

    database • Used the REST API and pulled data on demand • PHP for realtime parsing • All stored in one git repo
  7. V2

  8. V2 • Decoupled • Made up of five “apps” •

    Easier to scale • More fault tolerant
  9. LNMPNRMR? • Linux • nginx • MySQL • PHP •

    NodeJS • Redis • Mongo DB • Ruby
  10. Do one thing, and do it well Use the right

    tool for the job Stand on the shoulders of giants
  11. Easy Can we still deploy? Harder What if we need

    a new server firing up? Even Harder What if $customComponent breaks?
  12. Always code as if the guy who ends up maintaining

    your code will be a violent psychopath who knows where you live - John f. Woods
  13. forever stop /home/user/parser/parser.js && APP_ENV=production forever start -a -l ~/parser-logs/

    parser.log -o ~/parser-logs/out.log -e ~/parser-logs/ parser.err.log --minUptime 10000 --spinSleepTime 8000 ~/ parser/parser.js
  14. forever stop /home/user/parser/parser.js && APP_ENV=production forever start -a -l ~/parser-logs/

    parser.log -o ~/parser-logs/out.log -e ~/parser-logs/ parser.err.log --minUptime 10000 --spinSleepTime 8000 ~/ parser/parser.js parser_control restart