tcc/scripts/common.py

50 lines
1.7 KiB
Python

import person_pb2
person_proto = person_pb2.Person()
person_proto.name = "John Doe"
person_proto.age = 30
person_proto.friends.extend(["Jane Doe", "John Smith"])
person_proto.email = "john.doe@email.com"
person_proto.phone = "123-456-7890"
person_proto = person_proto.SerializeToString()
person_json = {
"name": "John Doe",
"age": 30,
"friends": ["Jane Doe", "John Smith"],
"email": "john.doe@email.com",
"phone": "123-456-7890"
}
person_json = str(person_json).encode('utf-8')
FRAMEWORKS = [
('Actix', 'tcc-actix', 'orange'),
('ASP.NET', 'tcc-aspnet', 'blue'),
('Flask', 'tcc-flask', 'grey'),
# ('Express', 'tcc-express', 'red'),
# ('Spring', 'tcc-spring', 'green'),
]
ENDPOINTS = {
'Actix': 'http://localhost:9083',
'ASP.NET': 'http://localhost:9081',
'Flask': 'http://localhost:9082',
'Express': 'http://localhost:9084',
'Spring': 'http://localhost:9085',
}
AVG_RUNS = 5
API_REQUESTS = [
# ('/status/ok', 'GET', range(0, 30_000, 5000), None),
# ('/simulation/harmonic-progression?n=100000', 'GET', range(0, 30_000, 5000), None),
('/simulation/json', 'POST', range(0, 30_000, 5000), (person_json, "application/json")),
# ('/image/save-big-image', 'POST', range(0, 500, 50), (open('big-image.png', 'rb').read(), "image/png")),
# ('/image/load-small-image', 'GET', range(0, 30_000, 5000), None),
# ('/static/small-image.png', 'GET', range(0, 30_000, 5000), None),
# ('/image/load-big-image', 'GET', range(0, 500, 50), None),
# ('/static/big-image.png', 'GET', range(0, 500, 50), None),
# ('/static/nginx.html', 'GET', range(0, 30_000, 5000), None),
('/simulation/protobuf', 'POST', range(0, 30_000, 5000), (person_proto.SerializeToString(), "application/protobuf")),
]