Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filling Up Memory 2

Status
Not open for further replies.

jameshall

Technical User
Jul 9, 2002
36
GB
Hello all,

I am new to Unix and as my first exercise i have to write a mini script to load test the memory on new server.
My limited knowledge of commands has come up with.

1. Fill the swap space
2. Create a large file.

#!/usr/bin/ksh

x=1
while [ "$x" -lt "1000" ] ;do
echo $x
x=`echo "$x + 1" | bc`

while true;do
ls -l > /james/test12
done

while true;do
cat /james/test12 | grep .
done

echo "x after add = $x"

done

It sort of works!! but the memory level gets down to a certian level and it stops.
It also takes ages and the test machine has 758mb wheras the server has 4gb.

Can anyone help with completing this any quicker.

Thanks in advance

Jameshall
 
What exactly do you mean by load test the memory on the server?

If you want to see how the server behaves under low memory conditions you won't be able to do this by simply creating large files (unless they are in /tmp, which is usually a swap based filesystem).

You can use mkfile to quickly create a file of any size.



Annihilannic.
 
Why not install sunvts and run memory test?
 
Hello,

Sorry i wasn't very clear on what i said. i need to test the memory under full load and see what happens. We are not allowed to install many apps on a server without loads of paperwork and testing.

I would like to know what things use loads of memory on a standard install of solaris, and how I might be able to use it to complete my task.

I thought about filling up the swap space to stop memory using it so in theory i could stop the meomory using it??

Any advice would be much appreciated

jameshall

 
Type df -k /tmp, and if, for example, it has 3,800MB free, type mkfile 3800m /tmp/hugefile. That will fill your swap space (virtual memory) pretty quickly.

Annihilannic.
 
Hi,

I have filled up the SWAP space but after checking my vmstat list, i have not filled up the RAM 768mb.

Is there a simple way to go about this?

Any advice would help,

Many Thanks

jameshall
 
Create a largish file, then write a shell script such as:

[tt]#!/bin/ksh
t=`cat largish_file`
sleep 300[/tt]

Then run a whole bunch of those (in the background) until all memory is consumed!

Annihilannic.
 
Thanks Annihilannic.

i'll try it now.

many thanks

jameshall
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top