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

How Sysadmins view your stinkin' code

How Sysadmins view your stinkin' code

Talk given at Zendcon `12 discussing the dangers of devops in PHP and some tools to bring dev in harmony with ops.

Shawn Stratton

October 25, 2012
Tweet

More Decks by Shawn Stratton

Other Decks in Technology

Transcript

  1. How Sysadmins View Your Stinkin’ Code Shawn Stratton Senior Systems

    Engineer / Architect Monday, October 29, 12
  2. Who Am I? Currently work for Discovery Communications, Inc as

    a Systems Architect / Engineer. Became a Systems Architect 2011. Worked as a developer for NationalGuard.com, HowStuffWorks.com. PHP Developer since early 2000’s. Linux user since 1998. Monday, October 29, 12
  3. Sysadmin at Work! http://xkcd.com/705/ Sysadmins are neurotic, OCD, and more

    than a little Paranoid. Beware! Monday, October 29, 12
  4. So what is a Sysadmin? Server monkey. Administrates servers to

    ensure uptime, stability, and performance. Responds to service outages, power outages, errors, etc. Often after hours. Monday, October 29, 12
  5. Great Sysadmin Qualities Calm during the inevitable firestorm. Analytical and

    understanding of everything that is being ran. Obsession about Single Points of Failure, Bus Factor, anything that impacts downtime. Monday, October 29, 12
  6. What is a Developer? Compiler, uses caffeine to compile business

    requirements into software. Constantly trying to “improve” software and add “functionality.” Monday, October 29, 12
  7. What’s wrong with that? Nothing, but... Sysadmins care about stability,

    developers introduce instability. Monday, October 29, 12
  8. So what do we care about? Fault tolerance. Error handling.

    Configurability. Scalability. Minimal resource utilization. Sanity. Monday, October 29, 12
  9. Fault Tolerance System Multiple Servers. “Self Healing” systems. Software Exception

    handling. Tolerance just means try to handle errors as well as possible. Monday, October 29, 12
  10. Error Reporting Meaningful errors that we can act on. Tell

    us what failed, not just that a failure has occurred. Clear messages that we can understand. You have a parse error at line x of file y. Concise errors that don’t overwhelm. Parseable so we can automate responses. Monday, October 29, 12
  11. Configurability / Flexibility Make values configurable. Database endpoints. HTTP endpoints.

    Directories you write to/read from. Cache endpoints. Monday, October 29, 12
  12. Scalability In our world, we talk about Horizontal Scalability (scale

    out vs. up.) Basically means the ability to handle more traffic by adding additional servers. Monday, October 29, 12
  13. Disk Access Disk access is per server. Never assume you’ll

    talk to the same server twice in a row. NFS is slooow. Sticky sessions break more things than they fix. Monday, October 29, 12
  14. Database Master / Slave Master should be write-only. Dedicated slave

    for reporting / backups. Clustered Don’t expect instant consistency. Be aware of what you’ll lose. Monday, October 29, 12
  15. Disclaimer I’m a Linux administrator, a Linux/Mac user, and the

    majority of PHP Serving is done via Linux. The tools discussed are Linux tools. I’ve written everything for what’s included in Ubuntu (the common denominator). Sorry Windows guys. Monday, October 29, 12
  16. Checking CPU /Memory utilization xDebug + Cache Grind. Zend Debugger

    + Zend Studio. XHProf. uptime top htop Profiling Monitoring Monday, October 29, 12
  17. Load Averages - wtf? Commonly shown as 3 values, e.g.

    1.06 1.14 1.36 Numbers are load over 1 minute, 5 minutes, 15 minutes Numbers represent load for a single core 1 = 100% Magic numbers (when you’re good): .7 per core is good utilization. 1 per core is fully utilized (start planning new hw.) Monday, October 29, 12
  18. xDebug http://xdebug.org/docs/install Simple, efficient, open source. Integrated into PHPStorm, Netbeans,

    and most every other IDE (beside Zend Studio). Monday, October 29, 12
  19. Zend Debugger Very well integrated to Zend Studio & Zend

    Server. Dead simple to use. Monday, October 29, 12
  20. inclued Get a map of your includes. This is more

    useful than it seems. Monday, October 29, 12
  21. dtrace From solaris, this will show you every system call,

    command is a bit complicated. Monday, October 29, 12
  22. CPU / System Metrics Too many to list but Cacti

    & Munin are common and have low barrier to entry. Monday, October 29, 12
  23. Don’t Tell us it works on this machine or that

    machine. Forget to tell us your requirements while you’re making a deadline in the past. Claim you’ve found yet another [PHP|Apache|MySQL] bug when something doesn’t work. Do foolish things. e.g. Serve dynamically resized images (this is what gearman and caching is for.) Monday, October 29, 12
  24. Do Control your IO & Network access. Be aware of

    your environment. Use the tools you have available and learn new ones. Monday, October 29, 12