Server self-monitoring

SAYMON can schedule a self-monitoring memory check. After this check, the results will be sent to an object specified in the server configuration.

You can configure self-monitoring with the following server configuration parameters:

  • server.self_object_id — ID of an object used for self-monitoring,

  • server.self_monitoring_period — Period between self-monitoring processes.

Self-monitoring checks return the following data:

  • Memory leak information,

  • General memory stats.

Results of a self-monitoring process are stored in the entity, the ID of which is set in the server.self_object_id parameter. Server also saves the memory dump in the following file:

/tmp/saymon-rest-server-worker-<ID-self-monitoring-entity-id>-<dump-timestamp>.heapsnapshot
If an object with the ID specified in the server.self_object_id doesn’t exist, server doesn’t perform the self-monitoring check.

Self-monitoring result has the following fields:

Field Description

entityType

Numerical type of the entity used for the self-monitoring processes.

entityId

ID of the entity used for the self-monitoring processes.

period

Period between self-monitoring processes.

timestamp

Timestamp of the launch of a self-monitoring process.

payload

Self-monitoring data.

payload.eventLoopLagMs

Server’s main loop delay in milliseconds.

payload.memory

Server memory information.

payload.memory.leak

true if there are memory leaks on the server.

payload.memory.leakInfo

Memory leak information.

payload.memory.usage

Server memory usage.

payload.memory.stats

Memory stats.

Server memory usage

Example of the server memory usage information
{
  rss: 23851008,
  heapTotal: 4907008,
  heapUsed: 2905912,
  external: 951886,
  arrayBuffers: 17574
}

Memory stats

Memory stats example
{
  gcScavengeCount: 1,
  gcScavengeTime: 1100880, // ns
  gcMarkSweepCompactCount: 2,
  gcMarkSweepCompactTime: 21157231, // ns
  gcIncrementalMarkingCount: 0,
  gcIncrementalMarkingTime: 0, //ns
  gcProcessWeakCallbacksCount: 0,
  gcProcessWeakCallbacksTime: 0, // ns
  total_heap_size: 16097280, // bytes
  total_heap_size_executable: 3670016, // bytes
  total_physical_size: 10741880, // bytes
  total_available_size: 1487689928, // bytes
  used_heap_size: 5691584, // bytes
  heap_size_limit: 1501560832, // bytes
  malloced_memory: 8192,
  peak_malloced_memory: 1185464,
  gc_time: 4587251 // ns
}