Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latency synchronizing cook completed state #310

Open
KevinCalderone opened this issue Jun 21, 2024 · 0 comments
Open

Latency synchronizing cook completed state #310

KevinCalderone opened this issue Jun 21, 2024 · 0 comments

Comments

@KevinCalderone
Copy link

Problem

There is a large latency in how the cook completed state is synchronized between the Houdini application and the HoudiniSchedulerThread. This is causing an unnecessary random 0ms-100ms latency to get added to all cook operations.

This issue is similar to what I described in this PR: #309

A cook is performed on the HoudiniSchedulerThread by calling FHoudiniApi::CookNode. (See: FHoudiniEngineScheduler::TaskCookAsset)

The HoudiniSchedulerThread then spins in a wait loop calling FHoudiniApi::GetStatus periodically to check when the cook is completed. (See: Bottom of FHoudiniEngineScheduler::TaskCookAsset).

The frequency of this polling is controlled by FHoudiniEngineScheduler::UpdateFrequency which is currently set to 100ms. This is causing there to be a random 0ms-100ms of unnecessary latency in the cook operation completing.

Possible Solutions

I am not sure what the best solution to this problem is.

The HAPI does allow you to stall the thread until the cook operation is complete. However this would break the other functionality in this function of periodically sending cook state notifications while in the wait loop.

Here are some possible solutions:

1. Increase the polling frequency

  • This is a half-measure solution
  • The GetStatus call appears to be fast but I am unsure if this causes any extra overhead inside the HAPI implementation.

2. Stall the HoudiniSchedulerThread and move the cook state update loop to a different thread.

  • It isn't clear what the thread safety is of the HAPI functions so not sure if this is safe.

3. Use a second worker thread that stalls and signals the cook complete signal back to HoudiniSchedulerThread using an FEventRef.

  • It isn't clear what the thread safety is of the HAPI functions so not sure if this is safe.
  • This is likely just a more complicated version of option 2.

4. Stall the HoudiniSchedulerThread only if the "Display Slate Cooking Notifications" option is turned off.

  • This assumes the cook state updates are only used to drive the notification UI which I am not sure of.
  • The notification UI is on by default, so this solution wouldn't help people with default settings.

4. Expose a wait with timeout primitive in the HAPI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant