devmadhuu commented on PR #12079:
URL: https://github.com/apache/ozone/pull/12079#issuecomment-7129110795

   > Thanks [@devmadhuu](https://github.com/devmadhuu) . Adding a few comments.
   > 
   > **Can we add below three metrics to improve the observability:**
   > 
   > _1. Silent fallback — write succeeds on wrong tier, no metric_ Scenario: A 
COLD key requests ARCHIVE tier. ARCHIVE is full. SCM falls back to DISK. The 
write succeeds. The user gets no error. The data sits on DISK instead of 
ARCHIVE — only discoverable via manual ozone admin storagepolicy check CLI.
   > 
   > Metric: 
`scm_pipeline_metrics_tier_placement_fallbacks{requested_tier="ARCHIVE", 
fallback_tier="DISK"} 47`
   > 
   > ```
   > // BlockManagerImpl.java:175-192 — CURRENT
   > boolean isFallBack = false;
   > ContainerInfo containerInfo = null;
   > try {
   >   containerInfo = writableContainerFactory.getContainer(
   >       size, replicationConfig, owner, excludeList, 
storagePolicy.getCreationTier());
   > } catch (IOException e) {
   >   if (allowFallbackStoragePolicy && 
storagePolicy.getCreationFallbackTier() != StorageTier.EMPTY) {
   >     isFallBack = true;
   >     // No metric here — the fallback is silent
   >     containerInfo = writableContainerFactory.getContainer(size, 
replicationConfig, owner,
   >         excludeList, storagePolicy.getCreationFallbackTier());
   >   } else {
   >     throw e;
   >   }
   > }
   > 
   > // SUGGESTED — add a fallback counter
   > } catch (IOException e) {
   >   if (allowFallbackStoragePolicy && 
storagePolicy.getCreationFallbackTier() != StorageTier.EMPTY) {
   >     isFallBack = true;
   >     pipelineManager.getMetrics().incTierPlacementFallback(
   >         storagePolicy.getCreationTier(), 
storagePolicy.getCreationFallbackTier());
   >     containerInfo = writableContainerFactory.getContainer(size, 
replicationConfig, owner,
   >         excludeList, storagePolicy.getCreationFallbackTier());
   >   } else {
   >     throw e;
   >   }
   > }
   > ```
   > 
   > _2. ARCHIVE tier missing from cluster capacity metrics — can't predict 
COLD policy fallback risk. Add below metrics into the existing list._
   > 
   > ```
   > scm_node_manager_online_archive_capacity    
   > scm_node_manager_online_archive_used        
   > scm_node_manager_online_archive_remaining   
   > ```
   > 
   > Sample Code Snippet:
   > 
   > ```
   > // 1. SCMNodeManager.java:1641 — add Archive to UsageMetrics
   > private enum UsageMetrics {
   >   DiskCapacity, DiskUsed, DiskRemaining,
   >   SSDCapacity, SSDUsed, SSDRemaining,
   >   ArchiveCapacity, ArchiveUsed, ArchiveRemaining  // <-- add
   > }
   > 
   > // 2. SCMNodeManager.java:1228 — add ARCHIVE branch in getNodeInfo() loop
   > for (StorageReportProto reportProto : storageReportProtos) {
   >   if (reportProto.getStorageType() == StorageTypeProto.DISK) {
   >     nodeInfo.compute(keyPrefix + UsageMetrics.DiskCapacity.name(), ...);
   >     nodeInfo.compute(keyPrefix + UsageMetrics.DiskRemaining.name(), ...);
   >     nodeInfo.compute(keyPrefix + UsageMetrics.DiskUsed.name(), ...);
   >   } else if (reportProto.getStorageType() == StorageTypeProto.SSD) {
   >     nodeInfo.compute(keyPrefix + UsageMetrics.SSDCapacity.name(), ...);
   >     nodeInfo.compute(keyPrefix + UsageMetrics.SSDRemaining.name(), ...);
   >     nodeInfo.compute(keyPrefix + UsageMetrics.SSDUsed.name(), ...);
   >   } else if (reportProto.getStorageType() == StorageTypeProto.ARCHIVE) {  
// <-- add
   >     nodeInfo.compute(keyPrefix + UsageMetrics.ArchiveCapacity.name(),
   >         (k, v) -> v + reportProto.getCapacity());
   >     nodeInfo.compute(keyPrefix + UsageMetrics.ArchiveRemaining.name(),
   >         (k, v) -> v + reportProto.getRemaining());
   >     nodeInfo.compute(keyPrefix + UsageMetrics.ArchiveUsed.name(),
   >         (k, v) -> v + reportProto.getScmUsed());
   >   }
   >   // ... rest unchanged
   > }
   > ```
   > 
   > _3. Per-tier latency breakdown — to diagnose slow tier writes_ A user 
writes with COLD policy (ARCHIVE tier). Say, the write takes 5x longer than a 
HOT write (SSD tier). The operator can't tell if it's tier scarcity (no ARCHIVE 
pipelines, need to create one), container search being slow, or a general SCM 
issue.
   > 
   > Existing metrics shows aggregation only:
   > 
   >     * allocateBlockSuccessLatencyNs
   > 
   >     * allocateBlockFailureLatencyNs
   > 
   >     * pipelineCreationLatencyNs
   > 
   > 
   > Fix: pass storageTier to existing latency metrics:
   > 
   > ```
   > // 1. SCMBlockProtocolServer.java:287 — block allocation (end-to-end)
   > // CURRENT (aggregate)
   > perfMetrics.updateAllocateBlockSuccessLatencyNs(startNanos);
   > 
   > // SUGGESTED — storageTier is already available at line 224
   > perfMetrics.updateAllocateBlockSuccessLatencyNs(startNanos, storageTier);
   > perfMetrics.updateAllocateBlockFailureLatencyNs(startNanos, storageTier);
   > // 2. PipelineManagerImpl.java:429 — pipeline creation
   > // CURRENT (aggregate)
   > metrics.updatePipelineCreationLatencyNs(startNanos);
   > 
   > // SUGGESTED — storageTier is passed to createPipeline()
   > metrics.updatePipelineCreationLatencyNs(startNanos, storageTier);
   > Metrics produced:
   > 
   > scm_performance_metrics_allocate_block_success_latency_ns{tier="ARCHIVE"} 
rate
   > scm_performance_metrics_allocate_block_failure_latency_ns{tier="ARCHIVE"} 
rate
   > scm_pipeline_metrics_pipeline_creation_latency_ns{tier="ARCHIVE"} rate
   > ```
   
   Thanks @rakeshadr for the review. Agreed, these fit better as follow-ups 
than in this PR.
   
   Suggestion 2 is already filed 
[HDDS-17821](https://issues.apache.org/jira/browse/HDDS-17821). We have a 
parent JIRA [HDDS-17818](https://issues.apache.org/jira/browse/HDDS-17818) for 
storage policy observability and current JIRA [HDDS-17820 
(https://issues.apache.org/jira/browse/HDDS-17820)](https://issues.apache.org/jira/browse/HDDS-17820)
 is part of [HDDS-17818](https://issues.apache.org/jira/browse/HDDS-17818)
   
   **For other #1 and #2 suggestions:**
   1. Fallback counter: agreed, it is missing today (only the audit log has 
fallbackBlockCount). Only HOT falls back today (SSD→DISK); COLD has no fallback 
tier, so a COLD write on a full ARCHIVE fails instead, and this PR counts that 
as `requestedtier="ARCHIVE", reason="no_space"`. I'll file a sub-task under 
HDDS-17818 that counts a fallback only after the fallback allocation succeeds.
   3. Per-tier latency: I'll file a sub-task for allocateBlock latency by 
requested tier. `pipelineCreationLatencyNs` is measured inside openPipeline and 
covers only the OPEN state change, so per-tier pipeline timing fits better with 
HDDS-17823.


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to