CRM and CX Blogs by SAP
Stay up-to-date on the latest developments and product news about intelligent customer experience and CRM technologies through blog posts from SAP experts.
cancel
Showing results for 
Search instead for 
Did you mean: 
joris_quenee
Product and Topic Expert
Product and Topic Expert
1,499

Introduction


SAP Commerce Cloud comes with some access restriction when we want to perform deep dive debugging at the node level. Indeed, unlike OnPrem installations, it is not possible to access the operation system directly where service is running.

This article shows you how to perform analysis on a specific node/pod through Hybris Administration Console (HAC) access.

Pod selection


SAP Commerce Cloud runs on Kubernetes (k8s) where pod (scheduling unit) is created dynamically at each new deployment and with up scaling/down scaling.

A pod is a Linux OS container where Commerce node is running. When we want to know what's going on with a specific Commerce node, it is necessary to identify the pod id.

From SAP Cloud Portal


You can get POD list from SAP Cloud Portal by following this path: Environments > Env > Services > Service > Replicas.

See below an example for the BackOffice Service



From Dynatrace


It is also possible to get pod list from the Dynatrace monitoring tool by following this path: Infra Observability > Tech and Processes > Apache Tomcat > tomcat <service>-*

See in below an example for the BackOffice Service



Cookie routing


KBA related : https://me.sap.com/notes/3251529/E

When we find the right pod identification we want to inspect, we can influence the routing system by forcing pod id value.

At the first page loading, the SAP Commerce Cloud routing system sets up a cookie named ROUTE to assign the user session to a specific pod. We can see the cookie value by using browser developer tool.

See in below an example for the BackOffice Service


If we want to be routed on a different pod, we just need to replace this value the pod id wished.

Node Debugging


Once we're logged into the right Commerce node, we can use HAC tooling to debug/inspect this node:

  • Node CPU / RAM usage : hac/

  • Node ThreadDump : hac/monitoring/threaddump

  • Node Cache: hac/monitoring/cache

  • Node Configuration : hac/platform/config


Pod Debugging


It is also possible to debug/inspect POD itself by using some Groovy script from HAC.

See in below some Groovy script examples that could help

List files into POD
def proc = "find .".execute()
def b = new StringBuffer()
proc.consumeProcessErrorStream(b)

println proc.text
println b.toString()

Read file deployed into the pod
def proc = "cat config/localextensions.xml".execute()
def b = new StringBuffer()
proc.consumeProcessErrorStream(b)

println proc.text
println b.toString()

Fire HTTP request from the pod
import java.net.http.*;
def TEST_URL = "https://www.google.fr" // PUT TEST URL HERE

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(TEST_URL))
.build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
println response.body();

Get TCP latency from the pod
package com.sap.groovyhac.net

def inetAddress = InetAddress.localHost
def ip = '....database.windows.net'
def port = 1443

3.times {
try {
def t0 = System.currentTimeMillis()
def clientSocket = new java.net.Socket(ip, port)
def t1 = System.currentTimeMillis()
println "${inetAddress.hostAddress} -> ${ip}:${port} OK ${clientSocket} ${t1-t0} ms"
clientSocket.close()
} catch (any) {
println "${inetAddress.hostAddress} -> ${ip}:${port} KO ${any}"
println "${any.stackTrace.join('\n')}"
}
}

Conclusion


Now that we see how to debug a Commerce Cloud node/pod, this guideline should give you a greater autonomy in your SAP Commerce Cloud administration/maintenance instance. However, if you need more advanced assistance, you should not hesitate to request an SAP Expert Service consultant to help you.

We've got several prepackaged services that could help, including a Performance Review