Skip to content

Add configurable cache sizes for MongoDB#1513

Merged
hackerwins merged 1 commit into
mainfrom
cache-flag
Sep 19, 2025
Merged

Add configurable cache sizes for MongoDB#1513
hackerwins merged 1 commit into
mainfrom
cache-flag

Conversation

@hackerwins

@hackerwins hackerwins commented Sep 19, 2025

Copy link
Copy Markdown
Member

What this PR does / why we need it:

Add configurable cache sizes for MongoDB

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


Additional documentation:


Checklist:

  • Added relevant tests or not required
  • Addressed and resolved all CodeRabbit review comments
  • Didn't break anything

Summary by CodeRabbit

  • New Features
    • Per-cache Mongo sizing exposed via CLI flags and matching config fields with sensible defaults; applied when Mongo is enabled.
  • Documentation
    • Sample server config updated with cache options and cache-statistics settings (enable, interval, per-cache sizes).
  • Tests
    • Test suites updated to exercise per-cache sizing and cache-statistics settings.
  • Bug Fixes
    • Cache statistics interval parsing is now strict; invalid values no longer fall back silently.

@coderabbitai

coderabbitai Bot commented Sep 19, 2025

Copy link
Copy Markdown

Walkthrough

Adds per-cache sizing and cache-stats configuration for Mongo, exposes CLI flags and config defaults, and wires them into server startup; mongo.Dial now creates a shared cache.Manager and initializes/registers client, doc, change, and vector caches using configured sizes.

Changes

