How to quickly reduce memory usage on SAP Commerce Cloud
Maybe you get notified by SAP that your application on SAP Commerce Cloud is overusing the infrastructure. In this article I am showing how to check the amount of memory that is used by the different services and how to decide if some of the services can be scaled down.
The analysis shown here is only for the quick wins, e.g. shutting down services that are not used.
The first question is how much memory is my application using, and for which service? The answer is in the Dynatrace dashboard “SAP – Infra Usage”. It can look like this
From this overview it can be derived how many replicas for each service are running and how much memory is assigned for them.
The following sections showing quick strategies for the different services.
JS Storefront vs Storefront
The question here is if your application is using the legacy Storefront with JSP pages or the new JS Storefront (aka Composable Storefront aka Spartacus)?
Maybe the setup is using both, in that case there is not that much that can be done quickly here.
But if only one or the other is in use, then the other service does not need to run and can be scaled down to 0 replicas.
But if JS Storefront is not used there is a good chance that the API service is also not used and can be scaled down to 0 replicas.
If the OCC service is not used heavily it would also be possible to run this service on the Storefront service.
Backgroundprocessing and Backoffice
Usually it is not possible (and useful) to scale these service down to 0, but again in Dynatrace it can be monitored how much memory is really used by the cronjobs (usually running on the Backgroundprocessing service) or by Backoffice users.
Often it is possible to reduce the amount of memory that is allocated to these services.
The default setup for Solr in production environments is with four servers. The Solr admin console can be used to determine if all four servers are in use. Also the memory consumption should be checked during a full index.
The following screenshot shows a Solr admin console in which two servers are not used and can be removed.
If during the investigation some optimisations could be found the services can be adjusted by SAP Support, which means you have to contact the SAP Support through a ticket.
This article is only about quick wins, if you need deeper analysis there are other articles that can help in that case or you can buy our Performance Review package. Other articles are:
- How to Reduce Memory Utilization on SAP Commerce Cloud
- How to Reduce CPU Utilization on SAP Commerce Cloud
- How to perform a cleanup table to improve the DB performance?
It is also possible to buy additional memory usage, please contact your sales representative.