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 consommation of citizens #1673

Closed
Elytes opened this issue Jan 19, 2019 · 18 comments
Closed

High CPU consommation of citizens #1673

Elytes opened this issue Jan 19, 2019 · 18 comments
Labels
Help Request User needs help.

Comments

@Elytes
Copy link

Elytes commented Jan 19, 2019

Hi !
I'm making a server since months, and I've got much problems with citizens consommation. Citizens takes 99% of total cpu consommation (1% are others plugins) and 1 second per 5.2 seconds of cpu's time is used for Citizens, and that's decreasing the average tps of the server.
I'm using the version 2.0.24-SNAPSHOT (build 1591).
I've got 39 citizens and I will need much more in the future :/
I descreased retry delay while skin is lost, updated the packets update delay to 50 and pathfinding update path rate to 10 (i'm using the new finder with 5000 max iterations).
Much of these npc are moving with path and I forgot to use triggers so there is just a lot of waypoints where the npc needs to stop, but by looking at the source code, it seems that you don't load every waypoints each time the npc walks, so that wont makes the server lags uh ?
Tell me if you got any ideas to decrease cpu consommation ^^
Thanks

@mcmonkey4eva
Copy link
Member

  • Your build of Citizens is outdated, update: http://ci.citizensnpcs.co/job/Citizens2/
    Naturally also ensure your Spigot build is fully up-to-date.

  • Using the Spigot timings system (/timings command) to get some indication of lag sources more specifically (and post the results here for us to read)

  • Post your config file.

  • Be aware that NPCs walking paths can sometimes heavily use your server CPU power if they have to walk particularly complex paths or are being told to walk paths they can't walk (ie their path is blocked)

@mcmonkey4eva mcmonkey4eva added the Help Request User needs help. label Jan 19, 2019
@Elytes
Copy link
Author

Elytes commented Jan 19, 2019

Here is the report : https://timings.spigotmc.org/?url=bimafuwesi
And I downloaded the new version, thanks for your reply :)

@mcmonkey4eva
Copy link
Member

It looks like your server (or at least Citizens) loaded during the timings recording sequence, which is distorting the accuracy of the timings report. Please try to start recording timings after the server is loaded to avoid it being offset by slow load times.

@Elytes
Copy link
Author

Elytes commented Jan 19, 2019

@mcmonkey4eva
Copy link
Member

I don't know how or why you uploaded your config as a zip file but I repastebin'd that for anyone else trying to look at it: https://pastebin.com/2DU8KgMF

@Elytes
Copy link
Author

Elytes commented Jan 19, 2019

Yeah sry, forgot that, thanks ^^

@mcmonkey4eva
Copy link
Member

mcmonkey4eva commented Jan 19, 2019

The new timings link was recorded with Citizens loading in during the timings still. Please fix that.

You may want to switch use-new-finder: back to false in your config.

... I have no idea why you just pastebin'd the thing I already pastebin'd for you as a reply to me pastebinning it for you...
edit: and you deleted the post where you did so I guess you realized lol

@Elytes
Copy link
Author

Elytes commented Jan 19, 2019

Yeah sorry, i'm so tired right now so i'm getting stupid ^^
The problem is that I need use-new-finder for specifics npc, but not for every npc, but I didn't see command to do it ^^
How can I fix the timing link ? By doing /timings again ?

@mcmonkey4eva
Copy link
Member

Turn timings on manually, not automatically.

@Elytes
Copy link
Author

Elytes commented Jan 19, 2019

Ehm, that's really weird but it seems that the new citizens version that I installed corrected every lags, cause now, the plugin takes only 1/10 of the cpu's time ?? _

edit : this comment is false, I don't know why but 6 seconds after the comment, citizens came back to 1/5 of cpu's time

@Elytes
Copy link
Author

Elytes commented Jan 19, 2019

Is this link is good ?
https://timings.spigotmc.org/?url=venitijima

@mcmonkey4eva
Copy link
Member

That's a better recording.
It does look like pathfinder related lag, so... see my previous posts above about that.

@Elytes
Copy link
Author

Elytes commented Jan 20, 2019

My plugin use citizens API to create some custom "mobs" who needs new path finder, else they are useless cause we can block them behind a wall ... Could I add pathfinder to these mobs by my plugin ? Like that it will avoid others npc getting a path finder ?

@Elytes
Copy link
Author

Elytes commented Jan 20, 2019

I desactivated the use-new-finder and now, citizens is taking 1/3 cpu's time, I don't think that's cause of the use-new-finder:false, but it doesn't reduce lags :(
https://timings.spigotmc.org/?url=timoqixiti

@mcmonkey4eva
Copy link
Member

That recording is from load time again

@Elytes
Copy link
Author

Elytes commented Jan 20, 2019

This one is good ? https://timings.spigotmc.org/?url=hibujapoco

@Elytes
Copy link
Author

Elytes commented Jan 20, 2019

I removed npc wich are using /npc path and the cpu consommation decreased a lot (citizens takes 3% approximativly), so is there a way to make npc move without consumming all cpu ressources ?

@mcmonkey4eva
Copy link
Member

Usually in pathfinding is making a severe impact on a server, it's from NPCs walking complex or blocked paths.
It's possible you had that happening.

You also mentioned you have a custom plugin giving paths to NPCs: it's possible your plugin is at fault here, eg if it's giving new paths very rapidly or is giving complicated path requests

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

No branches or pull requests

2 participants