Performance Monitoring Made Easy

26
Performance Monitoring Made Easy @kriskhaira

Transcript of Performance Monitoring Made Easy

Page 1: Performance Monitoring Made Easy

Performance Monitoring Made Easy@kriskhaira

Page 2: Performance Monitoring Made Easy

6 months ago• After a past Ruby Tuesdays

meet up

• Same train ride home with Liang Zheng Gooi from OnApp

• Talked about performance monitoring and Gooi asked me to speak about what we use at Touristly

• So here I am. Hope you find it useful.

Page 3: Performance Monitoring Made Easy

Why monitor?

Page 4: Performance Monitoring Made Easy

“To measure is to know. You can’t improve what you don’t measure”

Lord Kelvin

Page 5: Performance Monitoring Made Easy

Performance issues accumulate over time

• Uncompressed images

• Too many API queries in 1 page

• N+1 queries

• Not caching things that should be cached

• Network latency

• Technical debt

Page 6: Performance Monitoring Made Easy

Distractions• A lot of irrelevant advice out there

• “Use GraphQL”

• “Use NoSQL”

• “That image is too big.”

• “No animated GIFs”

• “Ruby can’t scale.”

Page 7: Performance Monitoring Made Easy

Nobody uses Ruby for speed

• Easy and nice to use

• Proven

• Ecosystem

• Conventions

• Usually not the problem

Page 8: Performance Monitoring Made Easy

Don’t optimise randomly

• 80:20 rule

• Think about the user

• Page load time + perceived page load time

• Set goals

• Know your targets—how many users, sessions, open rate, CTR, conversions, etc

Page 9: Performance Monitoring Made Easy

April 2016 EDM

Expectations / goals: >500,000 users, 30% open rate, 6% CTR rate😅

Page 10: Performance Monitoring Made Easy

Measure in production first

Page 11: Performance Monitoring Made Easy

Page load time

• lighthouse (DevTools > Audits) — “first meaningful paint”

• Google’s PageSpeed Insights, Analytics

• webpagetest.org — “first interactive time”

• gtmetrix.com — for lazy people, also uses YSlow

• perflint

Page 12: Performance Monitoring Made Easy

perflint

$ perflint -u $URL -k $PERFLINT_API_KEY

https://touristly.com: [====-----------------] 6.3 Timeout at 120s

Page 13: Performance Monitoring Made Easy

Big improvements require teamwork

• DevOps

• Single point of reference

• Easy to inspect together

• One-person CLI tools for measuring development make it difficult for others

Page 14: Performance Monitoring Made Easy

Skylight

Page 15: Performance Monitoring Made Easy
Page 16: Performance Monitoring Made Easy
Page 17: Performance Monitoring Made Easy
Page 18: Performance Monitoring Made Easy

ScoutApp APM

Page 19: Performance Monitoring Made Easy

New Relic APM

Page 20: Performance Monitoring Made Easy

HTTP benchmarking / load testing for API

requestsfor development or staging

Page 21: Performance Monitoring Made Easy

wrk$ wrk -d30s $URL

Running 30s test http://localhost:3000/... 2 threads and 10 connections Thread Stats Avg Stdev Max Latency 801.96ms 137.24ms 1.68s Req/Sec 6.77 4.74 48.00 371 requests in 30.06s, 3.40MB readRequests/sec: 12.34Transfer/sec: 115.96KB

Page 22: Performance Monitoring Made Easy

autocannon

$ autocannon -d 30 -c 5 $URL

Running 30s test @ http://localhost:3000/...5 connections

running [==== ] 20%

Page 23: Performance Monitoring Made Easy

Local bandwidth throttling

Slow down ports 3000 and 4200 to GPRS-like speeds

$ comcast --device=eth0 --latency=500 --target-bw=50 --default-bw=1000000 --packet-loss=2% --target-addr=8.8.8.8,10.0.0.0/24 --target-proto=tcp,udp,icmp —target-port=4200,3000

Page 24: Performance Monitoring Made Easy

Scratching the surface

• Benchmarking Ruby

• Network latency

• Finding optimal CDN locations

Page 25: Performance Monitoring Made Easy

Thank you

• Touristly

• Kevin Francis for proofreading

• Ruby Tuesdays

• Liang Zheng Gooi

• LRT photo: Yosri042005PuteraLRT.jpg by Yosri, Wikimedia Commons

Page 26: Performance Monitoring Made Easy

careers.touristly.com