MySQL disconnects now and then causing problems

Discussion in 'Bukkit Help' started by Neilnet, Jan 20, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Neilnet

    So, as you know MySQL disconnects now and then.

    So, I've come up with a solution. Sending a query every 25 seconds when MySQL connects.
    Code:
        public static void runAsyncBeat() {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    PreparedStatement ps;
                        ps = con.prepareStatement("SELECT 1;");
                        ps.execute();
                        Thread.sleep(1000*25);
                    runAsyncBeat();
                }
            }).start();;
        }
    
    Which is called after connect
    Code:
            //DB connect driver stuff...
            runAsyncBeat();
        }
    
    This causes a drop in tps (from 20tps to 19.80/19.90 in tps).

    I've also tried Bukkit's deprecated Async scheduler, which yields the same results.
     
    Last edited: Jan 20, 2015
  2. Offline

    Larry Newman

    Neilnet likes this.
Thread Status:
Not open for further replies.

Share This Page