Skip to content

Online stats sizes and specifying exact slab class sizes#169

Closed
dormando wants to merge 3 commits into
memcached:nextfrom
dormando:online_stats_sizes
Closed

Online stats sizes and specifying exact slab class sizes#169
dormando wants to merge 3 commits into
memcached:nextfrom
dormando:online_stats_sizes

Conversation

@dormando

@dormando dormando commented Jun 22, 2016

Copy link
Copy Markdown
Member

This two-parter PR is handy for folks wanting to tune their slab class sizes.

The stats sizes command was generally off limits as it used to hang the cache. More recently it just hangs that particular worker thread and hammers the locks.

With this update a passive system can be enabled or disabled live which will track a histogram of item sizes as they're added or removed from the cache. This allows temporarily enabling it, or simply enable and leave it running if you don't mind the overhead. The command then dumps just the pre-created histogram on demand.

stats sizes_enable and stats sizes_disable enable and disable the feature.

If your -f and -n options can be tuned to give less memory overhead, that's great. However, what if you have a cluster where items only exist at exact sizes, or the factorial is never quite close enough?

You can now specify the slab classes manually via -o slab_sizes=100-200-300-400-500. Which will create 5 slab classes around those sizes, plus a sixth at the max item size.

TODO:

  • Update documentation and -h.
  • Decide on requiring CAS being enabled for stats sizes to work.
  • Start option for enabling stats_sizes

Optional:

  • Automated tests (a nice to have since they weren't here before either)

dormando added 2 commits June 21, 2016 20:40
"stats sizes" is one of the lack cache-hanging commands. With millions of
items it can hang for many seconds.

This commit changes the command to be dynamic. A histogram is tracked as items
are linked and unlinked from the cache. The tracking is enabled or disabled at
runtime via "stats sizes_enable" and "stats sizes_disable".

This presently "works" but isn't accurate. Giving it some time to think over
before switching to requiring that CAS be enabled. Otherwise the values could
underflow if items are removed that existed before the sizes tracker is
enabled. This attempts to work around it by using it->time, which gets updated
on fetch, and is thus inaccurate.
"-o slab_sizes=100-200-300-400-500" will create 5 slab classes of those
specified sizes, with the final class being item_max_size.

Using the new online stats sizes command, it's possible to determine if the
typical factoral slab class growth rate doesn't align well with how items are
stored.

This is dangerous unless you really know what you're doing. If your items have
an exact or very predictable size this makes a lot of sense. If they do not,
the defaults are safer.
@dormando dormando added the WIP label Jun 22, 2016
Now relies on CAS feature for runtime enable/disable tracking. Still usable if
enabled at starttime with CAS disabled. Also adds start option `-o
track_sizes`, and a stat for `stats settings`.

Finally, adds documentation and cleans up status outputs.

Could use some automated tests but not make or break for release.
@dormando

Copy link
Copy Markdown
Member Author

This is now complete so far as I'm concerned. I won't merge it for a day or two while I work on other things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant