In some cases (e.g. lots of instances) the Workload Statistics Collector fails to create those statistics due to memory shortage and aborts with a TSV_TNEW_PAGE_ALLOC_FAILED short dump (or another short dump indicating memory shortage).
Note: If you never saw such a short dump in your system, this blog is purely informational for you, no need to change anything in your system.
SAP offers an enhanced version of the Workload Statistics Collector to resolve these problems, it is described in note 945279 (and some more notes attached to that one). This enhanced version is an additional piece of software, no changes at existing coding are necessary.
To build up weekly or monthly statistics, the standard collector loads the profiles from the database, does the aggregation and stores them back into the database. So far, so good. But it loads all profiles together into main memory; transaction profile, time profile, memory profile, RFC profiles, ... All profiles you can see in ST03N for a given time period are loaded together into main memory for aggregation. This may lead to memory shortage if the profiles are large.
The enhanced Workload Statistics Collector works different. It loads one profile, does the aggregation, stores the result back to the database, frees the memory and then loads the next profile. So it will never keep all the profiles mentioned above together in main memory.
Unfortunately, all profiles are stored together in the database in one cluster, so when touching such a cluster, all profiles are touched.
To alleviate that, the first step is to load all the profiles for one instance for one day (created by the standard collector) into the memory and then save one profile after the other into a new database table, not creating one big cluster but many smaller ones -- the transaction profile gets its own cluster, so does the memory profile, each RFC profile (there are four different types of RFC profiles), the time profile, ... you get the point.
The next step is the aggregation, but instead of loading the big cluster containing all profiles, we now can handle each profile separately, built the weekly or monthly statistics, save the profile back to the database and free the main memory before continuing with the next profile.
Next challenge: ST03N does not know anything about the new database table where all the profiles are located separately. It still looks at the well-known MONI table. So the third step is the re-combination of the single profiles (but now for weekly or monthly statistics!) into one big chunk and save that into the MONI table.
Step four is merely cleaning up, deleting all pieces (profiles) that are not used anymore for further aggregation.
Within the next screen, disable the flags for "Cumulate statistics for period 'Week'", "Cumulate statistics for period 'Month'" and "Cumulate server statistics for total system-wide stats".
...
Finally, you can schedule a background job with program RSTOTL00 as only step. Let it run and finish once before scheduling it as a daily job, because the initial run may take a long time to process. The enhanced collector will process all available daily statistics from all instances in its first run and two collectors should not run at the same time.
The enhanced Workload Statistics Collector can handle amounts of statistical data that are a lot larger than the standard Workload Statistics Collector can handle. However, it cannot handle everything. Quite often, the four types of RFC profiles are getting really big, causing memory problems even with the enhanced collector. The RFC profiles contain about twelve key fields and five data fields. By omitting some of the key fields, the size of the RFC profiles can be reduced. The enhanced collector offers this feature, including an analysis tool to find out, how much memory can be saved when omitting which key fields. I will shed more light on this in the An Enhanced Workload Statistics Collector for large customer systems - Part II.
The enhanced Workload Statistics Collector trades off memory usage against performance. Due to the algorithm, database load may be higher than it would be with the standard collector and more redo logs may be created. If the standard collector does its job without problems, don't switch to the enhanced collector.
The enhanced Workload Statistics Collector maintains several tables to record its progress. First, there is the log which can be viewed with program RSTOTL05. Second, table SAPWLMTOC1 contains entries for the daily statistics including flags if they have been splitted into SAPWLMONI, if they have been aggregated to weekly or monthly statistics and how many seconds the aggregation needed. You can view this table with transaction SE16 and watch the flags changing while the enhanced collector is running. Third, table SAPWLMTOC2 contains entries for weekly and monthly statistics, including flags if the statistics have been changed by the collector (then it's necessary to put the data back to table MONI) or if the statistics are complete. This is all quite technical information, but if you want to watch the collector doing its work, this might be interesting.