A D Script for Observing the Network - Take Two
By Bleonard-Oracle on May 31, 2011
About a year and a half ago I wrote about a nifty little D script I came across while working with the now defunct Crossbow Virtual Wire Demo Tool. However, the script stopped compiling somewhere between the release of OpenSolaris 2009.06 and Solaris 11 Express.
Solaris 11 Express also included the addition of two new DTrace providers, TCP and UDP. These new providers make it possible to simplify the script and Solaris Systems Architect Andrew Gabriel did this, creating so2.d.
bleonard@solaris:~$ sudo dtrace -s so2.d Tracing... Hit Ctrl-C to end. ^C Process Zone Protocol Destination Port Bits dhcpagent global UDP ff02::1:2 547 512 pidgin global TCP 184.108.40.206 5223 720 firefox-bin global TCP 220.127.116.11 80 279536 Trace ran for 8 seconds
The associated Chime display is useful when you want to monitor a system with lots of network traffic. In this example I'm using Netperf to simulate traffic between my global zone and a local zone, which has been configured to run at IP address 10.0.1.25:
In this example you can see we're achieving a throughput of 681,836,544 bits per second, or approximately 682 megabits per second. In my case the local zone is configured using a VNIC, myzone0:
bleonard@solaris:~$ dladm show-vnic myzone0 LINK OVER SPEED MACADDRESS MACADDRTYPE VID myzone0 e1000g0 1000 2:8:20:3f:cc:8a random 0
Notice the link speed of myzone0 is 1000 megabits per second, and at the moment it's using a good chunk of that bandwidth, potentially starving other virtual NICs and the physical NIC itself from the network. Fortunately, network virtualization allows me to put some reigns on my virtual NICs. For example, if I do the following:
bleonard@solaris:~$ sudo dladm set-linkprop -p maxbw=200 myzone0
Above we can see we're now running just under 200 megabits per second. Or More ridiculously:
bleonard@solaris:~$ sudo dladm set-linkprop -p maxbw=2 myzone0
We're now under 2 megabits per second.
Now it is also possible to drill down on the Chime display, graphing throughput over time. The above scenario looks like so:
If you want to check this out on your own environment, you only need the D script, Chime and the Network display:
<void property="programFileName"> <string>/export/home/bleonard/so2.d</string> </void>
To launch the Chime display:
chime -C ./Network.xml
To run the netperf test for an extended period of time:
netperf -H <ip address of netserver> -l <seconds to run>