Python program execution on IBM i

Issue #159 closed
Shiva Kumar created an issue

Hello Team, We have a python script that is consuming more CPU % when we run on IBM i system. The same code has been tested on Windows system which executed in seconds with minimal CPU%. Does python Multithreading supports on IBM i system? We ran the script without multithreading for first time it ran in seconds but the same script takes more time and CPU after running a script that has multithreading. Thinking if python has corrupted, have reinstalled but no results.

commands used to call the program,

CALL QP2TERM

cd /Qopensys/pkgs/bin

python3 “ifspath“

Please advise.

Comments (3)

  1. Jesse G

    What does your Python program do? Do you have a sense of what methods are consuming CPU? You may be able to use QCacheGrind (see https://www.seidengroup.com/2021/03/17/how-to-measure-python-speed-with-qcachegrind/ ) or leverage PDI to get a sense of what’s going on. Python supports multithreading, but has the same global interpreter lock (GIL) restriction that other platforms have. Your underlying problem may be due to filesystem performance restrictions or something like that.

  2. Shiva Kumar reporter

    Hello Jesse, Thanks for the revert. Basically the code reads QSYSOPR messages from three systems using pyodbc in a loop, that gets updated since last run with a delay of 30sec. These messages are sent to Kafka simultaneously. Please find the CPU utilization and the time taken for each execution.

    CPU --112.8, Time taken for first execution - 142.18 seconds,

    CPU came to 71% and 71.27 seconds.

    71% and 72.06 seconds

    67% and 71.93 seconds

    72.2% and 71.67 seconds

    73.3% and 72.16 seconds

    73.9% and 71.44

    76.8% and 70.44

    78.5% and 71 seconds.

    The above stats have been taken when the Program goes to the sleep. Also I have noticed during the execution of individual threads CPU% is not constant which has touched 112% when tried to get the data from one system.

  3. Log in to comment