games647 / ChangeSkin

Allows your players to change their skin by command
https://dev.bukkit.org/bukkit-plugins/changeskin/
MIT License
187 stars 33 forks source link

Local database for BungeeCord #138

Open ygtdmn opened 6 years ago

ygtdmn commented 6 years ago

My MySQL and BungeeCord servers are in different machines. For this reason when i use ChangeSkin with MySQL, my BungeeCord server lagging because of high network connection. So if you can add SQLite, H2 or YAML database to ChangeSkin it will be great.

games647 commented 6 years ago

If the MySQL server is on the same network, you shouldn't notice any lags. Furthermore all SQL queries are processed async. For player logins it registers an intent to delay it until the query is finished (still async other plugins could run at the same time). So here you could maybe notice a delay.

If you're not on a game hoster, you can still install it on the same host too.

ygtdmn commented 6 years ago

MySQL server and BungeeCord is not on the same network unfortunately.

games647 commented 6 years ago

Could I ask why and if you are on a shared hoster?

ygtdmn commented 6 years ago

My MySQL server is in dedicated with some spigot instances. And there is no place for any more server. BungeeCord is in another VPS.

games647 commented 6 years ago

Then couldn't you run an MySQL instance on the BungeeCord server?

ygtdmn commented 6 years ago

I don't want to setup another MySQL server :/ Also the VPS only enough for one bungeecord instance.

games647 commented 6 years ago

Also the VPS only enough for one bungeecord instance.

Because of disk space, cpu, memory?

ygtdmn commented 6 years ago

Yes

ygtdmn commented 6 years ago

Right now everything is fine. Cpu usage is %80, Memory usage %60, disk is almost not using. Only network is a problem.

games647 commented 6 years ago

If you run MySQL/MariaDB on the same host, it will use the loopback interface. It won't make any networking traffic.

ygtdmn commented 6 years ago

MySQL and ChangeSkin is not in the same host.

games647 commented 6 years ago

MySQL and ChangeSkin is not in the same host.

I understood that the first time too, but I thought you answer is related to my previous post (https://github.com/games647/ChangeSkin/issues/138#issuecomment-385741909) and that you don't want host MySQL/MariaDB on the BungeeCord host, because of networking. Sorry for this misunderstanding.

I'm going to add the SQLite driver to ChangeSkin after some performance tests. For now you could do this:

https://gist.github.com/games647/d2a57abf90f707c0bd1107e432c580f3

(I know this isn't an optimal solution and is only temporarily)


Keep in mind that SQLite only supports single thread requests unlike MySQL/MariaDB that can handle parallel requests which is more optimal for BungeeCord environments with more players.

ygtdmn commented 6 years ago

Thanks. This solves the problem.

ygtdmn commented 6 years ago

@games647 I made a plugin for this: https://www.spigotmc.org/resources/sqlite-for-bungeecord.57191/

It was hard to do that process at every BungeeCord update.