Skip to content
Snippets Groups Projects
Commit aa4948cb authored by Embruch, Gerd's avatar Embruch, Gerd
Browse files

finalized

parent 50d8bf40
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,8 @@ TARGET=https://localhost:8080 ...@@ -8,7 +8,8 @@ TARGET=https://localhost:8080
# TESTING # TESTING
########## ##########
# API key from https://app.artillery.io/ # API key from https://app.artillery.io/
# ARTILLERY_CLOUD_API_KEY=a9_7GibberISHw-ApL # https://www.artillery.io/docs/get-started/artillery-cloud#configure-the-cli-to-send-data-to-artillery-cloud
ARTILLERY_CLOUD_API_KEY=a9_7GibberISHw-ApL
# seconds to wait between each http request # seconds to wait between each http request
SLEEP=2 SLEEP=2
......
...@@ -16,6 +16,8 @@ cd ragchat-artillery ...@@ -16,6 +16,8 @@ cd ragchat-artillery
npm i npm i
cp ./.env.template ./.env cp ./.env.template ./.env
# fill envs with production and/or devel values # fill envs with production and/or devel values
# evtl. edit tags on package.json => scripts => start
npm start
``` ```
...@@ -24,5 +26,3 @@ cp ./.env.template ./.env ...@@ -24,5 +26,3 @@ cp ./.env.template ./.env
- [PM2](https://pm2.keymetrics.io/) - [PM2](https://pm2.keymetrics.io/)
# Roadmap # Roadmap
- [ ] create a artillery script to test login & fetch jwt
- [ ] extend script to use JWT to send a prompt
config: config:
# This is a test server run by team Artillery # This is a test server run by team Artillery
# It's designed to be highly scalable # It's designed to be highly scalable
name: "WSL - 4 Cores"
target: "{{ $processEnvironment.TARGET}}" target: "{{ $processEnvironment.TARGET}}"
processor: "../helper.js" processor: "../helper.js"
timeout: 300 timeout: 300
phases: phases:
- duration: 10 - duration: 10
arrivalRate: 1 arrivalRate: 1
#rampTo: 2 rampTo: 2
name: Warm up phase name: Warm up phase
# - duration: 2 - duration: 20
# arrivalRate: 2 arrivalRate: 2
# rampTo: 3 rampTo: 3
# name: Ramp up load name: Ramp up load
# - duration: 1 - duration: 10
# arrivalRate: 3 arrivalRate: 3
# rampTo: 4 rampTo: 4
# name: Spike phase name: Spike phase
# Load & configure a couple of useful plugins # Load & configure a couple of useful plugins
# https://docs.art/reference/extensions # https://docs.art/reference/extensions
plugins: plugins:
...@@ -24,36 +25,41 @@ config: ...@@ -24,36 +25,41 @@ config:
apdex: {} apdex: {}
metrics-by-endpoint: {} metrics-by-endpoint: {}
fake-data: {} fake-data: {}
expect: {}
apdex: apdex:
# define how many milliseconds is considered satisfactory # define how many milliseconds is considered satisfactory
threshold: 1200 threshold: 3000
ensure: ensure:
thresholds: thresholds:
# p99 of response time must be lower # 99% of the responses are expected to be faster than this value (in ms)
- http.response_time.p99: 1200 - http.response_time.p99: 5000
# p95 of response time must be lower # 95% of the responses are expected to be faster than this value (in ms)
- http.response_time.p95: 1100 - http.response_time.p95: 4000
scenarios: scenarios:
- flow: - flow:
- function: "createUser" - function: "createUser"
- post: - post:
url: '/users/signup' url: '/users'
json: json:
name: "{{name}}" name: "{{name}}"
username: "{{username}}" username: "{{username}}"
email: "{{email}}" email: "{{email}}"
password: "{{password}}" password: "{{password}}"
passwordConfirm: "{{password}}" confirmPassword: "{{password}}"
expect:
- statusCode: 201
- log: "Created user: {{username}}" - log: "Created user: {{username}}"
- think : "{{$processEnvironment.SLEEP}}" - think : "{{$processEnvironment.SLEEP}}"
- post: - post:
url: '/users/login' url: '/auth/login'
json: json:
email: "{{email}}" email: "{{email}}"
password: "{{password}}" password: "{{password}}"
capture: capture:
- json: "$.token" - json: "$.accessToken"
as: "JWT" as: "JWT"
expect:
- statusCode: 200
- log: "{{username}} fetched JWT {{JWT}}" - log: "{{username}} fetched JWT {{JWT}}"
- think : "{{$processEnvironment.SLEEP}}" - think : "{{$processEnvironment.SLEEP}}"
- post: - post:
...@@ -66,19 +72,24 @@ scenarios: ...@@ -66,19 +72,24 @@ scenarios:
capture: capture:
- json: "$.chat.id" - json: "$.chat.id"
as: "chatId" as: "chatId"
# - think : "{{$processEnvironment.SLEEP}}" expect:
# - post: - statusCode: 200
# url: '/ai/chat' - think : "{{$processEnvironment.SLEEP}}"
# headers: - post:
# Authorization: "Bearer {{ JWT }}" url: '/ai/chat'
# json: headers:
# input: "{{$processEnvironment.RAGQ2}}" Authorization: "Bearer {{ JWT }}"
# model: "llama3" json:
# chatId: "{{ chatId }}" input: "{{$processEnvironment.RAGQ2}}"
# capture: model: "llama3"
# - json: "$.chat.id" chatId: "{{ chatId }}"
# as: "chatId" capture:
#- think : "{{$processEnvironment.SLEEP}}" - json: "$.chat.id"
#- get: as: "chatId"
# url: '/users/logout' expect:
# - statusCode: 200
\ No newline at end of file - think : "{{$processEnvironment.SLEEP}}"
- delete:
url: '/auth'
expect:
- statusCode: 200
\ No newline at end of file
config:
# This is a test server run by team Artillery
# It's designed to be highly scalable
target: "{{ $processEnvironment.TARGET}}"
processor: "../helper.js"
timeout: 300
phases:
- duration: 10
arrivalRate: 1
#rampTo: 2
name: Warm up phase
# - duration: 2
# arrivalRate: 2
# rampTo: 3
# name: Ramp up load
# - duration: 1
# arrivalRate: 3
# rampTo: 4
# name: Spike phase
# Load & configure a couple of useful plugins
# https://docs.art/reference/extensions
plugins:
ensure: {}
apdex: {}
metrics-by-endpoint: {}
fake-data: {}
apdex:
# define how many milliseconds is considered satisfactory
threshold: 1200
ensure:
thresholds:
# p99 of response time must be lower
- http.response_time.p99: 1200
# p95 of response time must be lower
- http.response_time.p95: 1100
scenarios:
- flow:
- function: "createUser"
- post:
url: '/users/signup'
json:
name: "{{name}}"
username: "{{username}}"
email: "{{email}}"
password: "{{password}}"
passwordConfirm: "{{password}}"
- log: "Created user: {{username}}"
- think : "{{$processEnvironment.SLEEP}}"
- post:
url: '/users/login'
json:
email: "{{email}}"
password: "{{password}}"
capture:
- json: "$.token"
as: "JWT"
- log: "{{username}} fetched JWT {{JWT}}"
- think : "{{$processEnvironment.SLEEP}}"
- post:
url: '/ai/chat'
headers:
Authorization: "Bearer {{ JWT }}"
json:
input: "{{$processEnvironment.INTQ1}}"
model: "llama3"
capture:
- json: "$.chat.id"
as: "chatId"
# - think : "{{$processEnvironment.SLEEP}}"
# - post:
# url: '/ai/chat'
# headers:
# Authorization: "Bearer {{ JWT }}"
# json:
# input: "{{$processEnvironment.INTQ2}}"
# model: "llama3"
# chatId: "{{ chatId }}"
# capture:
# - json: "$.chat.id"
# as: "chatId"
#- think : "{{$processEnvironment.SLEEP}}"
#- get:
# url: '/users/logout'
#
\ No newline at end of file
...@@ -6,7 +6,7 @@ module.exports = { ...@@ -6,7 +6,7 @@ module.exports = {
function createUser(userContext, events, done) { function createUser(userContext, events, done) {
userContext.vars.name = faker.person.fullName(); userContext.vars.name = faker.person.fullName();
userContext.vars.username = faker.internet.userName(); userContext.vars.username = `artillery_${faker.internet.userName()}`;
userContext.vars.email = faker.internet.email(); userContext.vars.email = faker.internet.email();
userContext.vars.password = faker.internet.password({ length: 16, prefix: '#8aZ_' }); userContext.vars.password = faker.internet.password({ length: 16, prefix: '#8aZ_' });
return done(); return done();
......
...@@ -4,9 +4,7 @@ ...@@ -4,9 +4,7 @@
"description": "performance tests for RAGChat API", "description": "performance tests for RAGChat API",
"main": "server.js", "main": "server.js",
"scripts": { "scripts": {
"online": "artillery run -k --dotenv ./.env ./__tests__/prompting.yaml --record --key a9_7yTC5bnk1Lgl94FtpIQgepfXzfgw-ApL", "start": "artillery run -k --dotenv ./.env ./__tests__/prompting.yaml --tags Cores:8,Host:Node045,Questions:RAG,Storage:SSD,DB:central,Artillery:Node044,OllamaParallel:8 --record"
"start": "artillery run -k --dotenv ./.env ./__tests__/prompting.yaml --output ./reports/prompting.json ; artillery report --output ./reports/prompting.html ./reports/prompting.json",
"intrinsic": "artillery run -k --dotenv ./.env ./__tests__/prompting_intrinsic.yaml --output ./reports/prompting_intrinsic.json ; artillery report --output ./reports/prompting_intrinsic.html ./reports/prompting_intrinsic.json"
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment