Re: HAProxy, multicores and EC2

From: Vincent Bernat <bernat#luffy.cx>
Date: Sun, 09 Oct 2011 10:55:57 +0200


OoO En ce milieu de nuit étoilée du dimanche 09 octobre 2011, vers 04:24, Erik Torlen <erik.torlen#apicasystem.com> disait :

> I read a lot of people that have tried stud. This example is
> interesting in this case because he assigns the
> different processes to different cores with cpuset:
> http://vincent.bernat.im/en/blog/2011-ssl-benchmark.html

> In my case, would cpuset be the same as taskset?

taskset is more low level than cpuset. You won't be able to "evade" from a cpuset with taskset. But if you don't use cpuset (or cgroups), taskset should work just fine.

Here is how I do with cpuset :

mkdir /dev/cpuset
mount -t cpuset cpuset /dev/cpuset
cd /dev/cpuset

# All system process on CPU 7
mkdir system
cd system
echo 7 > cpus
echo 0 > mems
while read i; do /bin/echo $i; done < ../tasks > tasks cd ..
for i in $(seq 0 7); do

    mkdir cpu$i
    cd cpu$i
    echo $i > cpus
    echo 0 > mems
    cd ..
done

[...]

# Stud on CPU 3-6
PID=stud
i=0
for pid in $(pidof $PID); do
 echo $pid > /dev/cpuset/cpu$(($i + 3))/tasks  i=$(( ($i+1) % 4))
done

At the end, just check that the process is properly pined down to wanted CPU with /proc/PID/status:

Cpus_allowed_list: 5

-- 
Vincent Bernat ☯ http://vincent.bernat.im

Don't comment bad code - rewrite it.
            - The Elements of Programming Style (Kernighan & Plauger)
Received on 2011/10/09 10:55

This archive was generated by hypermail 2.2.0 : 2011/10/09 11:00 CEST