Closed John-H-Smith closed 4 years ago
It's recent the use of ServerSign on your server ? Because I didn't make big changes in this part. Maybe not all the playerInteractCheck because so verification must be synchronous but maybe the sign execution.
Do you have more details timing to know what exactly create this lag and not only the entry point ?
@EpiCanard Yeah, it's a recent version. But this issue exists since a longer time for me, no update ever patched that.
So should I record timings longer?
ok, what is the setup of your server ? launcher (bukkit, spigot, etcc), minecraft version, ram assigned to server ?
which tool do you use for your timings ?
@EpiCanard I am running git-Spigot-a03b1fd-fc318cc, so its one of the latest Spigot 1.15.2 versions. The Server has 8GB RAM assigned. My timings are made by the default spigot timings.
ok, thanks for the information. I will investigate to optimize the command execution.
@John-H-Smith what do you have on your sign to create so much lag ? can you send me your /svs info ?
I tried to make the sign execution asynchronous but it came with issues that don't make it possible.
First, the cancel mode must wait the end of execution (see wiki for more details) so if it is asynchronous it is not possible Second, all action that interact with spigot must be done synchronously so the impact on the code is huge (can create a lot of unwanted bugs).
I tried also to make the execution asynchronous and wait the end of this execution to continue but the performance are the same and the second point above is still true.
@EpiCanard
This is independent of the command on the server sign.
Even *gamemode creative
is causing lag.
Maybe this is caused because of the slow read/write speed of writing in files? Then it would be a great idea for adding database support (like mentioned in https://github.com/serversigns/ServerSigns/issues/17#issue-553076971) or maybe the option to store the signs in a sqlite database.
For the second point in your last comment, you can create a new synchronous task in an existing asynchronous task like
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
Bukkit.getScheduler().runTask(plugin, new Runnable() {
@Override
public void run() {
//Synchronous request
}
});
}
});
This should work I think.
@John-H-Smith I don't know if SQL will change that much performances.
I didn't say that I don't know how to do it, I said it will have a huge impact because I have to make all call to Spigot Api in sync.
I made a version with save of files asynchronously, it doesn't affect CancelMode. Tell me if it improve your performances. ServerSigns.zip
Sadly, this does not resolve this issue. For testing purposes I set up a completely fresh server and added serversigns. But this error still persists. On my production server this is causing some problems, I have many users so all few seconds a serversign is clicked. The lag spike all few seconds is not very good. Do you have any further ideas about this?
I don't any further ideas :/ All what is done synchronously is just comparison but nothing really consuming. Maybe you can try to use paperSpigot instead of spigot ? It is a fork fully compatible and way more optimized.
@EpiCanard I already tried that, but it doesn't changed anything. Am I the first person having this problem?
Since I maintain this plugin yes but maybe before someone had the problem. @CalibeR50 has maybe a solution to track memory consuming, I will try and tell you.
Can you try this plugin: https://www.spigotmc.org/resources/spark.57242/
/spark tickmonitoring
/spark sampler --interval 2 --only-ticks-over 30
/spark sampler --stop
@EpiCanard Thank you! Here is the link: https://spark.lucko.me/#vrGhKa6t4x
What is the CPU you have on your computer/server ? Because I see a usage of 17% of your CPU just to do CraftPlayer.setOp()
Right now I am using a AMD FX-6300. But the server is on an Intel Core i7-4770 CPU with 3.40GHz where the issue also exists.
Hum ok.
Can you try to replace in your sign the *your_command
by <server> your_command
and try again the process above ?
With 1.15, there are a lot of performance issues that come with it and I don't know if it is fixable but if you can try the process. It would be nice if we could find an alternative.
Wow, this removes the delay! Console outputs instantly! Here you go: https://spark.lucko.me/#O6niy8XhjT Any further advice?
Perfect :)
No, just continue to use <server>
instead of op operator *
except when you have no other choice.
Even if you haven't seen it, thanks to @CalibeR50 and @Exloki who helped me in the background ^^
Can I close this issue ?
One further question: Not all of my commands are made to be executed by console. For example, the /home command. I cannot bind it to a sign because it have to be executed by a player. Is there a way to archive that without the op command? Maybe using grants or something?
You can simply do /svs add home
Every command that is not of format <type>
or *command
are considered as a player command
Thats clear. But there are some commands too which the player shoudn't execute directly so they don't have the permissions, but only by clicking onto a serversign. Because of this I added the op command to the signs.
you can maybe try to give the permission, execute the command and remove the permission ? If it create less lag than op command
I will give it a try. Give me a few hours.
Take all the time you need ^^
Seems to work. Its not the best solution, but will work.
Thanks for the great help! If you have any ideas in the future please let me know!
Not the most beautiful solution but if it works without lag maybe the best. Hoping it will be improved in 1.16.
Unfortunately, I have no better idea to give you. If you have no other lag issues, I close this issue.
After a user clicks on a serversign with a command added like
*gamemode 1
, a big lag spike hits the server. This is caused by normal users and admins or ops too. Here's a screenshot of the ServerSigns data from a timings-report: Maybe the PlayerInteractEvent-checks have to be asynchronuos? I would be glad if you could give me a hint what is causing this error and how I could prevent it.