Stress-Testing LTSP was Re: No Sound with Flash in Firefox

Gavin McCullagh gmccullagh at gmail.com
Sat Jul 21 15:24:24 BST 2007


Hi,

On Wed, 18 Jul 2007, Jim Kronebusch wrote:

> When you get to the point that you think things are polished enough that
> you might want someone to give it a try, let me know.  I would be happy
> to run our system through it's paces.  I will be out of town until next
> Monday, but my new clients will all be set up and ready to test at that
> time.

This is not really ready yet, but as I'm going away for ten days I'll post
in case anyone has some thoughts in the meantime.

The major bug currently is that firefox, if closed with a kill signal,
restarts asking do you want to restore it.  I'm sure there's some file you
can remove or touch in firefox to convince it not to restart.  Stick all
these files in one directory, make simulate_user executable and run it.

Have to run now, comments welcome.

Gavin

config:
#######################################################################
TIMESTEP=1
URLFILE="urls.txt"

COMMAND[0]="no_op"
WEIGHT[0]=248

COMMAND[1]="load_random_url"
WEIGHT[1]=7

COMMAND[2]="close_browser"
WEIGHT[2]=1
#######################################################################

urls.txt:
#######################################################################
http://www.youtube.com
http://www.google.com
http://www.ireland.com
http://www.microsoft.com
http://www.apple.com
http://www.bbc.co.uk
http://www.yahoo.com
http://www.edubuntu.org
http://www.firefox.com
http://youtube.com/browse?s=mp
#######################################################################

simulate_user:
#######################################################################
#!/bin/bash

maxrand=32768

# perhaps later use random number generator from
# http://www.shelldorado.com/newsletter/issues/2002-3-Aug.html
# bash $RANDOM is on 0-32767
function make_random() {
	rand=$RANDOM
}

function calculate_weightings() {
	local i=0
	local divisor=0
	while [ ! -z ${COMMAND[$i]} ]
	do
		divisor=$(( $divisor + ${WEIGHT[$i]} ))
		i=$(( $i + 1 ))
	done
	i=0
	last_index=0
	while [ ! -z ${COMMAND[$i]} ]
	do
		INDEX[$i]=$(( $last_index + ${WEIGHT[$i]} * $maxrand / $divisor ))
		last_index=${INDEX[$i]}
		echo "${COMMAND[$i]} $last_index"
		i=$(( $i + 1 ))
		
	done
}

# pick one url from the file
function get_random_url() {
	make_random
	local num=`wc -l $URLFILE | cut -f 1 -d " "`
	local line_number=$(( $rand % $num ))
	url=`head -$line_number $URLFILE | tail -1` 
}

function load_random_url() {
	get_random_url
	echo "loading $url"
	if firefox -remote "ping()" &>/dev/null
	then
		firefox -remote "openurl($url,new-tab)"
	else 
		firefox $url &
		sleep 10
	fi
}

function close_browser() {
	echo "Stopping Firefox"
	if firefox -remote "ping()"
	then
		killall -HUP firefox-bin
	fi
} 

# is it possible to reboot a thin client in a script?
# ssh server on thin clients would be one way
function reboot() {
	local a=b
}

function no_op() {
	/bin/true
	#echo "no op"
}

if [ -r config ]
then
	source config
else
	echo "Couldn't load config"
	exit 
fi

calculate_weightings

while /bin/true
do
	sleep $TIMESTEP
	make_random
	j=0; k=0
	while [ ! -z ${COMMAND[$j]} ] && [ $k -lt 1 ]
	do
		if [ ${INDEX[$j]} -gt $rand ]
		then	
			echo "$j: running ${COMMAND[$j]} $rand"
			eval ${COMMAND[$j]}
			k=1
		fi
		j=$(( $j + 1 ))
	done
done
#######################################################################





More information about the edubuntu-users mailing list