My application runs slower after consecutive http calls

Multi tool use
My application runs slower after consecutive http calls
I am running .Net Core 2.1 and NPGSQL 4.0 on a mac. I am doing performance tuning and trying to run 100 http requests and measure performance using Jmeter . As you can see below the 1st request takes 550 milli-seconds, 25th request takes 3.9 seconds and the last final 100th request takes 12.7 seconds . Is there something that I can do to improve the performance of my application ? I ran these tests in release mode and the database is returning every request within 40 milli-seconds. The requests are suppose to be executed all-together but by the times you can see that every request takes longer than the previous one .
public class HomeController : Controller
{
public static string ConnectionString = "Host=localhost;Username=postgres;Password=password;" +
"Database=dbname;port=port;CommandTimeout=50000;TIMEOUT=1024;POOLING=True;MINPOOLSIZE=1;MAXPOOLSIZE=100";
public async Task<String> Test()
{
string result = string.Empty;
using (var conn = new NpgsqlConnection(ConnectionString))
{
await conn.OpenAsync();
// Retrieve all rows
using (var cmd = new NpgsqlCommand("select json_build_object('Locations', array_to_json(array_agg(t))) from (SELECT latitudes,county,longitudes," +
"statelong, thirtylatmin,thirtylatmax,thirtylonmin,thirtylonmax,city" +
" FROM zips where city='Miami' ORDER BY city limit 5) t", conn))
{
using (var reader = await cmd.ExecuteReaderAsync())
{
while (await reader.ReadAsync())
{
result = reader.GetString(0);
}
}
}
return result;
}
}
}
in addition to the above comment, when youre putting that much load the the HTTPRequest and it hitting the server, your application pool if youre not load balancing or have limited CPU RAM on a single machine youre going to just queue up request to the application poon and results will take a long time
– Simon Price
Jun 30 at 20:08
monitis.com/blog/important-iis7-counters - look at the listed
ASP.NET*
counters during these trials, primarily Requests Queued
and Request Wait Time
.– user2864740
Jun 30 at 20:13
ASP.NET*
Requests Queued
Request Wait Time
@user2864740 ASP.NET Core is not running on a managed IIS application pool, so I would be very surprised if any of those IIS performance counters worked.
– poke
Jun 30 at 21:34
@poke sigh Surely there are equivalents on whichever server implementation is being used? Being able to monitor performance at all levels is a requirement for production-ready applications :}
– user2864740
Jul 1 at 3:32
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
what I see is the first request is taking 0.5 seconds and then the delta between each request is 0.1 seconds. I looks like you requests are running serial instead of parallel.
– jdweng
Jun 30 at 19:59