Workload Management
The load on an SAP HANA system can be managed by selectively applying limitations and priorities to how resources (such as the CPU, the number of active threads, and memory) are used. Settings can be applied globally or at the level of individual user sessions by using workload classes.
On an SAP HANA system, thanks to the capabilities of the platform, there are many different types of workload, from simple or complex statements to potentially long-running data loading jobs. These workload types must be balanced with the system resources that are available to handle concurrent work. For simplicity, we classify workload queries as transactional (OLTP) or analytic (OLAP). With a transactional query the typical response time is measured in milliseconds and these queries are normally executed in a single thread. However, analytic queries normally feature more complex operations using multiple threads during execution: this can lead to higher CPU usage and memory consumption compared with transactional queries.
To manage the workload of your system aim to ensure that the database management system is running in an optimal way given the available resources. The goal is to maximize the overall system performance by balancing the demand for resources between the various workloads: not just to optimize for one particular type of operation. If you achieve this, requests will be carried out in a way that meets your performance expectations and you will be able to adapt to changing workloads over time. Besides optimizing for performance, you can also optimize for robustness so that statement response times are more predictable.
Workload in the Context of SAP HANA
Workload in the context of SAP HANA can be described as a set of requests with common characteristics.
We can look at the details of a particular workload in a number of ways. We can look at the source of requests and determine if particular applications or application users generate a high workload for the system. We can examine what kinds of SQL statements are generated: are they simple or complex? Is there a prioritization of work done based on business importance, for example, does one part of the business need to have more access at peak times? We can also look at what kind of service level objectives the business has in terms of response times and throughput.

The figure shows different types of workload such as Extract Transform and Load operations (used in data warehouses to load new data in batches from source system) as well as analytic and transactional operations.
When we discuss workload management we are really talking about stressing the system in terms of its resource utilization. The main resources we look at (shown in the previous figure) are CPU, memory, disk I/O, and network. In the context of SAP HANA, disk I/O comes into play for logging, for example, in an OLTP scenario many small transactions result in a high level of logging compared to analytic workloads (although SAP HANA tries to minimize this). With SAP HANA, network connections between nodes in a scale out system can also be optimized, for example, statement routing is used to minimize network overheads.
However, when we try to influence workload in a system, the main focus is on the available CPUs and memory being allocated and utilized. Mixed transactional and analytic workloads can, for example, compete for resources and at times require more resources than are readily available. If one request dominates, there may be a queuing effect, so the next request may have to wait until the previous one is ready. Such situations need to be managed to minimize the impact on overall performance.
Options for Managing Workload
All of these options have default settings which are applied during the SAP HANA installation. These general-purpose settings may provide you with a perfectly acceptable performance, in which case the workload management features described in this chapter may be unnecessary. Before you begin workload management, ensure that the system generally is well configured: that SQL statements are tuned, that in a distributed environment tables are optimally distributed, and that indexes have been defined as needed.
If you have specific workload management requirements, the following table outlines a process of looking at ever more fine-grained controls that can be applied with regard to CPU, memory and execution priority.
Area | Possible Actions |
---|---|
CPU | Settings related to affinity are available to bind server processes to specific CPU cores. Processes must be restarted before these changes become effective. |
CPU Thread Pools | Global execution settings are available to manage CPU thread pools and manage parallel execution (concurrency). |
Memory | Global memory manager settings are available to apply limits to the resources allocated to expensive SQL statements. |
Admission Control | Global admission control settings can be used to apply system capacity thresholds above which SQL statements can be either rejected or queued. |
Workload Class Mapping | A more targeted approach to workload management is possible by setting up preconfigured classes which can be mapped to individual user sessions. You can, for example, map an application name or an application user to a specific workload class. Classes include the option to apply a workload priority value. |
Understand your Workload
Managing workloads can be viewed as an iterative three-part process: analyze the current system performance, understand the nature of your workload, and map your workload to the system resources.
There is no one single workload management configuration that fits all scenarios. Because workload management settings are highly workload dependent you must first understand your workload. The following figure shows an iterative process that you can use to understand and optimize how the system handles the workload.
- First, look at how the system is currently performing in terms of CPU usage and memory consumption. What kinds of workloads are running on the system? Are there complex, long running queries that require lots of memory?
- When you have a broad understanding of the activity in the system you can drill down to the details, such as business importance. Are statements being run that are strategic or analytic in nature, compared to standard reporting that may not be so time-critical? Can those statements be optimized to run more efficiently?
- When you have a deeper understanding of the system, you have a number of ways to influence how it handles the workload. You can map the operations to available resources, such as CPU and memory, and determine the priority that requests get by, for example, using workload classes.
Analyzing System Performance
You can use system views to analyze how effectively your system is handling the current workload.
This section lists some of the most useful views available which you can use to analyze your workload and gives suggestions for how to improve performance. Refer also to the scenarios section for more details of how these analysis results can help you to decide which workload management options to apply.
Analyzing SQL Statements
Use these views to analyze the performance of SQL statements:
- M_ACTIVE_STATEMENTS
- M_PREPARED_STATEMENTS
- M_EXPENSIVE_STATEMENTS
If these views indicate problems with statements you can use workload classes to tune the statements by limiting memory or parallelism.
Consider also the setting of any session variables (in M_SESSION_CONTEXT) which might have a negative impact on these statements. The following references provide more detailed information on this:
- SAP Note 2215929: Using Client Info to set Session Variables and Workload Class settings describes how client applications set session variables for dispatching workload classes.
- SAP HANA Developer Guide (Setting Session-Specific Client Information)
Analyzing CPU Activity
Use these views to analyze CPU activity:
- M_SERVICE_THREADS
- M_SERVICE_THREAD_SAMPLES
- M_EXPENSIVE_STATEMENTS.CPU_TIME (column)
- M_SERVICE_THREAD_CALLBACKS (stack frame information for service threads)
- M_JOBEXECUTORS (job executor statistics)
These views provide detailed information on the threads that are active in the context of a particular service and information about locks held by threads.
If these views show many threads for a single statement, and the general system load is high you can adjust the settings for the set of 'execution' ini-parameters as described in the topic Controlling Parallel Execution.