javapythonperlworkload

How to Simulate workload


I have to write a program (perl , python or java) to simulate workload on our server such that it takes 2 arguments :

  1. Memory

  2. Time

And based on these arguments it should start a process that consumes the specified amount of memory for specified amount of time.Max value of memory can be as high as 50-100GB and Time can be upto 12-24 hrs.

I cannot use fork or multi threads, this process should be a single thread and should continuously do operations (like Integer / Floating point etc). I don't want to do any I/O operations also.

The simplest way I could think of was:

 1. while(timeSpent < timeLimit || memoryConsumed < memorySpecified){
 2.           if(memoryConsumed < ){
 3.                Add random number to ArrayList 
 4.           }else{
 5.                Multiply all numbers (Do some exception handling to prevent this from overflowing) 
 6.           }
 7. }

Please let me know if there is a better way of doing this.

Thanks,

Amit


Solution

  • I am using the utility stress weather.ou.edu/~apw/projects/stress ... though tweaked it a bit to extend the features that I wanted..

    Thanks for your help guys.