Hi all.
I recently migrated XI to a new server with 16G RAM and an 8 core CPU. The load was out of control, often hitting 20.0 if not higher, so I set process affinity in hopes that it would help. I gave httpd cores 7&8, nagios and npcd cores 1-3, and mysql uses cores 4-6. It seems like its improved performance but I don't know how I can definitively check that. Any thoughts? Is this all in my head?
Setting core affinity improves performance?
-
- Posts: 316
- Joined: Thu Mar 31, 2011 9:54 am
- Location: Patten, ME
- Contact:
Setting core affinity improves performance?
Last edited by cwscribner on Tue Oct 18, 2011 10:53 am, edited 1 time in total.
Re: Setting core affinity improves performance?
I would be interested in getting the notes on how you set that up. That's something we haven't tested before.
I'm currently running some benchmark tests on a smaller scale with a single CPU to see what other tweaks can be done. One of the ways that I'm testing changes is to use the Graph Explorer component, and then I use the Time-Stacked view where I overlay the last 3 days for the localhost->Current Load. I make a change, let it run for a day, and come back and compare it with the days before. It's not an exact science, but it gives a decent idea of what makes a difference.
I'm currently running some benchmark tests on a smaller scale with a single CPU to see what other tweaks can be done. One of the ways that I'm testing changes is to use the Graph Explorer component, and then I use the Time-Stacked view where I overlay the last 3 days for the localhost->Current Load. I make a change, let it run for a day, and come back and compare it with the days before. It's not an exact science, but it gives a decent idea of what makes a difference.
-
- Posts: 316
- Joined: Thu Mar 31, 2011 9:54 am
- Location: Patten, ME
- Contact:
Re: Setting core affinity improves performance?
I just make the changes using htop as the root user. After you open htop, highlight a process, then hit "a" to see the cores that the process is able to use. You can check/uncheck them with the space bar. I just set the affinity arbitrarily as I wasn't sure which processes would use the most. I assumed that nagios/npcd would be tier 1, mysql would be tier 2, and apache/httpd would be tier 3 at a distance. So I gave nagios/npcd cores 1-3, mysql cores 4-6, and apache cores 7-8.
Re: Setting core affinity improves performance?
Cool stuff!
As an FYI, mysqld and httpd are #1 and #2 for CPU if mysql is not offloaded, after that it's dependent on the environment.
As an FYI, mysqld and httpd are #1 and #2 for CPU if mysql is not offloaded, after that it's dependent on the environment.
-
- Posts: 316
- Joined: Thu Mar 31, 2011 9:54 am
- Location: Patten, ME
- Contact:
Re: Setting core affinity improves performance?
So just a quick note, I don't think the CPU affinity is retained after restarting the process or the server. I restarted mine yesterday and all the affinities I set are gone. There may be a more permanent way to do it. Possibly force a PID and then set the affinity on that PID, or perhaps a configuration file somewhere? I'm not well versed in resource manipulation...
Re: Setting core affinity improves performance?
hmmm this is a pretty interesting read and this article has some info on permanently setting affinity: http://www.linuxjournal.com/article/6799?page=0,1. I wonder if this would have any benefit in a virtualised environment... highly unlikely... now that I think about it, depends on the Hypervisor I suppose.