rapiddisk icon indicating copy to clipboard operation
rapiddisk copied to clipboard

Showing stats in a graphical layout via php/apache/ncurses

Open matteotenca opened this issue 2 years ago • 6 comments

Hello,

not an issue, but an idea: use rapiddiskd and (for example) a web server + PHP to show rapiddisk's statistics in a fashonable way. ncurses may be used too, in a command line tool, same idea, different approach. The objective is to show a real-time graph of the changing stats for a device. But to be honest I don't understand the exact meaning of many of the values - when/if you have time you might explain them to me:

{
  "statistics": [
    {
      "cache_stats": [
        {
          "device": "rc-wa_sda2",
          "reads": 276566,
          "writes": 198611,
          "cache_hits": 13201,
          "replacement": 147282,
          "write_replacement": 0,
          "read_invalidates": 0,
          "write_invalidates": 13572,
          "uncached_reads": 3,
          "uncached_writes": 198611,
          "disk_reads": 263370,
          "disk_writes": 198611,
          "cache_reads": 13201,
          "cache_writes": 263367
        }
      ]
    }
  ]
}

device - no problem reads - global read operations performed by rapiddisk? What is the unit of measurement of this value? writes - as above cache_hits - the number of read operations (?) which did not require disk access? replacement - no clue write_replacement - no clue read_invalidates - no clue write_invalidates - no clue uncached_reads - the number of read operations (?) which did not go into the cache? uncached_writes - as above disk_reads - the number of read operations (?) which required disk access? Is this equal to reads - cache_hits (or cache_reads)? disk_writes - same as above? In WA cache writes == disk_writes == uncached_writes ? cache_reads - no clue cache_writes - no clue

Thanks in advance!

Regards

matteotenca avatar Jun 25 '22 20:06 matteotenca

I can document these fields shortly. Remember, the caching code was originally based from Facebook's flashcache-wt: https://github.com/facebookarchive/flashcache/blob/master/doc/flashcache-doc.txt FYI, it would be neat to have a simple graphical interface.

pkoutoupis avatar Jun 27 '22 13:06 pkoutoupis

Here we go (I will add this with better detail to the Wiki and project source documentation):

          "device": "rc-wa_sda2",

RapidDisk-Cache device name.

          "reads": 276566,

Number of total reads to the RapidDisk-Cache front-node device. That means total reads that will hit both the RapidDisk RAM drive and backing store.

          "writes": 198611,

Number of total writes to the RapidDisk-Cache front-node device. That means total writes that will hit both the RapidDisk RAM drive and backing store.

          "cache_hits": 13201,

Number of read/write operations that hit the cache (i.e. the RapidDisk RAM drive).

          "replacement": 147282,

Follows a cache miss, where blocks are replaced into the cache volume i.e. the RapidDisk RAM drive).

          "write_replacement": 0,

Hmmm. I need to dig deeper into the code for this one. But this may be the writes replaced out of the cache. If that is the case, you would not see this increment in WA mode.

          "read_invalidates": 0,

Invalidated overlapping read cache blocks.

          "write_invalidates": 13572,

Invalidated overlapping write cache blocks.

          "uncached_reads": 3,

Backing store reads that were not cached.

          "uncached_writes": 198611,

Backing store writes that were not cached.

          "disk_reads": 263370,

Backing store reads.

          "disk_writes": 198611,

Backing store writes.

          "cache_reads": 13201,

Cached reads.

          "cache_writes": 263367

Cached writes.

EDIT:

In WA cache writes == disk_writes == uncached_writes ?

Yes, in a WA caching policy, that should be the case, because the writes are not cached.

pkoutoupis avatar Jun 28 '22 13:06 pkoutoupis

@matteotenca This is next on my TODO list (i.e. documenting these fields) but am intrigued to learn more about this graphical piece. It would be neat.

pkoutoupis avatar Jul 01 '22 13:07 pkoutoupis

@pkoutoupis Thank you for the informations. I'm writing a PHP app using some JS libraries to show graphs etc. I want to write a PHP interface (webserver involved) and a Python CLI tool using curses (never done this before, have to study).

I'm attaching two screenshots.

Regards

2022-07-02 09_08_07-RapidCurse – Mozilla Firefox 2022-07-02 09_09_28-RapidCurse – Mozilla Firefox s

matteotenca avatar Jul 02 '22 07:07 matteotenca

Updated Wiki to include stats description: https://github.com/pkoutoupis/rapiddisk/wiki/Miscellaneous#understanding-the-rapiddisk-cache-statistics and added you to the PR: https://github.com/pkoutoupis/rapiddisk/pull/111

Also, the mockups look neat. Thank you for experimenting and doing this work.

pkoutoupis avatar Jul 02 '22 14:07 pkoutoupis

an very good feature for an very good utility

Augusto7743 avatar Jul 07 '22 15:07 Augusto7743