1616These comments are also used as content when moin items are created; the result is
1717a small load is placed upon the Whoosh indexer.
1818
19- The primary goal of this test is to create a server overload. A server overload will likely take the
19+ The primary goal of this test is to create a server overload. A server overload will likely take the
2020form of a LockError in the Whoosh AsyncWriter (/whoosh/writing.py). Each thread attempting
2121to update the Whoosh index tries to obtain the write lock for a short period of time (~5
2222seconds). If the lock is not obtained, a LockError exception is raised and the console log
2323will show a traceback with the message "server overload or corrupt index". The item was
24- saved but cannot be accessed because it is not in the index - to correct the error,
25- stop the server, rebuild the indexes, restart the server.
24+ saved but cannot be accessed because it is not in the index — to correct the error,
25+ stop the server, rebuild the indexes, and restart the server.
2626
2727The maximum load that the wiki server can process is established by trial and error.
28- With the default wait_time of 2- 3 seconds running 3 symultaneous users will create a load of about
28+ With the default wait_time of 2– 3 seconds, running 3 simultaneous users will create a load of about
2929one transaction per second. Running 30 users could create a load of about 10
3030transactions per second - but this may be reduced because the wiki server will have slow responses.
3131
3939and create wiki items as part of the test. It is best to start with
4040an empty wiki (./m new-wiki).
4141
42- Each locust user registers a new id , creates and updates a home page in the user namespace,
43- creates and updates a <username> item in the default namespace, and logs- out.
42+ Each Locust user registers a new ID , creates and updates a home page in the user namespace,
43+ creates and updates a <username> item in the default namespace, and logs out.
4444
45- Because each locust user is working on unique items, it does not test edit locking. Use locustfile2.py
46- to stress test edit locking.
45+ Because each Locust user is working on unique items, it does not test edit locking. Use locustfile2.py
46+ to stress- test edit locking.
4747
48- To load test Moin2 :
48+ To load- test Moin 2 :
4949 * read about Locust at https://docs.locust.io/en/stable/index.html - last tested with Locust 2.9.0
5050 * install Locust per the docs in its own venv
5151 * open a terminal window and start the Moin built-in server (./m run)
6262 * customize and repeat:
6363 * ./m del-wiki
6464 * ./m new-wiki
65- * restart Moin2 buit -in server
65+ * restart the Moin 2 built -in server
6666 * restart Locust server
6767 * refresh browser window
6868"""
6969
7070
71- # used to create unique user IDs
71+ # Used to create unique user IDs
7272user_number = 0
73- # min and max wait time in seconds between user transactions, ignored, there is only 1 task
73+ # Min and max wait time in seconds between user transactions; ignored, there is only 1 task
7474wait_time = between (2 , 3 )
75- # sleep time between GET, POST requests in seconds
75+ # Sleep time between GET and POST requests, in seconds
7676sleep_time = 0
7777
7878
7979class LoadTest (HttpUser ):
8080 """
8181 First, create a Home page in the default and user namespaces.
8282
83- Next create a workflow for each locust user that will
84- register a new user, login , create a user home page,
85- modify user home page several times,
86- create a new item, modify new item several times, and logout .
83+ Next, create a workflow for each Locust user that will
84+ register a new user, log in , create a user home page,
85+ modify the user home page several times,
86+ create a new item, modify the new item several times, and log out .
8787 """
8888
8989 @events .test_start .add_listener
@@ -207,7 +207,7 @@ def click_post_login(self):
207207 print ("%s: response.status_code = %s" % (sys ._getframe ().f_lineno , response .status_code ))
208208
209209 def create_home_page (self ):
210- # click link to users home page (home page has not been created: 404 expected)
210+ # Click link to the user's home page (home page has not been created: 404 expected)
211211 with self .client .get (self .user_home_page , catch_response = True ) as response :
212212 if response .status_code == 404 :
213213 response .success ()
@@ -249,7 +249,7 @@ def create_home_page(self):
249249 print ("%s: response.status_code = %s" % (sys ._getframe ().f_lineno , response .status_code ))
250250
251251 def modify_home_page (self , idx ):
252- # get users home page
252+ # Get the user's home page
253253 with self .client .get (self .user_home_page , catch_response = True ) as response :
254254 if response .status_code != 200 :
255255 print ("%s: response.status_code = %s" % (sys ._getframe ().f_lineno , response .status_code ))
@@ -267,7 +267,7 @@ def modify_home_page(self, idx):
267267 home_page ,
268268 {
269269 "content_form_data_text" : test_content % (self .user_name , self .get_time () + " idx=%s" % idx ),
270- "comment" : "my homepage comment" ,
270+ "comment" : "my home page comment" ,
271271 "submit" : "OK" ,
272272 "meta_form_contenttype" : "text/x.moin.wiki;charset=utf-8" ,
273273 "meta_form_itemtype" : "default" ,
0 commit comments