Cohort / File(s) Change Summary
Server CLI & startup
cmd/yorkie/server.go
Added CLI flags --mongo-client-cache-size, --mongo-doc-cache-size, --mongo-change-cache-size, --mongo-vector-cache-size and pass values into Mongo config when mongoConnectionURI is set.
Server config & defaults
server/config.go, server/config.sample.yml
Added defaults DefaultMongoCacheStatsInterval, DefaultMongoClientCacheSize, DefaultMongoDocCacheSize, DefaultMongoChangeCacheSize, DefaultMongoVectorCacheSize; ensureMongoDefaultValue populates cache-related fields; sample YAML updated with CacheStats and per-cache keys.
Mongo backend config
server/backend/database/mongo/config.go
Added public config fields CacheStatsInterval, ClientCacheSize, DocCacheSize, ChangeCacheSize, VectorCacheSize (with YAML tags); ParseCacheStatsInterval removed default fallback and now parses the provided value.
Mongo client initialization
server/backend/database/mongo/client.go
Added cacheManager *cache.Manager to Client; Dial creates a shared cache.Manager, builds four LRU caches using config sizes (client/doc/change/vector), registers them with the manager, and assigns manager to the Client.
Tests & helpers
test/helper/helper.go, test/..., server/..._test.go, test/complex/*, server/packs/pushpull_test.go, test/integration/*
Introduced test constants for CacheStatsInterval and per-cache sizes; updated many test Mongo config literals to set CacheStatsInterval and per-cache sizes (Client/Doc/Change/Vector).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant CLI as CLI flags
  participant Server as Server init
  participant Config as Mongo Config
  participant MongoDial as mongo.Dial
  participant CacheMgr as cache.Manager
  participant Caches as LRU Caches

  Note over CLI,Server: Startup reads CLI flags
  CLI->>Server: --mongo-*-cache-size values
  Server->>Config: set Mongo cache fields
  Server->>MongoDial: mongo.Dial(conf)
  MongoDial->>CacheMgr: cache.NewManager(parseInterval)
  CacheMgr-->>MongoDial: manager
  MongoDial->>Caches: create client/doc/change/vector caches using conf.*CacheSize
  MongoDial->>CacheMgr: register caches
  MongoDial->>Server: return Client{..., cacheManager}
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested Labels

enhancement 🌟

Suggested Reviewers

  • krapie

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Add configurable cache sizes for MongoDB" accurately and concisely reflects the primary change in the diff: introducing per-cache configuration fields, CLI flags, defaults, and wiring those values into the MongoDB client and tests for client/doc/change/vector caches. It is specific to the main functionality (configurable Mongo cache sizes) and avoids noise or unrelated details. A reviewer scanning PR history will understand the principal intent from the title alone.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cache-flag

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@hackerwins hackerwins marked this pull request as ready for review September 19, 2025 02:53
@hackerwins hackerwins force-pushed the cache-flag branch 2 times, most recently from 9d0c6e9 to bfbab84 Compare September 19, 2025 03:04

@hackerwins-yorkie hackerwins-yorkie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

k6 Load Test 📊

This is a comparison result between the previous(8458791) and the current commit(b250165).

Change

Metric Previous Current Change
transaction_time.avg 6550.12 6612.20 🔴 +0.95%
http_req_duration.avg 53.31 59.76 🔴 +12.12%
http_req_duration.p(95) 233.01 248.01 🔴 +6.43%
iteration_duration.avg 6550.16 6612.24 🔴 +0.95%
data_received.count 1,161,434,596 1,177,639,950 🔴 +1.40%
data_sent.count 62,156,494 61,576,512 🟢 -0.93%

Result

Details
    script: test/k6/presence.ts

 scenarios: (100.00%) 1 scenario, 500 max VUs, 3m0s max duration (incl. graceful stop):
          * default: Up to 500 looping VUs for 2m30s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s)

█ THRESHOLDS

active_clients_time
✓ 'p(95)<500' p(95)=103ms

attach_documents_time
✓ 'p(95)<10000' p(95)=529ms

deactivate_clients_time
✓ 'p(95)<10000' p(95)=97ms

http_req_duration
✓ 'p(95)<10000' p(95)=248ms

pushpulls_time
✓ 'p(95)<1000' p(95)=226ms

transaction_success_rate
✓ 'rate>0.99' rate=100.00%

transaction_time
✓ 'p(95)<30000' p(95)=7.38s

█ TOTAL RESULTS

checks_total.......: 130896  841.671931/s
checks_succeeded...: 100.00% 130896 out of 130896
checks_failed......: 0.00%   0 out of 130896

✓ status is 200
✓ response has valid body

CUSTOM
active_clients....................: 8181    52.604496/s
active_clients_success_rate.......: 100.00% 8181 out of 8181
active_clients_time...............: avg=26.39ms  min=1ms      med=9ms     max=547ms    p(90)=74ms     p(95)=103ms
attach_documents..................: 8181    52.604496/s
attach_documents_success_rate.....: 100.00% 8181 out of 8181
attach_documents_time.............: avg=167.33ms min=3ms      med=87ms    max=861ms    p(90)=456ms    p(95)=529ms
deactivate_clients................: 8181    52.604496/s
deactivate_clients_success_rate...: 100.00% 8181 out of 8181
deactivate_clients_time...........: avg=21.2ms   min=0s       med=4ms     max=639ms    p(90)=59ms     p(95)=97ms 
pushpulls.........................: 40905   263.022478/s
pushpulls_success_rate............: 100.00% 40905 out of 40905
pushpulls_time....................: avg=64.03ms  min=1ms      med=29ms    max=908ms    p(90)=171ms    p(95)=226ms
transaction_success_rate..........: 100.00% 8181 out of 8181
transaction_time..................: avg=6.61s    min=6.01s    med=6.62s   max=8.32s    p(90)=7.2s     p(95)=7.38s

HTTP
http_req_duration.................: avg=59.76ms  min=214.98µs med=17.31ms max=855.76ms p(90)=167.96ms p(95)=248ms
  { expected_response:true }......: avg=59.76ms  min=214.98µs med=17.31ms max=855.76ms p(90)=167.96ms p(95)=248ms
http_req_failed...................: 0.00%   0 out of 65448
http_reqs.........................: 65448   420.835966/s

EXECUTION
iteration_duration................: avg=6.61s    min=6.01s    med=6.62s   max=8.32s    p(90)=7.2s     p(95)=7.38s
iterations........................: 8181    52.604496/s
vus...............................: 4       min=4              max=500
vus_max...........................: 500     min=500            max=500

NETWORK
data_received.....................: 1.2 GB  7.6 MB/s
data_sent.........................: 62 MB   396 kB/s

@hackerwins hackerwins force-pushed the cache-flag branch 3 times, most recently from f0b4792 to 9d5f1c7 Compare September 19, 2025 03:23

@hackerwins-yorkie hackerwins-yorkie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Go Benchmark Analysis 📊

This is a comparison result between the previous(8458791) and the current commit(b250165).

Significant Changes (≥20% difference)

Benchmark suite Previous Current Change
BenchmarkVersionVector/clients_10/ (7_pushpull_after_detach(ms)) 8.00 ms 4.00 ms 🟢 -50.00%
BenchmarkVersionVector/clients_100/ (3_pushpull(ms)) 4.00 ms 3.00 ms 🟢 -25.00%
BenchmarkVersionVector/clients_1000/ (3_pushpull(ms)) 3.00 ms 4.00 ms 🔴 +33.33%

Key Observations 🔍

  • The benchmark suite BenchmarkVersionVector/clients_10/ shows a significant improvement with a reduction of 50.00% in the 7_pushpull_after_detach(ms) metric.
  • In the complete benchmark comparison data for various suites, there are sporadic improvements in performance metrics such as response times, memory usage, and allocations. Most changes are within a reasonable range, with no alarming trends observed.
  • Overall, there is no consistent trend in the benchmark data, as some metrics show slight improvements while others exhibit slight degradations.

Clock Analysis

Lamport vs VersionVector

BenchmarkVersionVector Test

Version Vector (current)
Metric 10 clients 100 clients 1000 clients
Total Operation Time 112.51 ms 941.05 ms 11.34 s
Memory Allocations 8.19 MB 80.85 MB 1.69 GB
Number of Allocations (allocs/op) 62,244 allocs 621,381 allocs 24,729,968 allocs
ChangePack Size 185.00 B 185.00 B 186.00 B
Snapshot Size 399.00 B 3.10 KB 30.10 KB
Push-Pull Time 3.00 ms 3.00 ms 4.00 ms
Attach Time 5.00 ms 6.00 ms 19.00 ms
ChangePack After Detach 230.00 B 231.00 B 231.00 B
Snapshot After Detach 156.00 B 156.00 B 156.00 B
Push-Pull After Detach 4.00 ms 4.00 ms 4.00 ms

Summary for BenchmarkVersionVector Results

  • The Version Vector clock system generally shows consistent performance across different numbers of clients, with slight increases in total operation time and memory allocations as the number of clients scale up.
  • The ChangePack size and snapshot size remain stable, indicating a constant size for recorded changes and snapshots.
  • The push-pull time also shows stability, aside from a slight increase with 1000 clients.
  • The attach time increases with more clients, as expected, but the push-pull time after detach remains consistent.

BenchmarkSyncConcurrency Test

Metric Clients Lamport (v0.5.2) Version Vector (current)
Total Operation Time 1-100-10-10 7.48 s 8.16 s
100-100-10-10 9.62 s 9.26 s
300_100-10-10 14.77 s 11.34 s
Memory Allocations 1-100-10-10 1.15 GB 4.39 GB
100-100-10-10 1.45 GB 4.65 GB
300_100-10-10 2.19 GB 4.96 GB
Number of Allocations (allocs/op) 1-100-10-10 17,107,766 108,497,889
100-100-10-10 20,084,480 113,595,037
300_100-10-10 30,359,215 118,132,016

Summary for BenchmarkSyncConcurrency Results

  • The Version Vector system generally shows higher total operation times and memory allocations compared to the Lamport system across different concurrency settings.
  • Total operation time increases with higher client numbers, with Version Vector exhibiting longer times at each concurrency level.
  • Memory allocations also increase with more clients, showing that Version Vector consumes more memory compared to Lamport.
  • The number of allocations per operation is significantly higher in the Version Vector system, indicating potentially higher overhead in terms of memory management.
  • Version Vector exhibits consistent performance across different concurrency settings, albeit with higher resource consumption compared to Lamport.

Detailed Test Results

BenchmarkDeactivate
Benchmark suite Previous Current Change
deactivate_with_100_total_50_attached/ (ns/op) 118.59 ms 119.02 ms 🔴 +0.36%
deactivate_with_100_total_50_attached/ (B/op) 13.09 MB 13.17 MB 🔴 +0.64%
deactivate_with_100_total_50_attached/ (allocs/op) 153,118 allocs 153,112 allocs ⚪ 0%
deactivate_with_100_total_100_attached/ (ns/op) 243.02 ms 239.31 ms 🟢 -1.53%
deactivate_with_100_total_100_attached/ (B/op) 23.85 MB 24.25 MB 🔴 +1.68%
deactivate_with_100_total_100_attached/ (allocs/op) 308,747 allocs 308,734 allocs ⚪ 0%
BenchmarkDeletionConcurrency
Benchmark suite Previous Current Change
concurrent_text_delete_range_100/ (ns/op) 574.65 ms 575.62 ms 🔴 +0.17%
concurrent_text_delete_range_100/ (B/op) 57.14 MB 57.15 MB 🔴 +0.01%
concurrent_text_delete_range_100/ (allocs/op) 619,938 allocs 619,979 allocs ⚪ 0%
concurrent_text_delete_range_1000/ (ns/op) 4.65 s 4.66 s 🔴 +0.27%
concurrent_text_delete_range_1000/ (B/op) 344.85 MB 340.52 MB 🟢 -1.26%
concurrent_text_delete_range_1000/ (allocs/op) 5,888,591 allocs 5,886,767 allocs 🟢 -0.03%
concurrent_tree_delete_range_100/ (ns/op) 594.19 ms 594.34 ms 🔴 +0.02%
concurrent_tree_delete_range_100/ (B/op) 74.08 MB 71.38 MB 🟢 -3.65%
concurrent_tree_delete_range_100/ (allocs/op) 688,047 allocs 684,141 allocs 🟢 -0.57%
concurrent_tree_delete_range_1000/ (ns/op) 5.41 s 5.42 s 🔴 +0.14%
concurrent_tree_delete_range_1000/ (B/op) 890.73 MB 890.92 MB 🔴 +0.02%
concurrent_tree_delete_range_1000/ (allocs/op) 6,475,546 allocs 6,460,149 allocs 🟢 -0.24%
concurrent_text_edit_delete_all_100/ (ns/op) 511.20 ms 502.08 ms 🟢 -1.78%
concurrent_text_edit_delete_all_100/ (B/op) 51.00 MB 53.76 MB 🔴 +5.41%
concurrent_text_edit_delete_all_100/ (allocs/op) 526,917 allocs 526,987 allocs 🔴 +0.01%
concurrent_text_edit_delete_all_1000/ (ns/op) 3.90 s 3.92 s 🔴 +0.44%
concurrent_text_edit_delete_all_1000/ (B/op) 327.09 MB 294.80 MB 🟢 -9.87%
concurrent_text_edit_delete_all_1000/ (allocs/op) 4,903,202 allocs 4,793,964 allocs 🟢 -2.23%
concurrent_tree_edit_delete_all_100/ (ns/op) 517.73 ms 521.36 ms 🔴 +0.70%
concurrent_tree_edit_delete_all_100/ (B/op) 57.85 MB 60.79 MB 🔴 +5.08%
concurrent_tree_edit_delete_all_100/ (allocs/op) 573,993 allocs 573,897 allocs 🟢 -0.02%
concurrent_tree_edit_delete_all_1000/ (ns/op) 4.46 s 4.52 s 🔴 +1.40%
concurrent_tree_edit_delete_all_1000/ (B/op) 700.05 MB 698.00 MB 🟢 -0.29%
concurrent_tree_edit_delete_all_1000/ (allocs/op) 5,272,929 allocs 5,272,986 allocs ⚪ 0%
BenchmarkDocument
Benchmark suite Previous Current Change
constructor_test/ (ns/op) 1631.00 ns 1603.00 ns 🟢 -1.72%
constructor_test/ (B/op) 1.59 KB 1.59 KB ⚪ 0%
constructor_test/ (allocs/op) 27 allocs 27 allocs ⚪ 0%
status_test/ (ns/op) 1239.00 ns 1168.00 ns 🟢 -5.73%
status_test/ (B/op) 1.56 KB 1.56 KB ⚪ 0%
status_test/ (allocs/op) 25 allocs 25 allocs ⚪ 0%
equals_test/ (ns/op) 8619.00 ns 8463.00 ns 🟢 -1.81%
equals_test/ (B/op) 8.33 KB 8.33 KB ⚪ 0%
equals_test/ (allocs/op) 139 allocs 139 allocs ⚪ 0%
nested_update_test/ (ns/op) 18148.00 ns 17833.00 ns 🟢 -1.74%
nested_update_test/ (B/op) 12.86 KB 12.86 KB ⚪ 0%
nested_update_test/ (allocs/op) 272 allocs 272 allocs ⚪ 0%
delete_test/ (ns/op) 24069.00 ns 23694.00 ns 🟢 -1.56%
delete_test/ (B/op) 16.37 KB 16.37 KB ⚪ 0%
delete_test/ (allocs/op) 352 allocs 352 allocs ⚪ 0%
object_test/ (ns/op) 9198.00 ns 9193.00 ns 🟢 -0.05%
object_test/ (B/op) 7.42 KB 7.42 KB ⚪ 0%
object_test/ (allocs/op) 124 allocs 124 allocs ⚪ 0%
array_test/ (ns/op) 29822.00 ns 29551.00 ns 🟢 -0.91%
array_test/ (B/op) 12.64 KB 12.64 KB ⚪ 0%
array_test/ (allocs/op) 283 allocs 283 allocs ⚪ 0%
text_test/ (ns/op) 33868.00 ns 34439.00 ns 🔴 +1.69%
text_test/ (B/op) 15.31 KB 15.31 KB ⚪ 0%
text_test/ (allocs/op) 503 allocs 503 allocs ⚪ 0%
text_composition_test/ (ns/op) 33082.00 ns 33582.00 ns 🔴 +1.51%
text_composition_test/ (B/op) 16.94 KB 16.94 KB ⚪ 0%
text_composition_test/ (allocs/op) 493 allocs 493 allocs ⚪ 0%
rich_text_test/ (ns/op) 89891.00 ns 90207.00 ns 🔴 +0.35%
rich_text_test/ (B/op) 38.47 KB 38.48 KB ⚪ 0%
rich_text_test/ (allocs/op) 1,185 allocs 1,185 allocs ⚪ 0%
counter_test/ (ns/op) 18604.00 ns 18413.00 ns 🟢 -1.03%
counter_test/ (B/op) 12.31 KB 12.31 KB ⚪ 0%
counter_test/ (allocs/op) 254 allocs 254 allocs ⚪ 0%
text_edit_gc_100/ (ns/op) 1.54 ms 1.49 ms 🟢 -3.04%
text_edit_gc_100/ (B/op) 808.47 KB 808.45 KB ⚪ 0%
text_edit_gc_100/ (allocs/op) 16,885 allocs 16,885 allocs ⚪ 0%
text_edit_gc_1000/ (ns/op) 58.99 ms 59.99 ms 🔴 +1.69%
text_edit_gc_1000/ (B/op) 46.27 MB 46.27 MB ⚪ 0%
text_edit_gc_1000/ (allocs/op) 181,590 allocs 181,607 allocs ⚪ 0%
text_split_gc_100/ (ns/op) 2.31 ms 2.21 ms 🟢 -4.08%
text_split_gc_100/ (B/op) 1.53 MB 1.53 MB ⚪ 0%
text_split_gc_100/ (allocs/op) 15,553 allocs 15,553 allocs ⚪ 0%
text_split_gc_1000/ (ns/op) 136.66 ms 137.23 ms 🔴 +0.42%
text_split_gc_1000/ (B/op) 137.28 MB 137.28 MB ⚪ 0%
text_split_gc_1000/ (allocs/op) 181,011 allocs 181,005 allocs ⚪ 0%
text_100/ (ns/op) 253457.00 ns 244963.00 ns 🟢 -3.35%
text_100/ (B/op) 113.26 KB 113.26 KB ⚪ 0%
text_100/ (allocs/op) 4,985 allocs 4,985 allocs ⚪ 0%
text_1000/ (ns/op) 2.68 ms 2.64 ms 🟢 -1.26%
text_1000/ (B/op) 1.08 MB 1.08 MB ⚪ 0%
text_1000/ (allocs/op) 49,088 allocs 49,088 allocs ⚪ 0%
array_1000/ (ns/op) 1.37 ms 1.34 ms 🟢 -1.99%
array_1000/ (B/op) 1.13 MB 1.13 MB ⚪ 0%
array_1000/ (allocs/op) 13,883 allocs 13,883 allocs ⚪ 0%
array_10000/ (ns/op) 14.95 ms 14.85 ms 🟢 -0.63%
array_10000/ (B/op) 10.29 MB 10.29 MB ⚪ 0%
array_10000/ (allocs/op) 140,739 allocs 140,740 allocs ⚪ 0%
array_gc_100/ (ns/op) 150045.00 ns 143027.00 ns 🟢 -4.68%
array_gc_100/ (B/op) 104.28 KB 104.28 KB ⚪ 0%
array_gc_100/ (allocs/op) 1,469 allocs 1,469 allocs ⚪ 0%
array_gc_1000/ (ns/op) 1.57 ms 1.53 ms 🟢 -2.95%
array_gc_1000/ (B/op) 1.18 MB 1.18 MB ⚪ 0%
array_gc_1000/ (allocs/op) 14,929 allocs 14,929 allocs ⚪ 0%
counter_1000/ (ns/op) 214598.00 ns 204171.00 ns 🟢 -4.86%
counter_1000/ (B/op) 194.39 KB 194.39 KB ⚪ 0%
counter_1000/ (allocs/op) 5,773 allocs 5,773 allocs ⚪ 0%
counter_10000/ (ns/op) 2.22 ms 2.20 ms 🟢 -0.92%
counter_10000/ (B/op) 2.23 MB 2.23 MB ⚪ 0%
counter_10000/ (allocs/op) 59,780 allocs 59,780 allocs ⚪ 0%
object_1000/ (ns/op) 1.60 ms 1.54 ms 🟢 -3.33%
object_1000/ (B/op) 1.48 MB 1.48 MB ⚪ 0%
object_1000/ (allocs/op) 11,927 allocs 11,927 allocs ⚪ 0%
object_10000/ (ns/op) 17.21 ms 17.27 ms 🔴 +0.38%
object_10000/ (B/op) 12.75 MB 12.75 MB ⚪ 0%
object_10000/ (allocs/op) 121,228 allocs 121,231 allocs ⚪ 0%
tree_100/ (ns/op) 795284.00 ns 765944.00 ns 🟢 -3.69%
tree_100/ (B/op) 524.17 KB 524.17 KB ⚪ 0%
tree_100/ (allocs/op) 4,722 allocs 4,722 allocs ⚪ 0%
tree_1000/ (ns/op) 54.94 ms 52.00 ms 🟢 -5.35%
tree_1000/ (B/op) 43.74 MB 43.74 MB ⚪ 0%
tree_1000/ (allocs/op) 46,132 allocs 46,131 allocs ⚪ 0%
tree_10000/ (ns/op) 6.90 s 6.90 s ⚪ 0%
tree_10000/ (B/op) 4.30 GB 4.30 GB ⚪ 0%
tree_10000/ (allocs/op) 460,226 allocs 460,221 allocs ⚪ 0%
tree_edit_gc_100/ (ns/op) 2.80 ms 2.76 ms 🟢 -1.41%
tree_edit_gc_100/ (B/op) 2.40 MB 2.40 MB ⚪ 0%
tree_edit_gc_100/ (allocs/op) 11,868 allocs 11,868 allocs ⚪ 0%
tree_edit_gc_1000/ (ns/op) 228.57 ms 217.88 ms 🟢 -4.68%
tree_edit_gc_1000/ (B/op) 214.01 MB 213.95 MB 🟢 -0.03%
tree_edit_gc_1000/ (allocs/op) 118,147 allocs 118,143 allocs ⚪ 0%
tree_split_gc_100/ (ns/op) 2.14 ms 2.07 ms 🟢 -2.98%
tree_split_gc_100/ (B/op) 1.61 MB 1.61 MB 🔴 +0.04%
tree_split_gc_100/ (allocs/op) 9,806 allocs 9,806 allocs ⚪ 0%
tree_split_gc_1000/ (ns/op) 162.55 ms 150.12 ms 🟢 -7.65%
tree_split_gc_1000/ (B/op) 149.86 MB 149.86 MB ⚪ 0%
tree_split_gc_1000/ (allocs/op) 109,755 allocs 109,756 allocs ⚪ 0%
BenchmarkDocumentDeletion
Benchmark suite Previous Current Change
single_text_delete_all_10000/ (ns/op) 18.27 ms 18.65 ms 🔴 +2.09%
single_text_delete_all_10000/ (B/op) 10.51 MB 10.51 MB ⚪ 0%
single_text_delete_all_10000/ (allocs/op) 76,126 allocs 76,128 allocs ⚪ 0%
single_text_delete_all_100000/ (ns/op) 267.64 ms 298.08 ms 🔴 +11.37%
single_text_delete_all_100000/ (B/op) 104.74 MB 104.74 MB ⚪ 0%
single_text_delete_all_100000/ (allocs/op) 766,066 allocs 766,090 allocs ⚪ 0%
single_tree_delete_all_1000/ (ns/op) 53.68 ms 53.46 ms 🟢 -0.41%
single_tree_delete_all_1000/ (B/op) 44.66 MB 44.66 MB ⚪ 0%
single_tree_delete_all_1000/ (allocs/op) 58,205 allocs 58,205 allocs ⚪ 0%
single_text_delete_range_100/ (ns/op) 450622.00 ns 447088.00 ns 🟢 -0.78%
single_text_delete_range_100/ (B/op) 243.25 KB 243.27 KB ⚪ 0%
single_text_delete_range_100/ (allocs/op) 7,074 allocs 7,074 allocs ⚪ 0%
single_text_delete_range_1000/ (ns/op) 9.21 ms 9.18 ms 🟢 -0.38%
single_text_delete_range_1000/ (B/op) 6.37 MB 6.37 MB ⚪ 0%
single_text_delete_range_1000/ (allocs/op) 73,370 allocs 73,370 allocs ⚪ 0%
single_tree_delete_range_100/ (ns/op) 971035.00 ns 964149.00 ns 🟢 -0.71%
single_tree_delete_range_100/ (B/op) 708.43 KB 708.47 KB ⚪ 0%
single_tree_delete_range_100/ (allocs/op) 6,392 allocs 6,392 allocs ⚪ 0%
single_tree_delete_range_1000/ (ns/op) 61.57 ms 62.07 ms 🔴 +0.82%
single_tree_delete_range_1000/ (B/op) 54.51 MB 54.51 MB ⚪ 0%
single_tree_delete_range_1000/ (allocs/op) 63,432 allocs 63,434 allocs ⚪ 0%
BenchmarkGetDocuments
Benchmark suite Previous Current Change
without_root_presence_10/ (ns/op) 1.15 ms 1.14 ms 🟢 -0.33%
without_root_presence_10/ (B/op) 145.94 KB 143.41 KB 🟢 -1.74%
without_root_presence_10/ (allocs/op) 1,192 allocs 1,190 allocs 🟢 -0.17%
with_root_presence_10/ (ns/op) 3.98 ms 3.92 ms 🟢 -1.40%
with_root_presence_10/ (B/op) 626.57 KB 608.27 KB 🟢 -2.92%
with_root_presence_10/ (allocs/op) 5,737 allocs 5,731 allocs 🟢 -0.10%
without_root_presence_100/ (ns/op) 2.35 ms 2.37 ms 🔴 +0.72%
without_root_presence_100/ (B/op) 785.94 KB 806.45 KB 🔴 +2.61%
without_root_presence_100/ (allocs/op) 5,976 allocs 5,996 allocs 🔴 +0.33%
with_root_presence_100/ (ns/op) 41.00 ms 41.38 ms 🔴 +0.93%
with_root_presence_100/ (B/op) 7.59 MB 7.62 MB 🔴 +0.35%
with_root_presence_100/ (allocs/op) 67,209 allocs 67,464 allocs 🔴 +0.38%
without_root_presence_1000/ (ns/op) 14.80 ms 14.96 ms 🔴 +1.04%
without_root_presence_1000/ (B/op) 7.91 MB 7.89 MB 🟢 -0.17%
without_root_presence_1000/ (allocs/op) 54,743 allocs 54,737 allocs 🟢 -0.01%
with_root_presence_1000/ (ns/op) 392.09 ms 404.06 ms 🔴 +3.05%
with_root_presence_1000/ (B/op) 73.55 MB 72.19 MB 🟢 -1.84%
with_root_presence_1000/ (allocs/op) 669,363 allocs 667,208 allocs 🟢 -0.32%
BenchmarkRPC
Benchmark suite Previous Current Change
client_to_server/ (ns/op) 221.91 ms 221.82 ms 🟢 -0.04%
client_to_server/ (B/op) 13.83 MB 14.51 MB 🔴 +4.88%
client_to_server/ (allocs/op) 177,213 allocs 177,145 allocs 🟢 -0.04%
client_to_client_via_server/ (ns/op) 170.18 ms 169.20 ms 🟢 -0.58%
client_to_client_via_server/ (B/op) 22.29 MB 21.95 MB 🟢 -1.50%
client_to_client_via_server/ (allocs/op) 267,485 allocs 267,180 allocs 🟢 -0.11%
attach_large_document/ (ns/op) 1.28 s 1.30 s 🔴 +1.48%
attach_large_document/ (B/op) 1.88 GB 1.88 GB 🔴 +0.10%
attach_large_document/ (allocs/op) 11,172 allocs 11,476 allocs 🔴 +2.72%
adminCli_to_server/ (ns/op) 658.84 ms 726.03 ms 🔴 +10.20%
adminCli_to_server/ (B/op) 763.48 MB 755.51 MB 🟢 -1.04%
adminCli_to_server/ (allocs/op) 543,115 allocs 542,655 allocs 🟢 -0.08%
BenchmarkLocker
Benchmark suite Previous Current Change
(ns/op) 83.62 ns 84.22 ns 🔴 +0.72%
(B/op) 32.00 B 32.00 B ⚪ 0%
(allocs/op) 1 allocs 1 allocs ⚪ 0%
BenchmarkLockerParallel
Benchmark suite Previous Current Change
(ns/op) 45.89 ns 44.87 ns 🟢 -2.22%
(B/op) 0.00 B 0.00 B ⚪ 0%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkLockerMoreKeys
Benchmark suite Previous Current Change
(ns/op) 184.20 ns 173.80 ns 🟢 -5.65%
(B/op) 30.00 B 31.00 B 🔴 +3.33%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkRWLocker
Benchmark suite Previous Current Change
RWLock_rate_2/ (ns/op) 49.98 ns 50.22 ns 🔴 +0.48%
RWLock_rate_2/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_2/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_10/ (ns/op) 45.04 ns 44.25 ns 🟢 -1.75%
RWLock_rate_10/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_10/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_100/ (ns/op) 61.70 ns 60.80 ns 🟢 -1.46%
RWLock_rate_100/ (B/op) 2.00 B 2.00 B ⚪ 0%
RWLock_rate_100/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_1000/ (ns/op) 91.79 ns 92.37 ns 🔴 +0.63%
RWLock_rate_1000/ (B/op) 8.00 B 8.00 B ⚪ 0%
RWLock_rate_1000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkPresenceConcurrency
Benchmark suite Previous Current Change
0-100-10/ (ns/op) 870.70 ms 876.55 ms 🔴 +0.67%
0-100-10/ (B/op) 406.66 MB 404.01 MB 🟢 -0.65%
0-100-10/ (allocs/op) 5,081,931 allocs 5,083,759 allocs 🔴 +0.04%
100-100-10/ (ns/op) 926.48 ms 966.66 ms 🔴 +4.34%
100-100-10/ (B/op) 439.74 MB 438.32 MB 🟢 -0.32%
100-100-10/ (allocs/op) 5,616,984 allocs 5,618,666 allocs 🔴 +0.03%
300-100-10/ (ns/op) 980.82 ms 979.08 ms 🟢 -0.18%
300-100-10/ (B/op) 495.59 MB 494.27 MB 🟢 -0.27%
300-100-10/ (allocs/op) 6,560,789 allocs 6,548,291 allocs 🟢 -0.19%
BenchmarkChange
Benchmark suite Previous Current Change
Push_10_Changes/ (ns/op) 4.62 ms 4.61 ms 🟢 -0.28%
Push_10_Changes/ (B/op) 347.82 KB 348.06 KB 🔴 +0.07%
Push_10_Changes/ (allocs/op) 5,862 allocs 5,878 allocs 🔴 +0.27%
Push_100_Changes/ (ns/op) 18.23 ms 18.53 ms 🔴 +1.65%
Push_100_Changes/ (B/op) 1.59 MB 1.59 MB 🔴 +0.22%
Push_100_Changes/ (allocs/op) 17,509 allocs 17,541 allocs 🔴 +0.18%
Push_1000_Changes/ (ns/op) 149.54 ms 153.06 ms 🔴 +2.35%
Push_1000_Changes/ (B/op) 13.71 MB 13.71 MB ⚪ 0%
Push_1000_Changes/ (allocs/op) 108,452 allocs 108,481 allocs 🔴 +0.03%
Pull_10_Changes/ (ns/op) 3.04 ms 3.19 ms 🔴 +4.91%
Pull_10_Changes/ (B/op) 341.33 KB 341.90 KB 🔴 +0.17%
Pull_10_Changes/ (allocs/op) 6,945 allocs 6,961 allocs 🔴 +0.23%
Pull_100_Changes/ (ns/op) 4.97 ms 5.10 ms 🔴 +2.55%
Pull_100_Changes/ (B/op) 1.15 MB 1.14 MB 🟢 -0.65%
Pull_100_Changes/ (allocs/op) 18,827 allocs 18,699 allocs 🟢 -0.68%
Pull_1000_Changes/ (ns/op) 12.85 ms 13.79 ms 🔴 +7.35%
Pull_1000_Changes/ (B/op) 6.72 MB 6.72 MB 🟢 -0.08%
Pull_1000_Changes/ (allocs/op) 68,590 allocs 68,325 allocs 🟢 -0.39%
BenchmarkSnapshot
Benchmark suite Previous Current Change
Push_3KB_snapshot/ (ns/op) 20.68 ms 21.41 ms 🔴 +3.54%
Push_3KB_snapshot/ (B/op) 2.42 MB 2.40 MB 🟢 -0.86%
Push_3KB_snapshot/ (allocs/op) 39,742 allocs 39,507 allocs 🟢 -0.59%
Push_30KB_snapshot/ (ns/op) 155.84 ms 159.22 ms 🔴 +2.17%
Push_30KB_snapshot/ (B/op) 18.06 MB 18.05 MB 🟢 -0.10%
Push_30KB_snapshot/ (allocs/op) 190,048 allocs 192,436 allocs 🔴 +1.26%
Pull_3KB_snapshot/ (ns/op) 6.36 ms 6.22 ms 🟢 -2.15%
Pull_3KB_snapshot/ (B/op) 1.83 MB 1.82 MB 🟢 -0.47%
Pull_3KB_snapshot/ (allocs/op) 34,810 allocs 34,480 allocs 🟢 -0.95%
Pull_30KB_snapshot/ (ns/op) 18.30 ms 18.71 ms 🔴 +2.25%
Pull_30KB_snapshot/ (B/op) 11.53 MB 11.52 MB 🟢 -0.09%
Pull_30KB_snapshot/ (allocs/op) 164,528 allocs 164,172 allocs 🟢 -0.22%
BenchmarkSplayTree
Benchmark suite Previous Current Change
stress_test_100000/ (ns/op) 0.17 ns 0.17 ns 🟢 -2.94%
stress_test_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_200000/ (ns/op) 0.35 ns 0.36 ns 🔴 +0.90%
stress_test_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_300000/ (ns/op) 0.53 ns 0.54 ns 🔴 +1.88%
stress_test_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_100000/ (ns/op) 0.01 ns 0.01 ns 🔴 +5.12%
random_access_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_200000/ (ns/op) 0.03 ns 0.04 ns 🔴 +3.57%
random_access_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_300000/ (ns/op) 0.05 ns 0.05 ns 🔴 +9.01%
random_access_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
editing_trace_bench/ (ns/op) 0.00 ns 0.00 ns 🔴 +21.16%
editing_trace_bench/ (B/op) 0.00 B 0.00 B ⚪ 0%
editing_trace_bench/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkSync
Benchmark suite Previous Current Change
memory_sync_10_test/ (ns/op) 6850.00 ns 6981.00 ns 🔴 +1.91%
memory_sync_10_test/ (B/op) 1.34 KB 1.34 KB ⚪ 0%
memory_sync_10_test/ (allocs/op) 35 allocs 35 allocs ⚪ 0%
memory_sync_100_test/ (ns/op) 55675.00 ns 56010.00 ns 🔴 +0.60%
memory_sync_100_test/ (B/op) 9.51 KB 9.51 KB 🟢 -0.02%
memory_sync_100_test/ (allocs/op) 268 allocs 268 allocs ⚪ 0%
memory_sync_1000_test/ (ns/op) 597433.00 ns 617561.00 ns 🔴 +3.37%
memory_sync_1000_test/ (B/op) 76.65 KB 76.01 KB 🟢 -0.84%
memory_sync_1000_test/ (allocs/op) 2,137 allocs 2,117 allocs 🟢 -0.94%
memory_sync_10000_test/ (ns/op) 7.95 ms 7.95 ms 🟢 -0.04%
memory_sync_10000_test/ (B/op) 761.75 KB 762.78 KB 🔴 +0.13%
memory_sync_10000_test/ (allocs/op) 20,518 allocs 20,513 allocs 🟢 -0.02%
BenchmarkSyncConcurrency
Benchmark suite Previous Current Change
1-100-10/ (ns/op) 8.00 s 8.16 s 🔴 +1.93%
1-100-10/ (B/op) 4.40 GB 4.39 GB 🟢 -0.20%
1-100-10/ (allocs/op) 108,233,566 allocs 108,497,889 allocs 🔴 +0.24%
100-100-10/ (ns/op) 9.09 s 9.26 s 🔴 +1.86%
100-100-10/ (B/op) 4.66 GB 4.65 GB 🟢 -0.29%
100-100-10/ (allocs/op) 113,884,551 allocs 113,595,037 allocs 🟢 -0.25%
300_100-10/ (ns/op) 11.13 s 11.34 s 🔴 +1.93%
300_100-10/ (B/op) 4.96 GB 4.96 GB 🟢 -0.03%
300_100-10/ (allocs/op) 118,027,435 allocs 118,132,016 allocs 🔴 +0.09%
BenchmarkTextEditing
Benchmark suite Previous Current Change
(ns/op) 5.61 s 5.82 s 🔴 +3.83%
(B/op) 3.88 GB 3.88 GB ⚪ 0%
(allocs/op) 20,100,420 allocs 20,100,580 allocs ⚪ 0%
BenchmarkTree
Benchmark suite Previous Current Change
10000_vertices_to_protobuf/ (ns/op) 4.77 ms 4.92 ms 🔴 +3.00%
10000_vertices_to_protobuf/ (B/op) 6.68 MB 6.68 MB ⚪ 0%
10000_vertices_to_protobuf/ (allocs/op) 90,026 allocs 90,026 allocs ⚪ 0%
10000_vertices_from_protobuf/ (ns/op) 231.15 ms 230.16 ms 🟢 -0.43%
10000_vertices_from_protobuf/ (B/op) 442.15 MB 442.15 MB ⚪ 0%
10000_vertices_from_protobuf/ (allocs/op) 280,047 allocs 280,047 allocs ⚪ 0%
20000_vertices_to_protobuf/ (ns/op) 10.26 ms 10.68 ms 🔴 +4.03%
20000_vertices_to_protobuf/ (B/op) 13.53 MB 13.53 MB ⚪ 0%
20000_vertices_to_protobuf/ (allocs/op) 180,029 allocs 180,029 allocs ⚪ 0%
20000_vertices_from_protobuf/ (ns/op) 888.07 ms 888.60 ms 🔴 +0.06%
20000_vertices_from_protobuf/ (B/op) 1.70 GB 1.70 GB ⚪ 0%
20000_vertices_from_protobuf/ (allocs/op) 560,101 allocs 560,078 allocs ⚪ 0%
30000_vertices_to_protobuf/ (ns/op) 14.89 ms 16.26 ms 🔴 +9.22%
30000_vertices_to_protobuf/ (B/op) 19.94 MB 19.94 MB ⚪ 0%
30000_vertices_to_protobuf/ (allocs/op) 270,030 allocs 270,031 allocs ⚪ 0%
30000_vertices_from_protobuf/ (ns/op) 1.99 s 2.01 s 🔴 +0.90%
30000_vertices_from_protobuf/ (B/op) 3.75 GB 3.75 GB ⚪ 0%
30000_vertices_from_protobuf/ (allocs/op) 840,239 allocs 840,125 allocs 🟢 -0.01%
BenchmarkVersionVector
Benchmark suite Previous Current Change
clients_10/ (ns/op) 112.12 ms 112.51 ms 🔴 +0.34%
clients_10/ (1_changepack(bytes)) 185.00 B 185.00 B ⚪ 0%
clients_10/ (2_snapshot(bytes)) 399.00 B 399.00 B ⚪ 0%
clients_10/ (3_pushpull(ms)) 3.00 ms 3.00 ms ⚪ 0%
clients_10/ (4_attach(ms)) 5.00 ms 5.00 ms ⚪ 0%
clients_10/ (5_changepack_after_detach(bytes)) 230.00 B 230.00 B ⚪ 0%
clients_10/ (6_snapshot_after_detach(bytes)) 156.00 B 156.00 B ⚪ 0%
clients_10/ (7_pushpull_after_detach(ms)) 8.00 ms 4.00 ms 🟢 -50.00%
clients_10/ (B/op) 7.17 MB 8.19 MB 🔴 +14.28%
clients_10/ (allocs/op) 62,203 allocs 62,244 allocs 🔴 +0.07%
clients_100/ (ns/op) 925.57 ms 941.05 ms 🔴 +1.67%
clients_100/ (1_changepack(bytes)) 185.00 B 185.00 B ⚪ 0%
clients_100/ (2_snapshot(bytes)) 3.10 KB 3.10 KB ⚪ 0%
clients_100/ (3_pushpull(ms)) 4.00 ms 3.00 ms 🟢 -25.00%
clients_100/ (4_attach(ms)) 6.00 ms 6.00 ms ⚪ 0%
clients_100/ (5_changepack_after_detach(bytes)) 231.00 B 231.00 B ⚪ 0%
clients_100/ (6_snapshot_after_detach(bytes)) 156.00 B 156.00 B ⚪ 0%
clients_100/ (7_pushpull_after_detach(ms)) 4.00 ms 4.00 ms ⚪ 0%
clients_100/ (B/op) 75.01 MB 80.85 MB 🔴 +7.79%
clients_100/ (allocs/op) 621,501 allocs 621,381 allocs 🟢 -0.02%
clients_1000/ (ns/op) 11.06 s 11.34 s 🔴 +2.49%
clients_1000/ (1_changepack(bytes)) 186.00 B 186.00 B ⚪ 0%
clients_1000/ (2_snapshot(bytes)) 30.10 KB 30.10 KB ⚪ 0%
clients_1000/ (3_pushpull(ms)) 3.00 ms 4.00 ms 🔴 +33.33%
clients_1000/ (4_attach(ms)) 19.00 ms 19.00 ms ⚪ 0%
clients_1000/ (5_changepack_after_detach(bytes)) 231.00 B 231.00 B ⚪ 0%
clients_1000/ (6_snapshot_after_detach(bytes)) 156.00 B 156.00 B ⚪ 0%
clients_1000/ (7_pushpull_after_detach(ms)) 4.00 ms 4.00 ms ⚪ 0%
clients_1000/ (B/op) 1.72 GB 1.69 GB 🟢 -1.58%
clients_1000/ (allocs/op) 25,486,058 allocs 24,729,968 allocs 🟢 -2.97%
BenchmarkWebhook
Benchmark suite Previous Current Change
Send_10_Webhooks_to_10_Endpoints/ (ns/op) 12.66 ms 12.30 ms 🟢 -2.85%
Send_10_Webhooks_to_10_Endpoints/ (B/op) 770.26 KB 770.02 KB 🟢 -0.03%
Send_10_Webhooks_to_10_Endpoints/ (allocs/op) 9,818 allocs 9,816 allocs 🟢 -0.02%
Send_100_Webhooks_to_10_Endpoints/ (ns/op) 126.23 ms 123.88 ms 🟢 -1.86%
Send_100_Webhooks_to_10_Endpoints/ (B/op) 7.70 MB 7.71 MB 🔴 +0.09%
Send_100_Webhooks_to_10_Endpoints/ (allocs/op) 98,174 allocs 98,171 allocs ⚪ 0%
Send_10_Webhooks_to_100_Endpoints/ (ns/op) 128.48 ms 129.32 ms 🔴 +0.66%
Send_10_Webhooks_to_100_Endpoints/ (B/op) 7.90 MB 7.90 MB 🔴 +0.02%
Send_10_Webhooks_to_100_Endpoints/ (allocs/op) 99,539 allocs 99,538 allocs ⚪ 0%
Send_100_Webhooks_to_100_Endpoints/ (ns/op) 1.27 s 1.26 s 🟢 -1.09%
Send_100_Webhooks_to_100_Endpoints/ (B/op) 78.52 MB 78.50 MB 🟢 -0.03%
Send_100_Webhooks_to_100_Endpoints/ (allocs/op) 992,342 allocs 992,302 allocs ⚪ 0%
Send_10_Webhooks_to_1000_Endpoints/ (ns/op) 2.79 s 2.81 s 🔴 +0.73%
Send_10_Webhooks_to_1000_Endpoints/ (B/op) 205.79 MB 205.84 MB 🔴 +0.03%
Send_10_Webhooks_to_1000_Endpoints/ (allocs/op) 1,686,534 allocs 1,686,531 allocs ⚪ 0%
BenchmarkWebhookWithLimit
Benchmark suite Previous Current Change
Send_10_Webhooks_to_10_Endpoints_with_limit/ (ns/op) 3.83 ms 3.82 ms 🟢 -0.23%
Send_10_Webhooks_to_10_Endpoints_with_limit/ (B/op) 301.90 KB 301.95 KB 🔴 +0.02%
Send_10_Webhooks_to_10_Endpoints_with_limit/ (allocs/op) 2,853 allocs 2,853 allocs ⚪ 0%
Send_100_Webhooks_to_10_Endpoints_with_limit/ (ns/op) 4.12 ms 4.08 ms 🟢 -0.84%
Send_100_Webhooks_to_10_Endpoints_with_limit/ (B/op) 453.52 KB 453.25 KB 🟢 -0.06%
Send_100_Webhooks_to_10_Endpoints_with_limit/ (allocs/op) 4,653 allocs 4,653 allocs ⚪ 0%
Send_10_Webhooks_to_100_Endpoints_with_limit/ (ns/op) 38.01 ms 38.94 ms 🔴 +2.46%
Send_10_Webhooks_to_100_Endpoints_with_limit/ (B/op) 3.04 MB 3.04 MB 🟢 -0.02%
Send_10_Webhooks_to_100_Endpoints_with_limit/ (allocs/op) 28,574 allocs 28,575 allocs ⚪ 0%
Send_100_Webhooks_to_100_Endpoints_with_limit/ (ns/op) 41.09 ms 41.25 ms 🔴 +0.38%
Send_100_Webhooks_to_100_Endpoints_with_limit/ (B/op) 4.62 MB 4.62 MB 🔴 +0.01%
Send_100_Webhooks_to_100_Endpoints_with_limit/ (allocs/op) 46,592 allocs 46,597 allocs 🔴 +0.01%
Send_10_Webhooks_to_1000_Endpoints_with_limit/ (ns/op) 367.51 ms 373.10 ms 🔴 +1.52%
Send_10_Webhooks_to_1000_Endpoints_with_limit/ (B/op) 44.09 MB 44.05 MB 🟢 -0.10%
Send_10_Webhooks_to_1000_Endpoints_with_limit/ (allocs/op) 374,121 allocs 374,079 allocs 🟢 -0.01%

@hackerwins hackerwins force-pushed the cache-flag branch 3 times, most recently from 4d79cb1 to 464a91e Compare September 19, 2025 04:17
@codecov

codecov Bot commented Sep 19, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 18.86792% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.78%. Comparing base (8458791) to head (a5171e7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/yorkie/server.go 0.00% 28 Missing ⚠️
server/config.go 0.00% 10 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1513      +/-   ##
==========================================
- Coverage   48.86%   48.78%   -0.08%     
==========================================
  Files         182      182              
  Lines       22745    22789      +44     
==========================================
+ Hits        11114    11118       +4     
- Misses      10701    10735      +34     
- Partials      930      936       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
server/backend/database/mongo/client.go (1)

84-99: Ensure Mongo client disconnects on any subsequent Dial failure (leak).

If any step after connect (index creation or cache init) fails, the Mongo connection stays open. Guard with a deferred disconnect until success.

Apply this diff:

 client, err := mongo.Connect(
   clientOptions,
 )
 if err != nil {
   return nil, fmt.Errorf("connect to MongoDB: %w", err)
 }
+ok := false
+defer func() {
+  if !ok {
+    _ = client.Disconnect(context.Background())
+  }
+}()
server/backend/database/mongo/config.go (1)

76-84: Validate non-negative cache sizes and require interval when stats are enabled

Negative sizes will cause runtime issues. Also, if CacheStatsEnabled is true but interval is empty, later parse will exit the process.

Apply this diff:

   if c.CacheStatsInterval != "" {
     if _, err := time.ParseDuration(c.CacheStatsInterval); err != nil {
       return fmt.Errorf(
         `invalid argument "%s" for cache stats interval: %w`,
         c.CacheStatsInterval,
         err,
       )
     }
   }
+
+  if c.CacheStatsEnabled && c.CacheStatsInterval == "" {
+    return fmt.Errorf("cache stats enabled but CacheStatsInterval is empty")
+  }
+
+  if c.ClientCacheSize < 0 {
+    return fmt.Errorf("ClientCacheSize must be >= 0 (got %d)", c.ClientCacheSize)
+  }
+  if c.DocCacheSize < 0 {
+    return fmt.Errorf("DocCacheSize must be >= 0 (got %d)", c.DocCacheSize)
+  }
+  if c.ChangeCacheSize < 0 {
+    return fmt.Errorf("ChangeCacheSize must be >= 0 (got %d)", c.ChangeCacheSize)
+  }
+  if c.VectorCacheSize < 0 {
+    return fmt.Errorf("VectorCacheSize must be >= 0 (got %d)", c.VectorCacheSize)
+  }
🧹 Nitpick comments (9)
server/backend/database/mongo/client.go (3)

130-131: Avoid logging credentials in Mongo URI.

Mask userinfo before logging to prevent accidental credential leakage.

Example:

+u, _ := url.Parse(conf.ConnectionURI)
+if u != nil && u.User != nil {
+  u.User = url.UserPassword(u.User.Username(), "****")
+}
-logging.DefaultLogger().Infof("MongoDB connected, URI: %s, DB: %s", conf.ConnectionURI, conf.YorkieDatabase)
+logging.DefaultLogger().Infof("MongoDB connected, URI: %s, DB: %s", u.String(), conf.YorkieDatabase)

(Remember to import "net/url".)


148-149: Complete the leak guard by flipping ok before return.

Apply this diff:

-  return yorkieClient, nil
+  ok = true
+  return yorkieClient, nil

151-165: Use a timeout when disconnecting.

Avoid indefinite waits on shutdown.

Apply this diff:

-func (c *Client) Close() error {
-  if err := c.client.Disconnect(context.Background()); err != nil {
+func (c *Client) Close() error {
+  ctx, cancel := context.WithTimeout(context.Background(), c.config.ParseConnectionTimeout())
+  defer cancel()
+  if err := c.client.Disconnect(ctx); err != nil {
     return fmt.Errorf("close MongoDB client: %w", err)
   }
test/integration/housekeeping_test.go (1)

51-61: Use shared test constant for CacheStatsInterval.

Keeps test config consistent and avoids magic strings.

Apply this diff:

-    CacheStatsEnabled:  false,
-    CacheStatsInterval: "30s",
+    CacheStatsEnabled:  false,
+    CacheStatsInterval: helper.MongoCacheStatsInterval,
test/complex/main_test.go (1)

89-99: Prefer helper.MongoCacheStatsInterval over literal.

Consistency with other tests.

Apply this diff:

-    CacheStatsEnabled:  false,
-    CacheStatsInterval: "30s",
+    CacheStatsEnabled:  false,
+    CacheStatsInterval: helper.MongoCacheStatsInterval,
test/helper/helper.go (2)

305-315: Reuse MongoCacheStatsInterval constant.

Avoid duplicating "30s".

Apply this diff:

-      CacheStatsEnabled:  false,
-      CacheStatsInterval: "30s",
+      CacheStatsEnabled:  false,
+      CacheStatsInterval: MongoCacheStatsInterval,

569-571: Remove noisy println in WaitForServerToStart.

This pollutes test output; rely on backoff silently or t.Log in callers.

Apply this diff:

-    fmt.Println("delay: ", delay)
cmd/yorkie/server.go (1)

364-387: Prefer using server.DefaultMongoCacheStatsInterval for flag default (consistency)

Tiny consistency nit: other defaults are sourced from server constants. Consider aligning the interval flag default too (line 389 below).

Use this outside-change snippet:

cmd.Flags().DurationVar(
  &mongoCacheStatsInterval,
  "mongo-cache-stats-interval",
  server.DefaultMongoCacheStatsInterval,
  "Interval for logging MongoDB cache statistics (e.g. '30s', '1m')",
)
server/backend/database/mongo/config.go (1)

45-56: Fix comment label: VectorCacheSize, not ActorCacheSize

Comment says “ActorCacheSize” but the field is VectorCacheSize / version vector cache.

Apply this diff:

-// ActorCacheSize is the size of the actor cache. It works as LRU cache.
+// VectorCacheSize is the size of the version vector cache. It works as LRU cache.
 VectorCacheSize int `yaml:"VectorCacheSize"`
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8458791 and 464a91e.

📒 Files selected for processing (12)
  • cmd/yorkie/server.go (3 hunks)
  • server/backend/database/mongo/client.go (2 hunks)
  • server/backend/database/mongo/client_test.go (1 hunks)
  • server/backend/database/mongo/config.go (1 hunks)
  • server/config.go (2 hunks)
  • server/config.sample.yml (1 hunks)
  • server/packs/pushpull_test.go (1 hunks)
  • server/rpc/server_test.go (1 hunks)
  • test/complex/main_test.go (1 hunks)
  • test/complex/mongo_client_test.go (1 hunks)
  • test/helper/helper.go (3 hunks)
  • test/integration/housekeeping_test.go (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (7)
server/packs/pushpull_test.go (1)
test/helper/helper.go (9)
  • MongoConnectionURI (97-97)
  • TestDBName (119-121)
  • MongoConnectionTimeout (96-96)
  • MongoPingTimeout (98-98)
  • MongoCacheStatsInterval (99-99)
  • MongoClientCacheSize (100-100)
  • MongoDocCacheSize (101-101)
  • MongoChangeCacheSize (102-102)
  • MongoVectorCacheSize (103-103)
server/rpc/server_test.go (1)
test/helper/helper.go (9)
  • MongoConnectionURI (97-97)
  • TestDBName (119-121)
  • MongoConnectionTimeout (96-96)
  • MongoPingTimeout (98-98)
  • MongoCacheStatsInterval (99-99)
  • MongoClientCacheSize (100-100)
  • MongoDocCacheSize (101-101)
  • MongoChangeCacheSize (102-102)
  • MongoVectorCacheSize (103-103)
cmd/yorkie/server.go (1)
server/config.go (4)
  • DefaultMongoClientCacheSize (51-51)
  • DefaultMongoDocCacheSize (52-52)
  • DefaultMongoChangeCacheSize (53-53)
  • DefaultMongoVectorCacheSize (54-54)
server/backend/database/mongo/client_test.go (1)
test/helper/helper.go (6)
  • TestDBName (119-121)
  • MongoCacheStatsInterval (99-99)
  • MongoClientCacheSize (100-100)
  • MongoDocCacheSize (101-101)
  • MongoChangeCacheSize (102-102)
  • MongoVectorCacheSize (103-103)
test/integration/housekeeping_test.go (1)
test/helper/helper.go (5)
  • TestDBName (119-121)
  • MongoClientCacheSize (100-100)
  • MongoDocCacheSize (101-101)
  • MongoChangeCacheSize (102-102)
  • MongoVectorCacheSize (103-103)
test/complex/main_test.go (1)
test/helper/helper.go (7)
  • MongoConnectionTimeout (96-96)
  • MongoConnectionURI (97-97)
  • MongoPingTimeout (98-98)
  • MongoClientCacheSize (100-100)
  • MongoDocCacheSize (101-101)
  • MongoChangeCacheSize (102-102)
  • MongoVectorCacheSize (103-103)
server/backend/database/mongo/client.go (2)
pkg/cache/manager.go (2)
  • Manager (27-32)
  • NewManager (42-49)
pkg/cache/lru_with_stats.go (1)
  • NewLRUWithStats (70-81)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: load-test
  • GitHub Check: build
  • GitHub Check: complex-test
  • GitHub Check: bench
🔇 Additional comments (11)
server/backend/database/mongo/client.go (2)

54-59: Shared cache manager wiring looks good.

Centralizing caches under cacheManager improves observability and simplifies lifecycle.


103-121: Cache init and registration: verify non-zero sizes.

NewLRUWithStats(size) errors on size <= 0. Confirm defaults/flags always set positive values in all code paths (prod/test).

Run:

Also applies to: 122-129, 144-146

test/helper/helper.go (1)

96-104: LGTM on new Mongo cache test constants.

server/config.go (1)

50-54: LGTM: sensible cache defaults added

The new Mongo cache defaults look reasonable and align with the sample config and flags.

server/config.sample.yml (1)

135-152: LGTM: sample YAML mirrors new Mongo cache options

The new keys and comments look clear and match the code defaults.

server/packs/pushpull_test.go (1)

108-116: LGTM: tests wire the new Mongo cache fields

Good coverage of CacheStatsInterval and per-cache sizes in TestMain.

server/rpc/server_test.go (1)

84-92: LGTM: test setup includes new Mongo cache fields

Config is consistent with helper constants.

server/backend/database/mongo/client_test.go (1)

40-48: LGTM: client tests exercise new cache fields

Validation + Dial path with per-cache sizes is sound.

cmd/yorkie/server.go (2)

63-66: LGTM: added vars for per-cache sizes

No issues.


114-118: LGTM: propagate cache sizes into mongo.Config

Values flow only when URI is set; consistent with existing pattern.

test/complex/mongo_client_test.go (1)

47-56: LGTM: complex test opts include cache toggles and sizes

Covers CacheStatsEnabled=false with explicit interval and sizes; good for exercising Validate.

Comment thread server/config.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
server/backend/database/mongo/config.go (2)

54-56: Fix misleading comment: Actor vs Vector.

Comment says "ActorCacheSize" but the field is VectorCacheSize. Please correct to avoid confusion.

Apply this diff:

-  // ActorCacheSize is the size of the actor cache. It works as LRU cache.
+  // VectorCacheSize is the size of the vector cache. It works as an LRU cache.

111-120: Avoid hard-exit on CacheStatsInterval; validate when enabled and treat empty as disabled.

Make ParseCacheStatsInterval tolerant of empty strings (return 0) and enforce a non-empty interval in Validate() when CacheStatsEnabled is true.

File: server/backend/database/mongo/config.go — Validate(), ParseCacheStatsInterval()

@@
-import (
-  "fmt"
-  "os"
-  "time"
-)
+import (
+  "fmt"
+  "os"
+  "strings"
+  "time"
+)
@@
 func (c *Config) Validate() error {
@@
-  if c.CacheStatsInterval != "" {
+  if c.CacheStatsEnabled && strings.TrimSpace(c.CacheStatsInterval) == "" {
+    return fmt.Errorf(`invalid argument "%s" for cache stats interval: must be set when cache stats are enabled`, c.CacheStatsInterval)
+  }
+  if c.CacheStatsInterval != "" {
     if _, err := time.ParseDuration(c.CacheStatsInterval); err != nil {
       return fmt.Errorf(
         `invalid argument "%s" for cache stats interval: %w`,
         c.CacheStatsInterval,
         err,
       )
     }
   }
@@
 func (c *Config) ParseCacheStatsInterval() time.Duration {
-  result, err := time.ParseDuration(c.CacheStatsInterval)
+  if strings.TrimSpace(c.CacheStatsInterval) == "" {
+    // Treat empty as disabled. Callers should also gate on CacheStatsEnabled.
+    return 0
+  }
+  result, err := time.ParseDuration(c.CacheStatsInterval)
   if err != nil {
     fmt.Fprintf(os.Stderr, "parse cache stats interval: %v\n", err)
     os.Exit(1)
   }
 
   return result
 }
server/packs/pushpull_test.go (1)

108-116: Set CacheStatsEnabled explicitly to avoid future default surprises.

Even if stats are off by default today, make intent clear in tests.

Apply this diff:

         }, &mongo.Config{
           ConnectionURI:      helper.MongoConnectionURI,
           YorkieDatabase:     helper.TestDBName(),
           ConnectionTimeout:  helper.MongoConnectionTimeout,
           PingTimeout:        helper.MongoPingTimeout,
+          CacheStatsEnabled:  false,
           CacheStatsInterval: helper.MongoCacheStatsInterval,
           ClientCacheSize:    helper.MongoClientCacheSize,
           DocCacheSize:       helper.MongoDocCacheSize,
           ChangeCacheSize:    helper.MongoChangeCacheSize,
           VectorCacheSize:    helper.MongoVectorCacheSize,
         },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 464a91e and a5171e7.

📒 Files selected for processing (12)
  • cmd/yorkie/server.go (3 hunks)
  • server/backend/database/mongo/client.go (2 hunks)
  • server/backend/database/mongo/client_test.go (1 hunks)
  • server/backend/database/mongo/config.go (1 hunks)
  • server/config.go (2 hunks)
  • server/config.sample.yml (1 hunks)
  • server/packs/pushpull_test.go (1 hunks)
  • server/rpc/server_test.go (1 hunks)
  • test/complex/main_test.go (1 hunks)
  • test/complex/mongo_client_test.go (1 hunks)
  • test/helper/helper.go (3 hunks)
  • test/integration/housekeeping_test.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • cmd/yorkie/server.go
  • server/config.go
  • test/complex/main_test.go
  • server/config.sample.yml
  • test/helper/helper.go
  • test/integration/housekeeping_test.go
  • server/rpc/server_test.go
  • server/backend/database/mongo/client_test.go
  • server/backend/database/mongo/client.go
  • test/complex/mongo_client_test.go
🧰 Additional context used
🧬 Code graph analysis (1)
server/packs/pushpull_test.go (1)
test/helper/helper.go (9)
  • MongoConnectionURI (97-97)
  • TestDBName (119-121)
  • MongoConnectionTimeout (96-96)
  • MongoPingTimeout (98-98)
  • MongoCacheStatsInterval (99-99)
  • MongoClientCacheSize (100-100)
  • MongoDocCacheSize (101-101)
  • MongoChangeCacheSize (102-102)
  • MongoVectorCacheSize (103-103)
🔇 Additional comments (1)
server/packs/pushpull_test.go (1)

108-116: LGTM: tests now pass explicit Mongo cache config.

Wiring the new fields via helper constants keeps tests explicit and hermetic.

Comment thread server/backend/database/mongo/config.go
@hackerwins hackerwins merged commit ebef8d2 into main Sep 19, 2025
6 checks passed
@hackerwins hackerwins deleted the cache-flag branch September 19, 2025 05:51
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.

2 participants