Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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 have an application that is latency sensitive. Although I care about throughput, extreme low latency is more important to me.

Please suggest how I can optimise my server to achieve the lowest possible latency - that is, the lowest possible response time from a request being received on a network interface (or inifiniband card) and the response being published.

Initial thoughts are

  • Pin all operating system activity to a set of cores and dedicate others to my (don't know the best way to do this)
  • Setting overcommit_memory to don't overcommit

The article Optimizing Servers and Processes for Speed seems to be a good start but other pointers are welcome.

Any other suggestions welcome

share|improve this question

closed as too localized by Luis Alvarado Mar 14 '13 at 17:04

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

First and foremost, I think you should install and use the linux-rt kernel. This kernel is patched and allows nearly all of the kernel to be preempted, with the exception of a few very small regions of code ("raw_spinlock critical regions"). This is done by replacing most kernel spinlocks with mutexes that support priority inheritance, as well as moving all interrupt and software interrupts to kernel threads.

Preemption is the act of temporarily interrupting a task being carried out by a computer system, without requiring its cooperation, and with the intention of resuming the task at a later time.

Read A realtime preemption overview. This will allow you to understand how things work, something that will enable you to fine tune the kernel for your particular application.

There's also RTLinuxFree developed by Wind River Systems which also has a commercial counterpart if you have money laying around.

For linux-rt I recommend reading the RT Wiki

Maybe your application supports RTAI?

share|improve this answer
Thanks Li Lo. Although predictable behaviour is important, low latency is the main concern at the moment. The RT kernel would (almost) guarantee predictability but may increase latency if my application was pre-empted. I really want to focus on reducing scheduling contention within my application on a particular core rather than guaranteeing a particular level of performance. – Robert Christie Aug 16 '10 at 10:16
Your application will most certainy be preempted. I don't think the -rt patch changes how your application is preemped significantly (without you configuring so), however it allows the kernel to be preempted if an interface interrupt arrives when otherwise the kernel would be in an code area not previously preemptible. Give your app a high rt prio. Read – Li Lo Aug 16 '10 at 10:30

Perhaps twiddling with the hardware clock frequency could be of importance? That might affect switching ACPI power states, for example, if your machine is expected to be in idle state for periods of time, and has to respond quickly to network requests. Or if you need (extremely) accurate timing and logging, say.

See link text for some more discussion. I'm not sure how recent is, but the hardware clock option was still there last time I checked (some 6 months ago).

share|improve this answer

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