Timing question when getting a cube #1093
Replies: 7 comments
-
To add to this, the same is true for the "tm1.server.get_data_directory()" function |
Beta Was this translation helpful? Give feedback.
-
Fascinating. I'm pretty sure that the requests library we use in Python doesn't do caching implicitly. EDIT: from TM1py.Services import TM1Service
import time
def timing():
address = 'localhost'
port = 12354
user = 'admin'
password = 'apple'
with TM1Service(
address=address,
port=port,
user=user,
password=password
) as tm1:
now = time.time()
t = tm1.server.get_server_name()
print(time.time() - now)
for _ in range(4):
now = time.time()
t = tm1.server.get_product_version()
print(time.time() - now)
if __name__ == "__main__":
timing() |
Beta Was this translation helpful? Give feedback.
-
What TM1 version is it?
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Marius Wirtz ***@***.***>
Sent: Friday, April 5, 2024 4:43:51 AM
To: cubewise-code/tm1py ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [cubewise-code/tm1py] Timing question when getting a cube (Discussion #1093)
Fascinating.
Is this some kind of server-side caching we weren't aware of?
I'm pretty sure that the requests library we use in Python doesn't do caching implicitly
—
Reply to this email directly, view it on GitHub<#1093 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAZQV7P5D7MOE3KUXR7ZVLLY3WNOPAVCNFSM6AAAAABFXZAMD6VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TAMJTGM4TQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I guess next steps would be a test with curl or postman? |
Beta Was this translation helpful? Give feedback.
-
I did a bit of googling and found this: https://stackoverflow.com/questions/54078692/why-first-network-call-takes-more-time-than-subsequent-ones |
Beta Was this translation helpful? Give feedback.
-
There maybe some python network profiling tools we could use.
From: bennybooo22 ***@***.***>
Reply-To: cubewise-code/tm1py ***@***.***>
Date: Friday, April 5, 2024 at 11:17 AM
To: cubewise-code/tm1py ***@***.***>
Cc: "Clapp, Ryan" ***@***.***>, Comment ***@***.***>
Subject: Re: [cubewise-code/tm1py] Timing question when getting a cube (Discussion #1093)
I did a bit of googling and found this: https://stackoverflow.com/questions/54078692/why-first-network-call-takes-more-time-than-subsequent-ones
Someone having the same issue with a different API. I would guess the relevant part of the answer for our case would be "Making initial connection handshake to the server is taking time (DNS Lookup + Initial connection + SSL). Browsers are creating Persistent Connections for HTTP requests and keep it open for some time. If any request came in for the same domain within that time, the browser will try to reuse the same connection for faster response."
I don't know how to check/verify this, but I would not be surprised if there was an initial handshake which includes a verification process that subsequent requests do not do once the connection has been established.
—
Reply to this email directly, view it on GitHub<#1093 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AEK7GZSHINIBNXH5Y4QTJTTY32573AVCNFSM6AAAAABFXZAMD6VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TAMRSHE3DE>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Did some more investigation and testing on this with the team and have some interesting findings: We compared the timing between a PA Cloud TM1 instance and a local TM1 instance and the local instance was consistently slower: The type of call is not important for this context. Measured locally (response time in seconds):
Measured locally (response time in seconds):
Quite a significant difference here. For the local test it was using a the localhost reference in the tm1params.
The loopback address (127.0.0.1) is always available, so you don't have to rely on a specific IP address. Using the configured IP address produces similar results as compared to the loopback address, but is less reliable, since IP addresses can change in a DHCP based environment. Additional findings: Adding the lines below whilst using localhost produces similar results to when using the loopback adapter:
Results:
Please feel free to comment in case more detail is needed. Cheers! |
Beta Was this translation helpful? Give feedback.
-
Below is some simple code, which gets a reference to the same cube twice after connecting. It takes around 2 seconds the first time and a split second the second time. Trying to figure out why that is:
TM1py version: 2.0.2
PA version: 11.8.01900.10
Code:
Output:
Beta Was this translation helpful? Give feedback.
All reactions