2011/12/02

The Illusive Art of Acquiring A Good Idle-PC Value + Investigating Idlepc idlemax to minimise CPU usage

This article from blog:
http://forum.gns3.net/topic2873.html
http://forum.gns3.net/topic4197.html
Thanks for rednectar.

----------------------------------------------------------------
 The Illusive Art of Acquiring A Good Idle-PC Value
----------------------------------------------------------------

One of the most difficult problems new users have to come to grips with when starting out with GNS3 is the concept of an Idle-PC.

Get it right, and you will have a great GNS3 experience. Try to ignore it, and you will be forever miserable.

Here is my tedious and time consuming method of finding a good idle-pc value.

REPEAT FOR EVERY DIFFERENT IOS IMAGE YOU WISH TO RUN ON YOUR SYSTEM:


Step 1:
Windows: Open the windows task manager and sort by %CPU
Linux: Open a console window and enter the command top
Mac OS X: Open a terminal window and enter the command top -o cpu

Keep this window visible for the entire process

Step 2:
In GNS3, start a new topology with 1 router ONLY
Start the router
Open the console. When when the router is fully up, configure the following:
line con 0
exec-timeout 0

NOTE: While writing this post, I observed this step alone dropped the CPU usage from 98% to 1% on a Windows 7 install (running in a VM on OS X)

Step 3:
Back at your task manager or console window:
Take note of the amount of CPU being chewed by dynamips

Step 4:
In GNS3, right-click on the router and choose idle-pc

If NO values appear marked with *, try again

When you find a value marked with a *, WRITE IT DOWN
If MULTIPLE values appear with *, WRITE THEM ALL DOWN (in a column)
... then choose one of them

Step 5:
Check the CPU utilisation for dynamips in the task manager or console window.
Estimate the average CPU consumption for dynamips over say 15-20 seconds
WRITE IT DOWN next to the Idle-pc value you wrote down in step 4

If you have an idle-pc vlaue that shows less than 10-15% CPU, you may want to go to step 6,
Else, go back to step 4

Step 6:
Now that you have a good idle-pc, you need to know how to use it well.
Firstly, check that GNS3 has recorded you best value against the image you are using

That's in:Edit->IOS Images and Hypervisors
Select the image you are using and check the IDLE PCs value
Now GNS3 will automatically use that value in any NEW topologies you create.

Step 7:
If you have any saved topologies (ie .net files) that have used this IOS, open the .net file and replace the idle-pc value found there with your new "good" idle-pc value.

Step 8:
Record the results you found (IOS & idle-pc values) in a spreadsheet and keep it!
Now go back to Step 1 and repeat for the next IOS image you use

General Tips for keeping CPU under control
Always use the same image for ALL routers in your topology if possible.
This means using the same router model as well. If this is not possible, use the same image for all routers of the same model.
ALWAYS set the exec-timeout 0 under line con 0
In GNS 0.7.3 and later, you can set a base config for each IOS image under Edit->IOS Images and Hypervisors. Make sure the base config has the exec-timeout 0 under line con 0

UPDATE 2011-10-22
I've added a second article that you should read after this: Investigating Idlepc idlemax to minimise CPU usage

----------------------------------------------------------------
Investigating Idlepc idlemax to minimise CPU usage
----------------------------------------------------------------

Background
This is an extension to a previous article; "The Illusive Art of Acquiring A Good Idle-PC Value". Read it before you read this.

So - you have found a good idle-pc value, and are using it in your labs. But still your CPU is churning away at a rate higher than you'd like.

There may be a solution in sight yet - the idlepc idlemax setting.

Thanks to sharky1337 who alerted me to the possibility of adjusting the idlemax values, I found that others had already started giving advice here and here.

But these all talked about setting the idlemax value to 100. I wanted to see what other values would do.

How to set the idlemax value

Step 1:Observe your CPU Utilisation

Windows: Open the windows task manager and sort by %CPU
Linux: Open a console window and enter the command top
Mac OS X: Open a terminal window and enter the command top -o cpu

Keep this window visible for the entire process.

Step 2:Load your topology
, or build a new one. I'm assuming you are already using the best idle-pc values you could find.
Start your routers. Control->Start/Resume...

Check your CPU utilisation. After peaking high, it should settle once all routers are started.

Wait for all routers to go green.

(TIP 1: If your routers take too long to start, or won't all start, try starting a few, set the idlemax as described below and continue starting a few at at a time)
TIP 2: Opening a console session can also cause the CPU utilisation to drop.


Now click in the Dynagen management console at the bottom of the page.
Enter the command:
idlepc idlemax /all 100

Check your CPU utilisation now. It will probably have dropped. If it hasn't dropped enough, you can try another value. eg:
idlepc idlemax /all 10

BUT before you get too carried away, you must realise that all this CPU saving comes at a cost.

Step 3:Test your Console Access
Go to the console of one of your idlemax-tamed routers and issue a show run command from privileged mode.

If, (A) the console won't open, or (B) the output from your commands is slow, then tune your idlemax value up a bit higher. To put it back to the default:
idlepc idlemax /all 1500

While still at the Dynagen management console, check your settings by issuing a show run command. You should see something like:
=> show run
autostart = False
[127.0.0.1:7200]
workingdir = /opt/GNS3/Working
udp = 10000
[[3725]]
image = /opt/GNS3/IOS/c3725-adventerprisek9-mz.124-15.T10.image
ram = 256
idlepc = 0x6026b804
idlemax = 10
ghostios = True

Step 4:Saving your idlemax values
Nothign to it. Now that you have set the idlemax values, they will automatically be saved when you save your topology file. If you take a look at topology.net after saving your project, you should see the idlemax = xx line included.

沒有留言:

張貼留言