Performance Issue with @sap-cloud-sdk/http-client
Problem Statement:
I am using Node.js version 20 and the @sap-cloud-sdk/http-client to make POST requests, but I am encountering APIs performance issues. However, when using Node.js version 18 with sap-cf-axios, the performance is better, and I receive APIs responses more quickly.
Any one please help me out here on performance issues ?
Note: We are using Cloud SDk library ->@sap-cloud-sdk/http-client - npm (npmjs.com) and it function executeHttpRequest to send request to convergent mediation system(On premise ) via cloud connector .The connectivity is made using Destination which is maintained in BTP subaccount and same for sap-cf-axios,
Function -1
const httpclient = require('@sap-cloud-sdk/http-client');
async function callSoapApi(data, req, res) {
await httpclient.executeHttpRequest(
{
destinationName: destination
},
{
method: 'POST',
url: req.url,
data: data,
headers: {
SOAPAction: "SOAP ACTION NAME"
}
},
{
fetchCsrfToken: false
}
).then(response => {
res.status(200).send(response.data);
}).catch(error => {
generateErrorMessage(req, res, error);// Separate function for error handling
});
}
Function -2
let SapCfAxios = require('sap-cf-axios').default;
let callSoapApi = async (data, req, res) => {
try {
let axios = SapCfAxios("Destination_name");
let dataResp = await axios({
method: "POST",
url: req.url,
data: data,
headers: {
SOAPAction: "SOAP ACTION NAME", // Replace with your SOAP action
}
});
res.status(200).send(dataResp.data);
} catch (error) {
generateErrorMessage(req,res,error); //Separate function for error handling
}
}
Hey @zarar1210, could you share some more details on how much performance difference you see and also compare it with the same node version. The SAP Cloud SDK uses axios underneath as well.
Hi @marikaner , Thank you for reply, We were conducting some performance testing using the JMeter tool. Here is a screenshot. We have two API endpoints.
Hi @marikaner , FYI- We have deployed nodeJS application (microservice) to Cloud Foundry in Canada (ca10) region. This application internally calls https REST endpoint in Convergent mediation system(On premise)
We are using sap-cf-axios (1.0.2) to send request to convergent mediation system(On premise ) via cloud connector .The connectivity is made using Destination which is maintained in BTP subaccount.
Issue : The performance is bad when we use Node js version 20 with stated axios Library.
However if we switch to version 18 with same libraries performance is 3 times better
Hey @zarar1210, thank you for the screenshot. I am not 100% sure how to interpret this though, because I have the impression that the categories are not necessarily comparable, but it looks like the SAP Cloud SDK performs best.
Am I understanding correctly that the sap-cf-axios library has better performance in node 18 than node 20? How is that related to the SAP Cloud SDK?
Hey @zarar1210, thank you for the screenshot. I am not 100% sure how to interpret this though, because I have the impression that the categories are not necessarily comparable, but it looks like the SAP Cloud SDK performs best.
Am I understanding correctly that the sap-cf-axios library has better performance in node 18 than node 20? How is that related to the SAP Cloud SDK?
Hi @marikaner , I agreed, We are getting quick responses when using the sap-cf-axios library with Node.js version 18. However, with SAP Cloud SDK on Node.js version 20, we are not able to achieve the same quick response times. Is there something missing in the code functionality or any other issue?"
I am not aware of any issues yet. You also pointed out, that sap-cf-axios is significantly slower in node 20, right? Did you compare sap-cf-axios with node 18 vs SAP Cloud SDK with node 18 and sap-cf-axios with node 20 vs SAP Cloud SDK with node 20? Only then this would be a fair comparison, right?
I could imagine that there might be some change in node 20 that might be related to that.
I am not aware of any issues yet. You also pointed out, that sap-cf-axios is significantly slower in node 20, right? Did you compare sap-cf-axios with node 18 vs SAP Cloud SDK with node 18 and sap-cf-axios with node 20 vs SAP Cloud SDK with node 20? Only then this would be a fair comparison, right?
I could imagine that there might be some change in node 20 that might be related to that.
Hi @marikaner , We are using this SAP Cloud SDK , "node": "20.16.0",, and "npm": ">=10.8.2" and we did try with version 18 as well performance is same while it is better with Node js version 18 and axios
Were you able to identify, where the time is lost?
and just to make sure, which version of the SAP Cloud SDK for JS are you using?
and just to make sure, which version of the SAP Cloud SDK for JS are you using?
Hi @marikaner , We are using this for now- "@sap-cloud-sdk/http-client": "^3.22.1", and "node": "20.16.0", "npm": ">=10.8.2"
Hi @zarar1210,
your investigation seems to indicate that it is likely caused by node rather than the Cloud SDK. We do not know what part of node seems to have caused your loss in response time, but I would recommend opening an issue with node instead, if the loss in response time is too significant.
I will close this issue here, as there seems to be nothing we can do about it.