I have a windows service that do some business work. I profile it with dotTrace to find performance issue and have a picture like this: GC Wait 88%
It seems strange that GC Wait take 88% time, so I get closed look at some small interval and get: Thread stats
I found that during not bloking period, threads allocate object through JSON.Net deserilization and also this code blocked by GC:
using (var response = await _httpClient.SendAsync(request, combinedTokenSource.Token))
{
response.EnsureSuccessStatusCode();
if (response.Content == null)
throw new InvalidOperationException("No HTTP response received.");
using (var responseStream = await response.Content.ReadAsStreamAsync())
{
using (var textReader = new JsonTextReader(new StreamReader(responseStream)))
{
var results = new JsonSerializer().Deserialize<ElasticResponse>(textReader);
return results;
}
}
}
Did anyone have a similar problem? Or am I missing something?