I have 2 servers, one with a Java app using Spring for DB connection handling, and the other with MySQL.
Ping delay between both servers is about 100ms.
The Java server is using bulk inserts to DB, 2000 rows at a time. It seems that it’s taking 100ms x 2000 inserts = 200,000 ms to do this bulk insert!
Is there a way to minimize this network delay? Does using transactions help in reducing it?
Any ideas are much appreciated.
Like the other answer says, try using a batch. But if the MySQL JDBC driver doesn’t optimize them, it won’t help. See the answers here for other potential solutions: JDBC batch insert performance