1

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

2 Answers 2

2

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?

2
  • 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. Aug 16, 2010 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 rt.wiki.kernel.org/index.php/Frequently_Asked_Questions
    – Li Lo
    Aug 16, 2010 at 10:30
0

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).

Not the answer you're looking for? Browse other questions tagged .