forked from jean553/massive-insert-postgresql-tornado
-
Notifications
You must be signed in to change notification settings - Fork 0
/
locustfile.py
46 lines (33 loc) · 914 Bytes
/
locustfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import json
from locust import HttpLocust
from locust import TaskSet
from locust import task
class UserBehavior(TaskSet):
@task(10)
def post_copy(self):
items = [{"message": "hello world"}]
data = {"messages": items * 100}
self.client.post(
"/copy",
json.dumps(data),
)
@task(0)
def post_insert_transaction(self):
items = [{"message": "hello world"}]
data = {"messages": items * 100}
self.client.post(
"/insert-transaction",
json.dumps(data),
)
@task(0)
def post_multiple_inserts(self):
items = [{"message": "hello world"}]
data = {"messages": items * 100}
self.client.post(
"/multiple-inserts",
json.dumps(data),
)
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait = 5
max_wait = 5