A Perfect Launch, Every Time Stanford DrupalCamp 2014
May 11, 2015
A Perfect Launch, Every Time
Stanford DrupalCamp 2014
What is a perfect launch?• Schedule - On Time • Cost - On Budget • Scope - On Plan
Why should you care?
A Perfect Launch RecipeLaunch Team
• Onboarding Launch Check
• Best Practices Load Test
• Performance Tuning
Launch TeamOnboarding
How we prepare for launchGoal: Get rid of all the “uh-oh” moments Method: Launch Team Stakeholders:
• Project Manager - scheduling, best practices • Developer - platform knowledge, integration • Sys Admin - responsibilities, delegation • Business owner - flawless launch
Have a system and toolsSpecify common workflow requirements
• Repeatable tasks, delegatable Project management - Wrike, JIRA, Redmine Orientation logistics
• Scheduling - calendar, deadlines • Real-time communication
• Phone, Video Conference, GoToMeeting, IRC • Training - documentation, Slides, Videos
Mapping the terrainScoping of responsibilities
• Reduce confusion, set stage Channels of communication
• Define emergency procedures • Issue tracking as primary inbox
Staying in touch • Available, open, and regular • Proactive
Launch CheckBest Practices
What is Site Audit?Drupal 7 static analysis
• https://drupal.org/project/site_audit Best practices Actionable report Vendor agnostic
• Optional Pantheon specific recommendations
What can an audit analyze?• Drupal caching settings • Codebase and file size • Database structure • Modules, including duplicate / missing • Non-standard code structures • Views caching • Watchdog logs
Drupal caching settings
Drupal cron
Drupal’s database
Extensions (modules & themes)
Views
Watchdog
Test ConfigurationSimple Drupal 7 site Apache Bench
• 10,000 requests to home page (5 concurrent) Warmed cache, cleared watchdog Comparison
• Bad config, 1 PHP notice and warning in theme • Good config, no PHP notices or warnings
Result? Doubled performance.
Performance Comparison Bad Config Good Config
Load Time (min) 20:52 10:25
Requests per second 7.98 15.99
Time per request (ms) 626.192 312.780
Good configuration matters.
Load TestingPerformance Tuning
Why load test?Validate response times under peak load Smoke - operations under normal load Stress - behavior past peak load
• Spike - short bursts Capacity - plan for growth
Who should execute load tests?Developers execute Involve stakeholders
Tools for load testingDIY and simple
• Apache Bench - http://httpd.apache.org/docs/2.2/programs/ab.html
Complex / dynamic • Apache JMeter - https://jmeter.apache.org/ • Load Impact - https://loadimpact.com/ • Load Storm - http://loadstorm.com/
When should I load test?Baseline Tools
• Xdebug - http://xdebug.org/ • Webgrind - https://github.com/jokkedk/webgrind • Devel - https://drupal.org/project/devel • Syslog • Watchdog • New Relic - http://newrelic.com/
Incrementally during development
Where do I perform load tests?Live environment
• Bandwidth Resource limitations SaaS load testing solutions
What to expect during & after• Benchmark often
• Datapoints • Aggregate
• Be reasonable • Numbers should dictate expectations • Back-end
• Google Analytics
CachingOpcode Cache
• APC, Zend Opcache, eAccelerator Backends
• Memcached, Redis, MongoDB, file system, APC Front-end caching
• Varnish, Squid, reverse-proxy CDNs
Redis: Engage!
Anonymous page caching: Disabled!
Testing Varnish with cURL
PHP Slow Log
Nginx error log
MySQL slow log# Time: 130320 7:30:26 # User@Host: db_user[db_database] @ localhost [] # Query_time: 4.545309 Lock_time: 0.000069 Rows_sent: 219 Rows_examined: 254 SET timestamp=1363779026; SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes';
Pay attention to watchdog6652 11/Oct 15:05 warning php Warning: Cannot modify header information - headers already sent by (output started at /srv/www/code/includes/common.inc:2700) in drupal_goto() (line !6643 11/Oct 14:21 notice php Notice: Trying to get property of non-object in cap_ui_preprocess_page() (line 27 of /srv/www/code/sites/all/themes/cap_ui/template.php). !6595 11/Oct 13:00 notice php Notice: Unknown: Can not authenticate to IMAP server: [AUTHENTICATIONFAILED] Invalid credentials (Failure) (errflg=2) in main() (line of ).
Good load test
Bad load test
Interpreting resultsHard numbers Business impact
A Perfect Launch, Every Time
Thank you! Questions?@getpantheon
irc.freenode.net #pantheon getpantheon.com