Is there any way to determine an individual jobs memory consumption on the iSeries?
-
22-07-2019 - |
Question
We have a mixture of .Net apps that connect through ODBC and DB2 Connect to an iSeries LPAR that's at V5R4. We also have some batch jobs running natively on the machine (COBOL, RPG, and straight CL mostly). During certain periods of the day, we experience high page faulting and are trying to determine which apps might be causing the problem.
Without purchasing any of the dozens of expensive tools on the market (i.e. iDoctor), is there any way to see the amount of memory being consumed by each job. Most of our jobs are running out of pool 2 and we do see improved performance when we add memory to that pool and simply looking at wrksyssts doesn't help much. We'd like to isolate the problem jobs and see if some modifications can be made to improve performance and reduce unnecessary memory utilization.
Solution
If you don't mind Java or its jvm or doing a little coding ...
Get the following (all available for Windows, Linux, AIX, Solaris, etc ... Mac?):
- Groovy for I kinda hate Java's wordiness
- JTOpen which is IBM's open source version of IBM Toolbox for Java which is shipped with System i Access and which you should have received with your server
Keep in mind that JTOpen is just a plain old Java library so that you can use any jvm language that can access ordinary java libraries. I'm using Groovy cause I'm having a thing for it. Don't worry, Groovy is nice.
Here goes.
import com.ibm.as400.access.*
// how many seconds to run
secs = 20
sys = new AS400("theserver", "paulg", "dotnet4evah")
job = new Job(sys, "jobname", "jobusername", "jobnumber")
job.load()
println "Stats for ${job.toString()}"
// this might look horrible
println "total CPU time\tpage faults/sec\tdisk IO ops/sec"
while (secs--) {
job.loadStatistics()
print "${job.getCPUUsed()/1000}\t\t"
print "${job.getValue(Job.ELAPSED_PAGE_FAULTS)}\t\t"
println "${job.getValue(Job.ELAPSED_DISK_IO)}"
job.resetStatistics()
Thread.sleep(1000)
}
sys.disconnectAllServices()
That's it. There are many other job values to play with. I've never had to bother with these job statistics so I do not know if resetting the statistics is the right thing.
It is a pain to actually know the job number and other details about the job in order to create the Job object. That's why JobList is so nice. You can also run CL commands from your script if that is useful.
I think IBM uses this library to build Ops Navigator so maybe you've been using this for a while already.
OTHER TIPS
This seems to help a little:
-- In iSeries Navigator, expand My Connections > connection > Work Management > Memory Pools > Active Pools or Shared Pools. -- Right-click the memory pool you want to use and click Jobs. -- Customize view to include the Page Faults column
At least I can see which jobs are having faulting issues. The next time issue comes up, we'll see if it helps find the offending app(s).