launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #01955
Not a metric performance information
Hello all,
This isn't a metric as best as I can tell, but I thought you might be
interested.
I set up my personal server to fetch an arbitrary bug page from edge
Launchpad and time how long it took. I then graphed the data.
Points worth noting:
* there's a lot of variation
* it never goes below 2s
Attached is the picture and the script, in case you are interested.
I'm personally more interested in trends than the numbers themselves,
so I'm going to keep this running.
jml
Attachment:
edge-bug-118627.pdf
Description: Adobe PDF document
#!/usr/bin/python
from datetime import datetime
import os
import sys
import time
from urllib2 import urlopen
def time_operation(operation, *args, **kwargs):
start_time = time.time()
ret = operation(*args, **kwargs)
end_time = time.time()
return end_time - start_time, ret
def multi_time_operation(repetitions, operation, *args, **kwargs):
for rep in range(repetitions):
duration, result = time_operation(operation, *args, **kwargs)
yield duration
def average(numbers):
return sum(numbers) / float(len(numbers))
def report_timings(data_filename, repetitions, operation, *args, **kwargs):
now = datetime.now().strftime('%Y-%m-%d %H:%M:00')
times = list(multi_time_operation(repetitions, operation, *args, **kwargs))
avg = average(times)
line = ','.join(map(str, [now] + times + [avg]))
data_file = open(data_filename, 'a+')
data_file.write(line)
data_file.write('\n')
print line
data_file.close()
def load_url(url):
urlopen(url).read()
def other_main(argv):
filename = argv[1]
repetitions = int(argv[2])
url = "https://bugs.edge.launchpad.net/launchpad-code/+bug/118627"
report_timings(filename, repetitions, load_url, url)
if __name__ == '__main__':
sys.exit(other_main(sys.argv))
Follow ups