-
Notifications
You must be signed in to change notification settings - Fork 11
Store seshat:field_specs/0 in persistent terms
#202
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
Conversation
|
Testing this on RabbitMQ main with 2000 streams:
Persistent term field specs: |
f34d066 to
c53cddd
Compare
Previously each writer, replica reader and replica stored their field
spec in seshat, so the ETS group table in seshat contained many
duplicate field spec values. Seshat accepts `{persistent_term, term()}`
for field specs to avoid this duplication. We can update osiris_writer,
osiris_replica_reader and osiris_reader to eagerly create those
persistent terms with their field specs and avoid the duplication in
ETS. This saves a significant amount of memory consumed by the ETS table
and also saves time and garbage when querying the ETS table, for
example when building the counters map with `seshat:counters(osiris)`.
c53cddd to
a868b5b
Compare
|
So, a ≈ 38.5% percent speedup for |
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.
Note that besides a 38% execution time gain and a 90+% ETS table memory footprint gain (on isolated benchmarks), this practice is already used in Ra for its counters https://github.com/rabbitmq/ra/blob/main/src/ra_counters.erl#L28.
|
@the-mikedavis thank you! |
Previously each writer, replica reader and replica stored their field spec in seshat, so the ETS group table in seshat contained many duplicate field spec values. Seshat accepts
{persistent_term, term()}for field specs to avoid this duplication. We can update osiris_writer, osiris_replica_reader and osiris_reader to eagerly create those persistent terms with their field specs and avoid the duplication in ETS. This saves a significant amount of memory consumed by the ETS table and also saves time and garbage when querying the ETS table, for example when building the counters map withseshat:counters(osiris).