summaryrefslogtreecommitdiff
path: root/scripts/scalability
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/scalability')
-rw-r--r--scripts/scalability/.gitignore4
-rw-r--r--scripts/scalability/makefile40
-rw-r--r--scripts/scalability/test_controller/client/Blobs.conf2
-rw-r--r--scripts/scalability/test_controller/client/makefile11
-rw-r--r--scripts/scalability/test_controller/client/test_Blobs.py18
-rw-r--r--scripts/scalability/test_controller/server/blobs.py19
6 files changed, 41 insertions, 53 deletions
diff --git a/scripts/scalability/.gitignore b/scripts/scalability/.gitignore
new file mode 100644
index 00000000..a15032a5
--- /dev/null
+++ b/scripts/scalability/.gitignore
@@ -0,0 +1,4 @@
+test_controller/client/results/*
+test_controller/client/logs/*
+test_controller/client/test_download*
+test_controller/client/test_upload*
diff --git a/scripts/scalability/makefile b/scripts/scalability/makefile
index 0067c650..05ce1461 100644
--- a/scripts/scalability/makefile
+++ b/scripts/scalability/makefile
@@ -1,40 +1,20 @@
-# Test Controller for Server Scalability Tests
-# ============================================
+# Test Controller Makefile
+# ========================
#
# This makefile knows how to install server and client components of the Test
# Controller, as well as to trigger a run of the benchmarks.
#
-# Test Controller server
-# ----------------------
-#
-# In the server, run the following to have an instance of the Test Controller
-# server running:
-#
-# make install-server
-# make start-server
-#
-# And, if you want to see the logs, use:
-#
-# make log
-#
-# Alternativelly, use `make start-server-nodaemon` to avoid detaching from the
-# terminal.
-#
-# Test Controller client
-# ----------------------
-#
-# Make sure an instance of the Test Controller Server is reachable at $(URI),
-# and run:
-#
-# make install-client
-# make run-test
+# See the file README.rst for more information on how to use this makefile.
+
+
+URI ?= https://giraffe.cdev.bitmask.net:7001
+PIDFILE = /tmp/test_controller.pid
+LOGFILE = /tmp/test_controller.log
+TACFILE = ./test_controller/server/server.tac
-URI = https://giraffe.cdev.bitmask.net:7001
-PIDFILE = /tmp/test_controller.pid
-LOGFILE = /tmp/test_controller.log
-TACFILE = ./test_controller/server/server.tac
+all: test
#----------------#
diff --git a/scripts/scalability/test_controller/client/Blobs.conf b/scripts/scalability/test_controller/client/Blobs.conf
index d5a2761f..eea4b1cd 100644
--- a/scripts/scalability/test_controller/client/Blobs.conf
+++ b/scripts/scalability/test_controller/client/Blobs.conf
@@ -2,7 +2,7 @@
title=Blobs Scalability Tests
description=Upload and download blobs
url=http://giraffe.cdev.bitmask.net:2424/
-size=10
+size=1
templates_dir=/tmp/templates
[test_upload]
diff --git a/scripts/scalability/test_controller/client/makefile b/scripts/scalability/test_controller/client/makefile
index e0a719a0..97603cc4 100644
--- a/scripts/scalability/test_controller/client/makefile
+++ b/scripts/scalability/test_controller/client/makefile
@@ -25,8 +25,9 @@
# run `make`.
-URI = https://giraffe.cdev.bitmask.net:7001
-CREATE = 5000
+URI ?= https://giraffe.cdev.bitmask.net:7001
+BLOBS ?= 10000
+SIZE ?= 10
#------------------#
@@ -51,12 +52,10 @@ bench-download: create-users create-blobs
# for quick tests only
bench-upload-quick: create-users delete-blobs
- curl -X POST "$(URI)/blobs?action=delete"
fl-run-bench -c 1 --duration 10 -f test_Blobs.py Blobs.test_upload
# for quick tests only
bench-download-quick: create-users create-blobs
- curl -X POST "$(URI)/blobs?action=create&size=10"
fl-run-bench -c 1 --duration 10 -f test_Blobs.py Blobs.test_download
#---------------------#
@@ -81,10 +80,10 @@ stop-mem:
#--------------#
create-users:
- curl -X POST $(URI)/users?create=$(CREATE)
+ curl -X POST $(URI)/users?create=1
delete-blobs:
curl -X POST "$(URI)/blobs?action=delete"
create-blobs:
- curl -X POST "$(URI)/blobs?action=create&size=10&amount=5000"
+ curl -X POST "$(URI)/blobs?action=create&size=$(SIZE)&amount=$(BLOBS)"
diff --git a/scripts/scalability/test_controller/client/test_Blobs.py b/scripts/scalability/test_controller/client/test_Blobs.py
index 5f31dbc8..1bcfc74e 100644
--- a/scripts/scalability/test_controller/client/test_Blobs.py
+++ b/scripts/scalability/test_controller/client/test_Blobs.py
@@ -37,21 +37,21 @@ def _ensure_template(templates_dir, size):
class Blobs(FunkLoadTestCase):
- next_user_id = 0
+ next_blob_id = 0
lock = threading.Lock()
- def _get_next_user_id(self):
+ def _get_next_blob_id(self):
with Blobs.lock:
- user_id = Blobs.next_user_id
- Blobs.next_user_id += 1
- Blobs.next_user_id %= 5000
- return user_id
+ blob_id = Blobs.next_blob_id
+ Blobs.next_blob_id += 1
+ Blobs.next_blob_id %= 5000
+ return blob_id
def setUp(self):
- user_id = self._get_next_user_id()
+ blob_id = self._get_next_blob_id()
base_url = self.conf_get('main', 'url')
- self.url = urlparse.urljoin(base_url, 'blobs/%s/0' % user_id)
- self.setHeader('Authorization', _get_auth_header(user_id))
+ self.url = urlparse.urljoin(base_url, 'blobs/0/%d' % blob_id)
+ self.setHeader('Authorization', _get_auth_header('0'))
templates_dir = self.conf_get('main', 'templates_dir')
size = self.conf_getInt('main', 'size')
fpath = _ensure_template(templates_dir, size)
diff --git a/scripts/scalability/test_controller/server/blobs.py b/scripts/scalability/test_controller/server/blobs.py
index 2a60018d..2e68a12e 100644
--- a/scripts/scalability/test_controller/server/blobs.py
+++ b/scripts/scalability/test_controller/server/blobs.py
@@ -2,24 +2,28 @@
import shutil
import os
-
from argparse import ArgumentParser
-
+from twisted.logger import Logger
from test_controller.utils import mkdir_p, payload
+logger = Logger()
+
def _create_blob(path, data):
- if not os.path.isfile(path):
- with open(path, 'w') as f:
- f.write(data)
+ with open(path, 'w') as f:
+ logger.info('Creating %s' % path)
+ f.write(data)
def create_blobs(target_dir, amount, size):
+ delete_blobs(target_dir)
data = payload(size * 1000)
for i in xrange(amount):
- basedir = os.path.join(target_dir, '%d/default/0/0/0' % i)
+ istr = str(i)
+ blob_dir = '%s/%s/%s' % (istr[0], istr[0:3], istr[0:6])
+ basedir = os.path.join(target_dir, '0/default/%s' % blob_dir)
mkdir_p(basedir)
- _create_blob(os.path.join(basedir, '0'), data)
+ _create_blob(os.path.join(basedir, str(i)), data)
def delete_blobs(target_dir):
@@ -28,6 +32,7 @@ def delete_blobs(target_dir):
for f in os.listdir(target_dir):
if f.isdigit():
directory = os.path.join(target_dir, f)
+ logger.info('Deleting %s' % directory)
shutil.rmtree(directory)