Webapi (.NET Core) has no performance gain when I use async

1

I'm implementing an api asynchronously, but I have not seen much gain in performance. I used RESTful Stress for Chrome to do my tests, I just did not see performance gain when I use async. I thought this would increase the number of concurrent requests.

Configuration used Resultusingasync Resultwithoutusingasync Codeusingasync

publicasyncTask<ObjectResult>Get(){try{//usandoToListAsync()aperformancefoipior,porissouseiTask//varresult=await_dbSet.AsNoTracking().ToListAsync();varresult=awaitTask.FromResult(_dbSet.AsNoTracking().ToList());returnOk(result);}catch(Exceptionex){returnthis.BadRequest("ERROR: " + ex.Message);
    }
}

Code without using async

public ObjectResult Get()
{
    try
    {
        var result = _dbSet.AsNoTracking().ToList();

        return Ok(result);
    }
    catch (Exception ex)
    {
        return this.BadRequest("ERROR: " + ex.Message);
    }
}
    
asked by anonymous 10.02.2017 / 21:36

0 answers