You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by GitBox <gi...@apache.org> on 2021/02/03 01:40:07 UTC

[GitHub] [samza] ZitingShen commented on a change in pull request #1459: SAMZA-2618: Add per-container metric for memory-utilization

ZitingShen commented on a change in pull request #1459:
URL: https://github.com/apache/samza/pull/1459#discussion_r569041889



##########
File path: samza-core/src/main/scala/org/apache/samza/container/SamzaContainerMetrics.scala
##########
@@ -47,6 +47,7 @@ class SamzaContainerMetrics(
   val diskQuotaBytes = newGauge("disk-quota-bytes", Long.MaxValue)
   val executorWorkFactor = newGauge("executor-work-factor", 1.0)
   val physicalMemoryMb = newGauge[Double]("physical-memory-mb", 0.0F)
+  val containerMemoryUtilization = newGauge("container-memory-utilization", 0.0F)

Review comment:
       1. Sure
   2. Done
   3. Fixed the `Double` ones to be like the others, i.e. use `Float` as the type instead

##########
File path: samza-core/src/main/scala/org/apache/samza/container/SamzaContainer.scala
##########
@@ -617,13 +617,18 @@ object SamzaContainer extends Logging {
       taskConfig,
       clock)
 
+    val containerMemoryMb : Int = new ClusterManagerConfig(config).getContainerMemoryMb
+
     val memoryStatisticsMonitor : SystemStatisticsMonitor = new StatisticsMonitorImpl()
     memoryStatisticsMonitor.registerListener(new SystemStatisticsMonitor.Listener {
       override def onUpdate(sample: SystemMemoryStatistics): Unit = {
         val physicalMemoryBytes : Long = sample.getPhysicalMemoryBytes
         val physicalMemoryMb : Double = physicalMemoryBytes / (1024.0 * 1024.0)
+        val memoryUtilization : Float = physicalMemoryMb.toFloat / containerMemoryMb
         logger.debug("Container physical memory utilization (mb): " + physicalMemoryMb)
+        logger.debug("Container memory utilization: " + memoryUtilization)

Review comment:
       Done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org