PMC or direct MySql

Discussion in 'BungeeCord Plugin Development' started by Barbadosian, Jun 27, 2021.

  1. Barbadosian

    Barbadosian Previously Aaron_Mao

    This is kind of a useless question, but just out of curiosity... I have a plugin that collect player statistics from all servers within the network. I *think* the correct & easy way of doing that is for each spigot instance to write directly into the mysql db.

    I wonder what would be the downside to letting each spigot send the statistics through PMC to bungee and let bungee interact with db (other than the obvious ones such as making my code unnecessarily complicated, duh. Or possibly spamming the PMC and causing delays).
  2. Don't put unnecessary strain on your network proxy, its incredibly stupid. You want to have minimal performance consumption on your network instance so that it won't be stressed with thousands of concurrent players.
  3. Forget the idea of routing it through the proxy, there's absolutely no benefit to that and only puts unnecessary extra load (and an extra point of failure) to your data flow. What kind of data are we talking about? Mutable or immutable?
  4. Barbadosian

    Barbadosian Previously Aaron_Mao

    Yeah was thinking about the same. Its just some simple immutable statistics. Will continue writing directly into MySql.
  5. If it's immutable, then is MySQL really the best option? It scales like shit, has no support for cold storage and no proper implementation for immutable data (it has append-only storage engines, but reading online, they're just bad and shouldn't be used).
    • Agree Agree x 1
  6. Barbadosian

    Barbadosian Previously Aaron_Mao

    Good point. We have been just granting user INSERT privilege, so yeah it is definitely not a proper way to have append-only tables.

    Do you have a suggestion on what should be used instead? I saw there is immudb, which seems promising. Haven't used it yet tho.
  7. It really depends on the data structure. I've personally never heard of immudb, but it's probably worth looking into. If you're generating immutable data, you also have to think about how long you want to keep said data, and how long you'll be keeping it. If you want to indefinitely keep your data (such as me), you'll need to find a database that supports cold-storage one way or another. Keeping a billion records hot in a database isn't something I'd do unless I'd be very certain the database can handle that. As mentioned earlier, I personally use Elastic, which comes with Index Lifecycle Management, allowing me to unload old documents from memory and just keep them purely on the disk. Some databases may do this as default behavior, but Elastic doesn't. I can still search on them, but it'll take longer. Like I also said, it isn't exactly the most straight forward and easy to use, but it's one of the options.

    I'd recommend to look into immudb and at least see what it offers. Maybe it's a hidden gem, who knows. Let me know what you find.