Wednesday, July 20, 2011

VMs to Simulate Internet Traffic

‹prev | My Chain | next›

I have it my head that I would like to compare the performance of a single SPDY site to various CDN scenarios. First up, creating VMs to hold HTTP sites.

It seems easiest to clone my existing express-spdy VMs (used for testing install instructions). First things first, I clone the VirtualBox image to two separate instances: a www server to host the main site and a cdn server to hold a simulated content delivery network:
➜  VirtualBox VMs  vboxmanage clonehd express-spdy_node05.vdi www.local.vdi
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: 28dcc937-9520-43a5-a025-10f6188b773d
➜ VirtualBox VMs vboxmanage clonehd express-spdy_node05.vdi cdn.local.vdi
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: 485a1a00-e3d1-4c95-b8c6-48c8466e280f
My thinking right now is to host a web page on the www server that references a bunch of static files on the cdn server.

Now I need to create new VirtualBox VMs. Sadly the vboxmanage clonehd command has not added the new image to the list of disks known to VirtualBox:



So I have to do the "hard" way. I select the OS type to be the same as the source virtual machine:



Since the cloned hard drives are not known to Virtual, have to use the "Add disk" button:



After locating the cloned hard drive on disk, I am now all set:



All other options are set to the VirtualBox defaults.

Before I start the VM, I need to set it up so that I can connect to it like a real network machine. I opt for "Bridged Adapter":




I opt for this adapter because it is the easiest way to get networking between the host and guest working. I secretly fear that, by re-using the existing network interface (wlan0 on my laptop), the network filtering will lose packets in this configuration. But my desire for expediency wins out.

Anyhow, I set up both the www and cdn servers in the same way.

Normally, I would have to edit /etc/udev/rules.d/70-persistent-net.rules on a cloned Debian/Ubuntu/Linux machine to use a wildcard MAC address, but I already did that in the source machine:
# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
The only other thing I do tonight is install sudo apt-get install nginx. After making a dummy HTML page in /var/www/index.html, I can access the web page from my local machine:



With both www.local and cdn.local working, I have reached a fine stopping point for tonight. I will pick back up tomorrow configuring the two to simulate typical traffic and use Speed Tracer to put them through their paces.

Day #80

No comments:

Post a Comment