load impact

35
impact www. loadimpact.com Load

Upload: z-999

Post on 18-Nov-2014

1.239 views

Category:

Technology


3 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Load Impact

impa

ct

www. l

oadi

mpa

ct.c

omLoad

Page 2: Load Impact

Outline• What is load impact?

• The main Components of Load Impact.o Load testing tool.

o Page analyzer.

• Why Load Test?

• What is a test configuration?

• How to create test configuration?

• What is Scheduled tests?

• How to schedule tests?

• Using page analyzer.

• What is user scenarios?

• How to create your own scenarios?

• How to create user scenarios?o Lua Tutorial.

o Load impact with scripting?

o HTTP status codes.

Page 3: Load Impact

What is load impact?

• Load Impact is a cloud-based service for load

testing and website optimization. It generates

traffic load by simulating users. Load Impact is a

so-called freemium service.

Page 4: Load Impact

The main Components of Load Impact

• Load Impact consists of two main

parts:1. Load testing tool.

2. Page analyzer.

Page 5: Load Impact

1. Load testing tool

• It generates simulated user traffic to a website. Users can

simulate virtual users who are trying to load the web pages

at the same time.

• Results are displayed in real time throughout the test

process.

• There are three different types of load test:

1. Fixed - Test with static load level throughout the test.

2. Ramp-up - Test that starts at a low level and increases stepwise until it

reaches a maximum predetermined level.

3. Timeout - Ramp-up tests that increase the load level until the server

becomes too slow, or when the maximum load level is reached.

Page 6: Load Impact

2. Page analyzer

• It loads a web page the same way a web browser

would.

• It shows the user what objects were loaded, in

what order, and how long each object took to load.

• It also gives the user information about return

codes, compression ratio, etc.

Page 7: Load Impact

Why Load Test?

• Having a fast website is a key to commercial success on the

Internet.

• A slow website will increase your bounce rate, reduce your

rank in search engines & reduce conversions rates.

• In studies published in says that the average visitor expects a

web page to load in no more than two seconds.

• In 2010, Google has included site speed as part of its search

ranking algorithm.

Page 8: Load Impact

What is a test configuration?

• A test configuration describes the load test you want to run

– how many simulated users the test should load your site

with, and what those users should do on your site (what

pages they should load on the site).

Page 9: Load Impact

How to create test configuration?

1

2

1- choose the “test configuration” section, then click on “Create test configuration”.2- Type a name for the test, then enter the target URL

Page 10: Load Impact

How to create test configuration? (CONT>>)

3

This section will allow

you to specify what

load levels the test will

use, and how quickly to

ramp up or down

to/from those load

levels.

Page 11: Load Impact

How to create test configuration? (CONT>>)

3

What are VU and SBU users?

• A Virtual User will only use a single network

connection when loading resources from a target

host. Resources can be loaded from multiple hosts in

the same test, however, that will then result in one

connection per target host, per VU.

• A Simulated Browser User (SBU) can use multiple

concurrent network connections when loading

resources from a single target host. This results in

faster page loads, but also a lot more stress on the

target server that has to serve four connections at

once instead of just one.

Page 12: Load Impact

How to create test configuration? (CONT>>)

4

4 – Add extra IP address! But why?

Let’s take this example “If you are running a 800 SBU test with

user scenarios distributed evenly across a total of 5 loadzones (i.e.

800/5 = 160 SBUs per loadzone), you will have 1 (IP addresses

assigned for 160 SBUs per loadzone) x 5 (user scenarios/loadzones)

= 5 IP addresses assigned to your load test”.

Page 13: Load Impact

How to create test configuration? (CONT>>)

5

5 – Finally, click on “Create test configuration and start

test” to start testing.

Or, you could click on, “Create test configuration” to save

the configuration for later use.

Page 14: Load Impact

What is Scheduled tests?Scheduling allows you to run a load test at some point in the

future, or to run a load test regularly at certain intervals.

Page 15: Load Impact

How to schedule tests?

11- choose the “Scheduled tests” section, then click on “Add new scheduled test”.

Page 16: Load Impact

How to schedule tests? (CONT>>)

2

“Make sure you have created test configuration” before you start scheduling.

2- choose the test configuration.

3- Type the schedule data.

4- Type the schedule time.

5- choose the reputation time

(Daily, Weakly, Monthly).

6 – Schedule it.

3

4

56

Page 17: Load Impact

Using page analyzer• To Access the page analyzer section

go to: https://loadimpact.com/page-analyzer

1- Type the target URL.

2- choose the browser to emulate during analysis.

3- click on analyze.

1 2 3

Page 18: Load Impact

Case Study: ksu.edu.sa

The load times are

represented as colored

bars which is divided into

several components. They

are:

- Time in queue (grey).

- DNS lookup time

(orange).

- Connection time

(yellow).

- Time to first byte

(green).

- Download time (blue).

Page 19: Load Impact

Case Study: ksu.edu.sa (CONT>>)

Page 20: Load Impact

What is user scenarios?

A user scenario is a sequence of HTTP transactions that emulates a

certain type of user on your site. You can have several user

scenarios in a single load test, emulating several different types of

users.

Page 21: Load Impact

What is Lua?

Lua is a lightweight multi-paradigm programming language

designed as a scripting language.

Why Lua?

• Lua is cross-platform.

• It’s simple, elegant and easy to learn.

• It’s also light-weight and very suitable for resource-intensive

applications such as load testing.

Page 22: Load Impact

A Quick tutorial: Introduction to

let’sog

Page 23: Load Impact

Types in LuaThere are 8 types in Lua:

1- Number : Numeric value represented in double.

2- String: A sequence of arbitrary characters.

3- Boolean : "true" and "false“.

4- function : First-class object in Lua.

5- Table : Heterogeneous[1] hash table.

6- Thread : C data structures defined by C users.

7 – Userdata : Lua coroutine, a cooperative threading.

8- Nil : Nothing.

[1] : Heterogeneous composed of parts of different kinds.

Page 24: Load Impact

Functions in Lua

function foo(a, b, c)  local sum = a + b  return sum, c  --A function can return multi values.

End

var1, var2 = foo(1, '123', ‘KSU')  --Parallel assignmentprint(var1, var2)

output:

124 KSU

Page 25: Load Impact

Tables in Lua

To create Table:> t = {} -- construct an empty table and assign it to variable "t" > print(t)

Output: table: 0035AE18

Tables as arrays:> t = { 1,1,2,3,5,8,13 } > print( t[1] )

Output: 1 > print( t[0] )

Output: nil > print( t[4] )

Output: 3

What about this: > = # t --

Output: 7guess what?To find the size of the table

Page 26: Load Impact

:)

Page 27: Load Impact

How to create your own scenarios?Scenario name

TargetURL

Generate the scenario automatically

Validate script

docu

men

tation

Editor

Validation results

Page 28: Load Impact

How to create your own scenarios?Examples:1- load test a single recourse

http.request_batch({ {"GET", http://loadimpact.com/"}

})

2- POST requestshttp.request_batch({

{"POST", "http://test.loadimpact.com/login.php" , data="login=test_user&password=123"}

})

3-  Load-test multiple resourceshttp.request_batch({ {“GET”, “http://test.loadimpact.com/news.php”}}) http.request_batch({

{“GET”, “http://test.loadimpact.com/contacts.php”}})

Page 29: Load Impact

How to create your own scenarios?(CONT>>)

Examples:4- Random delays between requests

http.request_batch({ {"GET", "http://test.loadimpact.com/news.php"}, }) client.sleep( math.random(1, 15) --Sleeps between 1 - 15 seconds before continuing ) http.request_batch({ {"GET", "http://test.loadimpact.com/news.php"}, })

5- Read HTTP headers from a response local response = http.request_batch({ {"GET", "http://google.com"}, }) log.info( "google.com uses `" .. tostring(response[1].headers["Server"][1])

.. "' as a server software" )

Page 30: Load Impact

How to create your own scenarios?(CONT>>)

Examples:

6- Setting headers for a request Sometimes you need to set custom HTTP headers for your request. One

reason is to see if your server handles client-side caching.

local response = http.request_batch({ {"GET", "http://test.loadimpact.com/", headers = { ["If-Modified-Since"] = "Tue, 18 Jun 2013 03:30:00 GMT"; } } }) if response[1].status_code==304 then log.info("not modified") elseif response[1].status_code==200 then log.info("modified") else log.error("unexpected code" .. tostring(response[1].status_code)) end

Page 31: Load Impact

Some HTTP status codes:Categories: 1xx Informational , 2xx Success , 3xx Redirection , 4xx Client Error , 5xx Server Error.

Status code Description

304 Not ModifiedIndicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-Match.

400 Bad RequestThe request cannot be fulfilled due to bad syntax.

401 UnauthorizedSimilar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet been provided.

403 ForbiddenThe request was a valid request, but the server is refusing to respond to it.

404 Not FoundThe requested resource could not be found but may be available again in the future

500 Internal Server Error

A generic error message, given when no more specific message is suitable.

503 Service Unavailable

The server is currently unavailable (because it is overloaded or down for maintenance).

Page 32: Load Impact

The End

Page 33: Load Impact

For more information

Visit the knowledge base

http://support.loadimpact.com/

Page 34: Load Impact

References

• https://loadimpact.com/learning-center/

• http://support.loadimpact.com/knowledgebase/articles/

• http://en.wikipedia.org/wiki/List_of_HTTP_status_codes

• http://www.lua.org/pil/contents.html

Page 35: Load Impact

?

This file is licensed under a Creative Commons Attribution