Skip to content

Commit 7456e94

Browse files
committed
deploy: 794f9f6
1 parent 1fec685 commit 7456e94

File tree

384 files changed

+17347
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

384 files changed

+17347
-1
lines changed

.nojekyll

Whitespace-only changes.

404.html

Lines changed: 6 additions & 0 deletions
Large diffs are not rendered by default.

CNAME

Lines changed: 0 additions & 1 deletion
This file was deleted.

benchmarks/choose-movie.hf.yaml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: choose-movie
2+
http:
3+
host: http://localhost:8080
4+
# Use 80 concurrent HTTP connections to the server. Default is 1,
5+
# therefore we couldn't issue two concurrent requests (as HTTP pipelining
6+
# is disabled by default and we use HTTP 1.1 connections).
7+
sharedConnections: 80
8+
usersPerSec: 10
9+
duration: 5s
10+
# Each session will take at least 3 seconds (see the sleep time below),
11+
# and we'll be running ~10 per second. That makes 30, let's give it
12+
# some margin and set this to 40.
13+
maxSessions: 40
14+
scenario:
15+
# In previous scenarios we have used only single sequence and we could
16+
# define the list of sequences right away. In this scenario, we're going
17+
# to be using 3 different sequences.
18+
# Initial sequences are scheduled at session start and are not linked
19+
# to the other sessions.
20+
initialSequences:
21+
- home:
22+
# Pick a random username from a file
23+
- randomItem:
24+
file: usernames.txt
25+
toVar: username
26+
# The page would load a profile, e.g. to display full name.
27+
- httpRequest:
28+
GET: /quickstarts/choose-movie/profile?user=${username}
29+
sync: false
30+
metric: profile
31+
# Fetch movies user could watch
32+
- httpRequest:
33+
GET: /quickstarts/choose-movie/movies
34+
sync: false
35+
metric: movies
36+
handler:
37+
body:
38+
# Parse the returned JSON that is an array and for each
39+
# element fire the processor.
40+
json:
41+
query: .[]
42+
processor:
43+
# Store each element in a collection `movies`
44+
array:
45+
toVar: movies
46+
# Store as byte[] to avoid encoding UTF-8 into String
47+
format: BYTES
48+
# Every data structure in session has maximum size.
49+
# This space is pre-allocated.
50+
maxSize: 10
51+
# This step waits until responses for all sent requests are received and processed.
52+
- awaitAllResponses
53+
# Wait 3 seconds to simulate user-interaction
54+
- thinkTime:
55+
duration: 3s
56+
# Set variable `quality` and `movieNames` to an uninitialized array
57+
# of 10 elements. We will use them later on.
58+
- set:
59+
var: quality
60+
objectArray:
61+
size: 10
62+
- set:
63+
var: movieNames
64+
objectArray:
65+
size: 10
66+
# For each element in variable `movies` schedule one (new) instance
67+
# of sequence `movies`, defined below. These instances differ in
68+
# one intrinsic "variable" - their index.
69+
- foreach:
70+
fromVar: movies
71+
sequence: addComment
72+
# Schedule one more sequence
73+
- newSequence: watchMovie
74+
# These sequences are defined but don't get scheduled at session start. We activate
75+
# them explicitly (and multiple times in parallel) in foreach step above.
76+
sequences:
77+
# Sequences that can run multiple instances concurrently must declare the maximum
78+
# concurrency level explicitly using the brackets.
79+
- addComment[10]:
80+
# Variables `movies` hosts an array, and in the foreach step
81+
# we've created one sequence for each element. We'll access
82+
# the element through the '[.]' notation below.
83+
- json:
84+
fromVar: movies[.]
85+
query: .quality
86+
# We'll extract quality to another collection under
87+
# this sequence's index. We shouldn't use global variable
88+
# as the execution of sequences may interleave.
89+
toVar: quality[.]
90+
# For high-quality movies we won't post insults (we haven't seen
91+
# the movie yet anyway). Therefore, we'll stop executing
92+
# the sequence prematurely.
93+
- breakSequence:
94+
intCondition:
95+
fromVar: quality[.]
96+
# Note: ideally we could filter the JSON directly using query
97+
# .[] | select(.quality >= 80)
98+
# but this feature is not implemented yet.
99+
greaterOrEqualTo: 80
100+
- json:
101+
fromVar: movies[.]
102+
query: .name
103+
toVar: movieNames[.]
104+
- httpRequest:
105+
# URLs with spaces and other characters don't work well;
106+
# let's encode it (e.g. space -> %20)
107+
POST: /quickstarts/choose-movie/movie/${urlencode:movieNames[.]}/comments
108+
body:
109+
text: This movie sucks.
110+
# The sync shortcut actually sets up a bit in the session state
111+
# cleared before the request and set when the request is complete,
112+
# automatically waiting it after this step.
113+
# You can write your own handlers (using sequence-scoped vars)
114+
# to change this behaviour.
115+
sync: true
116+
# Set value to variable `commented`. The actual value does not matter.
117+
- set: commented <- true
118+
- watchMovie:
119+
# This sequence is blocked in its first step until the variable gets
120+
# set. Therefore we could define it in `initialSequences` and omit
121+
# the `newSequence` step at the end of `home` sequence.
122+
- awaitVar: commented
123+
# Choose one of the movies (including the bad ones, for simplicity)
124+
- randomItem: selectedMovie <- movies
125+
- json:
126+
fromVar: selectedMovie
127+
query: .name
128+
# This sequence is executed only once so we can use global var.
129+
toVar: movieName
130+
# Finally, go watch the movie!
131+
- httpRequest:
132+
GET: /quickstarts/choose-movie/movie/${urlencode:movieName}/watch
133+
sync: true

benchmarks/credentials.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
johnny,"pA55w012d"
2+
harry,"!@#$%^&*()"
3+
tony,aLongSequenceThatsReallyHardToGuess

benchmarks/credentials.hf.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: credentials
2+
http:
3+
- host: https://localhost:8084
4+
phases:
5+
- use-cookie:
6+
atOnce:
7+
users: 1
8+
scenario:
9+
# Make sure that without the cookie (before login) the request fails with 401
10+
- before-login:
11+
- httpRequest:
12+
GET: /howto/credentials/secure
13+
handler:
14+
autoRangeCheck: false # Don't fail with 4xx-5xx
15+
status:
16+
range: 401
17+
- login-with-form:
18+
- randomCsvRow:
19+
file: credentials.csv
20+
columns:
21+
0: username
22+
1: password
23+
- httpRequest:
24+
POST: /howto/credentials/login
25+
body:
26+
form:
27+
- name: username
28+
fromVar: username
29+
- name: password
30+
fromVar: password
31+
# Here we already have the cookie set to a httpRequest will succeed
32+
- after-login:
33+
- httpRequest:
34+
GET: /howto/credentials/secure
35+
- use-bearer-token:
36+
atOnce:
37+
users: 1
38+
scenario:
39+
- request-login-page:
40+
# This first request will response with WWW-Authenticate header
41+
- httpRequest:
42+
GET: /howto/credentials/login
43+
handler:
44+
autoRangeCheck: false
45+
status:
46+
range: 401
47+
- login-with-basic-auth:
48+
- randomCsvRow:
49+
file: credentials.csv
50+
columns:
51+
0: username
52+
1: password
53+
- template:
54+
pattern: ${username}:${password}
55+
toVar: concatenated
56+
- httpRequest:
57+
GET: /howto/credentials/login
58+
headers:
59+
# Our example runs over HTTP2 and that mandates lower-case header names
60+
authorization: Basic ${base64encode:concatenated}
61+
# With Authorization header the server will reply with token
62+
# and redirect us to the secured page. `httpRequest` implements
63+
# automatic redirection through `handler.followRedirect` but that
64+
# wouldn't send the token, so we'll do that manually
65+
handler:
66+
header:
67+
- filter:
68+
header: x-token
69+
processor:
70+
- store: token
71+
status:
72+
range: 30x
73+
- after-login:
74+
- httpRequest:
75+
GET: /howto/credentials/secure
76+
headers:
77+
authorization: Bearer ${token}

benchmarks/divide.hf.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This benchmark demonstrates custom steps
2+
name: divide
3+
http:
4+
host: http://localhost:8080
5+
usersPerSec: 1
6+
duration: 5s
7+
scenario:
8+
- test:
9+
- setInt: foo <- 33
10+
- divide: foo /= 3
11+
- log:
12+
message: Foo is {}
13+
vars:
14+
- foo

benchmarks/eshop-forks.hf.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: eshop-forks
2+
http:
3+
host: http://localhost:8080
4+
sharedConnections: 80
5+
phases:
6+
- rampUp:
7+
increasingRate:
8+
duration: 5s
9+
maxIterations: 10
10+
# Note that we have increased both the base and increment from 10 and 5
11+
# to 15. This value is split between the forks based on their weight.
12+
initialUsersPerSec:
13+
base: 0
14+
increment: 15
15+
targetUsersPerSec:
16+
base: 15
17+
increment: 15
18+
startAfter:
19+
phase: steadyState
20+
iteration: previous
21+
forks:
22+
browsingUser:
23+
weight: 2
24+
scenario: &browsingUser
25+
- browse:
26+
- httpRequest:
27+
GET: /quickstarts/eshop/items
28+
buyingUser:
29+
weight: 1
30+
scenario: &buyingUser
31+
- browse:
32+
- httpRequest:
33+
GET: /quickstarts/eshop/items
34+
handler:
35+
body:
36+
json:
37+
query: .[].id
38+
toArray: itemIds[10]
39+
- buy:
40+
- randomItem: itemId <- itemIds
41+
- httpRequest:
42+
POST: /quickstarts/eshop/items/${itemId}/buy
43+
- steadyState:
44+
constantRate:
45+
duration: 10s
46+
maxIterations: 10
47+
usersPerSec:
48+
base: 15
49+
increment: 15
50+
startAfter:
51+
phase: rampUp
52+
iteration: same
53+
forks:
54+
browsingUser:
55+
weight: 2
56+
scenario: *browsingUser
57+
buyingUser:
58+
weight: 1
59+
scenario: *buyingUser
60+
# Operator phase is omitted for brevity as we wouldn't scale that up

0 commit comments

Comments
 (0)