Thursday, October 15, 2009

Finding The Optimal J Value For Building Packages

Our task for week 6 was to find the optimal j value for one of the cdot systems, so when we start to build Fedora we would know which value to use to help speed up the build process.

The machine I decided to work on was Hong Kong, and my package I used to help me time the speed was seahorse.

We created a script would would run and replicate the build processes on the package and provide us a time it finishes a cycle.

Here is the script I used.

------------------------------------------------------------------------------------------------------

#!/bin/bash
rm -f build.log

#Setting the j value, starting from 5 to 15
for ((j=5; j<=15; j++))
do
mv ~/.rpmmacros ~/.rpmmacros.old
#Looks for the smp_flag in the .rpmmacros file and replaces the j value.
grep -v smp_flags ~/.rpmmacros.old >~/.rpmmacros
echo "%_smp_mflags -j$j" >> ~/.rpmmacros

#Run the Build 3 times and Outputting the values to a log
for ((x=1; x<=3; x++))
do
echo "Building...j:$j x:$x"
echo "Time for j value $j Number of Tries: $x" >> build.log
echo "" >>build.log
/usr/bin/time -f "%e %U %s" -o build.log -a rpmbuild -ba /home/bchao/rpmbuild/SPECS/seahorse.spec >/dev/null 2>&1
echo "" >> build.log
done


done

----------------------------------------------------------------------------

Here are my results.


Number of Tries

J Value 1 2 3
5 38.55 45.11 0 37.93 45.26 0 37.99 45.26 0
6 37.00 45.35 0 37.46 45.19 0 37.25 45.45 0
7 36.80 45.49 0 37.20 45.57 0 37.15 45.35 0
8 36.26 45.48 0 36.04 45.32 0 36.37 45.47 0
9 36.03 45.59 0 36.00 45.31 0 36.23 45.63 0
10 36.32 45.44 0 36.02 45.51 0 36.11 45.65 0
11 35.88 45.25 0 36.04 45.47 0 36.20 45.72 0
12 36.42 45.64 0 36.01 45.55 0 36.10 45.40 0
13 36.31 45.40 0 36.12 45.69 0 35.98 45.56 0
14 36.12 45.63 0 36.62 45.50 0 36.01 45.56 0
15 36.03 45.72 0 36.11 45.69 0 36.14 45.84 0

As you can see using the j value 5 gave us the slowest speed of 38 seconds, the fastest time recorded was with the j value 11 at 35.88. The j value where everything basically averages out is 9 with the time of 36 seconds.

So when we do any Fedora builds on Hong Kong, I know which value I would use which is 9.

0 comments:

Post a Comment