Performance of separate application and database servers vs all-in-one

1.9k Views Asked by At

We are migrating an existing application that requires a decent database setup. We've run a simple mysqlslap test on two server configurations - combined app & db server, separate app & 2 db servers (master/slave):

mysqlslap --auto-generate-sql --concurrency=50 --number-of-queries=1000 --number-char-cols=50 --number-int-cols=50 -vv

  • Result for separate servers is slower even though it is using the same instance size and being run from the db server.
  • In another test, using microtime & looping over a query, - there is a significant latency between the servers. Examples: test 1 is 0.01 seconds on combined and 0.1 on separate, and 0.2 (combined) compared to 3.0 (separate).

My questions:

  1. Are these expected results?
  2. Is there a way to minimize the latency between the servers?
  3. We are not able to use sysbench to match against the existing server - are the tests we've performed satisfactory or are there better alternatives?
1

There are 1 best solutions below

0
On BEST ANSWER

Not a MySQL specialist, but hey, reality does not care ;)
Physics is the same.

  1. yes. You introduce a network, there is latency.
  2. requests, batch. guaranteed 45 nanosecond latency. Generally: do NOT make small requests, batch.
  3. general may be a small set. database server I had was being hit with some hundred. 1000 query in general may be a small set.

At the end, you HAVE latency - deal with it. The main way to do that is to ask for batches of data, not row by row. Then understand that "latency" is something for one thread - throughput can STILL be higher due to higher capacity. That is a trade-off here.

If is is nice to you: all larger applications split, so it is not like that is not something you can deal with. Helps to have a real database server, though. Basically the machine should be powerfull enough to not be another bottleneck. You get latency, you also get scalability. Normally scalability is worth more than the latency.

Again, this is physics - nothing secial to MySQL here.