-
Notifications
You must be signed in to change notification settings - Fork 23.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] add idle rax (with benchmarks) #7990
base: unstable
Are you sure you want to change the base?
Conversation
@johncantrell97 thanks! i will go over the results and keep you posted |
@johncantrell97 thanks for looking into this.
p.s. converting this PR to draft (which is true), in order to hide the test failures due to build warnings. when it's time to be tested, feel free to convert back. |
Thanks for the feedback! I wasn't really sure the best way to measure memory usage here. I was also surprised by the overhead, doesn't the fact that I used short field+value pairs not really matter because the data isn't duplicated just the reference to the entry?
Thanks, the test failures from the warning is just because I have unused variables in some unfinished code where we handle failures for insertion. Wasn't going to bother thinking through it if the idea is thrown away. |
yeah, just a draft sloppy coding to test an idead.. i see the errors are til here though (bothering my eyes). regarding the lengths of the fields and values, we're measuring % increase of memory usage (gotta compare it to something), so if you had more fields, or longer values, the % increase will be lower. |
3aa8fde
to
f472009
Compare
So I tried to make the optimization you mentioned though I'm not a C programmer so I'm not sure it's exactly how to do it. It definitely doesn't compile on 32-bit machines because I'm trying to cast the pointer to a uint64 so I'd have to fix that code if it's even the right approach. Regardless, the key is now only 128 bits total and the value is NULL and the size increase is still large for some reason. Using INFO MEMORY now though: used_memory:183852184 used_memory:94070592 |
@johncantrell97 i'm not sure what test the measurements you posted refer to. i see in your initial test, we had 102mb RSS with unstable, and 155mb with the modified version (which had 24 bytes key and 8 byte value). Looking at the code it seems right (16 bytes key and 0 bytes value), one explanation for it might be that the rax tree is more diverged now, and the only way for that to happen is if the bytes at the beginning of the key (the If that's the case, the first question we should be asking ourselves is if this test is representative (so many records with very similar delivery_time)? maybe we need to scale down this test and use another theory is that maybe we have a bug and it's undetected because we didn't assert to check the return value of raxRemove? (not sure if the test you're doing is reaching that code) regarding 32bit, don't worry about it for now, we'll solve it later, and also avoid storing the extra 4 bytes in that case. |
there are two issues with the "pointer-in-the-key" approach:
we have two options:
|
@guybe7 a few points from our discussion that you forgot to mention: the two problems you mentioned above (random pointers, and defrag) are not the main problem (defrag can be easily resolved, and the pointers will be more similar if we store them in bigendian). regarding further testing, apart from short strings, what affects the results of this test greatly is that the XADD and XREADGROUP where both done very fast, so the stream IDs and delivery times are all very very similar. |
|
As discussed with @guybe7 in #7973
This is a test of adding a new rax for consumer groups and consumers that stores a PEL indexed on the entries delivery_time. This will allow for a more efficient and easier to use implementation of XAUTOCLAIM.
This test adds 1,000,000 entries to a stream where each entry just has a single field/value of the strings "field" and "value" via
redis.xadd(["mystream",'*','field','value'])
they are then all consumed by a single consumer using
xreadgroup
I ran the benchmark a couple times on each
unstable
andidle-pel
branch and the numbers are stable. I used/proc/<pid>/status
to measure memory usage.Before Running Benchmark
UNSTABLE RESULTS
IDLE-PEL RESULTS
If this idea is considered viable then there is still more work to do on the PR to get it ready to be merged but I think the changes were enough to generate a valid benchmark.