Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I got a dedicated VPS and installed mysql on it(I am new at this).

Now from my web server(on a different server), when I make queries it takes 10x longer than it used to take to make the queries when the database server was on the same server.

I think mysql server on the dedicated VPS is just configured wrong, especially with the cache sizes.

How do I properly set up the mysql server to gain performance? Or is this not a performance issue?

share|improve this question

migrated from Feb 1 '12 at 11:33

This question came from our site for professional and enthusiast programmers.

What's the latency between your app and DB server? With a local server your latency would be near enough zero but if you're running via WAN (I.E. your App and DB server are on different networks) you can expect a higher latency slowing down queries. – Smudge Feb 1 '12 at 11:37
are the queries also taking long if you execute them locally (i.e. on the database server)? – Niko S P Feb 1 '12 at 15:13
up vote 0 down vote accepted

The first thing I'd do is run a script executing your queries on the local machine you have Mysql running on. See the time to complete the query, if it's similarly slow, you probably just need to tweak mysql's memory usage/buffer size, etc... If it runs much faster than calling remotely, you've got a network latency or available client connection issue to tackle.

Both issues are resolved with different steps, but you can't move forward until you isolate the source of the lag to the newly install mysql DB or the network connectivity.

Once you narrow things down, post the details on what you did to isolate the issue and why you're certain it's with this or that.

share|improve this answer
It was because of the network latency. I now make get requests from the web server to the mysql server, to get the data obtained by the query. – user1137403 Feb 6 '12 at 2:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.