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 | * Python packages numpy, mechanize and matplotlib |
---|
37 | |
---|
38 | With recent Ubuntu installs it should be possible to install the |
---|
39 | required libs systemwide by doing:: |
---|
40 | |
---|
41 | $ sudo apt-get install python-numpy |
---|
42 | $ sudo apt-get install python-matplotlib |
---|
43 | $ sudo apt-get install python-mechanize |
---|
44 | |
---|
45 | With older Ubuntu releases (for instance ones, that do not ship with |
---|
46 | Python 2.6 or newer), you have to install Python 2.6 or 2.7 locally |
---|
47 | and then install both packages using ``easy_install`` or ``pip``. |
---|
48 | |
---|
49 | The latter is also possible in ``virtualenv`` environments, i.e. if |
---|
50 | you don't want to install the additional packages system-wide. |
---|
51 | |
---|
52 | Install of ``multi-mechanize`` then is especially, ehrm, improvable, |
---|
53 | because this package (yet) lacks support for any package management |
---|
54 | (no setup.py or similar; just plain code packed in a ZIP file for |
---|
55 | download). |
---|
56 | |
---|
57 | We therefore packed the sources of version "1.011" (?) here and added |
---|
58 | some own project which can be run. See usage instructions below. |
---|
59 | |
---|
60 | Usage |
---|
61 | ===== |
---|
62 | |
---|
63 | Quick guide: |
---|
64 | |
---|
65 | 1) Make sure configuration is up-to-date in |
---|
66 | `multi-mechanize/projects/sirp1/config.cfg`. This 'project' will |
---|
67 | run against a SIRP portal installed locally as ``app-stress`` |
---|
68 | |
---|
69 | 2) Create a local waeup.sirp portal running on localhost:8080 and |
---|
70 | named ``app-stress`` |
---|
71 | |
---|
72 | 3) Start the portal. |
---|
73 | |
---|
74 | 4) On the shell, run:: |
---|
75 | |
---|
76 | $ cd multi-mechanize |
---|
77 | $ python multi-mechanize sirp1 |
---|
78 | |
---|
79 | The latter tells multi mechanize to run the stress tests in the |
---|
80 | ``projects/sirp1`` directory. Make sure that the Python interpreter |
---|
81 | you use here is the one that has support for matplotlib and numpy. |
---|
82 | |
---|
83 | Results will be as HTML page in ``projects/sirp1/results/``. |
---|
84 | |
---|
85 | |
---|
86 | Tweaking and Playing Around |
---|
87 | =========================== |
---|
88 | |
---|
89 | The current stress tests only include simulation of a bunch of users |
---|
90 | simultaneously trying to access the portal home page and the portal |
---|
91 | applicants page (as anonymous users). |
---|
92 | |
---|
93 | You can tweak and change ``projects/sirp1/test_scripts/`` to do |
---|
94 | different things. See http://code.google.com/p/multi-mechanize/ for |
---|
95 | first steps/hints. |
---|
96 | |
---|
97 | |
---|
98 | ToDo |
---|
99 | ==== |
---|
100 | |
---|
101 | multi-mechanize currently makes no use of Python packaging, |
---|
102 | entry-points and the like. Improving it in this way and making it a |
---|
103 | first-class-citizen of the Python 'packaging' community would be a |
---|
104 | first step to make it more useful for others. |
---|
105 | |
---|
106 | Notes |
---|
107 | ===== |
---|
108 | |
---|
109 | Installing matplotlib with buildout |
---|
110 | ----------------------------------- |
---|
111 | |
---|
112 | To install `waeup.stresstest` you need matplotlib which in turn |
---|
113 | depends on `numpy`. While `numpy` can be installed during |
---|
114 | buildout-runs, `matplotlib` is a bit difficult. It does a manual check |
---|
115 | for already installed packages and does not detect already fetched |
---|
116 | numpy installs. As a result matplotlib cannot be installed easily with |
---|
117 | buildout, although there are a few workarounds: |
---|
118 | |
---|
119 | http://comments.gmane.org/gmane.comp.python.distutils.devel/13590 |
---|
120 | |
---|
121 | Installing on an old Ubuntu with virtualenv |
---|
122 | ------------------------------------------- |
---|
123 | |
---|
124 | Just for the logs, this is what I did to make it work:: |
---|
125 | |
---|
126 | $ virtualenv --no-site-packages -p <PATH-TO-PYTHON-2.6> sandbox26 |
---|
127 | $ source sandbox26/bin/activate |
---|
128 | $ pip install mechanize |
---|
129 | $ pip install numpy |
---|
130 | $ pip install matplotlib |
---|
131 | |
---|
132 | Then (on a different shell): |
---|
133 | |
---|
134 | - Started waeup.sirp:: |
---|
135 | |
---|
136 | $ ./bin/sirpctl fg |
---|
137 | |
---|
138 | |
---|
139 | - Added a University instance named 'app-stress' |
---|
140 | |
---|
141 | Back on the first shell:: |
---|
142 | |
---|
143 | $ python multi-mechanize.py sirp1 |
---|
144 | |
---|