Dustin Whittle - Performance Testing Crash Course - code.talks 2015

100 %
0 %
Information about Dustin Whittle - Performance Testing Crash Course - code.talks 2015

Published on September 30, 2015

Author: AboutYouGmbH

Source: slideshare.net

1. Performance Tes-ng Crash Course Dus$n Whi*le

2. Dus-n Whi5le • dus-nwhi5le.com • @dus-nwhi5le • San Francisco, California, USA • Technologist, Traveler, Pilot, Skier, Diver, Sailor, Golfer

3. Why does performance ma5er?

4. Performance directly impacts the bo5om line

5. How fast is fast enough? § Performance is key to a great user experience - Under 100ms is perceived as reac$ng instantaneously - A 100ms to 300ms delay is percep$ble - 1 second is about the limit for the user's flow of thought to stay uninterrupted - Users expect a site to load in 2 seconds - AMer 3 seconds, 40% will abandon your site. - 10 seconds is about the limit for keeping the user's a*en$on § Modern applica-ons spend more -me in the browser than on the server-side

6. Login Flight Status Search Flight Purchase Mobile Big data SOA NOSQL Cloud Agile Web Application complexity is exploding

7. Up-me is cri-cal for enterprises and consumers

8. Treat performance as a feature!

9. Tools of the trade for performance tes-ng

10. Understand your baseline performance

11. Sta-c vs Hello World vs Applica-ons

12. Apache Bench

13. ab -c 1 -t 10 -k http://acmedemoapp.com/

14. Benchmarking acmedemoapp.com (be patient) Finished 187 requests Server Software: Apache-Coyote/1.1 Server Hostname: acmedemoapp.com Server Port: 80 Document Path: / Document Length: 5217 bytes Concurrency Level: 1 Time taken for tests: 10.039 seconds Complete requests: 187 Failed requests: 0 Keep-Alive requests: 187 Total transferred: 1021768 bytes HTML transferred: 975579 bytes Requests per second: 18.63 [#/sec] (mean) Time per request: 53.687 [ms] (mean)

15. ab -c 10 -t 10 -k http://acmedemoapp.com/

16. Benchmarking acmedemoapp.com (be patient) Finished 659 requests Server Software: Apache-Coyote/1.1 Server Hostname: acmedemoapp.com Server Port: 80 Document Path: / Document Length: 5217 bytes Concurrency Level: 10 Time taken for tests: 10.015 seconds Complete requests: 659 Failed requests: 0 Keep-Alive requests: 659 Total transferred: 3600776 bytes HTML transferred: 3438003 bytes Requests per second: 65.80 [#/sec] (mean) Time per request: 151.970 [ms] (mean) Time per request: 15.197 [ms] (mean, across all

17. Siege

18. siege -c 10 -b -t 10S http://acmedemoapp.com/

19. ** SIEGE 3.0.6 ** Preparing 10 concurrent users for battle. The server is now under siege... Lifting the server siege... done. Transactions: 623 hits Availability: 100.00 % Elapsed time: 9.57 secs Data transferred: 3.10 MB Response time: 0.15 secs Transaction rate: 65.10 trans/sec Throughput: 0.32 MB/sec Concurrency: 9.91 Successful transactions: 623 Failed transactions: 0 Longest transaction: 0.30 Shortest transaction: 0.10

20. Crawl the entire app to discover all urls

21. sproxy -o ./urls.txt

22. SPROXY v1.02 listening on port 9001 ...appending HTTP requests to: ./urls.txt ...default connection timeout: 120 seconds

23. wget -r -l 0 -t 1 --spider -w 1 -e "http_proxy = http://127.0.0.1:9001" "http://acmedemoapp.com/" sort -u -o urls.txt urls.txt

24. http://acmedemoapp.com/ http://acmedemoapp.com/about http://acmedemoapp.com/cart http://acmedemoapp.com/currency/change/EUR http://acmedemoapp.com/currency/change/GBP http://acmedemoapp.com/currency/change/USD http://acmedemoapp.com/login http://acmedemoapp.com/register/ http://acmedemoapp.com/t/brand/bookmania http://acmedemoapp.com/t/category/books http://acmedemoapp.com/t/category/mugs http://acmedemoapp.com/t/category/stickers http://acmedemoapp.com/terms-of-service

25. Benchmark traffic across all unique urls with siege

26. siege -v -c 50 -i -t 3M -f urls.txt -d 10

27. ** SIEGE 3.0.6 ** Preparing 10 concurrent users for battle. The server is now under siege... Lifting the server siege... done. Transactions: 623 hits Availability: 100.00 % Elapsed time: 9.57 secs Data transferred: 3.10 MB Response time: 0.15 secs Transaction rate: 65.10 trans/sec Throughput: 0.32 MB/sec Concurrency: 9.91 Successful transactions: 623 Failed transactions: 0 Longest transaction: 0.30 Shortest transaction: 0.10

28. Multi-Mechanize is an open source framework for performance and load testing

29. pip install multi-mechanize

30. multimech-newproject demo

31. import requests class Transaction(object): def run(self): r = requests.get(‘http://acmedemoapp.com/) r.raw.read()

32. import mechanize import time class Transaction(object): def run(self): br = mechanize.Browser() br.set_handle_robots(False) start_timer = time.time() resp = br.open(‘http://acmedemoapp.com/) resp.read() latency = time.time() - start_timer self.custom_timers['homepage'] = latency start_timer = time.time() resp = br.open(‘http://acmedemoapp.com/cart') resp.read() latency = time.time() - start_timer self.custom_timers['cart'] = latency assert (resp.code == 200)

33. multimech-run demo

34. What about when you need more than one machine?

35. Who lives in the cloud?

36. Bees with Machine Guns

37. A utility for arming (creating) many bees (micro EC2 instances) to attack (load test) targets (web applications)

38. pip install beeswithmachineguns

39. # ~/.boto [Credentials] aws_access_key_id=xxx aws_secret_access_key=xxx [Boto] ec2_region_name = us-west-2 ec2_region_endpoint = ec2.us-west-2.amazonaws.com

40. bees up -s 2 -g default -z us-west-2b -i ami-bc05898c -k appdynamics- dustinwhittle-aws-us-west-2 -l ec2-user

41. Connecting to the hive. Attempting to call up 2 bees. Waiting for bees to load their machine guns... . . . . Bee i-3828400c is ready for the attack. Bee i-3928400d is ready for the attack. The swarm has assembled 2 bees.

42. bees report

43. Read 2 bees from the roster. Bee i-3828400c: running @ 54.212.22.176 Bee i-3928400d: running @ 50.112.6.191

44. bees attack -n 1000 -c 50 -u http://acmedemoapp.com/

45. Read 2 bees from the roster. Connecting to the hive. Assembling bees. Each of 2 bees will fire 500 rounds, 25 at a time. Stinging URL so it will be cached for the attack. Organizing the swarm. … Offensive complete. Complete requests: 1000 Requests per second: 306.540000 [#/sec] (mean) Time per request: 163.112000 [ms] (mean) 50% response time: 151.000000 [ms] (mean) 90% response time: 192.000000 [ms] (mean) Mission Assessment: Target crushed bee offensive. The swarm is awaiting new orders.

46. bees attack -n 100000 -c 1000 -u http://acmedemoapp.com/

47. Read 2 bees from the roster. Connecting to the hive. Assembling bees. Each of 2 bees will fire 50000 rounds, 500 at a time. Stinging URL so it will be cached for the attack. Organizing the swarm. … Offensive complete. Complete requests: 100000 Requests per second: 502.420000 [#/sec] (mean) Time per request: 360.114000 [ms] (mean) 50% response time: 451.000000 [ms] (mean) 90% response time: 402.000000 [ms] (mean) Mission Assessment: Target crushed bee offensive. The swarm is awaiting new orders.

48. Read 2 bees from the roster. Connecting to the hive. Assembling bees. Each of 2 bees will fire 50000 rounds, 500 at a time. Stinging URL so it will be cached for the attack. Organizing the swarm. Bee 0 is joining the swarm. Bee 1 is joining the swarm. Bee 0 is firing his machine gun. Bang bang! Bee 0 lost sight of the target (connection timed out). Bee 1 lost sight of the target (connection timed out). Offensive complete. Target timed out without fully responding to 2 bees. No bees completed the mission. Apparently your bees are peace-loving hippies. The swarm is awaiting new orders.

49. bees down

50. Read 2 bees from the roster. Connecting to the hive. Calling off the swarm. Stood down 2 bees.

51. locust.io https://github.com/locustio/locust

52. pip install locustio

53. There are many tools… •Gatling.io •Wrk •Vegeta •Tsung •…

54. What about the client side?

55. In modern web applications more latency comes from the client-side than the server-side.

56. npm install psi

57. WBench

58. gem install wbench

59. wbench http://dustinwhittle.com/

60. Automate client-side performance tes-ng with Grunt/Gulp

61. Use Bower (for dependencies), Grunt/Gulp (for automa-on), and Yeoman (for bootstrapping)

62. How many people understand exactly how fast their site runs in produc-on?

63. Track performance in development and produc-on

64. Instrument everything = code, databases, caches, queues, third party services, and infrastructure.

65. Statsd + Graphite + Grafana

66. Track performance of end users

67. webpagetest.org

68. SiteSpeed.io

69. Load tes-ng services from the cloud

70. Test for failures • NetFlix Simian Army + Chaos Monkey
 • What happens if you lose a caching layer? • What happens if dependencies slow down?

71. Performance Ma*ers • Treat performance as a feature • Using the 14kb Rule for instant loading • Markup management • Elimina$ng excess AJAX calls • Working with and around applica$on cache • Developing a responsive design + image strategy • Implemen$ng a good touch-first strategy • Code management for good produc$on and development experiences • Using task runners to build and deploy produc$on code

72. Best Prac$ces • Treat performance as a feature • Capacity plan and load test the server-side • Op-mize and performance test the client-side • Understand your star-ng point • Instrument everything • Monitor performance in development and produc-on • Measure the difference of every change • Automate performance tes-ng in your build and deployment process • Understand how failures impact performance

73. The protocols are evolving • The limita$ons of HTTP/1.X forced us to develop various applica$on workarounds (sharding, concatena$on, spri$ng, inlining, etc.) to op$mize performance. However, in the process we’ve also introduced numerous regressions: poor caching, unnecessary downloads, delayed execu$on, and more. • HTTP/2 eliminates the need for these hacks and allows us to both simplify our applica$ons and deliver improved performance. • You should unshard, unconcat, and unsprite your assets • You should switch from inlining to server push • Read Ilya Grigorik awesome book on browser performance - h*p://hpbn.co/ h*p2

74. Integrate automated performance tes-ng into con-nuous integra-on for server-side and client-side

75. Understand the performance implica-ons of every deployment and package upgrade

76. Monitor end user experience from end to end in produc-on

77. Ques-ons?

78. Find these slides on SpeakerDeck h5ps://speakerdeck.com/dus-nwhi5le

79. http://www.appdynamics.com/

Add a comment

Related pages

Performance Testing Crash Course - code.talks 2015

Performance Testing Crash Course. ... Dustin Whittle shares the latest performance testing tools and insights into why your team ... © 2015 code.talks
Read more

Dustin Whittle spricht auf der code.talks 2015 - code.talks

Dustin Whittle Developer Evangelist ... Performance Testing Crash Course Dienstag, 29. ... © 2015 code.talks AGB Datenschutz Kontakt Impressum Newsletter ...
Read more

Dustin Whittle (@dustinwhittle) | Twitter

... //www. codetalks.de/2015/programm/ performance-testing-crash-course ... Want to do a performance testing crash course in 5 ... Dustin Whittle ...
Read more

Performance Testing Crash Course - YouTube

Performance Testing Crash Course ... 2015. Recorded at ... Dustin Whittle shares the latest performance testing tools and insights into why your ...
Read more

Dustin Whittle | Mobile Dev + Test Conference

Dustin Whittle is a developer evangelist ... Mobile Performance Testing Crash Course. ... Dustin Whittle shares the latest performance testing tools and ...
Read more

Performance Testing Crash Course at Spring I/O 2015 | Lanyrd

Performance Testing Crash Course ... Dustin Whittle shares the latest performance testing tools and insights into why your team ... Date Thu 30th April 2015.
Read more

Performance Testing Crash Course - InfoQ: Software ...

Dustin Whittle explains how to evaluate performance and ... Performance Testing Crash Course. ... and manage high performance ...
Read more

Performance Testing | Mobile Dev + Test Conference

T11 Mobile Performance Testing Crash Course. Dustin Whittle, AppDynamics. ... Dustin Whittle shares the latest performance testing tools and insights for ...
Read more