Skip to content

Optimize HRANDFIELD and ZRANDMEMBER case 3 when listpack encoded#12205

Merged
oranagra merged 4 commits intoredis:unstablefrom
enjoy-binbin:srandmember_order
May 22, 2023
Merged

Optimize HRANDFIELD and ZRANDMEMBER case 3 when listpack encoded#12205
oranagra merged 4 commits intoredis:unstablefrom
enjoy-binbin:srandmember_order

Conversation

@enjoy-binbin
Copy link
Contributor

@enjoy-binbin enjoy-binbin commented May 19, 2023

Optimized HRANDFIELD and ZRANDMEMBER commands as in #8444,
CASE 3 under listpack encoding. Boost optimization to CASE 2.5.

CASE 2.5 listpack only. Sampling unique elements, in non-random order.
Listpack encoded hashes / zsets are meant to be relatively small, so
HRANDFIELD_SUB_STRATEGY_MUL / ZRANDMEMBER_SUB_STRATEGY_MUL
isn't necessary and we rather not make copies of the entries. Instead, we
emit them directly to the output buffer.

Simple benchmarks shows it provides some 400% improvement in HRANDFIELD
and ZRANGESTORE both in CASE 3.

Unrelated changes: remove useless setTypeRandomElements and fix a typo.

hash: a simple benchmark (listpack with 500 entries):

src/redis-cli hset hash 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999

unstable:

src/redis-benchmark -P 100 -n 400000 hrandfield hash 200
Summary:
  throughput summary: 5713.80 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
      674.346    17.024   769.023   813.055   843.775  1291.263

this branch:

src/redis-benchmark -P 100 -n 400000 hrandfield hash 200
Summary:
  throughput summary: 24100.74 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
      106.469     4.440   110.335   153.599   173.183   188.415

zset: a simple benchmark (listpack with 121 entries):

src/redis-cli zadd zset 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240

unstable:

Summary:
  throughput summary: 25461.49 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
      175.624     5.064   189.183   207.615   217.087   239.999

this branch:

src/redis-benchmark -P 100 -n 400000 zrandmember zset 50
Summary:
  throughput summary: 98546.44 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
       39.635     3.328    38.783    47.487    63.551    74.175

In redis#11290, we added listpack encoding to set, and added CASE 2.5
to SRANDMEMBER. This algorithm provides better performance, but
doesn't provide random order.

The order at which the members are returned is important. We provide
this random order in HRANDFIELD and ZRANDMEMBER case 3. So for
SRANDMEMBER we need to do the same.

Note that this change will degrade CASE 3 performance by a factor of 3.

Unrelated changes: remove useless setTypeRandomElements and fix a typo.
@enjoy-binbin enjoy-binbin requested a review from zuiderkwast May 19, 2023 16:47
@enjoy-binbin
Copy link
Contributor Author

simple random order test:

src/redis-cli sadd myset a b c d e 1 2 3 4 5 aa bb cc dd ee 11 22 33 44 55
src/redis-cli srandmember myset 8

unstable:

[root@binblog redis]# src/redis-cli srandmember myset 8
1) "a"
2) "c"
3) "2"
4) "bb"
5) "cc"
6) "dd"
7) "33"
8) "44"
[root@binblog redis]# src/redis-cli srandmember myset 8
1) "a"
2) "b"
3) "c"
4) "4"
5) "aa"
6) "cc"
7) "22"
8) "55"
[root@binblog redis]# src/redis-cli srandmember myset 8
1) "c"
2) "d"
3) "2"
4) "4"
5) "cc"
6) "11"
7) "22"
8) "44"

this branch:

[root@binblog redis]# src/redis-cli srandmember myset 8
1) "3"
2) "ee"
3) "2"
4) "bb"
5) "11"
6) "5"
7) "55"
8) "d"

[root@binblog redis]# src/redis-cli srandmember myset 8
1) "dd"
2) "ee"
3) "4"
4) "e"
5) "bb"
6) "44"
7) "55"
8) "c"

[root@binblog redis]# src/redis-cli srandmember myset 8
1) "1"
2) "cc"
3) "dd"
4) "3"
5) "bb"
6) "11"
7) "5"
8) "aa"

simple benchmark:

src/redis-cli sadd myset a b c d e 1 2 3 4 5 aa bb cc dd ee 11 22 33 44 55
src/redis-benchmark -P 100 -n 400000 srandmember myset 8

unstable:

Summary:
  throughput summary: 428265.53 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
       11.343     3.696    11.279    15.111    16.863    21.407

this branch:

Summary:
  throughput summary: 140301.64 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
       35.017     2.616    34.495    51.615    52.831    63.359

Copy link
Contributor

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the docs, "The order of elements in the reply is not truly random, so it is up to the client to shuffle them if needed".

The algorithm was optimized for the documented behaviour.

I don't really like the idea "looking like random but not really random". It sounds a bit like security by obscurity.

Why is this behaviour important?

@oranagra
Copy link
Member

i may be missing something (have a blackout), but what i see is this:

  1. in add hrandmember command #8219 the focus of conversation was efficient sampling from ziplist (without re-seeing into the middle of the ziplist again and again), the PR initially attempted to return a NON-random order for CASE 1, and that's what the comment was about.
  2. in Optimize HRANDFIELD and ZRANDMEMBER case 4 when ziplist encoded #8444 (which is the PR that brought the above no-re-seek algorithm into our code base), we added ziplistRandomPairs and ziplistRandomPairsUnique, and the comment above the later says the order of the picked entries is NOT-random (and that's what we use for CASE 4). that's also what we do today (lpRandomPairsUnique used in CASE 4 is non-random order)
  3. in Listpack encoding for sets #11290, we explicitly wrote that CASE 2.5 listpack only. Sampling unique elements, in non-random order

so the way i see it, like the docs say, if the count is positive, we return unique, but non-random order.
am i missing anything?

@enjoy-binbin
Copy link
Contributor Author

enjoy-binbin commented May 21, 2023

ohh, thanks for the details. ok, does this mean we can also use #8444 to optimize CASE 3? It can also improve the performance of CASE 3

a simple benchmark (listpack with 500 entries):

src/redis-cli hset hash 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999

unstable case3:

# case 3
src/redis-benchmark -P 100 -n 400000 hrandfield hash 200
Summary:
  throughput summary: 5713.80 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
      674.346    17.024   769.023   813.055   843.775  1291.263

case 3 (use the same CASE 4 way):

src/redis-benchmark -P 100 -n 400000 hrandfield hash 200
Summary:
  throughput summary: 24100.74 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
      106.469     4.440   110.335   153.599   173.183   188.415

@oranagra
Copy link
Member

Yeah. Seems like a good idea

@enjoy-binbin enjoy-binbin changed the title SRANDMEMBER case 3 random order when listpack encoded Optimize HRANDFIELD and ZRANDMEMBER case 3 when listpack encoded May 21, 2023
Copy link
Member

@oranagra oranagra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, so to sum up,
in t_set.c, we have case 2.5 using lpNextRandom (without any need to allocate a buffer to hold the results).
but in t_hash.c and t_zset.c we can't use it because we need pairs, so instead we pre-allocate a buffer to use lpRandomPairsUnique.

p.s. i suppose we can adjust lpNextRandom to handle pairs as well, if we want.

this new code code (in case 2.5 in hash and zset) is the same code that used to be in case 4 only, and now we moved it to case 2.5 (effectively applying it to case 3 as well).
so the only impact of this PR on efficiency is for what used to be case 3.

@zuiderkwast
Copy link
Contributor

p.s. i suppose we can adjust lpNextRandom to handle pairs as well, if we want.

There is already an even_only flag to lpNextRandom. I suppose it can be used to get random pairs.

@enjoy-binbin
Copy link
Contributor Author

I've tried using lpNextRandom before, the code is like this (maybe i wrote it wrong):

    if (zsetobj->encoding == OBJ_ENCODING_LISTPACK) {
        unsigned char *lp = zsetobj->ptr;
        unsigned char *p = lpFirst(lp);
        unsigned int index = 0;
        unsigned char *str = NULL;
        unsigned int len = 0;
        long long llele = 0;
        while (count) {
            if (withscores && c->resp > 2)
                addReplyArrayLen(c,2);

            p = lpNextRandom(lp, p, &index, count--, 1);

            str = lpGetValue(p, &len, (long long *)&llele);
            if (str == NULL) {
                addReplyBulkLongLong(c, llele);
            } else {
                addReplyBulkCBuffer(c, str, len);
            }

            p = lpNext(lp, p);

            if (withscores) {
                str = lpGetValue(p, &len, (long long *)&llele);
                if (str == NULL) {
                    addReplyDouble(c, llele);
                } else {
                    addReplyDouble(c, zzlStrtod(str, len));
                }
            }

            index++;
        }
        return;
    }

But his performance doesn't seem to be that good. like this branch:

