Every few seconds I’m seeing data like this report...
# puppet
i
Every few seconds I’m seeing data like this reported in the gc.log - which of these indicates the size of the code cache ? Do I need a different setting in the Xlog params to get the code cache data ? [1589.940s][info][gc,phases ] GC(138) Pre Evacuate Collection Set: 0.3ms [1589.940s][info][gc,phases ] GC(138) Merge Heap Roots: 0.5ms [1589.940s][info][gc,phases ] GC(138) Evacuate Collection Set: 168.9ms [1589.940s][info][gc,phases ] GC(138) Post Evacuate Collection Set: 8.2ms [1589.940s][info][gc,phases ] GC(138) Other: 0.2ms [1589.940s][info][gc,heap ] GC(138) Eden regions: 871->0(864) [1589.940s][info][gc,heap ] GC(138) Survivor regions: 50->57(116) [1589.940s][info][gc,heap ] GC(138) Old regions: 325->325 [1589.940s][info][gc,heap ] GC(138) Archive regions: 2->2 [1589.940s][info][gc,heap ] GC(138) Humongous regions: 1->1 [1589.940s][info][gc,metaspace] GC(138) Metaspace: 507122K(623808K)->507122K(623808K) NonClass: 448768K(518528K)->448768K(518528K) Class: 58354K(105280K)->58354K(105280K) [1589.940s][info][gc ] GC(138) Pause Young (Normal) (G1 Evacuation Pause) 9983M->3071M(12288M) 178.123ms [1589.940s][info][gc,cpu ] GC(138) User=0.70s Sys=0.00s Real=0.18s
c
None of those are code cache. As far as I know, the GC algorithm only manages the Java Heap --- which does not include the code cache. So, there likely is no GC log setting that would show the activity you are looking for.
i
Ok thanks - so how do I find out the usage in the code cache ?
c
The
status/
API exposes it as a metric. The https://forge.puppet.com/modules/puppetlabs/puppet_operational_dashboards may graph it out.
An example:
Copy code
# curl -ksS \
   --cert "$(puppet config print hostcert)" \
   --key "$(puppet config print hostprivkey)" \
   https://localhost:8140/status/v1/services/status-service?level=debug \
   | jq '.status.experimental."jvm-metrics"."memory-pools"'

{
  "Metaspace": {
    "type": "NON_HEAP",
    "usage": {
      "committed": 167182336,
      "init": 0,
      "max": -1,
      "used": 160125168
    }
  },
  "CodeHeap 'non-nmethods'": {
    "type": "NON_HEAP",
    "usage": {
      "committed": 2555904,
      "init": 2555904,
      "max": 5828608,
      "used": 1574528
    }
  },
  "CodeHeap 'profiled nmethods'": {
    "type": "NON_HEAP",
    "usage": {
      "committed": 39190528,
      "init": 2555904,
      "max": 265519104,
      "used": 38086912
    }
  },
  "Compressed Class Space": {
    "type": "NON_HEAP",
    "usage": {
      "committed": 32505856,
      "init": 0,
      "max": 1073741824,
      "used": 29519824
    }
  },
  "G1 Eden Space": {
    "type": "HEAP",
    "usage": {
      "committed": 1340080128,
      "init": 113246208,
      "max": -1,
      "used": 398458880
    }
  },
  "G1 Old Gen": {
    "type": "HEAP",
    "usage": {
      "committed": 794820608,
      "init": 2034237440,
      "max": 2147483648,
      "used": 181091840
    }
  },
  "G1 Survivor Space": {
    "type": "HEAP",
    "usage": {
      "committed": 12582912,
      "init": 0,
      "max": -1,
      "used": 12582912
    }
  },
  "CodeHeap 'non-profiled nmethods'": {
    "type": "NON_HEAP",
    "usage": {
      "committed": 10616832,
      "init": 2555904,
      "max": 265523200,
      "used": 10593792
    }
  }
}
a
These are captured by
puppet_operational_dashboards
but not included in the dashboard by default. Setting code cache to
2g
is something that should be done regardless.
i
Thanks .. I cant see it on operational dashboard Could it be added in the next update for the dashboard ?
a
No one really maintains it anymore, unfortunately. You can add these to a panel and "Save as" the dashboard if you want.
Copy code
SELECT distinct("memory-pools_CodeHeap_'non-profiled_nmethods'_usage_used") FROM "puppetserver" WHERE ("url" =~ /^$url$/) AND $timeFilter GROUP BY time($Group_by_time), "url" fill(null)
Copy code
SELECT distinct("memory-pools_CodeHeap_'profiled_nmethods'_usage_used") FROM "puppetserver" WHERE ("url" =~ /^$url$/) AND $timeFilter GROUP BY time($Group_by_time), "url" fill(null)
c
That can be raised as a feature request: https://github.com/puppetlabs/puppet_operational_dashboards I don't know when the next module update is planned, so creating that view as your own dashboard is probably the best path for now.
i
Thanks