Reputation: 127
i have a java application in italy that makes a number of queries to a database in italy when it's executing certain operations.The problems is that when this application is launched from china and it makes queries to the database in italy,the queries are slow and so operations that take 2 minutes in italy end up taking 30 minutes in china.I understand that the problem is caused by the poor quality of the WAN towards china but does someone know of any walk around this issue?Thank you
Upvotes: 0
Views: 86
Reputation: 2343
The 2 minute query running in Italy is the first problem. Getting results to China is the second and more troubling problem. Please share with us one of your 2 minute queries as recorded in the general.log from Italy and EXPLAIN EXTENDED results for the same query, please. This basic information is needed to allow analyzing part one of your current situation.
Upvotes: 0
Reputation: 11
Put the database and app near of each other - network wise. If needed keep 2 mirrors, one for each continent, although this will bring additional challenges.
Set up Database replication between the two locations. Updates on the Master will be replicated to the slave. This will likely to be the best effective option to choose. It the network connection is poor you can optimize what's "in" (improve and limit querys) but in the end takes time.
Upvotes: 1
Reputation: 8676
If you consider a code change in your client as a possible solution I would suggest to play around with Statement.setFetchSize method. Thiw will let you optimize network consumption by tuning the size of results "pack" fetched iteratively.
Upvotes: 0