@diana - I have 5 test users on my cloned production instance with anywhere from 5k to 200k documents each. I’ve written a test script to query the /api/v1/initial-replication/get-ids API 5 times for each user. We can then average together the times. The users on the cloned instance have had their passwords reset to be all the same using curl.
I’ll record a CSV of the results for 4.21 and then re-run script after we upgrade to cinque version. Here’s an example of what data will look like:
user docs seconds cht-version
foo 232021 3434.23 4.21
smang 12002 423.01 4.21
And here’s the python script I’m using:
import time
import subprocess
import requests
import os
def run_command(command):
proc = subprocess.Popen(
command,
shell=True,
executable="/bin/bash",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
return proc.communicate()
def check_docs(user, type):
start_time = time.time()
password = 'SHARED-PASSWORD-HERE'
api = '/api/v1/initial-replication/get-ids'
full_url = f"https://{user}:{password}@lumbini-cinque-test.dev.medicmobile.org{api}"
command = f"curl -qs '{full_url}' | jq -r '.doc_ids_revs | length'"
try:
doc_count, err = run_command(command)
except Exception as e:
print(f"FAIL: {user} doc count couldn't be fetched. Error: ({e})")
return False
if not isinstance(int(doc_count.decode().strip()), int):
print(f"FAIL: {user} doc count isn't an integer, got: {err}")
return False
try:
end_time = time.time()
total_time = end_time - start_time
print(f"{user},{int(doc_count.decode().strip())},{round(total_time,4)},{type}")
except Exception as e:
print(f"FAIL: {user} couldn't output results. Error: ({e})")
return False
num = 5
for _ in range(num):
check_docs('foo',"4.21")
check_docs('bar',"4.21")
check_docs('bash',"4.21")
check_docs('quuux',"4.21")
check_docs('smang',"4.21")
cc @binod