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

Improve uuid cache load times #5143

Merged
merged 1 commit into from
Nov 4, 2022
Merged

Conversation

Warriorrrr
Copy link
Contributor

Information

This PR fixes n/a

Details

Currently, the plugin can take a long time to load depending on the size of the uuids.bin file.

Proposed fix:

Replace the set implementation used by the uuid cache with a concurrenthasthmap backed set.

Environments tested:

OS: Ubuntu 20.04

Java version: 17.0.1

  • Most recent Paper version (1.XX.Y, git-Paper-BUILD)
  • CraftBukkit/Spigot/Paper 1.12.2
  • CraftBukkit 1.8.8

Demonstration:

Before

[18:29:28 INFO]: [Essentials] Enabling Essentials v2.20.0-dev+15-20011b9
[18:36:02 INFO]: [Essentials] Loaded 38132 items from items.json.
Jstack "Server thread" prio=7 os_prio=0 cpu=254434.36ms elapsed=256.38s tid=0x00007f33c4503e10 nid=0x37616e runnable [0x00007f33d81fa000] java.lang.Thread.State: RUNNABLE at java.util.concurrent.CopyOnWriteArrayList.indexOfRange(java.base@17.0.1/CopyOnWriteArrayList.java:193) at java.util.concurrent.CopyOnWriteArrayList.indexOf(java.base@17.0.1/CopyOnWriteArrayList.java:238) at java.util.concurrent.CopyOnWriteArrayList.contains(java.base@17.0.1/CopyOnWriteArrayList.java:230) at java.util.concurrent.CopyOnWriteArraySet.contains(java.base@17.0.1/CopyOnWriteArraySet.java:157) at com.earth2me.essentials.userstorage.ModernUUIDCache.loadCache(ModernUUIDCache.java:178) at com.earth2me.essentials.userstorage.ModernUUIDCache.(ModernUUIDCache.java:57) at com.earth2me.essentials.userstorage.ModernUserMap.(ModernUserMap.java:33) at com.earth2me.essentials.Essentials.onEnable(Essentials.java:313) at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) - locked <0x000000070a8aada0> (a org.bukkit.plugin.SimplePluginManager) at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:565) at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:479)

After

[18:53:41 INFO]: [Essentials] Enabling Essentials v2.20.0-dev+15-20011b9
[18:53:42 INFO]: [Essentials] Loaded 38132 items from items.json.

@pop4959 pop4959 added type: bugfix PRs that fix bugs in EssentialsX. module: main Issues or PRs for the main Essentials module labels Nov 1, 2022
@pop4959 pop4959 requested a review from JRoy November 1, 2022 21:32
@JRoy JRoy added this to the 2.20.0 milestone Nov 4, 2022
@JRoy JRoy changed the title Replace COW uuid cache with CHM-backed set Improve uuid cache load times Nov 4, 2022
@JRoy JRoy merged commit 22a0d53 into EssentialsX:2.x Nov 4, 2022
@Warriorrrr Warriorrrr deleted the fix/uuid-cache-speed branch November 4, 2022 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: main Issues or PRs for the main Essentials module type: bugfix PRs that fix bugs in EssentialsX.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants