games647 / FastLogin

Checks if a minecraft player has a valid paid account. If so, they can skip offline authentication automatically. (premium auto login)
https://www.spigotmc.org/resources/fastlogin.14153
MIT License
482 stars 119 forks source link

So many threads created #1175

Closed bobhenl closed 3 months ago

bobhenl commented 3 months ago

What happened?

Can we somehow limit the amount of threads created? It looks like that it creates so many threads that I run soon the thread limit (cannot create another thread error - pid limit on pterodactyl or shared hosts)

There are many fast login pools threads

What did you expect?

Less threads or reusing the old ones

Steps to reproduce

No response

Plugin list

No response

Configuration file

No response

Server log

No response

Plugin version

Build 1298 actually the latest

Platform

Spigot

Relevance

games647 commented 3 months ago

Fast login pools threads

These exactly names are used only in combination with Hikari for the database connection, are already limited in size and reused. FastLogin doesn't change the default setting. So it will be fixed to 10. (min and max). Which certainly won't be an issue. The CPU overhead of scaling threads will be much higher than the memory consumption of keeping a few threads alive.

Other threads used are packet interception in Spigot which is also limited to 1 by ProtocolLib (as far as I remember).

reusing the old ones

Then only left is threading for data processing. These scale on demand, but are using the schedulers from each platform, which is cached globally (Spigot) or per plugin (BungeeCord and Velocity). However, both of the last two points use a different naming scheme.

games647 commented 3 months ago

With the stabilization of project loom in combination with Java 21, there would be an even more lightweight alternative to threads. However, this would only be usable with Java 21 and up.

bobhenl commented 3 months ago

OK, thanks for answer!