microsoft / PowerPlatform-DataverseServiceClient

Code Replica for Microsoft.PowerPlatform.Dataverse.Client and supporting nuget packages.
MIT License
279 stars 50 forks source link

The value of RecommendedDegreesOfParallelism is not correct set until any request was performed #430

Closed jarvan-jiang closed 7 months ago

jarvan-jiang commented 8 months ago

We have a .net framework app working with 1.0.23 DataverseServiceClient working well, after the service client initialized, we can get the correct RecommendedDegreesOfParallelism returned from server. But recently we are creating new app with latest version 1.1.17 of DataverseServiceClient, I found the RecommendedDegreesOfParallelism is not correct after service client initialized. I dig into the source code and found the value only will be set after any request was received. And I did a test seems so: image

Is it an unexpected behavior?

MattB-msft commented 8 months ago

RDOP is set only after the first call to the server. The 1.1.17 client does not connect to DV as part of the client setup to improve boot up perf.

If you make a WhoAmI call right after creating the client, it will set it to what the server believes it to be.

jarvan-jiang commented 8 months ago

RDOP is set only after the first call to the server. The 1.1.17 client does not connect to DV as part of the client setup to improve boot up perf.

If you make a WhoAmI call right after creating the client, it will set it to what the server believes it to be.

Thanks for explanation, that make sense. But do you consider to throw exception before RDOP is got, or fire a request in the RDOP getter to get correct value, instead of given default 5? That makes people easier to find out the change.

MattB-msft commented 7 months ago

5 is used as the default as its the min RDOP for the platform. RDOP is not a fixed number once connected, it can change between requests depending on our auto rescaling of the platform. It's important that you're looking at the current numbers when you execute a request that depends on parallelism.

We chose to not throw here or force a refresh as any call to the server at all in the client will pick up the current values.

Hope that clarifies our thinking here.