My Application spend too many time on Wait
method
Environment:
I've checked performance by dottrace
Wait
is marked by SecuritySafeCriticalAttribute
Please note on Win7 (x64) all works fine. I found nothing, any suggestions are welcome.
Task Processing
private readonly BlockingCollection<TTask> _queue = new BlockingCollection<TTask>();
private Thread _workThread;
public void ProcessTask(TTask task)
{
_queue.Add(task);
}
private void ProcessTask()
{
while (_isRun)
{
try
{
TTask task = _queue.Take();
if (task.IsNull())
{
continue;
}
_log.DebugFormat("Sending task: {0}", task);
DoProcessMessage(task);
}
catch (Exception ex)
{
_log.Error(ex);
}
}
}
Solved
Looks like dottrace show the weather. I've checked performance by ANTS Performance Profiler and fixed the issue. Problem was in sql request thru NHibernate