Home > Archive > Unix Programming > January 2008 > how to generate 100% cpu load on solaris 10 zone
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
how to generate 100% cpu load on solaris 10 zone
|
|
|
| I tried to compile a quick one liner program :
main()
{
int i, j;
for (i=0; ; i++)
j++;
}
expecting to see 100% in top, and to my disbelief it stayed at most at 33%
I am not sure on what exact solaris box I am running, I am inside a solaris
10 zone.
Would the zone server allocate only say a quota of total cpu to each zone ?
By being at 33% does it mean there are 3 zones ?
here it says :
http://www.solarisinternals.com/wik...ce_Metric_00001
that any old loop :
perl -e 'while (--$ARGV[0] and fork) {}; while () {}' 4
will give 100% load, but not in my case ?
thanks for any information
| |
| Måns Rullgård 2008-01-14, 7:18 pm |
| "g f" <gfanini@tiscalinet.it> writes:
> I tried to compile a quick one liner program :
>
> main()
> {
> int i, j;
> for (i=0; ; i++)
> j++;
> }
> expecting to see 100% in top, and to my disbelief it stayed at most at 33%
>
> I am not sure on what exact solaris box I am running, I am inside a
> solaris 10 zone.
>
> Would the zone server allocate only say a quota of total cpu to each zone ?
>
> By being at 33% does it mean there are 3 zones ?
>
> here it says :
>
> http://www.solarisinternals.com/wik...ce_Metric_00001
>
> that any old loop :
>
> perl -e 'while (--$ARGV[0] and fork) {}; while () {}' 4
>
> will give 100% load, but not in my case ?
That's not "any old loop". It creates 4 infinite loops.
Try a proper fork bomb. Run this in a shell:
:(){ :|:& };:
--
Måns Rullgård
mans@mansr.com
| |
| nelson.bensley@gmail.com 2008-01-14, 7:18 pm |
| would brendan gregg's zoneflogcpu script work with slight changes?
| |
| lahuman9 2008-01-14, 7:18 pm |
| On Jan 14, 4:06=A0pm, "g f" <gfan...@tiscalinet.it> wrote:
> I tried to compile a quick one liner program :
>
> main()
> {
> int i, j;
> for (i=3D0; ; i++)
> =A0j++;}
>
> expecting to see 100% in top, and to my disbelief it stayed at most at 33%=
>
> I am not sure on what exact solaris box I am running, I am inside a solari=
s
> 10 zone.
>
> Would the zone server allocate only say a quota of total cpu to each zone =
?
>
> By being at 33% does it mean there are 3 zones ?
>
> here it says :
>
> http://www.solarisinternals.com/wik...ce_Metric_00001
>
> that any old loop :
>
> perl -e 'while (--$ARGV[0] and fork) {}; while () {}' 4
>
> will give 100% load, but not in my case ?
> thanks for any information
dd if=3D/dev/zero of=3D/dev/null bs=3D10485760 seems to do the trick for
me. handy to test out FSS scheduling for zones. increase bs as needed
| |
|
| there appears to be a FSS fair share scheduling mechanism for cpu quota
among solaris zones ...
"g f" <gfanini@tiscalinet.it> wrote in message news:fmgitm$la$1@aioe.org...
>I tried to compile a quick one liner program :
>
> main()
> {
> int i, j;
> for (i=0; ; i++)
> j++;
> }
> expecting to see 100% in top, and to my disbelief it stayed at most at 33%
>
> I am not sure on what exact solaris box I am running, I am inside a
> solaris 10 zone.
>
> Would the zone server allocate only say a quota of total cpu to each zone
> ?
>
> By being at 33% does it mean there are 3 zones ?
>
> here it says :
>
> http://www.solarisinternals.com/wik...ce_Metric_00001
>
> that any old loop :
>
> perl -e 'while (--$ARGV[0] and fork) {}; while () {}' 4
>
> will give 100% load, but not in my case ?
> thanks for any information
>
| |
| Darren Dunham 2008-01-15, 7:15 pm |
| In comp.unix.solaris g f <gfanini@tiscalinet.it> wrote:
> I tried to compile a quick one liner program :
>
> main()
> {
> int i, j;
> for (i=0; ; i++)
> j++;
> }
> expecting to see 100% in top, and to my disbelief it stayed at most at
33%
'top' will show you system CPU on Solaris. So it's possible that you
only have 3 online CPUs (33% ~ 1CPU), or that other constraints are
occuring.
> I am not sure on what exact solaris box I am running, I am inside a solaris
> 10 zone.
>
> Would the zone server allocate only say a quota of total cpu to each zone ?
It's possible, yes.
> By being at 33% does it mean there are 3 zones ?
No. Because your process is single threaded, you can't use it to
generate more than 1 CPU of load. So the percentage depends on how many
CPUs are on the system.
You may need to run more than one copy to saturate multiple CPUs.
> here it says :
>
> http://www.solarisinternals.com/wik...ce_Metric_00001
>
> that any old loop :
>
> perl -e 'while (--$ARGV[0] and fork) {}; while () {}' 4
>
> will give 100% load, but not in my case ?
Where does it say 100% load?
Also, that's not "any old loop". That generates 4 separate processes,
each looping. The text mentions that you should adjust the '4' to be
the number of CPUs on your system.
Since your process does not fork or create threads, you have to run it
multiple times to generate loads for multiple CPUs.
This is earlier on that page...
# a "run away" process or thread usually pegs a single CPU at 100%,
however for a multi-CPU server this will be divided by the CPU count
- making this error state difficult to identify (eg, spotting a 3%
rise for a 32 CPU server).
and futher down...
Technical Details
For a single CPU or virtual CPU (eg, hardware thread): this metric
is the percentge of time during the interval that the CPU did not
spend in an idle state, such as running the system idle thread. ie,
the percentage of time that the CPU ran user and kernel code. This
time includes CPU cycles stalled waiting for memory bus requests to
main memory.
For a multiple CPUs: the sum of the single CPU percentages, divided
by the number of CPUs. A maximum of 100 corresponds to all CPUs at
100 percent utilized for that interval.
--
Darren Dunham ddunham@taos.com
Senior Technical Consultant TAOS http://www.taos.com/
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >
| |
| Sharif Rizal 2008-01-18, 7:14 pm |
| On Jan 14, 4:06 pm, "g f" <gfan...@tiscalinet.it> wrote:
> I tried to compile a quick one liner program :
>
> main()
> {
> int i, j;
> for (i=0; ; i++)
> j++;}
>
> expecting to see 100% in top, and to my disbelief it stayed at most at 33%
>
> I am not sure on what exact solaris box I am running, I am inside a solaris
> 10 zone.
>
> Would the zone server allocate only say a quota of total cpu to each zone ?
>
> By being at 33% does it mean there are 3 zones ?
>
> here it says :
>
> http://www.solarisinternals.com/wik...ce_Metric_00001
>
> that any old loop :
>
> perl -e 'while (--$ARGV[0] and fork) {}; while () {}' 4
>
> will give 100% load, but not in my case ?
> thanks for any information
I found this script somewhere on the net. It works great.
#!/usr/bin/perl
print "Eating the CPUs\n";
foreach $i (1..64) {
$pid = fork();
last if $pid == 0;
print "Created PID $pid\n";
}
while (1) {
$x++;
}
|
|
|
|
|