"Is it slower since the upgrade?" You can only answer that if you measured before. Here is a simple way to do it with IBM i Services.
The question every upgrade gets
A few days after any IBM i upgrade, someone asks: "Is the system slower now?" Without data from before the change, the honest answer is "I don't know". Impressions are not evidence, and they are not a good basis for a conversation with your users, your management, or IBM Support.
The fix is cheap: capture a small snapshot of system status on a schedule, starting before the upgrade, and keep it in a table you can query. IBM i Services make this a matter of three SQL scripts.
Step 1: a history table (run once)
The table keeps one row per snapshot: CPU, ASP usage, address rates, job counts, and the value of QPFRADJ (the automatic performance adjustment), which is easy to forget and can change behavior between releases.
CREATE SCHEMA IBMIMON;
CREATE TABLE IBMIMON.SYSTEM_SNAPSHOT (
SNAPSHOT_TS TIMESTAMP NOT NULL DEFAULT CURRENT TIMESTAMP,
HOST_NAME VARCHAR(255),
ELAPSED_SECONDS INTEGER,
AVG_CPU_PCT DECIMAL(7, 2),
SYSTEM_ASP_USED_PCT DECIMAL(7, 2),
PERM_ADDRESS_RATE_PCT DECIMAL(7, 3),
TEMP_ADDRESS_RATE_PCT DECIMAL(7, 3),
TOTAL_JOBS INTEGER,
ACTIVE_JOBS INTEGER,
QPFRADJ INTEGER
);
Step 2: capture a snapshot
This insert reads QSYS2.SYSTEM_STATUS and QSYS2.SYSTEM_VALUE_INFO. Schedule it, for example every 15 minutes, with a job scheduler entry that runs RUNSQLSTM against the source member.
INSERT INTO IBMIMON.SYSTEM_SNAPSHOT (
HOST_NAME, ELAPSED_SECONDS, AVG_CPU_PCT,
SYSTEM_ASP_USED_PCT, PERM_ADDRESS_RATE_PCT,
TEMP_ADDRESS_RATE_PCT, TOTAL_JOBS, ACTIVE_JOBS, QPFRADJ)
SELECT S.HOST_NAME, S.ELAPSED_TIME, S.AVERAGE_CPU_UTILIZATION,
S.SYSTEM_ASP_USED, S.PERMANENT_ADDRESS_RATE,
S.TEMPORARY_ADDRESS_RATE, S.TOTAL_JOBS_IN_SYSTEM,
S.ACTIVE_JOBS_IN_SYSTEM,
(SELECT INTEGER(TRIM(CURRENT_CHARACTER_VALUE))
FROM QSYS2.SYSTEM_VALUE_INFO
WHERE SYSTEM_VALUE_NAME = 'QPFRADJ')
FROM TABLE (QSYS2.SYSTEM_STATUS(RESET_STATISTICS => 'YES')) S;
Two details worth knowing:
RESET_STATISTICS => 'YES' makes the CPU value the average for the interval since the previous call, so each row describes its own interval. Do not share that reset with other monitors in the same job.
- The first snapshot in a job has no previous interval, so its CPU value is 0. Values are meaningful from the second snapshot on.
- QPFRADJ is a character system value, so it has to be trimmed and converted before it goes into an integer column.
Step 3: compare days and systems
SELECT HOST_NAME,
DATE(SNAPSHOT_TS) AS DAY,
COUNT(*) AS SNAPSHOTS,
DEC(AVG(AVG_CPU_PCT), 7, 2) AS AVG_CPU_PCT,
MAX(AVG_CPU_PCT) AS PEAK_CPU_PCT,
MAX(SYSTEM_ASP_USED_PCT) AS MAX_ASP_USED_PCT,
MAX(TEMP_ADDRESS_RATE_PCT) AS MAX_TEMP_ADDR_PCT,
MAX(ACTIVE_JOBS) AS MAX_ACTIVE_JOBS,
MIN(QPFRADJ) AS QPFRADJ_MIN,
MAX(QPFRADJ) AS QPFRADJ_MAX
FROM IBMIMON.SYSTEM_SNAPSHOT
WHERE SNAPSHOT_TS >= CURRENT TIMESTAMP - 30 DAYS
GROUP BY HOST_NAME, DATE(SNAPSHOT_TS)
ORDER BY HOST_NAME, DAY;
This answers questions such as "Is production on the new release behaving like it did before the upgrade?" and, if you collect from two partitions, "Is the upgraded partition different from the one that stayed on the previous release?" Compare by HOST_NAME.
A quick tip: if QPFRADJ_MIN and QPFRADJ_MAX differ on the same day, someone changed the automatic performance adjustment. Check it.
A simple plan around your next upgrade
- Create the table and schedule the snapshot at least one to two weeks before the upgrade, so the baseline includes month-end or other peaks.
- Keep collecting through the upgrade and the first weeks after it.
- Run the daily summary and compare the same weekdays, not just averages across mixed days.
- Combine it with other evidence, such as the history log (
QSYS2.HISTORY_LOG_INFO), to explain any difference you find.
Get the scripts
All three scripts, plus others for history log analysis and PTF checks, are in my open-source repository: https://github.com/javierh77/ibmi-sql-toolkit. Feedback and pull requests are welcome.
How do you build your performance baseline before an upgrade? Which metrics would you add to this snapshot? I would like to hear in the comments.