src/redis-benchmark -P 100 -n 400000 zrandmember zset 50
Summary:
  throughput summary: 100175.30 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
       39.588     3.768    39.839    47.327    69.951    83.967

src/redis-benchmark -P 100 -n 400000 zrandmember zset 50 withscores
Summary:
  throughput summary: 65030.07 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
       48.079     3.184    48.895    57.023    64.063    96.255

using lpNextRandom with even_flag:

src/redis-benchmark -P 100 -n 400000 zrandmember zset 50
Summary:
  throughput summary: 92785.90 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
       42.327     4.088    41.599    52.319    56.799    72.895

src/redis-benchmark -P 100 -n 400000 zrandmember zset 50 withscores
Summary:
  throughput summary: 60855.01 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
       51.453     2.952    51.871    61.631    67.839    73.407

@zuiderkwast
Copy link
Contributor

zuiderkwast commented May 22, 2023

@enjoy-binbin That's surprising results. I would have guessed the algorithm without allocations would be faster than the one with allocations.

Maybe when the benchmark is run with the same size command every time (50 elements) and only one connection, the same allocation (the same memory in the allocator) is used every time. Have you tried the benchmark with --threads 2?

Maybe it behaves differently in a real deployment with many mixed commands.

@enjoy-binbin
Copy link
Contributor Author

yean, maybe. or maybe the former has a better cache hit ratio?

using --threads 2 (i am using 1c2g machine)
src/redis-benchmark -P 100 -n 400000 --threads 2 zrandmember zset 50

# this branch:
Summary:
  throughput summary: 92915.22 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
       43.950     1.872    44.607    57.183    74.111    93.695

# using even flag:
Summary:
  throughput summary: 88280.73 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
       46.909     1.152    48.351    56.799    70.463    96.255

src/redis-benchmark -P 100 -n 400000 --threads 2 zrandmember zset 50 withscores

# this branch:
Summary:
  throughput summary: 61115.36 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
       51.791     2.056    51.743    65.151    69.311    90.175

# using even flag:
Summary:
  throughput summary: 56713.46 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
       55.808     1.408    55.199    69.439    75.071    84.031

@oranagra
Copy link
Member

aren't you missing another call to lpNext()? maybe that can explain the benchmark difference too?

@enjoy-binbin
Copy link
Contributor Author

ohh right, missing a lpNext and a index++. Some performance improvements, but it is still

    if (zsetobj->encoding == OBJ_ENCODING_LISTPACK) {
        unsigned char *lp = zsetobj->ptr;
        unsigned char *p = lpFirst(lp);
        unsigned int index = 0;
        unsigned char *str = NULL;
        unsigned int len = 0;
        long long llele = 0;
        while (count) {
            if (withscores && c->resp > 2)
                addReplyArrayLen(c,2);

            p = lpNextRandom(lp, p, &index, count--, 1);

            str = lpGetValue(p, &len, &llele);
            if (str == NULL) {
                addReplyBulkLongLong(c, llele);
            } else {
                addReplyBulkCBuffer(c, str, len);
            }

            p = lpNext(lp, p);
            index++;

            if (withscores) {
                str = lpGetValue(p, &len, &llele);
                if (str == NULL) {
                    addReplyDouble(c, llele);
                } else {
                    addReplyDouble(c, zzlStrtod(str, len));
                }
            }

            p = lpNext(lp, p);
            index++;
        }
        return;
    }

new change benchmark:

Summary:
  throughput summary: 94585.01 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
       42.613     3.496    43.135    50.495    56.831    62.367

Summary:
  throughput summary: 61152.73 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
       48.664     2.712    48.415    57.343    64.575    74.495

@zuiderkwast
Copy link
Contributor

Yeah I noticed the missing lpNext and index++ but I think the algorithm is correct even without them. It does an extra iteration in the beginning if index is odd.

@oranagra
Copy link
Member

well, so i guess the malloc is relatively cheap when requesting 50 picks compared to the cache locality.
maybe it'll be more expensive when requesting 5.
in any case, i don't think we should bother with it, and we can just take which ever is easier to maintain (which is probably the current version).
any objections?

@enjoy-binbin
Copy link
Contributor Author

yes. I voted for the current version

@oranagra oranagra merged commit 006ab26 into redis:unstable May 22, 2023
@enjoy-binbin enjoy-binbin deleted the srandmember_order branch May 22, 2023 13:15
@enjoy-binbin enjoy-binbin added the release-notes indication that this issue needs to be mentioned in the release notes label Jun 7, 2023
@oranagra oranagra mentioned this pull request Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes indication that this issue needs to be mentioned in the release notes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants