Grafana dashboard: Memtierd Demo Dashboard
Description: Dashboard used to showcase the effects of using Memtierd as a memory manager memory manager in your Kubernetes cluster.

## Memtierd Demo
Showcases how Memtierd can be used as a memory manager in Kubernetes to save memory by swapping out idle processes to swap.

This demo showcases how "high-prio" and "low-prio" workloads behave when they are managed by Memtierd. Low-prio workloads are swapped out more aggressively than high-prio workloads.

To replicate the demo you need more than just the dashboard. The required steps can be found [here](https://github.com/luukasmakila/cri-resource-manager/blob/memtier-nri/demo/memtierd/Replicating-the-demo.md).

## About the metrics

RAM Saved (G)
- Tells how much RAM is being saved by swapping out the idle workloads.

RAM Saved (%)
- Tells how big the total memory saved is in comparsin to the overall memory of the system.

Compressed (%)
- Tells how well the data is being compressed.

RAM vs Swap
- Tells how the memory is being distributed between RAM and Swap.

Page faults
- Tells how many new page faults happen in between the requests from Grafana. This is a way to express the possible performance hit workloads experience if being tracked by Memtierd.

{
  "__inputs": [
    {
      "name": "DS_MEMTIERD",
      "label": "Memtierd",
      "description": "Allows for easy visualisation of JSON data on Grafana.",
      "type": "datasource",
      "pluginId": "yesoreyeram-infinity-datasource",
      "pluginName": "Infinity"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.4.1"
    },
    {
      "type": "panel",
      "id": "piechart",
      "name": "Pie chart",
      "version": ""
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "yesoreyeram-infinity-datasource",
      "name": "Infinity",
      "version": "1.3.0"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_MEMTIERD}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "blue",
            "mode": "fixed"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 0,
        "y": 0
      },
      "id": 18,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.4.1",
      "targets": [
        {
          "columns": [
            {
              "selector": "save_memory_total",
              "text": "RAM Saved (G)",
              "type": "number"
            },
            {
              "selector": "saved_memory_percentage",
              "text": "RAM Saved (%)",
              "type": "number"
            },
            {
              "selector": "compressed",
              "text": "Compressed (%)",
              "type": "number"
            }
          ],
          "datasource": {
            "type": "yesoreyeram-infinity-datasource",
            "uid": "${DS_MEMTIERD}"
          },
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "refId": "A",
          "root_selector": "zram_and_compressed",
          "source": "url",
          "type": "json",
          "url": "http://localhost:8000/metrics",
          "url_options": {
            "data": "",
            "method": "GET",
            "params": [
              {
                "key": "fetch_zram_data",
                "value": "1"
              }
            ]
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_MEMTIERD}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": []
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 10,
        "x": 4,
        "y": 0
      },
      "id": 2,
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "right",
          "showLegend": true,
          "values": [
            "percent",
            "value"
          ]
        },
        "pieType": "pie",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "columns": [
            {
              "selector": "VmRSS",
              "text": "RAM",
              "type": "number"
            },
            {
              "selector": "VmSwap",
              "text": "Swap",
              "type": "number"
            }
          ],
          "datasource": {
            "type": "yesoreyeram-infinity-datasource",
            "uid": "${DS_MEMTIERD}"
          },
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "refId": "A",
          "root_selector": "memtierd.meme-pod-highprio-1-container.output",
          "source": "url",
          "type": "json",
          "url": "http://localhost:8000/metrics",
          "url_options": {
            "data": "",
            "method": "GET"
          }
        }
      ],
      "title": "Highprio Container RAM vs Swap",
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_MEMTIERD}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "text",
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": []
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 10,
        "x": 14,
        "y": 0
      },
      "id": 4,
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "right",
          "showLegend": true,
          "values": [
            "percent",
            "value"
          ]
        },
        "pieType": "pie",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "columns": [
            {
              "selector": "VmRSS",
              "text": "RAM",
              "type": "number"
            },
            {
              "selector": "VmSwap",
              "text": "Swap",
              "type": "number"
            }
          ],
          "datasource": {
            "type": "yesoreyeram-infinity-datasource",
            "uid": "${DS_MEMTIERD}"
          },
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "refId": "A",
          "root_selector": "memtierd.meme-pod-lowprio-1-container.output",
          "source": "url",
          "type": "json",
          "url": "http://localhost:8000/metrics",
          "url_options": {
            "data": "",
            "method": "GET"
          }
        }
      ],
      "title": "Lowprio Container RAM vs Swap",
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_MEMTIERD}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic",
            "seriesBy": "max"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 15,
            "gradientMode": "hue",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "smooth",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 8
      },
      "id": 14,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "columns": [
            {
              "selector": "timestamp",
              "text": "",
              "type": "timestamp_epoch"
            },
            {
              "selector": "VmSwap",
              "text": "Swap",
              "type": "number"
            },
            {
              "selector": "SwapAndRam",
              "text": "Swap + RAM",
              "type": "number"
            }
          ],
          "datasource": {
            "type": "yesoreyeram-infinity-datasource",
            "uid": "${DS_MEMTIERD}"
          },
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "refId": "A",
          "root_selector": "time_series_highprio_1",
          "source": "url",
          "type": "json",
          "url": "http://localhost:8000/metrics",
          "url_options": {
            "data": "",
            "method": "GET",
            "params": [
              {
                "key": "fetch_time_series_highprio_1",
                "value": "1"
              }
            ]
          }
        }
      ],
      "title": "Highprio Container Swap vs Swap + RAM (kB)",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_MEMTIERD}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic",
            "seriesBy": "last"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 15,
            "gradientMode": "hue",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "smooth",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 8
      },
      "id": 12,
      "maxDataPoints": 999999999,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "columns": [
            {
              "selector": "timestamp",
              "text": "",
              "type": "timestamp_epoch"
            },
            {
              "selector": "VmSwap",
              "text": "Swap",
              "type": "number"
            },
            {
              "selector": "SwapAndRam",
              "text": "Swap + RAM",
              "type": "number"
            }
          ],
          "datasource": {
            "type": "yesoreyeram-infinity-datasource",
            "uid": "${DS_MEMTIERD}"
          },
          "filters": [],
          "format": "timeseries",
          "global_query_id": "",
          "refId": "A",
          "root_selector": "time_series_lowprio_1",
          "source": "url",
          "type": "json",
          "url": "http://localhost:8000/metrics",
          "url_options": {
            "data": "",
            "method": "GET",
            "params": [
              {
                "key": "fetch_time_series_lowprio_1",
                "value": "1"
              }
            ]
          }
        }
      ],
      "title": "Lowprio Container Swap vs Swap + RAM (kB)",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_MEMTIERD}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "red",
            "mode": "fixed"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "smooth",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 16
      },
      "id": 21,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.4.1",
      "targets": [
        {
          "columns": [
            {
              "selector": "page_faults_minor_diff",
              "text": "Page Faults Diff",
              "type": "number"
            },
            {
              "selector": "timestamp",
              "text": "",
              "type": "timestamp_epoch"
            }
          ],
          "datasource": {
            "type": "yesoreyeram-infinity-datasource",
            "uid": "${DS_MEMTIERD}"
          },
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "refId": "A",
          "root_selector": "memtierd.meme-pod-highprio-1-container.output",
          "source": "url",
          "type": "json",
          "url": "http://localhost:8000/metrics",
          "url_options": {
            "data": "",
            "method": "GET",
            "params": [
              {
                "key": "fetch_page_faults_highprio_1",
                "value": "1"
              }
            ]
          }
        }
      ],
      "title": "Minor Page Faults Diff Critical Container",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_MEMTIERD}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "red",
            "mode": "fixed"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "smooth",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 16
      },
      "id": 22,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.4.1",
      "targets": [
        {
          "columns": [
            {
              "selector": "page_faults_minor_diff",
              "text": "Page Faults Minor Diff",
              "type": "number"
            },
            {
              "selector": "timestamp",
              "text": "",
              "type": "timestamp_epoch"
            }
          ],
          "datasource": {
            "type": "yesoreyeram-infinity-datasource",
            "uid": "${DS_MEMTIERD}"
          },
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "refId": "A",
          "root_selector": "memtierd.meme-pod-lowprio-1-container.output",
          "source": "url",
          "type": "json",
          "url": "http://localhost:8000/metrics",
          "url_options": {
            "data": "",
            "method": "GET",
            "params": [
              {
                "key": "fetch_page_faults_lowprio_1",
                "value": "1"
              }
            ]
          }
        }
      ],
      "title": "Minor Page Faults Diff Lowprio Container",
      "type": "timeseries"
    }
  ],
  "refresh": "",
  "revision": 1,
  "schemaVersion": 38,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "2023-03-28T13:54:27.064Z",
    "to": "2023-03-28T14:08:45.702Z"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Memtierd Demo Dashboard",
  "uid": "dD04zsf4z",
  "version": 16,
  "weekStart": "",
  "gnetId": 18744,
  "description": "Dashboard used to showcase the effects of using Memtierd as a memory manager memory manager in your Kubernetes cluster."
}