Does too many sql connection at the same time will cause ping increase?

Discussion in 'Performance Tweaking' started by leelee, Mar 22, 2019.

  1. so uhh, i'm not sure this question is stupid or not, im noobie on sql database
    i have a proxy and like 12 server online at the same time
    every server will having at least 3 connection, one for the core plugin db, one for the minigame database
    and one for luckperm db
    and because the sql respond too many connections so i edit the max connections to higher value
    right now my server ping is kinda werid
    the players sometimes have like 20ms, sometimes getting to 400ms

    i tried a lot to optimize my server, but still no solution
    now i'm thinking about the sql part, because i have to do a lot of work on it
    with decrease sql connection for every servers, so i would like to ask before i do it
    does too many sql connections at the same time will cause ping increase? and why?
    #1 leelee, Mar 22, 2019
    Last edited: Mar 24, 2019
  2. No. those operations ideally shouldn't even be touching main thread, but unless your DB server itself is overloaded, total connection count is not going to impact the MC side.
  3. Evey server 3 Databases!? Do u means 3 table or 3 schem, if its really 3 databases, u probably should rebuild ur whole database structure
    Also, is ur database on local network? if u use a database on taiwan to like japan, ofc u get delay response bcs the data request from the database is already needed a long time
  4. Also yes its a common mistake I see that people run databases on one host and MC on another.

    your DB and your MC server must be on the same network!

    My host even went as far to ensure my MC Servers are as close to my DB servers rack as possible, which are connected over a private VLAN :)

    Look at my SQL Timings that sadly still hit main thread (ok well this data's old, some of this is now async)
  5. I think he means that every server is connected 3 times to the same db server / db
  6. yes that exactly what i means, sorry for my english
  7. and i always keeping the sql database in same hosting
  8. Why would he do that btw

    You should make a API which is a Core, then all other plugin access the Core which connect to a database and request data from it
    so each server only need 1 connection
  9. No, you do not need to do that. Number of connections is NOT a problem!!

    i have 90 connections open to my DB atm. My IDB system defaults to 3-5 connections per instance. I have 12 servers, plus the website and monitoring systems.

    Reducing # of connections can actually slow your stuff down waiting for a connection for asynchronous tasks.
  10. If you have 3 tasks running at the same time, it allows them to all 3 operate concurrently.

    connection pools :)
  11. I have 20+ servers, MySQL and website all in one server lol
    and i do all important data request sync in the main thread such as rank etc.
    but i would cache all unimportant data such as different language message, they still works fine xd

    i think it would just be much easier and i dont need to recode the MySQL connection pool code everytime : P

Share This Page