Thursday, February 21, 2013

Fibonacci crash - Don't let students code on a virtual Remote Desktop Server

Some  time ago I set up a virtual Server 2008 R2 on the physical Server 2008 R2 so I can test the Remote Desktop Services.

RDS would make my life as a sysadmin a lot easier because I wouldn't need the deployment server anymore and just install and maintain software on one machine but since some things like watching videos isn't as smooth and easy I didn't change the current system configuration but let the virtual RDS running. I gave the virtual Server just 4 cores of the Server and a dynamic amount of RAM (at least 2GB though).

I wanted to code in nodeJS with my students today via RDS and everything went great!

Well.. until I told them to solve the Project Euler Problem #2 which is about finding the sum of all even numbered fibonacci numbers below 4 million. Most of them just coded it straight forward like this

var lastfibo=1;
var sum=0;
for(var i=2;i<10000;i++)
{
   var fibo = i+lastfibo;
   if(fibo%2==0)
     sum+=fibo;
   lastfibo = fibo;
}

This of course led to massive CPU consumption so the RDP was pretty much dead.
Whats interesting is that this also affected the host system which is also the domain controller so nothing responded, nobody could save anything and because of roaming profiles many local applications died with the server.

When I realized that this was probably not such a good idea a teacher came in asking us if our computers also froze.

Because of my brilliant idea to work with my students on the testserver I set up the whole schoolnetwork was down and the main server didn't respond at all so I had to pull the plug.

Lesson learned: don't let students code on a virtual machine that is hosted on the domain controller :)

No comments:

Post a Comment