Episode 19: Nextcloud AIO, OpenCloud and Seafile measured with the same test data on the same server
This commit is contained in:
parent
76a3132a17
commit
145d318452
70 changed files with 3296 additions and 0 deletions
21
filesync/gen-testset.py
Normal file
21
filesync/gen-testset.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Einheitlicher Testsatz Folge 19: 5000 kleine Dateien (zufaellige Bytes, 1 KiB bis 79 KiB,
|
||||
Seed fest) in einem flachen Ordner plus eine 2-GiB-Datei. Zufallsbytes, damit keine
|
||||
Kompression oder Deduplizierung einem Produkt hilft.
|
||||
Aufruf: gen-testset.py ZIELORDNER"""
|
||||
import os, random, sys
|
||||
root = sys.argv[1]
|
||||
small = os.path.join(root, 'small'); big = os.path.join(root, 'big')
|
||||
os.makedirs(small, exist_ok=True); os.makedirs(big, exist_ok=True)
|
||||
rnd = random.Random(19)
|
||||
total = 0
|
||||
for i in range(1, 5001):
|
||||
n = rnd.randint(1024, 80895)
|
||||
with open(os.path.join(small, f'doc-{i:05d}.bin'), 'wb') as f:
|
||||
f.write(os.urandom(n))
|
||||
total += n
|
||||
with open(os.path.join(big, 'big.bin'), 'wb') as f:
|
||||
chunk = 64 * 1024 * 1024
|
||||
for _ in range(32): # 32 x 64 MiB = 2 GiB
|
||||
f.write(os.urandom(chunk))
|
||||
print(f'small: 5000 files, {total} bytes ({total/2**20:.1f} MiB); big: 2147483648 bytes (2.00 GiB)')
|
||||
Loading…
Add table
Add a link
Reference in a new issue