Skip to content
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

[#29] Add RCU-based node synchronization #32

Merged
merged 2 commits into from
Jan 10, 2024
Merged

Conversation

maypok86
Copy link
Owner

@maypok86 maypok86 commented Jan 10, 2024

Description

Added RCU mechanism to synchronize nodes to improve throughput for read-heavy workloads.

Related issue(s)

#29

✅ Checklist for your Pull Request

Related changes (conditional)

  • Tests

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from
      silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
  • Public contracts

    • My changes doesn't break project license.

Stylistic guide (mandatory)

  • My code complies with the styles guide.

  • My commit history is clean (only contains changes relating to my
    issue/pull request and no reverted-my-earlier-commit changes) and commit
    messages start with identifiers of related issues in square brackets.

    Example: [#42] Short commit description

    If necessary both of these can be achieved even after the commits have been
    made/pushed using rebase and squash.

Before merging (mandatory)

  • Check target branch of PR is set correctly

@maypok86
Copy link
Owner Author

RCU implementation benchmark results

reads=100%,writes=0%

BenchmarkCache/Zipf_Theine_reads=100%,writes=0%-8               10349106               112.6 ns/op         8884000 ops/s               0 B/op          0 allocs/op
BenchmarkCache/Zipf_Ristretto_reads=100%,writes=0%-8            49931085                23.92 ns/op       41810856 ops/s              16 B/op          1 allocs/op
BenchmarkCache/Zipf_Bigcache_reads=100%,writes=0%-8             28777293                38.36 ns/op       26065651 ops/s              96 B/op          2 allocs/op
BenchmarkCache/Zipf_Fastcache_reads=100%,writes=0%-8            39766262                30.36 ns/op       32937979 ops/s              47 B/op          0 allocs/op
BenchmarkCache/Zipf_Otter_reads=100%,writes=0%-8                235988992                4.341 ns/op     230386735 ops/s               0 B/op          0 allocs/op

reads=75%,writes=25%

BenchmarkCache/Zipf_Theine_reads=75%,writes=25%-8               11396006               110.0 ns/op         9086818 ops/s               0 B/op          0 allocs/op
BenchmarkCache/Zipf_Ristretto_reads=75%,writes=25%-8            26357984                43.93 ns/op       22764242 ops/s              27 B/op          1 allocs/op
BenchmarkCache/Zipf_Bigcache_reads=75%,writes=25%-8             17619958                61.52 ns/op       16255889 ops/s             106 B/op          1 allocs/op
BenchmarkCache/Zipf_Fastcache_reads=75%,writes=25%-8            20699691                53.26 ns/op       18777461 ops/s              43 B/op          0 allocs/op
BenchmarkCache/Zipf_Otter_reads=75%,writes=25%-8                175828222                6.885 ns/op     145241010 ops/s               2 B/op          0 allocs/op

reads=50%,writes=50%

BenchmarkCache/Zipf_Theine_reads=50%,writes=50%-8               13321800                88.12 ns/op       11347991 ops/s               0 B/op          0 allocs/op
BenchmarkCache/Zipf_Ristretto_reads=50%,writes=50%-8            24131536                46.66 ns/op       21430106 ops/s              34 B/op          1 allocs/op
BenchmarkCache/Zipf_Bigcache_reads=50%,writes=50%-8             15962000                64.46 ns/op       15513236 ops/s             111 B/op          1 allocs/op
BenchmarkCache/Zipf_Fastcache_reads=50%,writes=50%-8            22703031                52.41 ns/op       19081654 ops/s              39 B/op          0 allocs/op
BenchmarkCache/Zipf_Otter_reads=50%,writes=50%-8                98488806                12.23 ns/op       81767462 ops/s               6 B/op          0 allocs/op

reads=25%,writes=75%

BenchmarkCache/Zipf_Theine_reads=25%,writes=75%-8               13288441                93.63 ns/op       10680849 ops/s               0 B/op          0 allocs/op
BenchmarkCache/Zipf_Ristretto_reads=25%,writes=75%-8            18387763                60.40 ns/op       16555249 ops/s              58 B/op          1 allocs/op
BenchmarkCache/Zipf_Bigcache_reads=25%,writes=75%-8             15162562                68.59 ns/op       14578993 ops/s             196 B/op          0 allocs/op
BenchmarkCache/Zipf_Fastcache_reads=25%,writes=75%-8            26483512                47.32 ns/op       21130859 ops/s              23 B/op          0 allocs/op
BenchmarkCache/Zipf_Otter_reads=25%,writes=75%-8                52577490                21.35 ns/op       46847349 ops/s              10 B/op          0 allocs/op

reads=0%,writes=100%

BenchmarkCache/Zipf_Theine_reads=0%,writes=100%-8               29246624                40.11 ns/op       24930841 ops/s               0 B/op          0 allocs/op
BenchmarkCache/Zipf_Ristretto_reads=0%,writes=100%-8             9018708               130.6 ns/op         7656527 ops/s             122 B/op          3 allocs/op
BenchmarkCache/Zipf_Bigcache_reads=0%,writes=100%-8             13730578                81.44 ns/op       12279430 ops/s             262 B/op          0 allocs/op
BenchmarkCache/Zipf_Fastcache_reads=0%,writes=100%-8            24452991                47.78 ns/op       20928754 ops/s               0 B/op          0 allocs/op
BenchmarkCache/Zipf_Otter_reads=0%,writes=100%-8                10735712               121.4 ns/op         8236607 ops/s              64 B/op          1 allocs/op

Considering that cache loads are usually read-heavy, even reads=50%,writes=50% are rare, and otter starts degrading only under very heavy write load, the results are just great.

@maypok86 maypok86 merged commit aa5896c into main Jan 10, 2024
5 checks passed
@maypok86 maypok86 deleted the maypok86/#29-rcu-based-sync branch January 10, 2024 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant