Skip to content

Commit 7784cb1

Browse files
committed
Finaly updates pre blog post
1 parent 4e31bf7 commit 7784cb1

File tree

6 files changed

+42
-148
lines changed

6 files changed

+42
-148
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 102 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# wikibase-profile
22

3-
The general idea of this repo is to allow some basic profiling of different settings using docker and possible Github actions?
3+
The general idea of this repo is to allow some basic profiling of different setups of Wikibase, using Docker, in a mildly automated way.
44

55
Steps:
66

@@ -11,46 +11,15 @@ Steps:
1111
- Do some amount of known work
1212
- Stop timer
1313
- Output result...
14-
- Send result to Google Sheet via IFTTT
1514

1615
## Local profiling
1716

18-
You can also try running them locally... For example...
17+
You can also try running them locally...
1918

20-
```sh
21-
export PROFILE_IMAGE=wikibase/wikibase:mw1.43.0
22-
export PROFILE_SETTINGS=default
23-
export PROFILE_SQL=mariadb:11.7
24-
25-
docker-compose up -d mysql wikibase1
26-
./docker-compose-wait1.sh
27-
docker-compose up -d wikibase2
28-
./docker-compose-wait2.sh
29-
docker-compose up -d --force-recreate wikibase1
30-
./docker-compose-wait1.sh
31-
32-
echo "Sleeping for 5 seconds..."
33-
sleep 5
34-
echo "Starting profiling..."
35-
TIMING=$(time ASYNC=30 INSTANCES=2 ./loads/wbeditentity-2000EmptyItems.sh)
36-
LAST_LINE=$(tail -n 1 ./process.out)
37-
STATS=$(curl 'http://localhost:8181/w/api.php?action=query&format=json&meta=siteinfo&siprop=statistics')
38-
```
39-
40-
And to delete everything, just...
19+
Setup matrix.yml to your liking, and then run the following command:
4120

4221
```sh
43-
docker-compose down --volumes
44-
```
45-
46-
## Running Matrix Jobs Locally
47-
48-
To run the matrix jobs locally, use the `run_matrix.sh` script. This script reads the matrix configuration from `matrix.yml` and runs the jobs locally, storing the outputs in the `.data` directory.
49-
50-
### Usage
51-
52-
```bash
5322
./run_matrix.sh
5423
```
5524

56-
The outputs will be stored in the `.data` directory with a directory schema reflecting the matrix configuration. Each run will also be summarized in a CSV file located at `.data/summary.csv`, and the statistics from the API will be included in the output.
25+
You'll find some useful stuff output, but also in the `.data` directory, which will contain the results of the profiling.

loads/wbfastimport-FullishItems.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ make_group_request() {
4444
local response
4545
local url="http://localhost:818$((1 + RANDOM % $INSTANCES))/w/api.php"
4646

47-
response=$(curl -s -m 20 -X POST -F "action=wbfastimport" -F "format=json" -F "data=${data}" "$url")
47+
response=$(curl -s -m 300 -X POST -F "action=wbfastimport" -F "format=json" -F "data=${data}" "$url")
4848
echo "$response" >> process.out
4949

5050
if [[ "$response" != *"success"* ]]; then
@@ -82,7 +82,7 @@ do
8282
# Send the request with the temp file data
8383
data=$(cat "$temp_file")
8484
url="http://localhost:818$((1 + RANDOM % $INSTANCES))/w/api.php"
85-
response=$(curl -s -m 20 -X POST -F "action=wbfastimport" -F "format=json" -F "data=${data}" "$url")
85+
response=$(curl -s -m 300 -X POST -F "action=wbfastimport" -F "format=json" -F "data=${data}" "$url")
8686
echo "$response" >> process.out
8787

8888
# Clean up
@@ -125,7 +125,7 @@ do
125125
# Send the request with the temp file data
126126
data=$(cat "$temp_file")
127127
url="http://localhost:818$((1 + RANDOM % $INSTANCES))/w/api.php"
128-
response=$(curl -s -m 20 -X POST -F "action=wbfastimport" -F "format=json" -F "data=${data}" "$url")
128+
response=$(curl -s -m 300 -X POST -F "action=wbfastimport" -F "format=json" -F "data=${data}" "$url")
129129
echo "$response" >> process.out
130130

131131
# Clean up

matrix.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@ instances:
44
async:
55
# - 1
66
# - 5
7-
- 10
7+
# - 10
8+
- 16
9+
# - 20
10+
# - 25
811
# - 30
912
# - 60
10-
# - 100
13+
# - 90
14+
# - 120
15+
# - 150
16+
# - 200
1117
images:
1218
# - wikibase/wikibase:1.39.1-wmde.11
1319
# - wikibase/wikibase:1.40.3-wmde.19
@@ -19,19 +25,33 @@ sql:
1925
- mariadb:11.7
2026
settings:
2127
# - default
22-
- wbOwnIdConnection
28+
# - wbOwnIdConnection
29+
- wbOwnIdConnectionUpsert
2330
# - lightweight
2431
loads:
2532
# - wbeditentity-FullishItems
2633
- wbfastimport-FullishItems
34+
# - rest-FullishItems
2735
entity_groups:
2836
# - 1
2937
# - 2
3038
# - 5
3139
# - 10
3240
# - 25
33-
- 50
41+
# - 50
42+
# - 100
43+
# - 150
44+
# - 200
45+
- 250
3446
entity_counts:
3547
# - 2000
36-
- 5000
37-
# - 10000
48+
# - 5000
49+
# - 10000
50+
# - 25000
51+
# - 35000
52+
# - 50000
53+
# - 100000
54+
# - 250000
55+
- 500000
56+
# - 1000000
57+
# - 2000000

run_matrix.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ for instance in $instances; do
5656
docker-compose up -d --force-recreate wikibase1
5757
./docker-compose-wait1.sh
5858
sleep 2
59-
59+
6060
echo "Running init.."
6161
start_time=$(date +%s)
6262
INSTANCES=$instance ./loads/init.sh
@@ -71,8 +71,11 @@ for instance in $instances; do
7171
stop_time=$(date +%s)
7272
total_time=$((stop_time - start_time))
7373
echo "Stop time: $stop_time" > $job_dir/stop.out
74-
echo "Total time: $total_time" > $job_dir/time.out
74+
echo "Total time: $total_time" > $job_dir/time.o
7575
success_line=$(grep -o "success" process.out | wc -l)
76+
if [[ $load == *"rest"* ]]; then
77+
success_line=$((success_line + $(grep -o '"type":"item"' process.out | wc -l)))
78+
fi
7679
echo "Success line: $success_line" > $job_dir/success_line.out
7780
cp process.out $job_dir/process.out
7881
# Get statistics, but do it twice to make sure things have finished processing, and sleep in the middle?
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Use a separate DB connection for ID allocation to reduce contention
2+
# And try upserting...
3+
echo "\$wgWBRepoSettings['idGeneratorSeparateDbConnection'] = true;" >> LocalSettings.php
4+
echo "\$wgWBRepoSettings['idGenerator'] = 'mysql-upsert';" >> LocalSettings.php

0 commit comments

Comments
 (0)