add graphs
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -212,6 +212,7 @@ source_docs/
|
||||
|
||||
### Benchmark ###
|
||||
tests/benchmark/k6
|
||||
tests/benchmark/prometheus
|
||||
tests/benchmark/**/*.json
|
||||
tests/benchmark/**/*.ndjson
|
||||
tests/benchmark/**/*.html
|
||||
|
||||
8
Makefile
8
Makefile
@ -289,12 +289,14 @@ benchmark-install:
|
||||
mv k6 tests/benchmark/k6
|
||||
|
||||
benchmark-fixtures-create:
|
||||
./tests/benchmark/fixtures.py create
|
||||
tests/benchmark/fixtures.py create
|
||||
|
||||
benchmark-run:
|
||||
./tests/benchmark/run.sh
|
||||
docker compose -f tests/benchmark/docker-compose.yml up -d
|
||||
sleep 5
|
||||
tests/benchmark/run.sh
|
||||
|
||||
benchmark-fixtures-delete:
|
||||
./tests/benchmark/fixtures.py delete
|
||||
tests/benchmark/fixtures.py delete
|
||||
|
||||
benchmark: benchmark-install benchmark-fixtures-create benchmark-run benchmark-fixtures-delete
|
||||
|
||||
31
tests/benchmark/docker-compose.yml
Normal file
31
tests/benchmark/docker-compose.yml
Normal file
@ -0,0 +1,31 @@
|
||||
---
|
||||
services:
|
||||
prometheus:
|
||||
image: quay.io/prometheus/prometheus:latest
|
||||
command:
|
||||
- --enable-feature=native-histograms
|
||||
- --web.enable-remote-write-receiver
|
||||
- --config.file=/etc/prometheus/prometheus.yml
|
||||
- --storage.tsdb.path=/prometheus
|
||||
- --web.console.libraries=/usr/share/prometheus/console_libraries
|
||||
- --web.console.templates=/usr/share/prometheus/consoles
|
||||
ports:
|
||||
- 127.0.0.1:9090:9090
|
||||
volumes:
|
||||
- ./prometheus:/prometheus
|
||||
user: root
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:latest
|
||||
environment:
|
||||
GF_AUTH_ANONYMOUS_ENABLED: "true"
|
||||
GF_AUTH_ANONYMOUS_ORG_ROLE: Admin
|
||||
# GF_INSTALL_PLUGINS: grafana-image-renderer
|
||||
# GF_RENDERING_SERVER_URL: http://renderer:8081/render
|
||||
# GF_RENDERING_CALLBACK_URL: http://grafana:3000/
|
||||
# GF_LOG_FILTERS: rendering:debug
|
||||
ports:
|
||||
- 127.0.0.1:3000:3000
|
||||
volumes:
|
||||
- ./grafana/provisioning:/etc/grafana/provisioning:ro
|
||||
- ./grafana/dashboards:/var/lib/grafana/dashboards:ro
|
||||
@ -21,6 +21,7 @@ settings.CELERY["task_always_eager"] = True
|
||||
|
||||
|
||||
def user_list():
|
||||
print("user_list")
|
||||
# Number of users, groups per user, parents per groups
|
||||
tenants = [
|
||||
(10, 0, 0),
|
||||
@ -38,26 +39,31 @@ def user_list():
|
||||
]
|
||||
|
||||
for tenant in tenants:
|
||||
print(tenant)
|
||||
user_count = tenant[0]
|
||||
groups_per_user = tenant[1]
|
||||
parents_per_group = tenant[2]
|
||||
tenant_name = f"user-list-{user_count}-{groups_per_user}-{parents_per_group}"
|
||||
|
||||
print("tenant")
|
||||
t = Tenant.objects.create(schema_name=f"t_{tenant_name.replace('-', '_')}", name=uuid4())
|
||||
Domain.objects.create(tenant=t, domain=f"{tenant_name}.localhost")
|
||||
|
||||
with t:
|
||||
for _ in range(user_count):
|
||||
User.objects.create(username=uuid4(), name=uuid4())
|
||||
for user in User.objects.exclude_anonymous().exclude(username="akadmin"):
|
||||
for _ in range(groups_per_user):
|
||||
user.ak_groups.add(Group.objects.create(name=uuid4()))
|
||||
for group in Group.objects.exclude(name="authentik Admins"):
|
||||
print("groups")
|
||||
for _ in range(groups_per_user * 5):
|
||||
group = Group.objects.create(name=uuid4())
|
||||
for _ in range(parents_per_group):
|
||||
new_group = Group.objects.create(name=uuid4())
|
||||
group.parent = new_group
|
||||
group.save()
|
||||
group = new_group
|
||||
print("users")
|
||||
for _ in range(user_count):
|
||||
user = User.objects.create(username=uuid4(), name=uuid4())
|
||||
user.ak_groups.set(
|
||||
Group.objects.exclude(name="authentik Admins").order_by("?")[:groups_per_user]
|
||||
)
|
||||
|
||||
|
||||
def delete():
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
---
|
||||
apiVersion: 1
|
||||
providers:
|
||||
- name: default
|
||||
folder: k6
|
||||
type: file
|
||||
options:
|
||||
path: /var/lib/grafana/dashboards
|
||||
@ -0,0 +1,11 @@
|
||||
---
|
||||
apiVersion: 1
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
orgId: 1
|
||||
uid: prometheus
|
||||
url: http://prometheus:9090
|
||||
jsonData:
|
||||
timeInterval: 1s
|
||||
@ -7,8 +7,12 @@ BASE_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
|
||||
function _k6 {
|
||||
local filename="${1}"
|
||||
|
||||
K6_PROMETHEUS_RW_SERVER_URL=http://localhost:9090/api/v1/write \
|
||||
K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true \
|
||||
K6_PROMETHEUS_RW_PUSH_INTERVAL=1s \
|
||||
"${BASE_DIR}/k6" \
|
||||
run \
|
||||
--out experimental-prometheus-rw \
|
||||
--out "web-dashboard=port=-1&report=${filename%.*}.html&period=1s&tag=name&tag=group&tag=user_count&tag=page_size" \
|
||||
--out "json=${filename%.*}.json" \
|
||||
"${@}"
|
||||
|
||||
@ -29,8 +29,8 @@ export const options = {
|
||||
{
|
||||
executor: "constant-vus",
|
||||
vus: 10,
|
||||
duration: "30s",
|
||||
startTime: `${30 * i}s`,
|
||||
duration: "300s",
|
||||
startTime: `${315 * i}s`,
|
||||
env: {
|
||||
USER_COUNT: `${obj[0]}`,
|
||||
GROUPS_PER_USER: `${obj[1]}`,
|
||||
@ -38,6 +38,7 @@ export const options = {
|
||||
PAGE_SIZE: `${obj[3]}`,
|
||||
},
|
||||
tags: {
|
||||
testid: `user_list_${obj[0]}_${obj[1]}_${obj[2]}_${obj[3]}`,
|
||||
user_count: `${obj[0]}`,
|
||||
groups_per_user: `${obj[1]}`,
|
||||
parents_per_group: `${obj[2]}`,
|
||||
|
||||
Reference in New Issue
Block a user