-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
GH-437 Improve schedulers #486
Conversation
@Rollczi hey, looks like I finished for now, can you help me with Fabric and review the code? |
@BlackBaroness Hi, I noticed that you can't solve the fabric platform. Since I don't have permission to submit changes directly to the pr, I will create a new PR and submit it to your fork repository. |
* add fabric server scheduler * fix server, update ExampleCommand * del mixin * add FabricClientScheduler * fix later * fix later, update ClientCommands
Thanks, I merged it |
litecommands-core/src/dev/rollczi/litecommands/scheduler/SchedulerExecutorPoolImpl.java
Outdated
Show resolved
Hide resolved
litecommands-core/src/dev/rollczi/litecommands/shared/ThrowingRunnable.java
Show resolved
Hide resolved
litecommands-bukkit/src/dev/rollczi/litecommands/bukkit/BukkitSchedulerImpl.java
Show resolved
Hide resolved
litecommands-bukkit/src/dev/rollczi/litecommands/bukkit/BukkitSchedulerImpl.java
Outdated
Show resolved
Hide resolved
...nnotations/test/dev/rollczi/litecommands/annotations/async/AsyncArgumentsInitializeTest.java
Outdated
Show resolved
Hide resolved
litecommands-annotations/test/dev/rollczi/litecommands/annotations/async/AsyncCommandTest.java
Outdated
Show resolved
Hide resolved
...ds-annotations/test/dev/rollczi/litecommands/annotations/async/ParallelAsyncCommandTest.java
Outdated
Show resolved
Hide resolved
litecommands-fabric/src/main/java/dev/rollczi/litecommands/fabric/FabricScheduler.java
Outdated
Show resolved
Hide resolved
Using platform schedulers (BungeeCord, Velocity) can improve performance by sharing unused threads in the cached pools |
I believe an uncapped cached pools dedicated to a single plugin only is a bad idea. Especially if you look on how delayed tasks were implemented - they create a thread and then call Velocity is slightly better, but still has an uncapped pool. What if several players will spam async commands? Proxies are designed to handle thousands of players online concurrently, an uncapped pool can become a disaster when commands are expensive enough to make threads busy Or, for BungeeCord... Delayed tasks are usually used by cooldown system. What if we have a |
* add fabric server scheduler * fix server, update ExampleCommand * del mixin * add FabricClientScheduler * fix later * fix later, update ClientCommands * extend SchedulerExecutorPoolImpl
Okay, this is actually true, let's use pool with limited threads. |
litecommands-fabric/src/main/java/dev/rollczi/litecommands/fabric/FabricScheduler.java
Outdated
Show resolved
Hide resolved
litecommands-fabric/src/main/java/dev/rollczi/litecommands/fabric/FabricScheduler.java
Outdated
Show resolved
Hide resolved
I will try fix some issues |
@BlackBaroness Thank you for your substantive comments, I implemented them into the old scheduler implementation. I also simplified the code for Farbric scheduler, what do you think, that should work? @huanmeng-qwq |
@Rollczi, looks nice! (not about Fabric) I noticed you created the Also, this new abstraction could be used for Sponge scheduler, I think. |
Also, on Sponge we have both We could make it like |
okay, I will rename it
I don't think so, this will more complicated... let's follow the principe KISS (Keep it simple stupid) |
user should use |
litecommands-fabric/src/main/java/dev/rollczi/litecommands/fabric/FabricScheduler.java
Outdated
Show resolved
Hide resolved
litecommands-fabric/src/main/java/dev/rollczi/litecommands/fabric/FabricScheduler.java
Outdated
Show resolved
Hide resolved
I talked about Sponge, not Fabric btw I believe this PR is ready, if Fabric is ok |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for next improvements @BlackBaroness
litecommands-sponge/src/dev/rollczi/litecommands/sponge/LiteSpongeFactory.java
Outdated
Show resolved
Hide resolved
litecommands-sponge/src/dev/rollczi/litecommands/sponge/SpongeScheduler.java
Outdated
Show resolved
Hide resolved
litecommands-sponge/src/dev/rollczi/litecommands/sponge/SpongeScheduler.java
Outdated
Show resolved
Hide resolved
litecommands-sponge/src/dev/rollczi/litecommands/sponge/SpongeScheduler.java
Show resolved
Hide resolved
litecommands-sponge/src/dev/rollczi/litecommands/sponge/SpongeScheduler.java
Outdated
Show resolved
Hide resolved
…Scheduler.java Co-authored-by: Norbert Dejlich <ndejlich5@gmail.com>
Okay thanks @BlackBaroness and @huanmeng-qwq for your help! ❤️ |
Sorry for being late! Will finish soon! Closes #437.
I am currently reviewing and improving schedulers for all platforms:
About BungeeCord
I decided to use the Core scheduler instead, since it's more efficient by at least providing a max cap
About Velocity
I decided to use the Core scheduler instead, since it's more efficient by at least providing a max cap
About Bukkit
Looks good, only small improvements were made
About Minestom
Don't see anything to improve, it's fine. Also the Minestom's own scheduler is good, so no need to use our own
About Sponge
Sponge provides a scheduler similar to Bukkit, so I implemented a wrapper for one
About JDA
I don't think there is a specific implementation for JDA, so we should just use the one from Core
About Fabric
Was implemented by @huanmeng-qwq