Repository navigation
Conversation
|
|
||
| CHECK_MEMRECLAIM = os.getenv('MEMRECLAIM', '0') == '1' | ||
|
|
||
| JSON_FILES = [ |
There was a problem hiding this comment.
@rafie I think it's better to copy these files so it won't change without us knowing about it.
There was a problem hiding this comment.
They can become quite big and I don't want to introduce git-lfs. When it breaks, we'll fix it.
| if title is not None: | ||
| print(f"--- {title}") | ||
| pid = env.envRunner.masterProcess.pid | ||
| print(paella.sh(f'cat /proc/{pid}/status | grep ^Vm', join=False)) |
There was a problem hiding this comment.
Do we always want to print? Maybe use env.debugPrint?
There was a problem hiding this comment.
This runs only with MEMINFO=1.
There was a problem hiding this comment.
Well, I tried env.debugPrint() (with RLTest --debug-print) and got such a load of irrelevant garbage that I immediately reverted to print() (with MEMINFO=1). This is what happens when Truth (c) collides with user experience.
There was a problem hiding this comment.
Still its better to us debugPrint, debug prints should be verbose, you only enable it when you want better logging for debug. Also if you use debugPrint you will get those prints when you run with -vv.
| for i in range(0, 100): | ||
| env.execute_command('json.set', f'json{i}', '$', jfile['doc']) | ||
| title += f" t={datetime.timedelta(seconds=time.monotonic() - t0)}" | ||
| checkEnvMem(env, expected_vsz=jfile['vsz'], vsz0=vsz0, title=title) |
There was a problem hiding this comment.
Also here and other print - do we always want to print?
What is vsz0 in right-hand-side of vsz0=vsz0 ?
There was a problem hiding this comment.
This is a named argument.
| delete() | ||
| add_and_check(f"add after del (keys {fi})") | ||
| env.execute_command('flushall') | ||
| env.stop() |
There was a problem hiding this comment.
Can we also check mem here? Should be the initial mem before adding any key?
There was a problem hiding this comment.
Redis does not give memory back that easily. It's hard to get a consistent behavior (not like with fields, where we manage memory ourselves).
| print(f"--- {title}") | ||
| pid = env.envRunner.masterProcess.pid | ||
| print(paella.sh(f'cat /proc/{pid}/status | grep ^Vm', join=False)) | ||
| mem = envMem(env) |
There was a problem hiding this comment.
Do you prefer redis-server internal indications over system ones when investigating memory issues?
In most cases you'll be measuring vsz anyway so why not use it in the first place?
There was a problem hiding this comment.
info memory gives you both RSS and the memory Redis think it consumes so I do not see why not use it instead of using env.envRunner.masterProcess.pid which is internal to RLTest and might change someday and break this test.
| def add_and_check(title): | ||
| t0 = time.monotonic() | ||
| for i in range(0, 100): | ||
| env.execute_command('json.set', f'json{i}', '$', jfile['doc']) |
There was a problem hiding this comment.
I would make jfile as an argument to the function, its not clear where it is coming from..
There was a problem hiding this comment.
it's coming from the closure, but I can add.
| t0 = time.monotonic() | ||
| for i in range(0, 100): | ||
| env.execute_command('json.del', f'json{i}') | ||
| print(f"--- del: t={datetime.timedelta(seconds=time.monotonic() - t0)}") |
| fi = 0 | ||
| for jfile in JSON_FILES: | ||
| fi += 1 | ||
| env = Env() |
There was a problem hiding this comment.
You should not create more than one env inside a test, either use the same env or make multiple tests.
| fi = 0 | ||
| for jfile in JSON_FILES: | ||
| fi += 1 | ||
| env = Env() |
There was a problem hiding this comment.
Do not create more than one env inside a test
| t0 = time.monotonic() | ||
| for i in range(0, 100): | ||
| env.execute_command('json.del', 'json', f'json{i}') | ||
| print(f"--- del: t={datetime.timedelta(seconds=time.monotonic() - t0)}") |
| {'file': 'https://raw.githubusercontent.com/mloskot/json_benchmark/master/data/canada.json', | ||
| 'vsz': 2880000 if SERDE_JSON else 598000}, | ||
| {'file': 'https://raw.githubusercontent.com/RichardHightower/json-parsers-benchmark/master/data/citm_catalog.json', | ||
| 'vsz': 847000 if SERDE_JSON else 200000}, |
There was a problem hiding this comment.
Why not run the tests both with serde_json and ijson?
There was a problem hiding this comment.
but they do. when we run with serde_json, SERDE_JSON env var is 1.
There was a problem hiding this comment.
I meant why you want to control it from outside and not just run on both here?
There was a problem hiding this comment.
There's a full cycle of tests running with JSON_BACKEND SERDE_JSON, and when this is the case, we'll be testing it's memory usage. Otherwise, we'll be doing both backends on each cycle, which is redundant and somewhat confusing.
MeirShpilraien
left a comment
There was a problem hiding this comment.
Only review the tests part without the build changes.
No description provided.