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

High CPU/GPU usage when searching ladder #1371

Closed
JeanMars opened this issue Jul 28, 2019 · 23 comments
Closed

High CPU/GPU usage when searching ladder #1371

JeanMars opened this issue Jul 28, 2019 · 23 comments

Comments

@JeanMars
Copy link

JeanMars commented Jul 28, 2019

Hi,
client has an abonormal high GPU usage when searching for 1v1 ladder (see attached picture):
more than 40% of GPU resources just to animate "searching for "opponent" progress bar.
Note that CPU looks pretty abnormal too (~25%).
I would not expect this kind of resource usage for a search.
Using latest downlord release. Did not check for previous releases.
faf_ladder_search_cpu_gpu

@1-alex98
Copy link
Member

So does it stop when u stop searching?

@JeanMars
Copy link
Author

Yes, only when searching I can see this high GPU and CPU usage.
When game starts, it stops as well.

@1-alex98
Copy link
Member

Funny

@1-alex98
Copy link
Member

For me it is 3% usage with ladder search and 0% without

@1-alex98
Copy link
Member

But I have some crazy fast cpu

@1-alex98
Copy link
Member

@andreasley
Copy link
Contributor

andreasley commented Dec 3, 2019

On some systems, hardware acceleration is used for the UI. I see 25% load (!) on a RTX 2080 when searching for a 1v1 ranked match. If that can't be offloaded to the GPU (depending on hardware and drivers), it's very likely that a CPU core is completely pegged.

Edit: Confirmed. Disabling hardware acceleration for the client leads to high CPU usage instead of GPU.

@andreasley
Copy link
Contributor

andreasley commented Dec 3, 2019

I've tried limiting the framerate to 10fps like this:

public static void applicationMain(String[] args) {
    PreferencesService.configureLogging();
    System.setProperty("quantum.multithreaded", "false");
    System.setProperty("javafx.animation.pulse", "10");
    launch(args);
}

GPU usage was still over 10% and the animation was very jerky.

@andreasley
Copy link
Contributor

Something in JavaFX is just broken. I've tried replacing the JFXSpinner with https://github.com/HanSolo/CircularProgressIndicator and the result is almost exactly the same: 30% load on the GPU.

Caching the node doesn't help either and the different rendering pipelines (d3d, es2 etc.) don't make any difference.

Options:

  • Hope that some update to JavaFX or drivers makes things more efficient
  • Remove the progress indicator altogether
  • Replace the progress indicator with a linear progress bar that completes as the clock runs down and is updated once every second

@Katharsas
Copy link
Collaborator

Katharsas commented Dec 4, 2019

Maybe just put one of those spinning, circular loading indicators there instead of the bar?
Edit: Oh my bad, thats what JFXSpinner is.

@andreasley
Copy link
Contributor

Maybe just put one of those spinning, circular loading indicators there instead of the bar?

Unfortunately, as described in my previous comment, that doesn't seem to help. :(

Either there's a fundamental problem with animations in JavaFX, or something else is going on (e.g. some rendering loop or a driver problem). I'm planning to do some testing with a very basic app to rule that out.

@andreasley
Copy link
Contributor

A bare-bones JavaFX application with just an JFXSpinner or JFXProgressBar already requires 5% GPU. While that's already quite much, it's still considerably less than what we're seeing in the client. Something seems to be exaggerating that effect. Maybe some overlay or other Pane that is hidden but still being rendered?

@Katharsas
Copy link
Collaborator

Katharsas commented Dec 5, 2019

Maybe the animation causes all other parts of the GUI to get rerendered as well as the animation or something like that.
Anyway, the solution is probably either using an indicator that is less often updated (could be a custom JavaFX timeline animation) or removing it.

@andreasley
Copy link
Contributor

I couldn't find any specific problem. JFoenix and the custom styles (style.css) are fine. Removing hidden panes and elements on that tab didn't have any effect. JavaFX just seems to be fairly inefficient.

Updating less than 60 times per second (or whatever the refresh rate on the user's display is) only slightly reduced CPU load in my tests and will make the animation stutter, which isn't great.

I'm out of ideas. :(

@JeanMars, mind sharing some details about your system (CPU, GPU, display resolution and refresh rate)?

@JeanMars
Copy link
Author

JeanMars commented Dec 6, 2019

Yeah sure:
Win10 18362
Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz (4 CPUs), ~3.8GHz
16 GB RAM
GeForce GTX 660
2560 x 1440 (32 bit) (59Hz)
Details here:
DxDiag.txt
Hope that helps,
Jean

@1-alex98
Copy link
Member

1-alex98 commented Dec 9, 2019

When I researched that issue it seemed like this was a java fx issue and there is no solution to it atm. (from what i remember)

@Brutus5000
Copy link
Member

A solution would be to remove the animation causing this, right?

@andreasley
Copy link
Contributor

A solution would be to remove the animation causing this, right?

Yes.
But we have other progress bars and UI elements that are drawn frequently, so removing that one element improves just that specific case.

In the bigger context, I find it worrying that displaying a simple progress bar with JavaFX puts that much strain on a GPU (assuming that the GPU load readings in the Process Monitor are accurate).
Not that we really have a choice regarding using JavaFX with this client.

@1-alex98
Copy link
Member

Yes I also find it pretty unconfusing

@Katharsas Katharsas changed the title High GPU usage when searching ladder High CPU/GPU usage when searching ladder Jan 29, 2020
@speed2CZ
Copy link
Member

Current version of the client
After 2 hours of sitting in aeolus:
Taskmgr_2020-03-16_21-42-42
downlords-faf-client.log.2020-03-15.0.gz
downlords-faf-client.log

@1-alex98
Copy link
Member

@speed2CZ your problem is likely unrelated to this issue

@BlackYps
Copy link
Collaborator

we now have a gif instead of the spinner. So this is solved?

@JeanMars
Copy link
Author

Yeah, much better now, around 10-17%:
dwfafgpu

Nice animation BTW :-)

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

7 participants