I’ve been reading about Receive Packet Steering on Linux. I have heard anecdotal evidence that this can greatly improve performance. It made me wonder if you could improve performance even more by telling the kernel that you want the thread the processes the IO for a particular interface to run on the same CPU that is handling the interrupts for the interface.
Java doesn’t provide support for CPU/Thread affinity out of the box. Linux has the sched_setaffinity(2) that does this. So, I wrote some JNI code to allow me to set a thread’s affinity mask for a particular CPU. I’ve pushed this code out to GitHub. I also implemented a CpuLocal class that is similar to ThreadLocal. The build is targeted for 64-bit platforms and may require some tweaking to get it to run on yoru environment.
Unfortunately, I haven’t had much time (or proper resources) to benchmark my theories about combining CPU/thread affinity with receive packet steering but I thought I would push the code out anyway so that others can start playing with it.
2 Responses
Ruslan
October 25th, 2011 at 5:59 am
1Am I understand you right: your tool set affinity mask for current process, not thread actually? Docs on sched_setaffinity(2) you’ve refered seems to be about process affinity. Or I’m missed something?
Mike Heath
November 10th, 2011 at 11:05 am
2As far as the Linux scheduler is concerned, a thread is a process.
RSS feed for comments on this post · TrackBack URI
Leave a reply
Categories
Archives
Links
Meta
Calendar