-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Simplify Coordinator by Refactoring to Locker and PubSub #1136
Conversation
Warning Rate limit exceeded@hackerwins has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 17 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (28)
WalkthroughThis pull request implements widespread renaming and refactoring across multiple packages. The changes standardize project caching parameters by replacing “ProjectInfoCache” with “ProjectCache” in configurations, defaults, and tests. Simultaneously, the cache creation function now panics on invalid size instead of returning an error. The PR also removes coordinator-based synchronization in favor of dedicated PubSub and Locker implementations, updating method signatures and types to eliminate dependencies on the old sync package. Several tests and RPC methods have been updated to reflect these naming and architectural modifications. Changes
Sequence Diagram(s)sequenceDiagram
participant Admin
participant AdminServer
participant Backend
participant Locker
participant PubSub
Admin->>AdminServer: Request Remove Document
AdminServer->>Backend: RemoveDocumentByAdmin()
Backend->>Locker: NewLocker(key)
Locker-->>Backend: Lock acquired
Backend->>PubSub: Publish(document removal event)
PubSub-->>Backend: Acknowledgement
Backend-->>AdminServer: Operation complete
AdminServer-->>Admin: Document removed
sequenceDiagram
participant Client
participant YorkieServer
participant PubSub
Client->>YorkieServer: Request Watch Document
YorkieServer->>PubSub: Subscribe(document ref key)
PubSub-->>YorkieServer: Subscription details
YorkieServer-->>Client: Subscription established
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
6e1d857
to
da55594
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.
Actionable comments posted: 3
🧹 Nitpick comments (14)
server/backend/backend.go (2)
41-42
: Remove outdated mention of Coordinator in the comment.
Since the Coordinator has been replaced by PubSub and Locker, please consider removing or rephrasing references to it for accuracy.-// Backend manages Yorkie's backend such as Database and Coordinator. It also -// provides in-memory cache, pubsub, and locker. +// Backend manages Yorkie's backend resources. It provides in-memory cache, +// PubSub for event-driven communication, and a Locker for concurrency control.
46-46
: Align the comment name with the field name.
Currently, the comment references "AuthWebhookCache," but the field is namedWebhookCache
.-// AuthWebhookCache is used to cache the response of the auth webhook. +// WebhookCache is used to cache the response of the auth webhook.server/backend/pubsub/pubsub.go (1)
185-190
: Cached ActorID string usage.
Reliance onString()
for concurrency side effects is slightly unusual. Consider a dedicated thread-safe method to clarify intent.server/rpc/yorkie_server.go (4)
135-147
: Consider returning the unlock error or clarifying its impact
Currently, the code only logs the error fromlocker.Unlock
without returning it. This can be acceptable in certain patterns but might hide concurrency issues if unlocking fails.
572-600
: Publish call lacks explicit error handling
Consider checking (or logging) any potential error froms.backend.PubSub.Publish
. Although it may not return an error now, future changes might warrant handling failures.
602-626
: Unsubscription event publishing
Similar to watchDoc, you might want to handle or log any failure fromPublish
for unwatch events to help diagnose potential issues.
671-687
: Broadcast event error handling
As with other Publish calls, consider how to handle publish failures to avoid silently dropping critical broadcast messages.server/backend/sync/locker.go (2)
43-64
: Consider adding context timeout handling.The
NewLocker
method ignores the context parameter. Consider implementing context timeout handling for better control over lock acquisition timeouts.func (c *LockerManager) NewLocker( - _ context.Context, + ctx context.Context, key Key, ) (Locker, error) { + select { + case <-ctx.Done(): + return nil, ctx.Err() + default: return &internalLocker{ key.String(), c.locks, }, nil + } }
78-106
: Consider adding deadlock detection.The locking implementation could benefit from deadlock detection to help diagnose issues in production.
Consider implementing:
- Lock acquisition tracking
- Lock hold duration monitoring
- Deadlock detection algorithms
server/backend/pubsub/publisher.go (2)
70-72
: Address TODO comment regarding DocumentChangedEvent optimization.The TODO comment suggests a potential optimization for handling DocumentChangedEvent.
Would you like me to help implement the optimization for handling duplicate DocumentChangedEvent entries in the batch?
102-108
: Consider adding metrics for batch publishing.The batch publishing implementation could benefit from metrics to monitor performance.
Consider adding metrics for:
- Batch sizes
- Publishing latency
- Event types distribution
pkg/cache/cache.go (1)
51-54
: Consider adding validation for nil entries map.The entries map is initialized but not checked for potential allocation failures.
Consider adding a nil check:
- return &LRUExpireCache[K, V]{ + cache := &LRUExpireCache[K, V]{ maxSize: maxSize, entries: map[K]*list.Element{}, } + if cache.entries == nil { + return nil, errors.New("failed to allocate entries map") + } + return cacheserver/rpc/admin_server.go (2)
407-407
: LGTM! Consider addressing the TODO comment.The change to use dedicated locker functionality aligns with the PR's objectives. However, there's a TODO comment about renaming
PushPullKey
that should be addressed.Would you like me to help implement a more descriptive name for the
PushPullKey
function?
431-439
: LGTM! Consider addressing the TODO comment.The change to use dedicated PubSub functionality aligns with the PR's objectives. However, there's a TODO comment about changing the
publisherID
that should be addressed.Would you like me to help implement a solution to use the actual user ID instead of
InitialActorID
?
🛑 Comments failed to post (3)
pkg/cache/cache.go (1)
46-49: 🛠️ Refactor suggestion
Consider returning an error instead of panicking.
Changing from error return to panic is a significant behavioral change that might not align with Go's error handling best practices. Panics should typically be reserved for programmer errors that are truly unrecoverable, while invalid input parameters are usually better handled by returning errors.
Consider reverting to the previous error-returning approach:
-func NewLRUExpireCache[K comparable, V any](maxSize int) *LRUExpireCache[K, V] { +func NewLRUExpireCache[K comparable, V any](maxSize int) (*LRUExpireCache[K, V], error) { if maxSize <= 0 { - panic(ErrInvalidMaxSize) + return nil, ErrInvalidMaxSize }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.func NewLRUExpireCache[K comparable, V any](maxSize int) (*LRUExpireCache[K, V], error) { if maxSize <= 0 { return nil, ErrInvalidMaxSize }
server/backend/config.go (1)
112-118:
⚠️ Potential issueUpdate error message to match new field name.
The error message still references the old name
--project-info-cache-ttl
instead of--project-cache-ttl
.Apply this diff to fix the error message:
- `invalid argument "%s" for "--project-info-cache-ttl" flag: %w`, + `invalid argument "%s" for "--project-cache-ttl" flag: %w`,📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.if _, err := time.ParseDuration(c.ProjectCacheTTL); err != nil { return fmt.Errorf( `invalid argument "%s" for "--project-cache-ttl" flag: %w`, c.ProjectCacheTTL, err, ) }
cmd/yorkie/server.go (1)
323-333: 🛠️ Refactor suggestion
Update flag names to match new parameter names.
The flag names still use the old naming convention ("project-info-cache-size" and "project-info-cache-ttl") while the variables and configuration use the new naming ("ProjectCache"). This inconsistency could be confusing for users.
Apply this diff to update the flag names:
- "project-info-cache-size", + "project-cache-size", server.DefaultProjectCacheSize, "The cache size of the project info.", ) cmd.Flags().DurationVar( &projectCacheTTL, - "project-info-cache-ttl", + "project-cache-ttl", server.DefaultProjectCacheTTL, "TTL value to set when caching project info.",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.&conf.Backend.ProjectCacheSize, "project-cache-size", server.DefaultProjectCacheSize, "The cache size of the project info.", ) cmd.Flags().DurationVar( &projectCacheTTL, "project-cache-ttl", server.DefaultProjectCacheTTL, "TTL value to set when caching project info.", )
da55594
to
58d0717
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go Benchmark
Benchmark suite | Current: 58d0717 | Previous: da55594 | Ratio |
---|---|---|---|
BenchmarkDocument/constructor_test |
1492 ns/op 1337 B/op 24 allocs/op |
1483 ns/op 1337 B/op 24 allocs/op |
1.01 |
BenchmarkDocument/constructor_test - ns/op |
1492 ns/op |
1483 ns/op |
1.01 |
BenchmarkDocument/constructor_test - B/op |
1337 B/op |
1337 B/op |
1 |
BenchmarkDocument/constructor_test - allocs/op |
24 allocs/op |
24 allocs/op |
1 |
BenchmarkDocument/status_test |
1020 ns/op 1305 B/op 22 allocs/op |
1000 ns/op 1305 B/op 22 allocs/op |
1.02 |
BenchmarkDocument/status_test - ns/op |
1020 ns/op |
1000 ns/op |
1.02 |
BenchmarkDocument/status_test - B/op |
1305 B/op |
1305 B/op |
1 |
BenchmarkDocument/status_test - allocs/op |
22 allocs/op |
22 allocs/op |
1 |
BenchmarkDocument/equals_test |
9083 ns/op 7530 B/op 134 allocs/op |
7758 ns/op 7529 B/op 134 allocs/op |
1.17 |
BenchmarkDocument/equals_test - ns/op |
9083 ns/op |
7758 ns/op |
1.17 |
BenchmarkDocument/equals_test - B/op |
7530 B/op |
7529 B/op |
1.00 |
BenchmarkDocument/equals_test - allocs/op |
134 allocs/op |
134 allocs/op |
1 |
BenchmarkDocument/nested_update_test |
17291 ns/op 12394 B/op 264 allocs/op |
18082 ns/op 12395 B/op 264 allocs/op |
0.96 |
BenchmarkDocument/nested_update_test - ns/op |
17291 ns/op |
18082 ns/op |
0.96 |
BenchmarkDocument/nested_update_test - B/op |
12394 B/op |
12395 B/op |
1.00 |
BenchmarkDocument/nested_update_test - allocs/op |
264 allocs/op |
264 allocs/op |
1 |
BenchmarkDocument/delete_test |
23871 ns/op 15924 B/op 347 allocs/op |
23910 ns/op 15924 B/op 347 allocs/op |
1.00 |
BenchmarkDocument/delete_test - ns/op |
23871 ns/op |
23910 ns/op |
1.00 |
BenchmarkDocument/delete_test - B/op |
15924 B/op |
15924 B/op |
1 |
BenchmarkDocument/delete_test - allocs/op |
347 allocs/op |
347 allocs/op |
1 |
BenchmarkDocument/object_test |
8870 ns/op 7074 B/op 122 allocs/op |
8820 ns/op 7073 B/op 122 allocs/op |
1.01 |
BenchmarkDocument/object_test - ns/op |
8870 ns/op |
8820 ns/op |
1.01 |
BenchmarkDocument/object_test - B/op |
7074 B/op |
7073 B/op |
1.00 |
BenchmarkDocument/object_test - allocs/op |
122 allocs/op |
122 allocs/op |
1 |
BenchmarkDocument/array_test |
30176 ns/op 12203 B/op 278 allocs/op |
30170 ns/op 12203 B/op 278 allocs/op |
1.00 |
BenchmarkDocument/array_test - ns/op |
30176 ns/op |
30170 ns/op |
1.00 |
BenchmarkDocument/array_test - B/op |
12203 B/op |
12203 B/op |
1 |
BenchmarkDocument/array_test - allocs/op |
278 allocs/op |
278 allocs/op |
1 |
BenchmarkDocument/text_test |
32527 ns/op 15324 B/op 492 allocs/op |
32272 ns/op 15323 B/op 492 allocs/op |
1.01 |
BenchmarkDocument/text_test - ns/op |
32527 ns/op |
32272 ns/op |
1.01 |
BenchmarkDocument/text_test - B/op |
15324 B/op |
15323 B/op |
1.00 |
BenchmarkDocument/text_test - allocs/op |
492 allocs/op |
492 allocs/op |
1 |
BenchmarkDocument/text_composition_test |
30931 ns/op 18716 B/op 504 allocs/op |
30967 ns/op 18716 B/op 504 allocs/op |
1.00 |
BenchmarkDocument/text_composition_test - ns/op |
30931 ns/op |
30967 ns/op |
1.00 |
BenchmarkDocument/text_composition_test - B/op |
18716 B/op |
18716 B/op |
1 |
BenchmarkDocument/text_composition_test - allocs/op |
504 allocs/op |
504 allocs/op |
1 |
BenchmarkDocument/rich_text_test |
85422 ns/op 40187 B/op 1183 allocs/op |
85602 ns/op 40180 B/op 1183 allocs/op |
1.00 |
BenchmarkDocument/rich_text_test - ns/op |
85422 ns/op |
85602 ns/op |
1.00 |
BenchmarkDocument/rich_text_test - B/op |
40187 B/op |
40180 B/op |
1.00 |
BenchmarkDocument/rich_text_test - allocs/op |
1183 allocs/op |
1183 allocs/op |
1 |
BenchmarkDocument/counter_test |
18660 ns/op 11874 B/op 258 allocs/op |
18755 ns/op 11874 B/op 258 allocs/op |
0.99 |
BenchmarkDocument/counter_test - ns/op |
18660 ns/op |
18755 ns/op |
0.99 |
BenchmarkDocument/counter_test - B/op |
11874 B/op |
11874 B/op |
1 |
BenchmarkDocument/counter_test - allocs/op |
258 allocs/op |
258 allocs/op |
1 |
BenchmarkDocument/text_edit_gc_100 |
1374200 ns/op 872582 B/op 17283 allocs/op |
1355109 ns/op 872560 B/op 17282 allocs/op |
1.01 |
BenchmarkDocument/text_edit_gc_100 - ns/op |
1374200 ns/op |
1355109 ns/op |
1.01 |
BenchmarkDocument/text_edit_gc_100 - B/op |
872582 B/op |
872560 B/op |
1.00 |
BenchmarkDocument/text_edit_gc_100 - allocs/op |
17283 allocs/op |
17282 allocs/op |
1.00 |
BenchmarkDocument/text_edit_gc_1000 |
53133685 ns/op 50545863 B/op 186740 allocs/op |
51268338 ns/op 50547069 B/op 186744 allocs/op |
1.04 |
BenchmarkDocument/text_edit_gc_1000 - ns/op |
53133685 ns/op |
51268338 ns/op |
1.04 |
BenchmarkDocument/text_edit_gc_1000 - B/op |
50545863 B/op |
50547069 B/op |
1.00 |
BenchmarkDocument/text_edit_gc_1000 - allocs/op |
186740 allocs/op |
186744 allocs/op |
1.00 |
BenchmarkDocument/text_split_gc_100 |
1986724 ns/op 1589083 B/op 15950 allocs/op |
1985269 ns/op 1589083 B/op 15951 allocs/op |
1.00 |
BenchmarkDocument/text_split_gc_100 - ns/op |
1986724 ns/op |
1985269 ns/op |
1.00 |
BenchmarkDocument/text_split_gc_100 - B/op |
1589083 B/op |
1589083 B/op |
1 |
BenchmarkDocument/text_split_gc_100 - allocs/op |
15950 allocs/op |
15951 allocs/op |
1.00 |
BenchmarkDocument/text_split_gc_1000 |
119415769 ns/op 141481899 B/op 186148 allocs/op |
118510936 ns/op 141481119 B/op 186144 allocs/op |
1.01 |
BenchmarkDocument/text_split_gc_1000 - ns/op |
119415769 ns/op |
118510936 ns/op |
1.01 |
BenchmarkDocument/text_split_gc_1000 - B/op |
141481899 B/op |
141481119 B/op |
1.00 |
BenchmarkDocument/text_split_gc_1000 - allocs/op |
186148 allocs/op |
186144 allocs/op |
1.00 |
BenchmarkDocument/text_delete_all_10000 |
16556968 ns/op 10213323 B/op 55684 allocs/op |
16713864 ns/op 10216128 B/op 55686 allocs/op |
0.99 |
BenchmarkDocument/text_delete_all_10000 - ns/op |
16556968 ns/op |
16713864 ns/op |
0.99 |
BenchmarkDocument/text_delete_all_10000 - B/op |
10213323 B/op |
10216128 B/op |
1.00 |
BenchmarkDocument/text_delete_all_10000 - allocs/op |
55684 allocs/op |
55686 allocs/op |
1.00 |
BenchmarkDocument/text_delete_all_100000 |
290718369 ns/op 142981664 B/op 561720 allocs/op |
275862707 ns/op 142978716 B/op 561716 allocs/op |
1.05 |
BenchmarkDocument/text_delete_all_100000 - ns/op |
290718369 ns/op |
275862707 ns/op |
1.05 |
BenchmarkDocument/text_delete_all_100000 - B/op |
142981664 B/op |
142978716 B/op |
1.00 |
BenchmarkDocument/text_delete_all_100000 - allocs/op |
561720 allocs/op |
561716 allocs/op |
1.00 |
BenchmarkDocument/text_100 |
231455 ns/op 120491 B/op 5182 allocs/op |
220566 ns/op 120491 B/op 5182 allocs/op |
1.05 |
BenchmarkDocument/text_100 - ns/op |
231455 ns/op |
220566 ns/op |
1.05 |
BenchmarkDocument/text_100 - B/op |
120491 B/op |
120491 B/op |
1 |
BenchmarkDocument/text_100 - allocs/op |
5182 allocs/op |
5182 allocs/op |
1 |
BenchmarkDocument/text_1000 |
2505746 ns/op 1171263 B/op 51086 allocs/op |
2383205 ns/op 1171262 B/op 51086 allocs/op |
1.05 |
BenchmarkDocument/text_1000 - ns/op |
2505746 ns/op |
2383205 ns/op |
1.05 |
BenchmarkDocument/text_1000 - B/op |
1171263 B/op |
1171262 B/op |
1.00 |
BenchmarkDocument/text_1000 - allocs/op |
51086 allocs/op |
51086 allocs/op |
1 |
BenchmarkDocument/array_1000 |
1318991 ns/op 1091612 B/op 11833 allocs/op |
1216874 ns/op 1091702 B/op 11834 allocs/op |
1.08 |
BenchmarkDocument/array_1000 - ns/op |
1318991 ns/op |
1216874 ns/op |
1.08 |
BenchmarkDocument/array_1000 - B/op |
1091612 B/op |
1091702 B/op |
1.00 |
BenchmarkDocument/array_1000 - allocs/op |
11833 allocs/op |
11834 allocs/op |
1.00 |
BenchmarkDocument/array_10000 |
13561858 ns/op 9800533 B/op 120299 allocs/op |
13281731 ns/op 9800657 B/op 120300 allocs/op |
1.02 |
BenchmarkDocument/array_10000 - ns/op |
13561858 ns/op |
13281731 ns/op |
1.02 |
BenchmarkDocument/array_10000 - B/op |
9800533 B/op |
9800657 B/op |
1.00 |
BenchmarkDocument/array_10000 - allocs/op |
120299 allocs/op |
120300 allocs/op |
1.00 |
BenchmarkDocument/array_gc_100 |
159713 ns/op 133279 B/op 1266 allocs/op |
149462 ns/op 133280 B/op 1266 allocs/op |
1.07 |
BenchmarkDocument/array_gc_100 - ns/op |
159713 ns/op |
149462 ns/op |
1.07 |
BenchmarkDocument/array_gc_100 - B/op |
133279 B/op |
133280 B/op |
1.00 |
BenchmarkDocument/array_gc_100 - allocs/op |
1266 allocs/op |
1266 allocs/op |
1 |
BenchmarkDocument/array_gc_1000 |
1498883 ns/op 1159597 B/op 12882 allocs/op |
1400507 ns/op 1159715 B/op 12882 allocs/op |
1.07 |
BenchmarkDocument/array_gc_1000 - ns/op |
1498883 ns/op |
1400507 ns/op |
1.07 |
BenchmarkDocument/array_gc_1000 - B/op |
1159597 B/op |
1159715 B/op |
1.00 |
BenchmarkDocument/array_gc_1000 - allocs/op |
12882 allocs/op |
12882 allocs/op |
1 |
BenchmarkDocument/counter_1000 |
216353 ns/op 193336 B/op 5773 allocs/op |
199933 ns/op 193335 B/op 5773 allocs/op |
1.08 |
BenchmarkDocument/counter_1000 - ns/op |
216353 ns/op |
199933 ns/op |
1.08 |
BenchmarkDocument/counter_1000 - B/op |
193336 B/op |
193335 B/op |
1.00 |
BenchmarkDocument/counter_1000 - allocs/op |
5773 allocs/op |
5773 allocs/op |
1 |
BenchmarkDocument/counter_10000 |
2234873 ns/op 2088255 B/op 59780 allocs/op |
2200717 ns/op 2088254 B/op 59780 allocs/op |
1.02 |
BenchmarkDocument/counter_10000 - ns/op |
2234873 ns/op |
2200717 ns/op |
1.02 |
BenchmarkDocument/counter_10000 - B/op |
2088255 B/op |
2088254 B/op |
1.00 |
BenchmarkDocument/counter_10000 - allocs/op |
59780 allocs/op |
59780 allocs/op |
1 |
BenchmarkDocument/object_1000 |
1461122 ns/op 1428387 B/op 9851 allocs/op |
1382270 ns/op 1428402 B/op 9851 allocs/op |
1.06 |
BenchmarkDocument/object_1000 - ns/op |
1461122 ns/op |
1382270 ns/op |
1.06 |
BenchmarkDocument/object_1000 - B/op |
1428387 B/op |
1428402 B/op |
1.00 |
BenchmarkDocument/object_1000 - allocs/op |
9851 allocs/op |
9851 allocs/op |
1 |
BenchmarkDocument/object_10000 |
15655528 ns/op 12164938 B/op 100560 allocs/op |
15118642 ns/op 12167455 B/op 100566 allocs/op |
1.04 |
BenchmarkDocument/object_10000 - ns/op |
15655528 ns/op |
15118642 ns/op |
1.04 |
BenchmarkDocument/object_10000 - B/op |
12164938 B/op |
12167455 B/op |
1.00 |
BenchmarkDocument/object_10000 - allocs/op |
100560 allocs/op |
100566 allocs/op |
1.00 |
BenchmarkDocument/tree_100 |
1080374 ns/op 943960 B/op 6103 allocs/op |
1021798 ns/op 943956 B/op 6103 allocs/op |
1.06 |
BenchmarkDocument/tree_100 - ns/op |
1080374 ns/op |
1021798 ns/op |
1.06 |
BenchmarkDocument/tree_100 - B/op |
943960 B/op |
943956 B/op |
1.00 |
BenchmarkDocument/tree_100 - allocs/op |
6103 allocs/op |
6103 allocs/op |
1 |
BenchmarkDocument/tree_1000 |
82008712 ns/op 86460689 B/op 60116 allocs/op |
72306103 ns/op 86460532 B/op 60116 allocs/op |
1.13 |
BenchmarkDocument/tree_1000 - ns/op |
82008712 ns/op |
72306103 ns/op |
1.13 |
BenchmarkDocument/tree_1000 - B/op |
86460689 B/op |
86460532 B/op |
1.00 |
BenchmarkDocument/tree_1000 - allocs/op |
60116 allocs/op |
60116 allocs/op |
1 |
BenchmarkDocument/tree_10000 |
9801609719 ns/op 8580651072 B/op 600213 allocs/op |
9155831173 ns/op 8580662368 B/op 600222 allocs/op |
1.07 |
BenchmarkDocument/tree_10000 - ns/op |
9801609719 ns/op |
9155831173 ns/op |
1.07 |
BenchmarkDocument/tree_10000 - B/op |
8580651072 B/op |
8580662368 B/op |
1.00 |
BenchmarkDocument/tree_10000 - allocs/op |
600213 allocs/op |
600222 allocs/op |
1.00 |
BenchmarkDocument/tree_delete_all_1000 |
83093981 ns/op 87510335 B/op 75270 allocs/op |
74186650 ns/op 87509945 B/op 75271 allocs/op |
1.12 |
BenchmarkDocument/tree_delete_all_1000 - ns/op |
83093981 ns/op |
74186650 ns/op |
1.12 |
BenchmarkDocument/tree_delete_all_1000 - B/op |
87510335 B/op |
87509945 B/op |
1.00 |
BenchmarkDocument/tree_delete_all_1000 - allocs/op |
75270 allocs/op |
75271 allocs/op |
1.00 |
BenchmarkDocument/tree_edit_gc_100 |
4138793 ns/op 4147404 B/op 15147 allocs/op |
3795298 ns/op 4147165 B/op 15146 allocs/op |
1.09 |
BenchmarkDocument/tree_edit_gc_100 - ns/op |
4138793 ns/op |
3795298 ns/op |
1.09 |
BenchmarkDocument/tree_edit_gc_100 - B/op |
4147404 B/op |
4147165 B/op |
1.00 |
BenchmarkDocument/tree_edit_gc_100 - allocs/op |
15147 allocs/op |
15146 allocs/op |
1.00 |
BenchmarkDocument/tree_edit_gc_1000 |
337954212 ns/op 383744862 B/op 154868 allocs/op |
294520606 ns/op 383740390 B/op 154842 allocs/op |
1.15 |
BenchmarkDocument/tree_edit_gc_1000 - ns/op |
337954212 ns/op |
294520606 ns/op |
1.15 |
BenchmarkDocument/tree_edit_gc_1000 - B/op |
383744862 B/op |
383740390 B/op |
1.00 |
BenchmarkDocument/tree_edit_gc_1000 - allocs/op |
154868 allocs/op |
154842 allocs/op |
1.00 |
BenchmarkDocument/tree_split_gc_100 |
2716858 ns/op 2413864 B/op 11131 allocs/op |
2499280 ns/op 2413162 B/op 11131 allocs/op |
1.09 |
BenchmarkDocument/tree_split_gc_100 - ns/op |
2716858 ns/op |
2499280 ns/op |
1.09 |
BenchmarkDocument/tree_split_gc_100 - B/op |
2413864 B/op |
2413162 B/op |
1.00 |
BenchmarkDocument/tree_split_gc_100 - allocs/op |
11131 allocs/op |
11131 allocs/op |
1 |
BenchmarkDocument/tree_split_gc_1000 |
196405118 ns/op 222253984 B/op 122013 allocs/op |
179004737 ns/op 222250924 B/op 121993 allocs/op |
1.10 |
BenchmarkDocument/tree_split_gc_1000 - ns/op |
196405118 ns/op |
179004737 ns/op |
1.10 |
BenchmarkDocument/tree_split_gc_1000 - B/op |
222253984 B/op |
222250924 B/op |
1.00 |
BenchmarkDocument/tree_split_gc_1000 - allocs/op |
122013 allocs/op |
121993 allocs/op |
1.00 |
BenchmarkRPC/client_to_server |
424312635 ns/op 19267757 B/op 216301 allocs/op |
422880583 ns/op 19810802 B/op 216178 allocs/op |
1.00 |
BenchmarkRPC/client_to_server - ns/op |
424312635 ns/op |
422880583 ns/op |
1.00 |
BenchmarkRPC/client_to_server - B/op |
19267757 B/op |
19810802 B/op |
0.97 |
BenchmarkRPC/client_to_server - allocs/op |
216301 allocs/op |
216178 allocs/op |
1.00 |
BenchmarkRPC/client_to_client_via_server |
782274266 ns/op 42148176 B/op 458510 allocs/op |
786586999 ns/op 42899960 B/op 456864 allocs/op |
0.99 |
BenchmarkRPC/client_to_client_via_server - ns/op |
782274266 ns/op |
786586999 ns/op |
0.99 |
BenchmarkRPC/client_to_client_via_server - B/op |
42148176 B/op |
42899960 B/op |
0.98 |
BenchmarkRPC/client_to_client_via_server - allocs/op |
458510 allocs/op |
456864 allocs/op |
1.00 |
BenchmarkRPC/attach_large_document |
1248543123 ns/op 1908029568 B/op 12128 allocs/op |
1228356416 ns/op 1922569984 B/op 12026 allocs/op |
1.02 |
BenchmarkRPC/attach_large_document - ns/op |
1248543123 ns/op |
1228356416 ns/op |
1.02 |
BenchmarkRPC/attach_large_document - B/op |
1908029568 B/op |
1922569984 B/op |
0.99 |
BenchmarkRPC/attach_large_document - allocs/op |
12128 allocs/op |
12026 allocs/op |
1.01 |
BenchmarkRPC/adminCli_to_server |
537456542 ns/op 36807236 B/op 289711 allocs/op |
533489507 ns/op 35999188 B/op 289725 allocs/op |
1.01 |
BenchmarkRPC/adminCli_to_server - ns/op |
537456542 ns/op |
533489507 ns/op |
1.01 |
BenchmarkRPC/adminCli_to_server - B/op |
36807236 B/op |
35999188 B/op |
1.02 |
BenchmarkRPC/adminCli_to_server - allocs/op |
289711 allocs/op |
289725 allocs/op |
1.00 |
BenchmarkLocker |
66.24 ns/op 16 B/op 1 allocs/op |
65.9 ns/op 16 B/op 1 allocs/op |
1.01 |
BenchmarkLocker - ns/op |
66.24 ns/op |
65.9 ns/op |
1.01 |
BenchmarkLocker - B/op |
16 B/op |
16 B/op |
1 |
BenchmarkLocker - allocs/op |
1 allocs/op |
1 allocs/op |
1 |
BenchmarkLockerParallel |
41.11 ns/op 0 B/op 0 allocs/op |
40.82 ns/op 0 B/op 0 allocs/op |
1.01 |
BenchmarkLockerParallel - ns/op |
41.11 ns/op |
40.82 ns/op |
1.01 |
BenchmarkLockerParallel - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkLockerParallel - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkLockerMoreKeys |
165.5 ns/op 15 B/op 0 allocs/op |
157.3 ns/op 15 B/op 0 allocs/op |
1.05 |
BenchmarkLockerMoreKeys - ns/op |
165.5 ns/op |
157.3 ns/op |
1.05 |
BenchmarkLockerMoreKeys - B/op |
15 B/op |
15 B/op |
1 |
BenchmarkLockerMoreKeys - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkChange/Push_10_Changes |
4581233 ns/op 149412 B/op 1575 allocs/op |
4603152 ns/op 149324 B/op 1568 allocs/op |
1.00 |
BenchmarkChange/Push_10_Changes - ns/op |
4581233 ns/op |
4603152 ns/op |
1.00 |
BenchmarkChange/Push_10_Changes - B/op |
149412 B/op |
149324 B/op |
1.00 |
BenchmarkChange/Push_10_Changes - allocs/op |
1575 allocs/op |
1568 allocs/op |
1.00 |
BenchmarkChange/Push_100_Changes |
16670129 ns/op 785967 B/op 8283 allocs/op |
16317741 ns/op 792293 B/op 8278 allocs/op |
1.02 |
BenchmarkChange/Push_100_Changes - ns/op |
16670129 ns/op |
16317741 ns/op |
1.02 |
BenchmarkChange/Push_100_Changes - B/op |
785967 B/op |
792293 B/op |
0.99 |
BenchmarkChange/Push_100_Changes - allocs/op |
8283 allocs/op |
8278 allocs/op |
1.00 |
BenchmarkChange/Push_1000_Changes |
129304648 ns/op 7157544 B/op 77297 allocs/op |
129553713 ns/op 7058340 B/op 77293 allocs/op |
1.00 |
BenchmarkChange/Push_1000_Changes - ns/op |
129304648 ns/op |
129553713 ns/op |
1.00 |
BenchmarkChange/Push_1000_Changes - B/op |
7157544 B/op |
7058340 B/op |
1.01 |
BenchmarkChange/Push_1000_Changes - allocs/op |
77297 allocs/op |
77293 allocs/op |
1.00 |
BenchmarkChange/Pull_10_Changes |
3692554 ns/op 123457 B/op 1406 allocs/op |
3704154 ns/op 123256 B/op 1406 allocs/op |
1.00 |
BenchmarkChange/Pull_10_Changes - ns/op |
3692554 ns/op |
3704154 ns/op |
1.00 |
BenchmarkChange/Pull_10_Changes - B/op |
123457 B/op |
123256 B/op |
1.00 |
BenchmarkChange/Pull_10_Changes - allocs/op |
1406 allocs/op |
1406 allocs/op |
1 |
BenchmarkChange/Pull_100_Changes |
5313962 ns/op 351222 B/op 5041 allocs/op |
5205356 ns/op 351069 B/op 5040 allocs/op |
1.02 |
BenchmarkChange/Pull_100_Changes - ns/op |
5313962 ns/op |
5205356 ns/op |
1.02 |
BenchmarkChange/Pull_100_Changes - B/op |
351222 B/op |
351069 B/op |
1.00 |
BenchmarkChange/Pull_100_Changes - allocs/op |
5041 allocs/op |
5040 allocs/op |
1.00 |
BenchmarkChange/Pull_1000_Changes |
10757623 ns/op 2225495 B/op 43660 allocs/op |
10519289 ns/op 2228848 B/op 43656 allocs/op |
1.02 |
BenchmarkChange/Pull_1000_Changes - ns/op |
10757623 ns/op |
10519289 ns/op |
1.02 |
BenchmarkChange/Pull_1000_Changes - B/op |
2225495 B/op |
2228848 B/op |
1.00 |
BenchmarkChange/Pull_1000_Changes - allocs/op |
43660 allocs/op |
43656 allocs/op |
1.00 |
BenchmarkSnapshot/Push_3KB_snapshot |
18782165 ns/op 913351 B/op 8287 allocs/op |
18623951 ns/op 906188 B/op 8287 allocs/op |
1.01 |
BenchmarkSnapshot/Push_3KB_snapshot - ns/op |
18782165 ns/op |
18623951 ns/op |
1.01 |
BenchmarkSnapshot/Push_3KB_snapshot - B/op |
913351 B/op |
906188 B/op |
1.01 |
BenchmarkSnapshot/Push_3KB_snapshot - allocs/op |
8287 allocs/op |
8287 allocs/op |
1 |
BenchmarkSnapshot/Push_30KB_snapshot |
132617398 ns/op 8305330 B/op 88901 allocs/op |
132494457 ns/op 8032946 B/op 85076 allocs/op |
1.00 |
BenchmarkSnapshot/Push_30KB_snapshot - ns/op |
132617398 ns/op |
132494457 ns/op |
1.00 |
BenchmarkSnapshot/Push_30KB_snapshot - B/op |
8305330 B/op |
8032946 B/op |
1.03 |
BenchmarkSnapshot/Push_30KB_snapshot - allocs/op |
88901 allocs/op |
85076 allocs/op |
1.04 |
BenchmarkSnapshot/Pull_3KB_snapshot |
7835248 ns/op 1141052 B/op 19608 allocs/op |
7450369 ns/op 1140334 B/op 19607 allocs/op |
1.05 |
BenchmarkSnapshot/Pull_3KB_snapshot - ns/op |
7835248 ns/op |
7450369 ns/op |
1.05 |
BenchmarkSnapshot/Pull_3KB_snapshot - B/op |
1141052 B/op |
1140334 B/op |
1.00 |
BenchmarkSnapshot/Pull_3KB_snapshot - allocs/op |
19608 allocs/op |
19607 allocs/op |
1.00 |
BenchmarkSnapshot/Pull_30KB_snapshot |
19472005 ns/op 9330984 B/op 189558 allocs/op |
19525432 ns/op 9338038 B/op 189557 allocs/op |
1.00 |
BenchmarkSnapshot/Pull_30KB_snapshot - ns/op |
19472005 ns/op |
19525432 ns/op |
1.00 |
BenchmarkSnapshot/Pull_30KB_snapshot - B/op |
9330984 B/op |
9338038 B/op |
1.00 |
BenchmarkSnapshot/Pull_30KB_snapshot - allocs/op |
189558 allocs/op |
189557 allocs/op |
1.00 |
BenchmarkSplayTree/stress_test_100000 |
0.1948 ns/op 0 B/op 0 allocs/op |
0.1897 ns/op 0 B/op 0 allocs/op |
1.03 |
BenchmarkSplayTree/stress_test_100000 - ns/op |
0.1948 ns/op |
0.1897 ns/op |
1.03 |
BenchmarkSplayTree/stress_test_100000 - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkSplayTree/stress_test_100000 - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkSplayTree/stress_test_200000 |
0.3841 ns/op 0 B/op 0 allocs/op |
0.3997 ns/op 0 B/op 0 allocs/op |
0.96 |
BenchmarkSplayTree/stress_test_200000 - ns/op |
0.3841 ns/op |
0.3997 ns/op |
0.96 |
BenchmarkSplayTree/stress_test_200000 - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkSplayTree/stress_test_200000 - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkSplayTree/stress_test_300000 |
0.5958 ns/op 0 B/op 0 allocs/op |
0.5818 ns/op 0 B/op 0 allocs/op |
1.02 |
BenchmarkSplayTree/stress_test_300000 - ns/op |
0.5958 ns/op |
0.5818 ns/op |
1.02 |
BenchmarkSplayTree/stress_test_300000 - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkSplayTree/stress_test_300000 - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkSplayTree/random_access_100000 |
0.01253 ns/op 0 B/op 0 allocs/op |
0.01253 ns/op 0 B/op 0 allocs/op |
1 |
BenchmarkSplayTree/random_access_100000 - ns/op |
0.01253 ns/op |
0.01253 ns/op |
1 |
BenchmarkSplayTree/random_access_100000 - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkSplayTree/random_access_100000 - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkSplayTree/random_access_200000 |
0.03301 ns/op 0 B/op 0 allocs/op |
0.02909 ns/op 0 B/op 0 allocs/op |
1.13 |
BenchmarkSplayTree/random_access_200000 - ns/op |
0.03301 ns/op |
0.02909 ns/op |
1.13 |
BenchmarkSplayTree/random_access_200000 - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkSplayTree/random_access_200000 - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkSplayTree/random_access_300000 |
0.06669 ns/op 0 B/op 0 allocs/op |
0.04462 ns/op 0 B/op 0 allocs/op |
1.49 |
BenchmarkSplayTree/random_access_300000 - ns/op |
0.06669 ns/op |
0.04462 ns/op |
1.49 |
BenchmarkSplayTree/random_access_300000 - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkSplayTree/random_access_300000 - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkSplayTree/editing_trace_bench |
0.001782 ns/op 0 B/op 0 allocs/op |
0.001685 ns/op 0 B/op 0 allocs/op |
1.06 |
BenchmarkSplayTree/editing_trace_bench - ns/op |
0.001782 ns/op |
0.001685 ns/op |
1.06 |
BenchmarkSplayTree/editing_trace_bench - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkSplayTree/editing_trace_bench - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkSync/memory_sync_10_test |
7280 ns/op 1183 B/op 35 allocs/op |
7381 ns/op 1183 B/op 35 allocs/op |
0.99 |
BenchmarkSync/memory_sync_10_test - ns/op |
7280 ns/op |
7381 ns/op |
0.99 |
BenchmarkSync/memory_sync_10_test - B/op |
1183 B/op |
1183 B/op |
1 |
BenchmarkSync/memory_sync_10_test - allocs/op |
35 allocs/op |
35 allocs/op |
1 |
BenchmarkSync/memory_sync_100_test |
52653 ns/op 8538 B/op 270 allocs/op |
53879 ns/op 8548 B/op 270 allocs/op |
0.98 |
BenchmarkSync/memory_sync_100_test - ns/op |
52653 ns/op |
53879 ns/op |
0.98 |
BenchmarkSync/memory_sync_100_test - B/op |
8538 B/op |
8548 B/op |
1.00 |
BenchmarkSync/memory_sync_100_test - allocs/op |
270 allocs/op |
270 allocs/op |
1 |
BenchmarkSync/memory_sync_1000_test |
598778 ns/op 74302 B/op 2110 allocs/op |
592671 ns/op 74494 B/op 2122 allocs/op |
1.01 |
BenchmarkSync/memory_sync_1000_test - ns/op |
598778 ns/op |
592671 ns/op |
1.01 |
BenchmarkSync/memory_sync_1000_test - B/op |
74302 B/op |
74494 B/op |
1.00 |
BenchmarkSync/memory_sync_1000_test - allocs/op |
2110 allocs/op |
2122 allocs/op |
0.99 |
BenchmarkSync/memory_sync_10000_test |
7520170 ns/op 756216 B/op 20435 allocs/op |
7614384 ns/op 748601 B/op 20360 allocs/op |
0.99 |
BenchmarkSync/memory_sync_10000_test - ns/op |
7520170 ns/op |
7614384 ns/op |
0.99 |
BenchmarkSync/memory_sync_10000_test - B/op |
756216 B/op |
748601 B/op |
1.01 |
BenchmarkSync/memory_sync_10000_test - allocs/op |
20435 allocs/op |
20360 allocs/op |
1.00 |
BenchmarkTextEditing |
5670399678 ns/op 3982628792 B/op 20647761 allocs/op |
5105231614 ns/op 3982598896 B/op 20647670 allocs/op |
1.11 |
BenchmarkTextEditing - ns/op |
5670399678 ns/op |
5105231614 ns/op |
1.11 |
BenchmarkTextEditing - B/op |
3982628792 B/op |
3982598896 B/op |
1.00 |
BenchmarkTextEditing - allocs/op |
20647761 allocs/op |
20647670 allocs/op |
1.00 |
BenchmarkTree/10000_vertices_to_protobuf |
4215907 ns/op 6263045 B/op 70025 allocs/op |
4297938 ns/op 6263015 B/op 70025 allocs/op |
0.98 |
BenchmarkTree/10000_vertices_to_protobuf - ns/op |
4215907 ns/op |
4297938 ns/op |
0.98 |
BenchmarkTree/10000_vertices_to_protobuf - B/op |
6263045 B/op |
6263015 B/op |
1.00 |
BenchmarkTree/10000_vertices_to_protobuf - allocs/op |
70025 allocs/op |
70025 allocs/op |
1 |
BenchmarkTree/10000_vertices_from_protobuf |
224844993 ns/op 442173606 B/op 290039 allocs/op |
221431582 ns/op 442173614 B/op 290040 allocs/op |
1.02 |
BenchmarkTree/10000_vertices_from_protobuf - ns/op |
224844993 ns/op |
221431582 ns/op |
1.02 |
BenchmarkTree/10000_vertices_from_protobuf - B/op |
442173606 B/op |
442173614 B/op |
1.00 |
BenchmarkTree/10000_vertices_from_protobuf - allocs/op |
290039 allocs/op |
290040 allocs/op |
1.00 |
BenchmarkTree/20000_vertices_to_protobuf |
8798023 ns/op 12716884 B/op 140028 allocs/op |
9206587 ns/op 12716948 B/op 140028 allocs/op |
0.96 |
BenchmarkTree/20000_vertices_to_protobuf - ns/op |
8798023 ns/op |
9206587 ns/op |
0.96 |
BenchmarkTree/20000_vertices_to_protobuf - B/op |
12716884 B/op |
12716948 B/op |
1.00 |
BenchmarkTree/20000_vertices_to_protobuf - allocs/op |
140028 allocs/op |
140028 allocs/op |
1 |
BenchmarkTree/20000_vertices_from_protobuf |
854376326 ns/op 1697263856 B/op 580043 allocs/op |
877336345 ns/op 1697273008 B/op 580094 allocs/op |
0.97 |
BenchmarkTree/20000_vertices_from_protobuf - ns/op |
854376326 ns/op |
877336345 ns/op |
0.97 |
BenchmarkTree/20000_vertices_from_protobuf - B/op |
1697263856 B/op |
1697273008 B/op |
1.00 |
BenchmarkTree/20000_vertices_from_protobuf - allocs/op |
580043 allocs/op |
580094 allocs/op |
1.00 |
BenchmarkTree/30000_vertices_to_protobuf |
14615766 ns/op 19318262 B/op 210030 allocs/op |
14263090 ns/op 19318343 B/op 210030 allocs/op |
1.02 |
BenchmarkTree/30000_vertices_to_protobuf - ns/op |
14615766 ns/op |
14263090 ns/op |
1.02 |
BenchmarkTree/30000_vertices_to_protobuf - B/op |
19318262 B/op |
19318343 B/op |
1.00 |
BenchmarkTree/30000_vertices_to_protobuf - allocs/op |
210030 allocs/op |
210030 allocs/op |
1 |
BenchmarkTree/30000_vertices_from_protobuf |
1954973082 ns/op 3752692392 B/op 870142 allocs/op |
1955323634 ns/op 3752054008 B/op 870146 allocs/op |
1.00 |
BenchmarkTree/30000_vertices_from_protobuf - ns/op |
1954973082 ns/op |
1955323634 ns/op |
1.00 |
BenchmarkTree/30000_vertices_from_protobuf - B/op |
3752692392 B/op |
3752054008 B/op |
1.00 |
BenchmarkTree/30000_vertices_from_protobuf - allocs/op |
870142 allocs/op |
870146 allocs/op |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
What this PR does / why we need it:
This commit simplifies the existing Coordinator, which was initially responsible for synchronizing nodes within the cluster while providing distributed locking and PubSub capabilities. With the shift to a shard-based cluster architecture, it now handles only basic in-memory locking and PubSub.
The changes included in this commit are as follows:
This simplification will ensure that the system operates more efficiently and reduces complexity.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation:
Checklist:
Summary by CodeRabbit
Refactor
Tests
Chores