melhorando

This commit is contained in:
José Henrique Ivanchechen 2023-08-25 09:24:01 -03:00
parent 32a38fe48c
commit 81abfe0c30
3 changed files with 10 additions and 6 deletions

View File

@ -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");
} }

View File

@ -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:

View File

@ -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, 5000): 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)