LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-31-2014, 05:01 AM   #1
sa6kad
LQ Newbie
 
Registered: Jun 2014
Posts: 6

Rep: Reputation: Disabled
Virtual interfaces performance


Hi. I am relatively new to Linux, but currently i am working on my thesis that requires some measurements and experiments of Linux performance while using hundreds (even thousands) virtual interfaces. My current task is to find out...
"1. How long does it take for kernel to (1) start and (2) shutdown a virtual interface? For that purpose, I would write a script that sequentially starts and shutdowns, say, 1000 virtual interfaces and observe the start/shutdown durations. Among these 1000 samples, I'd calculate the min/max/avg/stddev. I'd repeat the same experiment, but instead of sequentially spawning interfaces, this time I'd spawn them using 2, 3, 4, and so on threads. This way, I'd be able to observe the kernel's performance under concurrent load."

I wrote a simple script that starts N interfaces and assigns IP address to them:
Code:
echo "Enter number of interfaces: "
read int
a=8 #I use 10.0.0.0/20 network, but here i start from 10.0.8.0
b=2 #Physical interface has address 10.0.8.1, so virtual starts from 10.0.8.2

for (( i=1; i<=$int; i++ ))
do
	ifconfig eth2:$i 10.0.$a.$b/20 
	
		if [ $b -eq 255 ] #incrementing third octet of the IP address when forth reaches 255
		then ((a++))
			b=0
		else (( b++ ))		
		fi
	
done
Similar script stops all the interfaces when needed with the following code:
Code:
ifconfig eth2:$i down
So, my questions are:
1. How to measure this:
Quote:
sequentially starts and shutdowns, say, 1000 virtual interfaces and observe the start/shutdown durations
2. How to do this part:
Quote:
but instead of sequentially spawning interfaces, this time I'd spawn them using 2, 3, 4, and so on threads
3. What tools, techniques to use to observe/measure this:
Quote:
...to observe the kernel's performance under concurrent load.
Thank you.

Last edited by sa6kad; 10-31-2014 at 05:19 AM.
 
Old 10-31-2014, 01:05 PM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
Hi

Remember a script is interpreted, and running commands take time. So to get more sensible numbers, you need to run your script again where the ifconfig comand does nothing. You could change the ifconfig command to "ifconfig >/dev/null" and compare the results.

You can't use proper threads in a script. But adding & after the ifconfig command will start it in the background. After the loop is finished add a "wait" command, so it waits until all are done.

To measure things, you can use the command "time". If you want to time many commands, you can add () around a section to measure

Code:
time (
 command1
 command2
)
 
Old 11-01-2014, 05:22 AM   #3
sa6kad
LQ Newbie
 
Registered: Jun 2014
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Remember a script is interpreted, and running commands take time. So to get more sensible numbers, you need to run your script again where the ifconfig command does nothing. You could change the ifconfig command to "ifconfig >/dev/null" and compare the results.
Thank you. Yes, this was my next question: whether it makes sense to measure how much time it takes for the script to simply iterate N times and exclude this time from the time needed for the script to create/delete N virtual interfaces.

Another my question is how precise is time command. It provides time in milliseconds, however, if it gives a result of 0.001, is it literally 1 millisecond or it is a rounded value?

Could you elaborate on this, please:
Quote:
You can't use proper threads in a script

Last edited by sa6kad; 11-01-2014 at 05:30 AM.
 
Old 11-01-2014, 08:01 AM   #4
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
Code:
man time
http://stackoverflow.com/questions/2...s-and-a-thread
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Virtual network interfaces performance measurement sa6kad Linux - Networking 2 06-13-2014 03:28 PM
Virtual interfaces for bridge for performance testing nktns Linux - Networking 2 05-19-2011 04:03 PM
[SOLVED] /etc/network/interfaces configuration for virtual interfaces nonshatter Linux - Networking 4 10-25-2010 06:22 AM
[SOLVED] HTB shaping and IPERF performance measurents on virtual interfaces skypixel Linux - Networking 1 06-22-2010 03:45 AM
Virtual Interfaces da_tibmeister Linux - Networking 2 10-15-2003 09:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration