1 | waeup.stresstest |
---|
2 | **************** |
---|
3 | |
---|
4 | This package provides stresstests for *existing* WAeUP SIRP sites. |
---|
5 | |
---|
6 | It deploys the Python multi-mechanize programme/library to fire tons |
---|
7 | of requests against a running site. So, you don't want to use it with |
---|
8 | sites that are under load already. The requests try to simulate users |
---|
9 | using the portal simultanously. |
---|
10 | |
---|
11 | multi-mechanize registers the numbers and latencies of single requests |
---|
12 | and generates graphics/tables with the results. This way you can see |
---|
13 | what actions/requests need how much time. You can also see how the |
---|
14 | server reacts when many concurrent users use the portal. |
---|
15 | |
---|
16 | `waeup.stresstest` is code-wise independent from `waeup.sirp`. You can |
---|
17 | run it on any machine that can do HTTP requests to the target machine |
---|
18 | (which means the machine that should be stress-tested). |
---|
19 | |
---|
20 | Installation is a bit difficult (numpy and matplotlib, two complex |
---|
21 | Python libs for statistical computations) are required and not easily |
---|
22 | installable in the usual buildout-way (well, numpy is but matplotlib |
---|
23 | is a constant source of trouble in that respect). Please refer to the |
---|
24 | ``Installation`` section below. |
---|
25 | |
---|
26 | Installation |
---|
27 | ============ |
---|
28 | |
---|
29 | The following steps are tested on Ubuntu Linux only. |
---|
30 | |
---|
31 | Requirements |
---|
32 | ------------ |
---|
33 | |
---|
34 | * Python 2.6 or Python 2.7. |
---|
35 | |
---|
36 | On the shell (after, optionally, enabling a virtual environment) run:: |
---|
37 | |
---|
38 | $ python bootstrap/bootstrap.py |
---|
39 | $ ./bin/buildout |
---|
40 | |
---|
41 | Usage (outdated) |
---|
42 | ================ |
---|
43 | |
---|
44 | Quick guide: |
---|
45 | |
---|
46 | 1) Make sure configuration is up-to-date in |
---|
47 | `multi-mechanize/projects/sirp1/config.cfg`. This 'project' will |
---|
48 | run against a SIRP portal installed locally as ``app-stress`` |
---|
49 | |
---|
50 | 2) Create a local waeup.sirp portal running on localhost:8080 and |
---|
51 | named ``app-stress`` |
---|
52 | |
---|
53 | 3) Start the portal. |
---|
54 | |
---|
55 | 4) On the shell, run:: |
---|
56 | |
---|
57 | $ cd multi-mechanize |
---|
58 | $ python multi-mechanize sirp1 |
---|
59 | |
---|
60 | The latter tells multi mechanize to run the stress tests in the |
---|
61 | ``projects/sirp1`` directory. Make sure that the Python interpreter |
---|
62 | you use here is the one that has support for matplotlib and numpy. |
---|
63 | |
---|
64 | Results will be as HTML page in ``projects/sirp1/results/``. |
---|
65 | |
---|
66 | |
---|
67 | Tweaking and Playing Around |
---|
68 | =========================== |
---|
69 | |
---|
70 | The current stress tests only include simulation of a bunch of users |
---|
71 | simultaneously trying to access the portal home page and the portal |
---|
72 | applicants page (as anonymous users). |
---|
73 | |
---|
74 | You can tweak and change ``projects/sirp1/test_scripts/`` to do |
---|
75 | different things. See http://code.google.com/p/multi-mechanize/ for |
---|
76 | first steps/hints. |
---|
77 | |
---|
78 | |
---|
79 | ToDo |
---|
80 | ==== |
---|
81 | |
---|
82 | multi-mechanize currently makes no use of Python packaging, |
---|
83 | entry-points and the like. Improving it in this way and making it a |
---|
84 | first-class-citizen of the Python 'packaging' community would be a |
---|
85 | first step to make it more useful for others. |
---|
86 | |
---|
87 | Notes |
---|
88 | ===== |
---|
89 | |
---|
90 | Installing matplotlib with buildout |
---|
91 | ----------------------------------- |
---|
92 | |
---|
93 | To install `waeup.stresstest` you need matplotlib which in turn |
---|
94 | depends on `numpy`. While `numpy` can be installed during |
---|
95 | buildout-runs, `matplotlib` is a bit difficult. It does a manual check |
---|
96 | for already installed packages and does not detect already fetched |
---|
97 | numpy installs. As a result matplotlib cannot be installed easily with |
---|
98 | buildout, although there are a few workarounds: |
---|
99 | |
---|
100 | http://comments.gmane.org/gmane.comp.python.distutils.devel/13590 |
---|
101 | |
---|
102 | Installing on an old Ubuntu with virtualenv |
---|
103 | ------------------------------------------- |
---|
104 | |
---|
105 | Just for the logs, this is what I did to make it work:: |
---|
106 | |
---|
107 | $ virtualenv --no-site-packages -p <PATH-TO-PYTHON-2.6> sandbox26 |
---|
108 | $ source sandbox26/bin/activate |
---|
109 | $ pip install mechanize |
---|
110 | $ pip install numpy |
---|
111 | $ pip install matplotlib |
---|
112 | |
---|
113 | Then (on a different shell): |
---|
114 | |
---|
115 | - Started waeup.sirp:: |
---|
116 | |
---|
117 | $ ./bin/sirpctl fg |
---|
118 | |
---|
119 | |
---|
120 | - Added a University instance named 'app-stress' |
---|
121 | |
---|
122 | Back on the first shell:: |
---|
123 | |
---|
124 | $ python multi-mechanize.py sirp1 |
---|
125 | |
---|