The aggregate option for stats command given wrong result

Created on 8 June 2023, almost 2 years ago

I am working on improving or a new memcache_admin module to inspect slabs content, etc.

It seems that the $aggregate flag for the stats command in DriverBase.php is aggregating some variables which don't make sense.
For example, I am using stats slab to get the list of slabs. I have 2 memcache servers.

Here is the result when I invoke the command without $aggregate (FALSE by default):

"memcache:11211" => array:418 [
  "2:chunk_size" => 120
  "2:chunks_per_page" => 8738
  "2:total_pages" => 1
     ....
"memcachebis:11211" => array:418 [
  "2:chunk_size" => 120
  "2:chunks_per_page" => 8738
  "2:total_pages" => 1

Now if I invoke the same with $aggregate = TRUE:

array:450 [
  "2:chunk_size" => 240
  "2:chunks_per_page" => 17476
  "2:total_pages" => 2

I don't think the chunk_size and chunks_per_page should be aggregated.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇫🇷France vbouchet

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @vbouchet
  • 🇫🇷France vbouchet

    These is a $no_aggregate array for some variable which don't aggregate:

    // Some variables don't logically aggregate.
    $no_aggregate = [
      'pid',
      'time',
      'version',
      'libevent',
      'pointer_size',
      'accepting_conns',
      'listen_disabled_num',
    ];
    

    However, the variable keys are not clearly known (actually it is from 0 to 42 I think) but even if we exclude from aggregation, it completely strips the variable from the result, it does not keep the first or last occurrence.

    We would need to add some logic here to accept "regex" variable name and to keep the first or last occurrence.

  • 🇫🇷France vbouchet

    I am actually wondering if there is any guarantee that 2 slabs with the same ID on different servers will always have the same chunk size. In other words, I am wondering if aggregating on keys makes any sense when talking about stats slabs. If we really want to aggregate slabs statistics from multiple servers, it has to be done on the chunk_size to be consistent.

Production build 0.71.5 2024