Conversation
Signed-off-by: Anton Dort-Golts <dortgolts@gmail.com>
Signed-off-by: Anton Dort-Golts <dortgolts@gmail.com>
7c30999 to
b18a678
Compare
sanderpick
left a comment
There was a problem hiding this comment.
Thanks for jumping in here! I left a couple comments around semantics, otherwise LGTM.
common/common.go
Outdated
| } | ||
| } | ||
|
|
||
| func WithPubSubDisabled() NetOption { |
There was a problem hiding this comment.
How about WithNetPubsub, and when setting up NetConfig, set PubSub to true by default?
There was a problem hiding this comment.
Opps, I forgot NetConfig is public. In any case, given your findings, I'm fine with letting pubsub be off by default. So, same comment as before around semantics, but no need to have PubSub true by default.
There was a problem hiding this comment.
(We can do a minor version bump)
There was a problem hiding this comment.
Sure, now it looks more consistent.
common/common.go
Outdated
| ConnManager cconnmgr.ConnManager | ||
| Debug bool | ||
| GRPCOptions []grpc.ServerOption | ||
| PubSubDisabled bool |
There was a problem hiding this comment.
To go along with the comment below, this would just be PubSub.
| // If this is just a public key, the service itself won't be able to create records. | ||
| // In other words, all records must be pre-created and added with AddRecord. | ||
| // If no log key is provided, one will be created internally. | ||
| func WithNewLogKey(key crypto.Key) NewOption { |
There was a problem hiding this comment.
Great! For some reason I assumed this wouldn't be desired at the DB level.
There was a problem hiding this comment.
It actually slipped into the PR, but anyway we have db failures without it.
Signed-off-by: Anton Dort-Golts <dortgolts@gmail.com>
common/common.go
Outdated
| } | ||
| } | ||
|
|
||
| func WithNetPubSub() NetOption { |
There was a problem hiding this comment.
One more nit: Can you make this more like the debug option that makes using an upstream bool a little nicer, as in: WithNetPubSub(enabled bool)
Signed-off-by: Anton Dort-Golts <dortgolts@gmail.com>
|
Looks like test failures from pubsub not being default. Can you |
Signed-off-by: Anton Dort-Golts <dortgolts@gmail.com>
|
Maybe it's better to make a major version bump as it changes default behavior? |
|
Yeah, good idea. Do you need a release right away? |
|
No, it's not urgent. |
* NewDB: add the option to pass logKey Signed-off-by: Anton Dort-Golts <dortgolts@gmail.com> * Feature: optionally disable pubsub Signed-off-by: Anton Dort-Golts <dortgolts@gmail.com> * Change option semantics and disable pubsub by default Signed-off-by: Anton Dort-Golts <dortgolts@gmail.com> * Use explicit flag in pubsub option Signed-off-by: Anton Dort-Golts <dortgolts@gmail.com> * Fix: use NetOption to explicitly enable pubsub Signed-off-by: Anton Dort-Golts <dortgolts@gmail.com> Co-authored-by: requilence <requilence@gmail.com>
Running nodes for some time we've detected that pubsub mechanism combined with threads may produce a lot of unneccesary traffic.
Assuming that every thread has corresponding topic propagated through the pubsub, long-running high-degree nodes accumulate a lot of topics during its lifetime. When some other node establishes connection, it will respond with a huge hello-packet, containing all the topics seen so far, mostly irrelevant to the caller.
Taking into account that pubsub is in fact a secondary channel of event propagation, we can alleviate the problem by making it optional. Pubsub stays enabled by default, so the change won't affect any existing setup, and there is a new NetOption allowing to disable pubsub subsystem in threads completely.