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

Lag spikes due to timer task that triggers every 6000 ticks #976

Closed
MorkaZ opened this issue Oct 6, 2019 · 6 comments
Closed

Lag spikes due to timer task that triggers every 6000 ticks #976

MorkaZ opened this issue Oct 6, 2019 · 6 comments
Assignees
Labels
Status: Done This issue has been completed or answered. This pull request has been merged. Type: Enhancement Improvement or modification which is usually a new feature.
Milestone

Comments

@MorkaZ
Copy link

MorkaZ commented Oct 6, 2019

BentoBox::Task: world.bentobox.bentobox.BentoBox$$Lambda$2942/1667770658 (interval:6000)
This thing generates big lag spikes everytime it triggers. Can you please optimalize it?
I think it is timed task that saves islands evey X time.
Using latest paper spigot 1.13 with bungeecord on Java 8.
If any other information will be needed then please post below.
image

@MorkaZ MorkaZ changed the title Lag spikes due to BukkitRunnable that triggers every 6000 ticks Lag spikes due to timer task that triggers every 6000 ticks Oct 6, 2019
@Poslovitch Poslovitch transferred this issue from BentoBoxWorld/BSkyBlock Oct 6, 2019
@tastybento
Copy link
Member

This is the full database save. You can change how often it occurs in the BentoBox config.

@MorkaZ
Copy link
Author

MorkaZ commented Oct 6, 2019

Thanks for reply but I think it should be done asynchronously if it has not links with main thread to not affect performance or at least it should be done in parts to not freeze server for seconds if database is bigger.
Anyway I think that optimalization is necessary.

@tastybento
Copy link
Member

What database are you using? Database saves are async. Do you actually see the server freeze for seconds or is this just from the timings report?

@tastybento tastybento self-assigned this Oct 6, 2019
@tastybento tastybento added the Status: Under investigation Investigating the interest and the feasability of the issue. label Oct 6, 2019
@MorkaZ
Copy link
Author

MorkaZ commented Oct 7, 2019

When it was every 5 minutes it was very annoying for players.
I am using MariaDB (Debian mysql default). I have 120~ players online (50 - 180) on this server and it was started 5 months ago.

I think simplest way to solve this problem is to split this database backup process to parts, for example schedule next part every 2000 rows (modulo 2000) and add 20 ticks to every next timed task to make this spikes be very small or just run it asynchronously because all sql databases do not require to be synchronous with main thread.

@tastybento
Copy link
Member

Thanks. I'll work on improving this. SQL saving is async, but there can be improvements so the prep tasks can be written better.

@tastybento tastybento added Status: In progress Working on the issue. and removed Status: Under investigation Investigating the interest and the feasability of the issue. labels Oct 7, 2019
@tastybento tastybento added this to the 1.8.0 milestone Oct 7, 2019
@tastybento
Copy link
Member

SHould be optimized now. Comments appreciated.

@tastybento tastybento added Status: Done This issue has been completed or answered. This pull request has been merged. and removed Status: In progress Working on the issue. labels Oct 7, 2019
@Poslovitch Poslovitch added the Type: Enhancement Improvement or modification which is usually a new feature. label Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Done This issue has been completed or answered. This pull request has been merged. Type: Enhancement Improvement or modification which is usually a new feature.
Projects
None yet
Development

No branches or pull requests

3 participants