appsphere 2016 - automate performance testing with appdynamics using continuous integration...

47
Automate performance testing with AppDynamics using continuous integration platforms Brad Stoner Senior Sales Engineer | AppDynamics

Upload: brad-stoner

Post on 25-Jan-2017

97 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

Automate performance testing with AppDynamics using continuous integration platforms

Brad StonerSenior Sales Engineer | AppDynamics

Page 2: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

APPDYNAMICS CONFIDENTIAL AND PROPRIETARY 2

Notice

The information and materials included in this presentation (collectively, the “Materials”) are the proprietary information of AppDynamics, Inc. (“AppDynamics” or the “Company”). No part of the Materials may be reproduced, distributed, communicated or displayed in any form or by any means, or used to make any derivative work, without prior written permission from AppDynamics.

The Materials may contain product roadmap information of AppDynamics. AppDynamics reserves the right to change any product roadmap information at any time, for any reason and without notice. This information is intended to outline AppDynamics' general product direction, it is not a guarantee of future product features, and it should not be relied on in making a purchasing decision. The development, release, and timing of any features or functionality described for AppDynamics' products remains at AppDynamics' sole discretion.  AppDynamics reserves the right to change any planned features at any time before making them generally available as well as never making them generally available.

All third-party trademarks, including names, logos and brands, referenced by AppDynamics in this presentation are property of their respective owners.  All references to third-party trademarks are for identification purposes only and shall be considered nominative fair use under trademark law. © 2016 AppDynamics, Inc. All rights reserved.

Page 3: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 3

Key takeaways

• How to get started with performance test automation• How to detect and resolve performance issues earlier in the

development lifecycle with AppDynamics• How to maximize the quality and value of your performance test

strategy

Page 4: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 4

My background

• 7 years @ H&R Block Load and Performance Team– 5 person team– 100k + user concurrency– Tax peak 2nd week after go-live– 70 applications annually– Diverse technology stack – including 3rd party

• 2 years @ Neotys – Senior Performance Engineer

• Currently Sales Engineer @ AppDynamics

Page 5: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 5

What is performance testing?

Page 6: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 6

Why bother?

Google - Using page speed in site ranking

Facebook - Launches 'lite' mobile app

Amazon - 100ms delay -> $6.79M sales decrease

Recent airline industry outages

Page 7: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 7

Legacy performance testing

Page 8: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 8

Increasing velocity

…performance testing isn't historically fast

Page 9: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 9

Keeping up with Agile / DevOps

Page 10: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 10

Performance defects

Page 11: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 11

Pull back the layersProd / Perf

Pre-Prod / Staging

Dev / QA

Page 12: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 12

Dev / QA

• Short test cycle• Low resources / cost• Rapid feedback• Component testing

Page 13: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 13

Staging / Pre-Prod

• Increased resources• Long test durations• Additional resources• Multiple test

elements• Integrated systems• Build validation

Page 14: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 14

Prod / Perf

• High complexity• Multiple integrated

systems• Environmental variance• Resource intensive• High cost

Page 15: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

Resources and speed

Res

ourc

es

Spe

ed

Prod / Perf

Staging / Pre-Prod

DEV/QA

Page 16: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

Mobile web/app example

Dev testing - APIs

Staging testing – Capacity w/ UI and API

Build automation

Baseline Pre-Prod / Staging - platform

Prod / Perf testing (inside firewall) – stability /

scalability

Prod / Perf testing (outside firewall) –

network / load balancing

QA testing – API flows

Optimize app chatter and network resources

Mobile app released

Mobile app built

Mobile site releasedMobile site built

APIs released/ BE functionalityFront End Optimization

Page 17: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

What if legacy test principles were applied?Staging testing – Capacity w/ UI and API

Baseline Pre-Prod / Staging - platform

Prod / Perf testing (inside firewall) – stability / scalability

Prod / Perf testing (outside firewall) –

network / load balancing

Front End Optimization

Optimize app chatter and network resources

Mobile app released

Mobile app built

Mobile site releasedMobile site built

APIs released/ BE functionality

Page 18: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

Demo

Page 19: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 19

AppDynamics Key ComponentsAppDynamics Usage

Compare Releases Compare critical metrics for different tests (FE and BE)Database Monitoring Measure and visualize performance deltas between tests

Server Monitoring Measure and visualize performance deltas between tests

Jenkins Plugin Enables automated pass/fail of testsTroubleshoot Slow Response Times

Quickly find root cause of performance issues and test failure

Service Endpoints Track shared services performance over time (APIs)Custom Match Rules Name Business Transactions to match load test scripts

Custom Dashboards Management and technical level tracking of application performance

Page 20: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 20

Questions and contact

• Email: [email protected]• Twitter: @sandbreak80

Page 21: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

APPDYNAMICS CONFIDENTIAL AND PROPRIETARY

Please give us your feedback—Session T5808

• Complete the online survey you'll receive via email later today or via text at:

Text this number: 878787 Text this word: APPSPHERE• Every time you submit a session survey, your

name will be entered in a random drawing. We're giving away Amazon Echos to 5 lucky winners!

• Thank you for your input

21

Win!

Page 22: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

Thank you

Page 23: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

Screenshots of live demo for offline viewing

Page 24: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 24

Jenkins for CI/CD

Page 25: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 25

Git and AppDynamics integration

Page 26: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 26

Jenkins job details

Page 27: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 27

AppDynamics Jenkins plugin

Page 28: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 28

Performance job execution

Page 29: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 29

NeoLoad performance report

Page 30: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 30

KonaKart test application

Page 31: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 31

Custom events in AppDynamics

Page 32: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 32

Identify slow queries

Page 33: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 33

Add missing index

Page 34: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 34

Compare release performance

Page 35: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

Reference material

Page 36: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 36

Technology stack

AppDynamics Confidential and Proprietary 36

Page 37: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 37

Demo resources

• AppDynamics controller - https://www.appdynamics.com/free-trial/ • Docker Compose YML: https://github.com/sandbreak80/myapp• NeoLoad project for KonaKart (localhost): https://

github.com/sandbreak80/konakart– Jenkins user will need access to modify these files

• Docker Hub for mysql access via adminer: https://hub.docker.com/r/sandbreak80/adminer/

• Docker Hub for konakart: https://hub.docker.com/r/sandbreak80/docker_konakart/

Page 38: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 38

Demo software install

• Setup instance for docker– Install Docker: curl -sSL https://get.docker.com/ | sh– Avoid sudo for docker: sudo usermod -aG docker ubuntu– Install docker compose:

• sudo apt-get -y install python-pip• sudo pip install docker-compose

• Jenkins 2 install (if needed):– wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -– sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'– sudo apt-get update– sudo apt-get install jenkins

• NeoLoad install – wget https://d24mnm5myvorwj.cloudfront.net/documents/download/neoload/v5.2/neoload_5_2_2_linux_x64.sh– sudo chmod +x neoload_5_2_2_linux_x64.sh– mkdir /home/ubuntu/neoload– sudo sh neoload_5_2_2_linux_x64.sh -q -dir /home/ubuntu/neoload -Vsys.installationTypeId=Controller -

Vsys.component.Common\$Boolean=true -Vsys.component.Controller\$Boolean=true

Page 39: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 39

Start demo environment

• Clone docker-compose file– mkdir myapp– cd myapp– git clone https://github.com/sandbreak80/myapp.git

• Pull, build, and start docker containers– sudo docker-compose start

Page 40: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 40

Configure AppDynamics

• Connect to the KonaKart instance– sudo docker exec -i -t konakart /bin/bash

• Install VIM: apt-get install vim• Edit the tomcat environment file

– vi /usr/local/konakart/bin/setenv.sh– export CATALINA_OPTS="$CATALINA_OPTS

-javaagent:/home/appdynamics/java_agent/javaagent.jar – -Dappdynamics.controller.hostName=your_controller_name_or_ip – -Dappdynamics.controller.port=8090 – -Dappdynamics.agent.applicationName=KonaKart – -Dappdynamics.agent.tierName=Kona_Server – -Dappdynamics.agent.nodeName=Node1 – -Dappdynamics.agent.accountName=customer1 – -Dappdynamics.agent.accountAccessKey=your_access_key"

Page 41: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 41

AppDynamics authentication

• BASIC authentication is used in AppDynamics to create custom events and time ranges in the next two slides

– As a reference, the AppDynamics REST API is documented here - https://docs.appdynamics.com/display/PRO42/Using+the+Controller+APIs.

– The first call authenticates with the AppDynamics controller, and stores the authentication cookie into /tmp/session.dat on the Jenkins Server. Note that we’re using a basic authentication header instead of directly exposing our username and password.

– There are a number of utilities you can leverage to base64 encode a string, like https://www.base64encode.org/. – The username / password format to encode is: <username>@<account name>:<password> and the @ symbol

needs to be URI encoded. – By default, in single tenant controllers, the <account name> will always be customer1. So, to get our base64

authentication header we can encode - admin%40customer1:appdynamics – to get our authentication header– YWRtaW4lNDBjdXN0b21lcjE6YXBwZHluYW1pY3M=– ***Note***– We need to URI encode our username and password string, which is why we use ‘%40’ instead of the ‘@’

character.

Page 42: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 42

Create custom event in AppDynamics

• Load test start (linux shell step):– curl --verbose -s -c /tmp/session.dat --header "Authorization: Basic your_base_64_token" -X GET

http://your_appdynamics_controller:8090/controller/auth?action=login – PARAMS="events?

eventtype=CUSTOM&customeventtype=LOAD_TEST&summary=LOAD_TEST_START-${JOB_NAME}-${BUILD_ID}&severity=INFO&tier=Kona_Server”

– curl -s -b /tmp/session.dat --data "${PARAMS}" http://your_appdynamics_controller:8090/controller/rest/applications/KonaKart/events

• Load test stop (linux shell step):– curl --verbose -s -c /tmp/session.dat --header "Authorization: Basic your_base_64_token " -X GET

http://your_appdynamics_controller:8090/controller/auth?action=login – PARAMS="events?

eventtype=CUSTOM&customeventtype=LOAD_TEST&summary=LOAD_TEST_STOP-${JOB_NAME}-${BUILD_ID}&severity=INFO&tier=Kona_Server”

– curl -s -b /tmp/session.dat --data "${PARAMS}" http://your_appdynamics_controller:8090/controller/rest/applications/KonaKart/events

Page 43: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 43

Create custom time range in AppDynamics

• Linux shell step in Jenkins for creating a custom time range based on job start and end:#!/bin/sh

END=$(date +%s)echo "$END"END_MS=$(($END * 1000))echo "$END_MS"

echo "$BUILD_TIMESTAMP"jobstart=$BUILD_TIMESTAMP

START=$(date -d "${jobstart}" +%s)echo "$START"START_MS=$(($START * 1000))echo "$START_MS" curl --verbose -s -c /tmp/session.dat --header "Authorization: Basic YWRtaW4lNDBjdXN0b21lcjE6YXBwZHluYW1pY3M=" -X GET http://devopslabappsphere:8090/controller/auth?action=login PARAMS="{\"name\":\"LOAD_TEST-${JOB_NAME}-${BUILD_ID}\",\"description\":\"\",\"shared\":true,\"timeRange\":{\"type\":\"BETWEEN_TIMES\",\"durationInMinutes\":0,\"startTime\":${START_MS},\"endTime\":${END_MS}}}" curl --verbose -s -b /tmp/session.dat --header "Content-Type: application/json;charset=utf-8" --header "Authorization: Basic YnJhZCU0MGN1c3RvbWVyMTozQ29tMzgxMg==" --header "Accept-Encoding: gzip, deflate" --header "Accept: application/json, text/plain" --data "${PARAMS}" http://devopslabappsphere:8090/controller/restui/user/createCustomRange

Page 44: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 44

NeoLoad with GIT

• GitHub project - https://github.com/sandbreak80/konakart– mkdir neoload_projects/konakart– cd neoload_projects/konakart– git clone https://github.com/sandbreak80/konakart.git

• Pull project in Jenkins job (linux shell step):– cd /home/ubuntu/neoload_projects/konakart– git fetch –all– git reset --hard origin/master

• Push test results (linux shell step):– cd /home/ubuntu/neoload_projects/konakart– git add *git commit -a -m "jenkins-${JOB_NAME}-${BUILD_NUMBER}”– git push https://username:[email protected]/username/konakart.git --all

• Generate GitHub token:– https://help.github.com/articles/creating-an-access-token-for-command-line-use/

Page 45: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 45

Jenkins plugins used

• AppDynamics - https://wiki.jenkins-ci.org/display/JENKINS/AppDynamics+Plugin/

• NeoLoad - https://wiki.jenkins-ci.org/display/JENKINS/NeoLoad+Plugin

• Timestamper - https://wiki.jenkins-ci.org/display/JENKINS/Timestamper – Manage Jenkins -> Configure -> – Date pattern for the BUILD_TIMESTAMP– EEE d MMM yyyy HH:mm:ss

Page 46: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 46

Adminer access

• http://your_server_name:8081/• host: konakart• user : monitor• password: appd123• database: konakart

Page 47: AppSphere 2016 - Automate performance testing with AppDynamics using continuous integration platforms

AppDynamics Confidential and Proprietary 47

KonaKart access

• http://your_server_name:8780/konakart/