WIP: Deployment #3
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
# project specific
|
# project specific
|
||||||
settings.json
|
settings.json
|
||||||
db.sqlite3
|
db.sqlite3
|
||||||
|
dummyusers.json
|
||||||
*.prof
|
*.prof
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
|
@ -105,7 +105,7 @@ INSTALLED_APPS = [
|
|||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
# 'silk.middleware.SilkyMiddleware', # DEBUG/profiling purposes
|
# 'silk.middleware.SilkyMiddleware', # DEBUG/profiling purposes
|
||||||
# 'debug_toolbar.middleware.DebugToolbarMiddleware', # DEBUG purposes
|
# 'debug_toolbar.middleware.DebugToolbarMiddleware', # DEBUG purposes
|
||||||
# 'django.middleware.cache.UpdateCacheMiddleware', # cache
|
'django.middleware.cache.UpdateCacheMiddleware', # cache
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
@ -113,7 +113,7 @@ MIDDLEWARE = [
|
|||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
# 'django.middleware.cache.FetchFromCacheMiddleware', # cache
|
'django.middleware.cache.FetchFromCacheMiddleware', # cache
|
||||||
]
|
]
|
||||||
## ##
|
## ##
|
||||||
########################################################################
|
########################################################################
|
||||||
|
18
README.md
18
README.md
@ -7,6 +7,21 @@ Remove the `.bak` from `db.sqlite3.bak` and `settings.json.bak`
|
|||||||
`./CalibreWebCompanion`
|
`./CalibreWebCompanion`
|
||||||
run `./manage.py runserver`
|
run `./manage.py runserver`
|
||||||
|
|
||||||
|
# Profiling
|
||||||
|
|
||||||
|
To do profiling, you have to create some dummy users
|
||||||
|
Unbakify a file `./loadtesting/dummyusers.json.bak` and fill in the credentials for the dummy users
|
||||||
|
|
||||||
|
While django is running, open another shell and cd to `./loadtesting` and run `./bench.py`
|
||||||
|
To have a more interactive session,
|
||||||
|
comment out
|
||||||
|
```
|
||||||
|
run-time = 2m
|
||||||
|
headless = true
|
||||||
|
```
|
||||||
|
in `locust.conf`, and then run `./bench.py`
|
||||||
|
You can then go to [http://localhost:8089/](http://localhost:8089/) to see live graphs, tweak the number of users and more.
|
||||||
|
|
||||||
this is in development mode. don't actually use it or release it like this. The debug info it shows is spicy.
|
this is in development mode. don't actually use it or release it like this. The debug info it shows is spicy.
|
||||||
# Features
|
# Features
|
||||||
|
|
||||||
@ -15,6 +30,7 @@ this is in development mode. don't actually use it or release it like this. The
|
|||||||
- [x] Search
|
- [x] Search
|
||||||
- [x] authentication
|
- [x] authentication
|
||||||
- [x] Cache
|
- [x] Cache
|
||||||
|
- [x] Profiling with logging
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
@ -22,7 +38,7 @@ this is in development mode. don't actually use it or release it like this. The
|
|||||||
- [ ] localisation
|
- [ ] localisation
|
||||||
- [ ] Beautifying template
|
- [ ] Beautifying template
|
||||||
- [ ] Setup email functionality
|
- [ ] Setup email functionality
|
||||||
- [ ] Profiling with logging
|
|
||||||
- [ ] deploy
|
- [ ] deploy
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,22 +1,34 @@
|
|||||||
import csv
|
import csv
|
||||||
|
from rich.console import Console
|
||||||
|
from rich.table import Column, Table
|
||||||
|
import subprocess
|
||||||
|
subprocess.run(["locust"])
|
||||||
|
|
||||||
def floatify(mystring): # floatify probable floats
|
def floatify(mystring): # floatify probable floats
|
||||||
try:
|
|
||||||
return f"{float(mystring):3.3f}"
|
return f"{float(mystring):3.3f}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
results = dict()
|
results = dict()
|
||||||
with open("calibre_stats.csv", "r") as cfile:
|
with open("calibre_stats.csv", "r") as cfile:
|
||||||
reader = csv.reader(cfile, delimiter=",")
|
reader = csv.reader(cfile, delimiter=",")
|
||||||
for row in reader:
|
for row in reader:
|
||||||
if not len(row):
|
if not len(row) or row[0] == "Type":
|
||||||
continue
|
continue
|
||||||
results[action] = {
|
results[row[0] + " " + row[1]] = {
|
||||||
"median" : floatify(row[4]),
|
"median": floatify(row[4]),
|
||||||
"avg" : floatify(row[5]),
|
"avg": floatify(row[5]),
|
||||||
"min" : floatify(row[6]),
|
"min": floatify(row[6]),
|
||||||
"max" : floatify(row[7]),
|
"max": floatify(row[7]),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console = Console()
|
||||||
|
table = Table(show_header=True, header_style="bold green")
|
||||||
|
table.add_column("Action/url")
|
||||||
|
table.add_column("min")
|
||||||
|
table.add_column("avg")
|
||||||
|
table.add_column("median") # destination
|
||||||
|
table.add_column("max") # source
|
||||||
|
|
||||||
|
for k, v in results.items():
|
||||||
|
table.add_row(k, v["min"], v["avg"], v["median"], v["max"])
|
||||||
|
console.print(table)
|
||||||
|
@ -1,2 +1 @@
|
|||||||
Method,Name,Error,Occurrences
|
Method,Name,Error,Occurrences
|
||||||
GET,/book/<id>,500 Server Error: Internal Server Error for url: /book/<id>,3
|
|
||||||
|
|
@ -1,20 +1,20 @@
|
|||||||
Type,Name,Request Count,Failure Count,Median Response Time,Average Response Time,Min Response Time,Max Response Time,Average Content Size,Requests/s,Failures/s,50%,66%,75%,80%,90%,95%,98%,99%,99.9%,99.99%,99.999%,100%
|
Type,Name,Request Count,Failure Count,Median Response Time,Average Response Time,Min Response Time,Max Response Time,Average Content Size,Requests/s,Failures/s,50%,66%,75%,80%,90%,95%,98%,99%,99.9%,99.99%,99.999%,100%
|
||||||
GET,/accounts/login/,20,0,48,65.55451154708862,14.944314956665039,260.83922386169434,2024.0,0.16925718599032696,0.0,53,60,79,82,180,260,260,260,260,260,260,260
|
GET,/accounts/login/,20,0,36,59.85466241836548,14.995336532592773,151.90577507019043,2024.0,0.8592061926044773,0.0,41,72,110,120,140,150,150,150,150,150,150,150
|
||||||
POST,/accounts/login/,20,0,500.0,563.2974982261658,342.44489669799805,988.3866310119629,68954.9,0.16925718599032696,0.0,520,630,680,770,860,990,990,990,990,990,990,990
|
POST,/accounts/login/,20,0,540.0,504.5383930206299,198.87518882751465,746.5388774871826,61528.8,0.8592061926044773,0.0,560,580,600,600,680,750,750,750,750,750,750,750
|
||||||
GET,/author/<id>,32,0,42,66.19161367416382,20.987987518310547,389.75977897644043,23424.375,0.2708114975845231,0.0,42,55,79,83,110,240,390,390,390,390,390,390
|
GET,/author/<id>,5,0,37,57.76419639587402,28.97953987121582,138.9150619506836,25477.6,0.21480154815111932,0.0,37,53,53,140,140,140,140,140,140,140,140,140
|
||||||
GET,/authors/,36,0,52,63.24449512693617,13.991117477416992,158.9028835296631,38376.63888888889,0.30466293478258855,0.0,56,70,76,76,99,150,160,160,160,160,160,160
|
GET,/authors/,8,0,49,45.841872692108154,3.998994827270508,121.92440032958984,30653.75,0.3436824770417909,0.0,50,50,73,73,120,120,120,120,120,120,120,120
|
||||||
GET,/book/<id>,91,3,57,71.04945968795609,19.988059997558594,273.82922172546387,31187.23076923077,0.7701201962559876,0.025388577898549043,57,72,87,90,130,170,230,270,270,270,270,270
|
GET,/book/<id>,8,0,31,44.84483599662781,22.98569679260254,111.92703247070312,15194.75,0.3436824770417909,0.0,37,42,55,55,110,110,110,110,110,110,110,110
|
||||||
GET,/books/,53,0,180.0,190.23628504771108,9.994029998779297,504.6887397766113,68252.92452830188,0.4485315428743664,0.0,180,200,220,240,270,410,480,500,500,500,500,500
|
GET,/books/,10,0,6,13.889431953430176,3.998994827270508,51.969289779663086,54841.6,0.42960309630223864,0.0,7,11,17,28,52,52,52,52,52,52,52,52
|
||||||
GET,/publisher/<id>,19,0,46,62.593510276392884,22.986173629760742,190.87886810302734,29474.105263157893,0.16079432669081062,0.0,46,60,85,87,150,190,190,190,190,190,190,190
|
GET,/publisher/<id>,9,0,46,47.74824778238932,32.979726791381836,68.95899772644043,27992.444444444445,0.3866427866720148,0.0,46,52,53,63,69,69,69,69,69,69,69,69
|
||||||
GET,/publishers/,22,0,41,52.96537009152499,9.990453720092773,127.92515754699707,30564.363636363636,0.18618290458935965,0.0,45,55,71,78,110,110,130,130,130,130,130,130
|
GET,/publishers/,7,0,33,27.697699410574778,4.996776580810547,51.969289779663086,25000.14285714286,0.30072216741156704,0.0,33,37,39,39,52,52,52,52,52,52,52,52
|
||||||
GET,/rating/<id>,47,0,56,69.93506817107505,28.981924057006836,293.81442070007324,33666.68085106383,0.39775438707726835,0.0,56,71,89,95,110,140,290,290,290,290,290,290
|
GET,/rating/<id>,8,0,66,77.861487865448,44.24405097961426,121.92630767822266,39245.375,0.3436824770417909,0.0,68,110,120,120,120,120,120,120,120,120,120,120
|
||||||
GET,/ratings/,9,0,84,76.82164510091145,22.31740951538086,146.39925956726074,30031.0,0.07616573369564714,0.0,84,93,120,130,150,150,150,150,150,150,150,150
|
GET,/ratings/,8,0,26,34.85342860221863,3.9975643157958984,69.95558738708496,26850.75,0.3436824770417909,0.0,34,42,56,56,70,70,70,70,70,70,70,70
|
||||||
GET,/search/,48,0,25,34.25489366054535,10.997772216796875,106.93764686584473,27502.3125,0.4062172463767847,0.0,25,36,41,43,72,87,110,110,110,110,110,110
|
GET,/search/,11,0,26,27.622352946888316,11.99197769165039,51.96666717529297,27841.454545454544,0.4725634059324625,0.0,26,30,34,34,44,52,52,52,52,52,52,52
|
||||||
GET,/series/,19,0,27,31.892036136827972,19.97995376586914,63.96055221557617,28473.894736842107,0.16079432669081062,0.0,27,31,37,39,62,64,64,64,64,64,64,64
|
GET,/series/,8,0,26,31.429588794708252,3.9980411529541016,53.01809310913086,20345.375,0.3436824770417909,0.0,34,50,52,52,53,53,53,53,53,53,53,53
|
||||||
GET,/tag/<id>,54,0,49,59.33219415170175,24.969100952148438,120.92876434326172,28703.61111111111,0.45699440217388276,0.0,52,70,85,92,110,110,120,120,120,120,120,120
|
GET,/tag/<id>,7,0,43,50.228118896484375,33.979177474975586,73.95386695861816,27211.85714285714,0.30072216741156704,0.0,43,54,71,71,74,74,74,74,74,74,74,74
|
||||||
GET,/tags/,36,0,48,66.21244218614366,10.992288589477539,373.7668991088867,33423.77777777778,0.30466293478258855,0.0,51,63,71,73,130,180,370,370,370,370,370,370
|
GET,/tags/,5,0,56,61.562395095825195,14.991283416748047,119.92549896240234,31376.8,0.21480154815111932,0.0,56,83,83,120,120,120,120,120,120,120,120,120
|
||||||
GET,search_by_author,48,0,35,49.331208070119224,8.999109268188477,187.8821849822998,27508.25,0.4062172463767847,0.0,35,41,56,62,120,160,190,190,190,190,190,190
|
GET,search_by_author,7,0,37,46.945163181849885,21.98958396911621,138.9153003692627,26497.571428571428,0.30072216741156704,0.0,37,39,45,45,140,140,140,140,140,140,140,140
|
||||||
GET,search_by_identifier,58,0,37,46.17996051393706,12.995004653930664,165.89641571044922,27873.603448275862,0.49084583937194814,0.0,38,46,55,59,97,100,120,170,170,170,170,170
|
GET,search_by_identifier,9,0,38,55.72432941860623,28.980731964111328,174.89361763000488,30605.11111111111,0.3866427866720148,0.0,38,38,47,67,170,170,170,170,170,170,170,170
|
||||||
GET,search_by_title,65,0,35,44.79830815241887,10.993003845214844,264.83631134033203,27183.56923076923,0.5500858544685626,0.0,35,41,50,54,61,110,140,260,260,260,260,260
|
GET,search_by_title,7,0,38,48.82873807634626,22.993087768554688,101.93872451782227,30429.571428571428,0.30072216741156704,0.0,38,53,62,62,100,100,100,100,100,100,100,100
|
||||||
GET,search_generic,117,0,40,51.21477852519761,9.992837905883789,282.82952308654785,28374.79487179487,0.9901545380434127,0.0,40,52,58,67,83,130,180,200,280,280,280,280
|
GET,search_generic,13,0,39,41.35936957139235,11.992692947387695,96.94075584411621,22713.076923076922,0.5584840251929102,0.0,39,49,54,62,62,97,97,97,97,97,97,97
|
||||||
,Aggregated,794,3,45,77.63347637743433,8.999109268188477,988.3866310119629,32404.799748110832,6.71951028381598,0.025388577898549043,45,62,78,93,160,230,460,610,990,990,990,990
|
,Aggregated,170,0,40,99.35710009406594,3.9975643157958984,746.5388774871826,29734.95294117647,7.303252637138057,0.0,41,53,70,110,380,580,600,680,750,750,750,750
|
||||||
|
|
@ -1,61 +1,15 @@
|
|||||||
"Timestamp","User Count","Type","Name","Requests/s","Failures/s","50%","66%","75%","80%","90%","95%","98%","99%","99.9%","99.99%","99.999%","100%","Total Request Count","Total Failure Count","Total Median Response Time","Total Average Response Time","Total Min Response Time","Total Max Response Time","Total Average Content Size"
|
"Timestamp","User Count","Type","Name","Requests/s","Failures/s","50%","66%","75%","80%","90%","95%","98%","99%","99.9%","99.99%","99.999%","100%","Total Request Count","Total Failure Count","Total Median Response Time","Total Average Response Time","Total Min Response Time","Total Max Response Time","Total Average Content Size"
|
||||||
"1594955401","1","","Aggregated",0.00,0.00,"N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A",0,0,0,0,0,0,0
|
"1594960389","0","","Aggregated",0.00,0.00,"N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A",0,0,0,0,0,0,0
|
||||||
"1594955403","5","","Aggregated",0.00,0.00,30,390,410,410,450,450,450,450,450,450,450,450,12,0,26,152,10,450,19557
|
"1594960391","1","","Aggregated",0.00,0.00,"N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A",0,0,0,0,0,0,0
|
||||||
"1594955405","9","","Aggregated",5.00,0.00,31,48,360,380,410,450,470,470,470,470,470,470,25,0,31,135,10,470,25208
|
"1594960394","5","","Aggregated",0.00,0.00,36,150,470,590,600,680,680,680,680,680,680,680,13,0,36,210,5,680,37214
|
||||||
"1594955407","13","","Aggregated",5.75,0.00,48,72,380,390,490,770,780,780,780,780,780,780,40,0,45,169,10,779,29961
|
"1594960396","9","","Aggregated",4.33,0.00,45,150,460,470,590,600,680,680,680,680,680,680,23,0,45,185,5,680,30962
|
||||||
"1594955409","17","","Aggregated",6.17,0.00,64,260,380,410,500,780,860,990,990,990,990,990,57,0,64,210,10,988,31323
|
"1594960398","13","","Aggregated",4.25,0.00,50,110,200,380,560,600,680,680,680,680,680,680,41,0,50,165,4,680,32896
|
||||||
"1594955411","20","","Aggregated",6.38,0.00,60,180,370,410,610,770,860,990,990,990,990,990,79,0,60,198,10,988,31968
|
"1594960400","17","","Aggregated",5.86,0.00,53,110,200,460,580,600,680,750,750,750,750,750,62,0,52,175,4,746,34112
|
||||||
"1594955413","20","","Aggregated",7.00,0.00,56,140,260,370,610,770,860,990,990,990,990,990,92,0,53,182,10,988,32493
|
"1594960402","20","","Aggregated",6.50,0.00,54,110,150,300,580,600,680,750,750,750,750,750,83,0,53,157,4,746,31425
|
||||||
"1594955415","20","","Aggregated",7.90,0.00,55,110,200,260,530,680,860,990,990,990,990,990,107,0,53,166,10,988,32284
|
"1594960404","20","","Aggregated",7.40,0.00,52,74,120,140,540,580,680,750,750,750,750,750,96,0,50,145,4,746,32075
|
||||||
"1594955417","20","","Aggregated",8.00,0.00,51,95,150,180,520,630,860,990,990,990,990,990,119,0,51,153,10,988,32032
|
"1594960406","20","","Aggregated",8.30,0.00,49,70,110,140,440,580,600,750,750,750,750,750,110,0,49,132,4,746,30740
|
||||||
"1594955419","20","","Aggregated",7.90,0.00,43,53,91,110,170,520,630,630,630,630,630,630,133,0,49,143,10,988,32464
|
"1594960408","20","","Aggregated",8.40,0.00,41,52,71,100,140,490,580,600,600,600,600,600,123,0,45,124,4,746,30477
|
||||||
"1594955421","20","","Aggregated",7.70,0.00,43,55,73,85,120,160,190,240,240,240,240,240,147,0,50,136,10,988,32634
|
"1594960410","20","","Aggregated",8.20,0.00,39,50,54,66,120,140,440,580,580,580,580,580,135,0,44,117,4,746,30262
|
||||||
"1594955423","20","","Aggregated",7.50,0.00,41,53,70,75,110,160,190,240,240,240,240,240,158,0,49,129,10,988,32266
|
"1594960412","20","","Aggregated",7.20,0.00,37,43,52,54,73,120,120,120,120,120,120,120,147,0,43,110,3,746,30003
|
||||||
"1594955425","20","","Aggregated",6.40,0.00,39,50,56,70,110,160,170,190,190,190,190,190,173,0,48,123,9,988,32582
|
"1594960414","20","","Aggregated",6.30,0.00,37,45,52,53,67,110,120,120,120,120,120,120,164,0,42,102,3,746,29411
|
||||||
"1594955427","20","","Aggregated",6.40,0.00,43,56,74,87,150,160,170,190,190,190,190,190,185,0,48,120,9,988,33041
|
"1594960415","0","","Aggregated",6.80,0.00,34,42,49,52,63,73,120,120,120,120,120,120,170,0,40,99,3,746,29734
|
||||||
"1594955429","20","","Aggregated",6.60,0.00,41,55,70,78,150,160,160,170,170,170,170,170,199,0,48,115,9,988,32717
|
|
||||||
"1594955431","20","","Aggregated",6.60,0.00,38,52,59,70,120,160,160,170,170,170,170,170,211,0,45,111,9,988,32736
|
|
||||||
"1594955433","20","","Aggregated",6.30,0.00,38,45,54,59,110,150,160,170,170,170,170,170,224,0,43,106,9,988,32289
|
|
||||||
"1594955435","20","","Aggregated",6.50,0.00,42,55,72,85,150,170,170,190,190,190,190,190,235,0,45,106,9,988,32805
|
|
||||||
"1594955437","20","","Aggregated",6.40,0.00,38,51,59,70,95,160,170,190,190,190,190,190,246,0,45,104,9,988,32821
|
|
||||||
"1594955439","20","","Aggregated",6.10,0.00,36,54,65,71,130,170,190,200,200,200,200,200,260,0,45,101,9,988,32811
|
|
||||||
"1594955441","20","","Aggregated",5.90,0.00,47,60,71,72,150,180,190,200,200,200,200,200,272,0,45,99,9,988,32809
|
|
||||||
"1594955443","20","","Aggregated",6.10,0.00,52,65,72,81,150,180,190,200,200,200,200,200,284,1,45,97,9,988,32796
|
|
||||||
"1594955445","20","","Aggregated",6.30,0.10,49,60,66,72,100,160,200,210,210,210,210,210,297,1,46,96,9,988,32829
|
|
||||||
"1594955447","20","","Aggregated",6.10,0.10,51,65,74,92,130,180,200,210,210,210,210,210,310,1,46,95,9,988,32921
|
|
||||||
"1594955449","20","","Aggregated",6.00,0.10,46,55,66,80,130,140,190,210,210,210,210,210,326,1,45,92,8,988,32638
|
|
||||||
"1594955451","20","","Aggregated",7.00,0.10,44,55,74,83,130,170,190,210,210,210,210,210,339,1,45,91,8,988,32716
|
|
||||||
"1594955453","20","","Aggregated",6.80,0.10,42,57,82,88,140,180,190,210,210,210,210,210,356,1,45,90,8,988,32851
|
|
||||||
"1594955455","20","","Aggregated",6.70,0.00,41,57,82,88,140,190,190,210,210,210,210,210,370,1,45,89,8,988,33034
|
|
||||||
"1594955457","20","","Aggregated",7.00,0.00,38,56,63,82,120,180,190,210,210,210,210,210,386,1,45,88,8,988,32931
|
|
||||||
"1594955459","20","","Aggregated",7.30,0.00,45,63,82,88,130,180,190,210,210,210,210,210,399,1,45,87,8,988,32863
|
|
||||||
"1594955461","20","","Aggregated",7.00,0.00,45,62,74,93,140,160,190,210,210,210,210,210,414,1,45,86,8,988,32948
|
|
||||||
"1594955463","20","","Aggregated",6.70,0.00,57,72,96,110,140,190,220,260,260,260,260,260,429,1,46,87,8,988,33186
|
|
||||||
"1594955466","20","","Aggregated",7.30,0.00,58,72,93,110,140,160,220,260,260,260,260,260,441,1,45,85,8,988,33061
|
|
||||||
"1594955468","20","","Aggregated",7.20,0.00,52,62,74,110,150,170,220,260,260,260,260,260,455,1,45,85,8,988,33127
|
|
||||||
"1594955470","20","","Aggregated",7.10,0.00,47,62,73,93,150,200,220,260,260,260,260,260,472,1,45,83,8,988,32985
|
|
||||||
"1594955472","20","","Aggregated",7.10,0.00,41,60,70,73,110,170,220,270,270,270,270,270,484,1,45,84,8,988,33133
|
|
||||||
"1594955474","20","","Aggregated",7.60,0.00,39,56,73,78,110,170,220,270,270,270,270,270,498,1,45,82,8,988,32962
|
|
||||||
"1594955476","20","","Aggregated",6.80,0.00,41,56,72,77,99,150,220,270,270,270,270,270,512,1,45,81,8,988,32885
|
|
||||||
"1594955478","20","","Aggregated",7.10,0.00,43,73,85,92,110,200,240,270,270,270,270,270,525,1,45,82,8,988,32823
|
|
||||||
"1594955480","20","","Aggregated",6.90,0.00,50,76,92,97,110,190,240,290,290,290,290,290,539,1,46,82,8,988,32767
|
|
||||||
"1594955482","20","","Aggregated",6.70,0.00,58,85,110,110,150,200,280,290,290,290,290,290,553,1,47,83,8,988,32674
|
|
||||||
"1594955484","20","","Aggregated",6.80,0.00,66,90,110,110,180,240,280,290,290,290,290,290,565,1,46,82,8,988,32603
|
|
||||||
"1594955486","20","","Aggregated",6.60,0.00,70,87,110,110,150,260,290,500,500,500,500,500,578,1,47,82,8,988,32592
|
|
||||||
"1594955488","20","","Aggregated",6.50,0.00,65,81,110,130,230,410,480,500,500,500,500,500,591,1,48,84,8,988,32680
|
|
||||||
"1594955490","20","","Aggregated",6.50,0.00,70,89,120,150,260,410,480,500,500,500,500,500,600,1,48,84,8,988,32721
|
|
||||||
"1594955492","20","","Aggregated",6.10,0.00,60,79,110,160,230,410,480,500,500,500,500,500,613,2,48,84,8,988,32745
|
|
||||||
"1594955494","20","","Aggregated",5.80,0.00,60,79,110,160,230,410,480,500,500,500,500,500,625,2,48,83,8,988,32634
|
|
||||||
"1594955496","20","","Aggregated",6.10,0.10,54,73,100,150,190,280,410,480,480,480,480,480,636,2,47,83,8,988,32677
|
|
||||||
"1594955498","20","","Aggregated",6.00,0.10,49,65,73,86,170,240,280,390,390,390,390,390,649,2,47,83,8,988,32666
|
|
||||||
"1594955500","20","","Aggregated",6.00,0.10,49,58,72,73,150,170,240,390,390,390,390,390,660,2,48,82,8,988,32557
|
|
||||||
"1594955502","20","","Aggregated",5.90,0.10,47,54,58,65,73,150,240,390,390,390,390,390,679,2,47,81,8,988,32488
|
|
||||||
"1594955504","20","","Aggregated",6.60,0.10,42,51,55,58,73,130,150,390,390,390,390,390,691,2,47,80,8,988,32380
|
|
||||||
"1594955506","20","","Aggregated",6.50,0.00,45,53,58,71,130,160,190,220,220,220,220,220,708,2,47,81,8,988,32447
|
|
||||||
"1594955508","20","","Aggregated",7.00,0.00,45,54,76,87,140,170,190,220,220,220,220,220,719,2,47,81,8,988,32424
|
|
||||||
"1594955510","20","","Aggregated",6.70,0.00,45,53,70,84,140,170,190,220,220,220,220,220,733,2,47,80,8,988,32351
|
|
||||||
"1594955512","20","","Aggregated",7.10,0.00,43,53,78,90,150,170,190,220,220,220,220,220,745,2,46,79,8,988,32376
|
|
||||||
"1594955514","20","","Aggregated",6.70,0.00,40,58,70,87,150,170,190,220,220,220,220,220,761,2,46,78,8,988,32333
|
|
||||||
"1594955516","20","","Aggregated",6.80,0.00,34,43,50,53,69,90,170,170,170,170,170,170,773,2,45,78,8,988,32295
|
|
||||||
"1594955518","20","","Aggregated",6.40,0.00,34,43,55,62,89,100,170,220,220,220,220,220,787,3,46,78,8,988,32419
|
|
||||||
"1594955519","0","","Aggregated",6.40,0.00,35,43,55,64,89,100,170,220,220,220,220,220,794,3,45,77,8,988,32404
|
|
||||||
|
|
22
loadtesting/dummyusers.json.bak
Normal file
22
loadtesting/dummyusers.json.bak
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"pw": "insertpasswordhere",
|
||||||
|
"user": "insertuserhere1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pw": "insertpasswordhere",
|
||||||
|
"user": "insertuserhere2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pw": "insertpasswordhere",
|
||||||
|
"user": "insertuserhere3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pw": "insertpasswordhere",
|
||||||
|
"user": "insertuserhere4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pw": "insertpasswordhere",
|
||||||
|
"user": "insertuserhere5"
|
||||||
|
}
|
||||||
|
]
|
@ -10,6 +10,9 @@ import json
|
|||||||
with open("./../CalibreWebCompanion/settings.json", "r") as jfile:
|
with open("./../CalibreWebCompanion/settings.json", "r") as jfile:
|
||||||
calpath = json.load(jfile)["CALIBRE_DIR"] + "\\metadata.db"
|
calpath = json.load(jfile)["CALIBRE_DIR"] + "\\metadata.db"
|
||||||
|
|
||||||
|
with open("dummyusers.json", "r") as jfile:
|
||||||
|
users = json.load(jfile)
|
||||||
|
|
||||||
engine = create_engine(f'sqlite:///{calpath}')
|
engine = create_engine(f'sqlite:///{calpath}')
|
||||||
Base = declarative_base(engine)
|
Base = declarative_base(engine)
|
||||||
|
|
||||||
@ -96,48 +99,48 @@ class UserBehavior(HttpUser):
|
|||||||
""" on_start is called when a Locust start before any task is scheduled """
|
""" on_start is called when a Locust start before any task is scheduled """
|
||||||
r = self.client.get('/accounts/login/')
|
r = self.client.get('/accounts/login/')
|
||||||
self.client.headers['Referer'] = self.client.base_url
|
self.client.headers['Referer'] = self.client.base_url
|
||||||
n = random.randint(0, 5)
|
user = randlist(users)
|
||||||
self.client.post('/accounts/login/',
|
self.client.post('/accounts/login/',
|
||||||
{
|
{
|
||||||
"username": f"performance{n}",
|
"username": user["user"],
|
||||||
"password": "profiling1234",
|
"password": user["pw"],
|
||||||
'csrfmiddlewaretoken': r.cookies["csrftoken"]
|
'csrfmiddlewaretoken': r.cookies["csrftoken"]
|
||||||
})
|
})
|
||||||
|
|
||||||
@task(10)
|
@task(1)
|
||||||
def search_by_title(self):
|
def search_by_title(self):
|
||||||
title = randlist(titles)
|
title = randlist(titles)
|
||||||
self.client.get(f"/results/?title={title}", name="search_by_title")
|
self.client.get(f"/results/?title={title}", name="search_by_title")
|
||||||
|
|
||||||
@task(10)
|
@task(1)
|
||||||
def booklist(self):
|
def booklist(self):
|
||||||
self.client.get("/books/")
|
self.client.get("/books/")
|
||||||
|
|
||||||
@task(15)
|
@task(1)
|
||||||
def bookdetail(self):
|
def bookdetail(self):
|
||||||
pk = randlist(book_ids)
|
pk = randlist(book_ids)
|
||||||
self.client.get(f"/book/{pk}", name="/book/<id>")
|
self.client.get(f"/book/{pk}", name="/book/<id>")
|
||||||
|
|
||||||
@task(10)
|
@task(1)
|
||||||
def search_by_author(self):
|
def search_by_author(self):
|
||||||
author = randlist(authors)
|
author = randlist(authors)
|
||||||
self.client.get(f"/results/?author={author}", name="search_by_author")
|
self.client.get(f"/results/?author={author}", name="search_by_author")
|
||||||
|
|
||||||
@task(6)
|
@task(1)
|
||||||
def authorlist(self):
|
def authorlist(self):
|
||||||
self.client.get("/authors/")
|
self.client.get("/authors/")
|
||||||
|
|
||||||
@task(5)
|
@task(1)
|
||||||
def authordetail(self):
|
def authordetail(self):
|
||||||
pk = randlist(author_ids)
|
pk = randlist(author_ids)
|
||||||
self.client.get(f"/author/{pk}", name="/author/<id>")
|
self.client.get(f"/author/{pk}", name="/author/<id>")
|
||||||
|
|
||||||
@task(10)
|
@task(1)
|
||||||
def search_by_id(self):
|
def search_by_id(self):
|
||||||
id_ = randlist(identifiers)
|
id_ = randlist(identifiers)
|
||||||
self.client.get(f"/results/?identifier={id_}", name="search_by_identifier")
|
self.client.get(f"/results/?identifier={id_}", name="search_by_identifier")
|
||||||
|
|
||||||
@task(20)
|
@task(1)
|
||||||
def search_generic(self):
|
def search_generic(self):
|
||||||
t = random.randint(0, 3)
|
t = random.randint(0, 3)
|
||||||
if not t:
|
if not t:
|
||||||
@ -148,7 +151,7 @@ class UserBehavior(HttpUser):
|
|||||||
term = randlist(identifiers)
|
term = randlist(identifiers)
|
||||||
self.client.get(f"/results/?generic={term}", name="search_generic")
|
self.client.get(f"/results/?generic={term}", name="search_generic")
|
||||||
|
|
||||||
@task(8)
|
@task(1)
|
||||||
def searchbad(self):
|
def searchbad(self):
|
||||||
self.client.get("/search/")
|
self.client.get("/search/")
|
||||||
|
|
||||||
@ -156,29 +159,29 @@ class UserBehavior(HttpUser):
|
|||||||
def ratingslist(self):
|
def ratingslist(self):
|
||||||
self.client.get("/ratings/")
|
self.client.get("/ratings/")
|
||||||
|
|
||||||
@task(10)
|
@task(1)
|
||||||
def ratingdetail(self):
|
def ratingdetail(self):
|
||||||
pk = randlist(rating_ids)
|
pk = randlist(rating_ids)
|
||||||
self.client.get(f"/rating/{pk}", name="/rating/<id>")
|
self.client.get(f"/rating/{pk}", name="/rating/<id>")
|
||||||
|
|
||||||
@task(5)
|
@task(1)
|
||||||
def taglist(self):
|
def taglist(self):
|
||||||
self.client.get("/tags/")
|
self.client.get("/tags/")
|
||||||
|
|
||||||
@task(10)
|
@task(1)
|
||||||
def tagdetail(self):
|
def tagdetail(self):
|
||||||
pk = randlist(tag_ids)
|
pk = randlist(tag_ids)
|
||||||
self.client.get(f"/tag/{pk}", name="/tag/<id>")
|
self.client.get(f"/tag/{pk}", name="/tag/<id>")
|
||||||
|
|
||||||
@task(4)
|
@task(1)
|
||||||
def serieslist(self):
|
def serieslist(self):
|
||||||
self.client.get("/series/")
|
self.client.get("/series/")
|
||||||
|
|
||||||
@task(4)
|
@task(1)
|
||||||
def publisherlist(self):
|
def publisherlist(self):
|
||||||
self.client.get("/publishers/")
|
self.client.get("/publishers/")
|
||||||
|
|
||||||
@task(4)
|
@task(1)
|
||||||
def publisherdetail(self):
|
def publisherdetail(self):
|
||||||
pk = randlist(publisher_ids)
|
pk = randlist(publisher_ids)
|
||||||
self.client.get(f"/publisher/{pk}", name="/publisher/<id>")
|
self.client.get(f"/publisher/{pk}", name="/publisher/<id>")
|
||||||
|
@ -4,3 +4,4 @@ django-debug-toolbar>=2.2
|
|||||||
django-silk>=4.0
|
django-silk>=4.0
|
||||||
locust>=1.1
|
locust>=1.1
|
||||||
sqlalchemy>=1.3.15
|
sqlalchemy>=1.3.15
|
||||||
|
rich>=3.0
|
||||||
|
Loading…
Reference in New Issue
Block a user