mirror of https://github.com/ivanch/tcc.git
Compare commits
2 Commits
fc07542237
...
81abfe0c30
Author | SHA1 | Date |
---|---|---|
José Henrique Ivanchechen | 81abfe0c30 | |
José Henrique | 32a38fe48c |
|
@ -34,11 +34,11 @@ namespace TCC.Controllers
|
||||||
[HttpGet("load-image")]
|
[HttpGet("load-image")]
|
||||||
public async Task<IActionResult> GetSimpleImage()
|
public async Task<IActionResult> GetSimpleImage()
|
||||||
{
|
{
|
||||||
//var result = ImageService.GetSimpleImage();
|
var result = ImageService.GetSimpleImage();
|
||||||
var result = System.IO.File.ReadAllBytes("simpleimage.png");
|
|
||||||
|
|
||||||
var imageStream = new byte[result.Length];
|
var imageStream = new MemoryStream();
|
||||||
result.CopyTo(imageStream, 0);
|
result.Write(imageStream);
|
||||||
|
imageStream.Position = 0;
|
||||||
|
|
||||||
return File(imageStream, "image/png");
|
return File(imageStream, "image/png");
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ def plot_graph(x, y, title, x_label, y_label, filename):
|
||||||
plt.ylabel(y_label)
|
plt.ylabel(y_label)
|
||||||
plt.savefig(f'{filename}.png')
|
plt.savefig(f'{filename}.png')
|
||||||
|
|
||||||
|
plt.clf()
|
||||||
|
|
||||||
def getData(filename):
|
def getData(filename):
|
||||||
lines = []
|
lines = []
|
||||||
with open(filename, 'r') as f:
|
with open(filename, 'r') as f:
|
||||||
|
@ -24,7 +26,8 @@ def getData(filename):
|
||||||
|
|
||||||
def generateGraph(filename, framework_name, endpoint_name):
|
def generateGraph(filename, framework_name, endpoint_name):
|
||||||
x, y = getData(filename)
|
x, y = getData(filename)
|
||||||
plot_graph(x, y, f'{framework_name} - {endpoint_name}', 'Number of requests', 'Requests per second', filename.split('.')[0])
|
new_filename = ".".join(filename.split('.')[:-1])
|
||||||
|
plot_graph(x, y, f'{framework_name} - {endpoint_name}', 'Number of requests', 'Requests per second', new_filename)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
generateGraph('data.txt', 'ASP.NET', 'test')
|
generateGraph('data.txt', 'ASP.NET', 'test')
|
||||||
|
|
|
@ -16,7 +16,8 @@ ENDPOINTS = [
|
||||||
'/image/load-image',
|
'/image/load-image',
|
||||||
]
|
]
|
||||||
|
|
||||||
num_requests = [10, 1000, 5000, 10_000, 50_000, 100_000, 500_000, 1_000_000]
|
#num_requests = [10, 1000, 5000, 10_000, 50_000, 100_000, 500_000, 1_000_000]
|
||||||
|
num_requests = range(0, 50_000, 5000)
|
||||||
|
|
||||||
def send_request(url):
|
def send_request(url):
|
||||||
success = False
|
success = False
|
||||||
|
@ -41,7 +42,7 @@ def run_tests(endpoint):
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
|
|
||||||
for num_request in range(0, 50_000, 1000):
|
for num_request in num_requests:
|
||||||
if num_request <= 0: continue
|
if num_request <= 0: continue
|
||||||
|
|
||||||
with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
|
with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
|
||||||
|
@ -65,4 +66,5 @@ def run_tests(endpoint):
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
for endpoint in ENDPOINTS:
|
for endpoint in ENDPOINTS:
|
||||||
|
print(f"# {endpoint}")
|
||||||
run_tests(endpoint)
|
run_tests(endpoint)
|
||||||
|
|
Loading…
Reference in New Issue