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

Optimization #176

Closed
4 tasks done
Lerphie opened this issue Nov 11, 2023 · 15 comments
Closed
4 tasks done

Optimization #176

Lerphie opened this issue Nov 11, 2023 · 15 comments

Comments

@Lerphie
Copy link

Lerphie commented Nov 11, 2023

Terms

  • I'm using the very latest version of CosmeticsCore and its dependencies.
  • I already searched on this Github page to check if the same issue was already reported.
  • I already searched on the plugin wiki to know if a solution is already known.
  • I already searched on the Discord server to know if anyone already provided a solution in the past for the issue.

Discord tag (optional)

Coder#6926

What happened?

I have a large server with over 300 people playing on it. When the players accumulate, your plugin causes a heavy load on the server processor.

https://spark.lucko.me/n0wU4PFcJ3

Steps to reproduce the issue

Server version

This server is running GuardSpigot 1.16.5 version git-Airplane-"e37fa86" (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)

CosmeticsCore Version

image

ProtocolLib Version

image

LoneLibs Version

image

FULL server log

No response

Error (optional)

No response

CosmeticsCore config.yml

No response

Problematic items yml configuration file (optional)

No response

Other files, you can drag and drop them here to upload. (optional)

https://spark.lucko.me/n0wU4PFcJ3

Screenshots/Videos (you can drag and drop files or paste links)

https://spark.lucko.me/n0wU4PFcJ3

@Lerphie Lerphie added the type: bug Something isn't working label Nov 11, 2023
@Lerphie
Copy link
Author

Lerphie commented Nov 11, 2023

The load is higher

image

25ms for main thread tasks

image

35ms for parse packet and then forward into protocollib and then into plugins

Please LoneDev! I really love your plugins, we need your optimization
Mostly the problem appears when many players are crowded into one chunk

@LoneDev6
Copy link
Contributor

TPS is 20, it's not causing excessive CPU load.

image

The plugin is coded with performance in mind, and was tested extensively on a server with more than 200 players moving around with cosmetics.

Did you experience any slowdown or the only alarming detail was the timings report orange ms indicators?

Anyway tomorrow I'll do a detailed check to see if the function you reported can be further optimized.

@LoneDev6 LoneDev6 moved this to Todo in Other plugins Nov 12, 2023
@LoneDev6 LoneDev6 added the status: need testing Issue needs to be tested to check if it's reproducible or not label Nov 12, 2023
@Lerphie
Copy link
Author

Lerphie commented Nov 12, 2023

TPS is 20, it's not causing excessive CPU load.

image

The plugin is coded with performance in mind, and was tested extensively on a server with more than 200 players moving around with cosmetics.

Did you experience any slowdown or the only alarming detail was the timings report orange ms indicators?

Anyway tomorrow I'll do a detailed check to see if the function you reported can be further optimized.

image
What does this have to do with tps? Your plugin is putting a lot of strain on my system. It happens only on spawning (when players get very close to each other). In addition, the server begins to lag very much within those chunks where there are many players

@LoneDev6
Copy link
Contributor

What does this have to do with tps?

Well, TPS is the main thing you have to check to see if a server is performant or not.

the server begins to lag very much within those chunks where there are many players

Provide a timings report of when the lag occurs.

@Lerphie
Copy link
Author

Lerphie commented Nov 13, 2023

What does this have to do with tps?

Well, TPS is the main thing you have to check to see if a server is performant or not.

the server begins to lag very much within those chunks where there are many players

Provide a timings report of when the lag occurs.

You're wrong. I'd like to send you a video of the proof. How can I do it privately so others can't see it?

@LoneDev6
Copy link
Contributor

Make a "payment issue" private ticket on my forum https://forum.devs.beer/

@LoneDev6
Copy link
Contributor

image

Update to DEV builds of Via
https://ci.viaversion.com/job/ViaVersion-DEV/
https://ci.viaversion.com/view/ViaBackwards/job/ViaBackwards-DEV/

I think the lag is caused by ViaVersion printing too many error messages.

@LoneDev6
Copy link
Contributor

Anyway analyzing the timings report I found out that you have some plugin that is refreshing the player inventory a lot.
This causes the CosmeticsCore hat reskin code to be called a lot of times.
This code has a part which reskins the read helmet to have the custom helmet skin.

image

I will do some more tests to see if I can optimize it or I will add an option to skip part of this code.
The heavy part of this code is the lore and display name logic to make it italic, which might sound stupid but I am using the internal game code to do that, so it's a performance problem related to the code of the game itself.

@LoneDev6 LoneDev6 added type: performance and removed status: need testing Issue needs to be tested to check if it's reproducible or not type: bug Something isn't working labels Nov 13, 2023
@Lerphie
Copy link
Author

Lerphie commented Nov 13, 2023

Update to DEV builds of Via https://ci.viaversion.com/job/ViaVersion-DEV/ https://ci.viaversion.com/view/ViaBackwards/job/ViaBackwards-DEV/

I think the lag is caused by ViaVersion printing too many error messages.

Unfortunately it's not going to help me. This is a problem of ModelEngine 3 not being compatible with ViaVersion

ViaVersion/ViaVersion#3522 (comment)

@Lerphie
Copy link
Author

Lerphie commented Nov 13, 2023

Anyway analyzing the timings report I found out that you have some plugin that is refreshing the player inventory a lot. This causes the CosmeticsCore hat reskin code to be called a lot of times. This code has a part which reskins the read helmet to have the custom helmet skin.

Maybe the problem is in my plugin. Could you please check it?
joinitems.zip

@Lerphie
Copy link
Author

Lerphie commented Nov 13, 2023

or more likely it's the HuskSync plugin, it synchronizes the player's inventory (including what he's wearing on his head).

https://www.spigotmc.org/resources/husksync-1-16-1-20-sync-inventories-e-chests-x-server-advancements-map-art-stats-backups.97144/

https://github.com/WiIIiam278/HuskSync

@Lerphie
Copy link
Author

Lerphie commented Nov 14, 2023

I found a prioritized configuration, maybe it will help.
https://william278.net/docs/husksync/config-file
image

@LoneDev6 LoneDev6 added this to the 1.2.3-r2 milestone Nov 14, 2023
@Lerphie
Copy link
Author

Lerphie commented Nov 17, 2023

@LoneDev6 Did you fix it? Have you read my last few posts?

@LoneDev6
Copy link
Contributor

I will do some more tests to see if I can optimize it or I will add an option to skip part of this code.
The heavy part of this code is the lore and display name logic to make it italic, which might sound stupid but I am using the internal game code to do that, so it's a performance problem related to the code of the game itself.

I scheduled it to be fixed, please be patient, I will do my best to finish the upcoming update as soon as possible.

@LoneDev6 LoneDev6 moved this from Todo to In Progress in Other plugins Nov 17, 2023
@LoneDev6
Copy link
Contributor

The code reported uses 70% less CPU on the upcoming update.
I will release it as soon as I can.

@LoneDev6 LoneDev6 moved this from In Progress to Done in Other plugins Nov 17, 2023
@LoneDev6 LoneDev6 mentioned this issue Dec 6, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants