nuxeo / FunkLoad

Functional and load testing framework for web applications, written in Python
http://funkload.nuxeo.org/
GNU General Public License v2.0
382 stars 83 forks source link

Distributed Loadtest Multiple URLs #35

Closed sharadgana closed 13 years ago

sharadgana commented 13 years ago

What is the best way to loadtest a site with mutliple URLS ( ~10000 urls) in a distributed fashion ? I was thinking of writing a Loadtest Case that opens the file ( file containing the urls) and randomly choosing a URL. Is this a suggested way ?

bdelbosc commented 13 years ago

Hi,

yes taking random urls from a file will work, You can put somethink like this in your setUp to get a list of urls:

import os
from random import randint

def get_random_lines(filename, nb_line):
    """Return a list of lines randomly taken from filename"""
    fd = open(filename, "r")
    filesize = os.stat(filename)[6]
    ret = []
    for i in range(nb_line):
        pos = max(randint(0, filesize - 40), 0)
        fd.seek(pos)
        fd.readline() # skip line
        ret.append(fd.readline().strip())
    return ret

ben

sharadgana commented 13 years ago

Hi,

Does the file containing the urls need to be present on all the loadtesting servers or one the master server ? IIUC, the master controller server ships the virtualenv to the loadtesting servers, so does the URL file also gets shipped along .

bdelbosc commented 13 years ago

Hi, Yes the content of the test directory is duplicated over each node.