cubewise-code / tm1py

TM1py is a Python package that wraps the TM1 REST API in a simple to use library.
http://tm1py.readthedocs.io/en/latest/
MIT License
190 stars 110 forks source link

TM1Py performance after upgrade 1.11.3 >> 2.0.4 #1176

Closed hermie64 closed 1 month ago

hermie64 commented 1 month ago

I noticed a performance decrease after upgrading TM1Py from version 1.11.3 to 2.0.4.

I ran some tests in QA before upgrading our production environment, where I copied a process and a dimension. With version 1.11.3, both operations took around 30 seconds, but with version 2.0.4, they take more than twice the time.

What could be causing this?

Best regards,

Version

MariusWirtz commented 1 month ago

Thanks for the feedback @hermie64

I assume you have exactly the same code in both setups, right?

Are you passing the same arguments to TM1Service in both setups?

Can you spot where exactly it takes the extra time? is it the authentication or the read or the write operation that has gotten slower?

hermie64 commented 1 month ago

Yes, I used the same code and arguments in the same TM1 instance. I simply upgraded to version 2.0.4, noticed the performance decrease, then reinstalled version 1.11.3 and tested again.

I’ll try to gather more details to pinpoint exactly where the extra time is being spent.

Best regards,

hermie64 commented 1 month ago

I tested both versions, 1.11.3 and 2.0.4, on my own workstation, and I don't observe the same performance issue.

However, on our servers, we kick off TM1Py processes via TI. As the next step, I added some logging statements to the Python code to gather more information.

I noticed that with version 1.11.3, there’s already a significant delay (about 30 seconds) before the first logging statement is written to the log file—this doesn’t happen on my workstation. With version 2.0.4, this delay is even longer, taking over 60 seconds. Interestingly, the performance of the Python/TM1Py code itself is more or less the same, regardless of the version.

Could this be related to something like a virus scanner issue?

MariusWirtz commented 1 month ago

Virus scanner / security software is the most likely explanation.

Or is it possible that the CAM authentication takes such a long time? That could explain differences between runs?

I'm just thinking out loud, but perhaps if you compile the script to exe with PyInstaller, it's handled differently?

I will move this to discussions as it's technically not a TM1py issue.