Managing workload in S4 HANA
Recently our team came across a situation in S4 HANA which i think worth sharing and this gives you an insight if you also come around such a case in any time.
In S4 HANA, we have a report that basically scheduled via background job. The report does intensive calculation and generated around 20-50 L records and runs approximately 2 hrs . In program level it uses MAP_MERGE operator which does automatic parallelization based on the no.of workload/threads available.
Now the challenging part was that, when this program runs in HANA, it uses all the available resource i.e HANA Threads. During this time no other activity can be performed in the system as all the available HANA Threads are occupied by the single program. And definitely in a productive environment while this report runs, no other activity can be performed and this is really really bad.
Now what is the solution to this problem- We can’t use MAP_MERGE operator in the program with additional attribute saying – hei please use 50% / 60% of the available hana threads and keep some other thread for other activities.
Finally we found that in HANA level- there is something called Workload Class and Mapping Class that can be configured which then tells how much available threads can be allocated to this program and then it really controls the system deadlock situation.
Work Load Class- This can be created in HANA Cockpit or in the HANA SQL Console. Teh workload class controls what is the HANA Thread limit. Depending on the hardware there can be 32/other hana threads. And out of this we just allocated 20 threads for this workload class.
Syntax of the Workload Class-
CREATE WORKLOAD CLASS “MyWorkloadClass” SET ‘PRIORITY’ = ‘3’, ‘STATEMENT MEMORY LIMIT’ = ‘2’ , ‘STATEMENT THREAD LIMIT’ = ’20’
Now then how is the link between HANA Workload class and the Report. This role is played by the Mapping Class.
CREATE WORKLOAD MAPPING “MyWorkloadMapping” WORKLOAD CLASS “MyWorkloadClass” SET ‘APPLICATION NAME’ = ‘Report Name’;
So with the help of HANA Workload Class and Mapping Class, we can control the maximum allocation of Hana Threads to a specific program and rest of the threads can be used for some other purpose. Yes this is really cool.