Network Tweaking - Database Query Across Internet

Hi

We run a script that queries a database via the internet and we need the fast possible connections to the database server.

I have centos server which sends the requests to the database across the internet . it sends upto 800 queries per milliseconds however this using the default settings on our server.

Are their any tweaks we can make to the network card / settings on centos 5.4 ?

I have increased MTU frames to 1500 but thats about it.

Any suggestion would be welcomed :slight_smile:

Changing the MTU on the NIC won't affect anything, really, as that only holds as far as the next hop (router or gateway). A better way would be to send pings or traceroutes to the destination with an increasing payload, and check at which point the latency begins to increase.

As for the transactions: a better way would be to check for optimizations in the database design (eg. preparing a view instead of multiple interdependent SELECTs) or implementing a caching proxy for repeated access to the same data.

1 Like

We don't own the database either its a 3rd party database .

What we want is to query it fast as possible , we need to sort the networking side out.

i have been searching for while and haven't found anything apart from the MTU.

i have performed a trace route the latency happens after the packet pass the firewall, i think they have load balancing in place.

Fact is: Database queries are pretty small on the network, unless they are very complicated. The biggest parts in terms of latency are the processing time in the database, and the result size (at least for SELECT queries). The former can't be influenced by the network, and the later depends more on the network infrastructure at the remote site than on yours.

And unless you can tell us more about the setup we won't be able to suggest any more useful approaches that might help you. For example, the MTU only applies for data leaving your system, not for incoming data, and only holds untill the next system that uses a different, smaller MTU.

You could move your server closer to the database server (in terms of hops). For example, if the database is in California and you are in New York, you could get better performance by moving your server to a data center in California.

Honestly, there is not much you can do if you do not lease the bandwidth between your server and the database server. You can't control network traffic across the Internet, you can't control bandwidth, you can't control latency, and the more hops between your server and the database server, the more uncertainty (and lack of control).

If the database if fairly static, you could replicate or cache a copy locally near your server; but as Pludi mentioned, without more details, there is not much else to offer.