What is your favorite Iconomy/ChestShop plugins

Discussion in 'Performance Tweaking' started by Amrac, Feb 20, 2013.

  1. Hi,
    I'm looking into my big performance issue, as i can get big lag with an i3 2130 2x2(HT)x3.4Ghz - 16 Go DDR3.
    I took timings during this awefull lag and go this: [​IMG]

    Somebody was flooding the server using chestshop.

    I use iconomy & chestshop, i have the same economy on several server, so i use MySQL.

    I have two issues, MySQL query are in the main thread, so every query block the main thread. Second issue, Iconomy put a LOT of query for doing pretty nothing.

    For exemple, if i try to buy something without having enough money, i get this:
    Its like 8 blocking query just to ask if a player have enough, this should need one asynchrone query. :(

    For simply taping /money player:

    And if i buy something in chestshop:
    18 blocking query, and i only logged the select, nice :)

    Do you know any good Iconomy/ChestShop plugins who don't attack server's performance?
  2. Quickshop is working out great for me as a replacement to chestshops.

    Chestshops is so easy to exploit anyways.
  3. LiLChris

    LiLChris Retired Moderator

    Change this setting in the config.

    Code (Text):
  4. Look really nice, and the possibility of doing 1 transaction no matter how many the player buy is really nice.

    Its already: SHOP_INTERACTION_INTERVAL: 1000 :(

    Still need something better to manage the economy, any idea?
  5. LiLChris

    LiLChris Retired Moderator

    I use Essentials + Chestshop, no issues thus far.

    It's set at 100, might tweak that now actually so I don't have to worry about it later. :D
  6. Exactly, it's really neat + much easier to use than Chestshop if you ask me (an most of my players :D )
  7. We dont have lag issues with items on the shop? In the capital off my main server, people get laggy (FPS drop) only with sign, their is an insane amount of shop. ( play.hellominecraft.fr if you want to see)

    What do you use for iconomy?
  8. Puremin0rez


    ChestShop has always been a performance hitter for me, no matter what I set the transaction interval at it causes noticeable lag.

    I've been giving "SignShop" a shot
  9. I convert to FE Economy and Quickshop
    It look very powerful, well, i don't understand yet the new output in mysql's log:

    130221 16:30:32 54 Query
    Its always n°54, i don't really know if it does so much query or not, this log is when i buy something (i get the 5% tax too). Perhaps its always 54 because the server keep the connection alive?

    Do you think FE Economy use none-blocking query? They say "SQLite & MySQL, whether your server has 10 or 10,000 players, Fe can handle it." but don't give details.

    Big thx for your suggestion, it help a lot :)
  10. Puremin0rez


    I've used both Fe Economy and iConomy and they both hang up the main thread when people spam chest shops

    I'm assuming Essentials Economy doesn't do this because it uses flatfile?
  11. You're really going to have this problem for any plugin that uses a database.

    It is not a simple task to simply use async queries....

    Most economic stuff HAS to be on the main thread...

    If you want to charge a user for say accessing a door, you listen to the playerinteract event...

    well, if you use async queries, you no longer can cancel the event based on the result from the database.

    to try to async query that, youd have to cancel all the events, then send an update back to the sync queue to fake do the same interaction.

    the code gets sloppy fast.

    Now, it looks like those plugins can be done more effeciently at least with cacheing...

    about the only thing you can reliably do async is the logging of the transaction, but most needs to be sync or you get into a world of problems or complicated code.
  12. I understand that for event we cant use async query, but for simple transaction of buying something, why not?

    I would imagine something like a list of "TODO action" which is safely sync with the main thread and checked every X tick, then when a player want to buy something, the shop plugin give a callback function for success and one for failure.
  13. also, file system (flat file) can slower than MySQL usually unless you have a slow/wrongly configured database.

    but flat file systems usually would cache data and do periodic saves so your not doing I/O on main thread there
  14. very simple, this is the workflow if it was async:

    playerinteract event
    get sign data
    find chest
    match item
    find price from sign
    check stock
    * check database if you have enough money
    * deduct currency from user
    --- problem; we are not on the main thread -- cant take the item out of the chest and give to the inventory
    --- you now have to register a sync task to then do the get out of chest and put in inventory

    What if another player bought from the same chest, and his transaction went faster, and now the item is out of stock?

    The first user has already paid for the item... yet he doesnt get it.

    Now you have to go back and undo the transaction.

    It requires A LOT of code and being very careful to do such a thing, and complicates the system greatly.

    You would have to have a "shop queue" that does this workflow in order they same in so everyones purchases stays on same thread.

    then we go into even more problems...

    If your running this over multiple servers, what happens if the person your selling to runs out of money from 1 transaction while the other server also tries it?

    The only way you can safely do this is to run it in a single read/write locked transaction on the main thread.
  15. For reference, here is our deduction economy function:
    Code (Java):

        public static Integer debit(Long userId, int amount, int type, String extraData) {
            Integer response = null;
            Long currentEpoch = System.currentTimeMillis() / 1000;
            DbStatement stm = null;
            try {
                stm = new DbStatement();
                stm.query("SELECT balance FROM rupee_user WHERE user_id = ? LIMIT 1 FOR UPDATE");
                Integer balance = null;
                Integer pass = null;
                DbRow rs = stm.getNextRow();
                if (rs != null) {
                    balance = rs.get("balance");
                    if (balance >= amount) {
                        pass = stm.query("UPDATE rupee_user SET balance = balance - ?, last_update = ? WHERE user_id = ?")
                                  .executeUpdate(amount, currentEpoch, userId);
                if (balance != null && pass != null && pass != 0) {
                    balance = balance - amount;
                    EmpireDb.executeUpdateAsync("INSERT INTO rupee_trans " +
                        "(user_id,time,server_id,amount,new_balance,rupee_trans_type_id,extra_data) " +
                        "VALUES (?, ?, ?, ?, ?, ?, ?)",
                        userId, currentEpoch, Empire.serverId, -amount, balance, type, extraData);
                if (pass != null && pass != 0) {
                    response = balance;
                } else {
            } catch (Exception e) {
                Util.printException("Exception in debit" + userId, e);
            } finally {
                if (stm != null) {
            return response;
    • Useful Useful x 1
  16. Well, QuickShop seems to bee very nice. Thanks for that. :)
  17. Funny enough it doesn't convert my database properly which only has 5000 entries.

    As for the OP, simply do /baltop and drop iconomy all together. Essentials will replace iConomy fluently. Assuming you have essentials that is.
  18. I dont think you mean Fe-Economy, there is no command "/baltop".