Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database Network Latency

I am currently working on an n-tier system and battling some database performance issues. One area we have been investigating is the latency between the database server and the application server. In our test environment the average ping times between the two boxes is in the region of 0.2ms however on the clients site its more in the region of 8.2 ms. Is that somthing we should be worried about?

For your average system what do you guys consider a resonable latency and how would you go about testing/measuring the latency?

Karl

like image 247
Karl Avatar asked Mar 03 '09 09:03

Karl


People also ask

What is latency in database?

Data latency is the time it takes for data packets to be stored or retrieved. In business intelligence (BI), data latency is how long it takes for a business user to retrieve source data from a data warehouse or BI dashboard.

How do you handle database latency?

A framework for comparing latency When projecting external latency, look at where your users are located and the path that requests and responses to the database will take. Look at ping tables to help inform network latencies between various hops.

What is low latency in database?

Low latency describes a computer network that is optimized to process a very high volume of data messages with minimal delay (latency). These networks are designed to support operations that require near real-time access to rapidly changing data.

What is an acceptable level of network latency?

Latency is measured in milliseconds, or during speed tests, it's referred to as a ping rate. The lower the ping rate the better the performance. A ping rate of less than 100ms is considered acceptable but for optimal performance, latency in the range of 30-40ms is desirable.


1 Answers

Sorry for the very untimely response, but I stumbled on this question when I was looking for metrics of what network latencies others were achieving between their app server and db server. Anyway, I noticed that the other answers

Anyway, in short : yes, network latency (measured by ping) can make a huge difference.

If your database response is .001ms then you will see a huge impact from going from a 0.2ms to 8ms ping. I've heard that database protocols are chatty, which if true means that they would be affected more by slow network latency versus http.

And more than likely, if you are running 1 query, then adding 8ms to get the reply from the db is not going to matter. But if you are doing 10,000 queries which happens generally with bad code or non-optimized use of an ORM, then you will have wait an extra 80seconds for an 8ms ping, where for a 0.2ms ping, you would only wait 4 seconds.

As a matter of policy for myself, I never let client applications contact the database directly. I require that client applications always go through an application server (eg a REST web service). That way, if I accidentally have an "1+N" ORM issue, then it is not nearly as impactful. I would still try to fix the underlying problem...

like image 152
Bob Thule Avatar answered Sep 28 '22 22:09

Bob Thule