Scripting Best Practices For Performance
Scripting Best Practices For Performance
Scripting allows users to extend maximo business logic using Python/JS or for that
matter any other JSR 223 compliant scripting language. All the script code gets
compiled to Java bytecode and are cached as part of Maximo runtime caches. So
when the script is invoked – it’s the cached bytecode that is executed by the JVM
using the JSR 223 bridge. Since the scripting code executes in the same thread as
other Maximo business logic (written in Java), a poorly written script code can
impact the performance of the system negatively. We have listed below a few
common mistakes that we have seen. In general we need to follow the Maximo
Performance guidelines as scripting in the end is equivalent to Maximo custom
code.
Bad code:
If mboset.count()<=1:
service.log(“skipping this as count is “+mboset.count())
try:
….
finally:
mboset.cleanup()
If this is not done, it tends to start building up and may result in OOM errors.
if debugEnabled:
service.log(“count of mbos “+mboset.count())
Starting 7612, we will add a function in the “service” variable that will allow one
to check this easily like below
If service.isLoggingEnabled():
service.log(“count of mbos “+mboset.count())