[NCLUG] Testing memory pressure

grant at amadensor.com grant at amadensor.com
Thu Jan 13 11:34:40 MST 2011


Thanks.   I searched around, found the home page for the developer, and
found a RPM file, since this is on CENTOS 5.

It looks like it will do the job very well.   Now I have two ways to test
under load.

If anyone else needs it:
http://weather.ou.edu/~apw/projects/stress/



> grant at amadensor.com wrote:
>> I want to test how an application reacts to being starved for resources.
>>
>> I have some pretty good ideas about how to create an artificial I/O load
>> and a CPU load.   Does anyone have a good idea for how to (from
>> something
>> quick like shell or PERL) use a lot of memory so that things start to
>> swap
>> out?
>
> Two ideas:
>
>  $ apt-cache show stress
>
>  Description: A tool to impose load on and stress test a computer system
>   'stress' is a tool that imposes a configurable amount of CPU, memory,
> I/O,
>   or disk stress on a POSIX-compliant operating system and reports any
> errors
>   it detects.
>   .
>   'stress' is not a benchmark.  It is a tool used by system administrators
> to
>   evaluate how well their systems will scale, by kernel programmers to
> evaluate
>   perceived performance characteristics, and by systems programmers to
> expose
>   the classes of bugs which only or more frequently manifest themselves
> when
>   the system is under heavy load.
>
> Second you could use a very simple program to hog memory at whatever
> value you want.  Here is a very simple one.  Originally written to hog
> memory and push a machine into vm thrashing.
>
> Bob
>
> #include <stdlib.h>
> #include <stdio.h>
> main()
> {
>   char *array;
>   int i, mem_size;
>
>   printf("Enter memory size to hog in megabytes: ");
>   scanf("%d",&mem_size);
>   array = malloc(mem_size * 1024 * 1024);
>   if (array == 0)
>     {
>       fprintf(stderr,"Error: unable to malloc: out of memory\n");
>       exit(1);
>     }
>   i = 0;
>   for (;;) {
>     for (i = i; i < (mem_size * 1024 * 1024); i += 1027) {
>       *(array + i) = 'f';
>     }
>     i = i - (mem_size * 1024 * 1024);
>   }
>   return 0;
> }
> _______________________________________________
> NCLUG mailing list       NCLUG at lists.nclug.org
>
> To unsubscribe, subscribe, or modify
> your settings, go to:
> http://lists.nclug.org/mailman/listinfo/nclug
>





More information about the NCLUG mailing list