最大并发HttpWebRequests数
我正在对一个Web应用程序进行压力测试,并设置了一个Windows测试程序,该程序可以旋转多个线程并在每个线程上发出Web请求。
问题是我得到以下输出:
01/09/09 11:34:04 Starting new HTTP request on 10
01/09/09 11:34:04 Starting new HTTP request on 11
01/09/09 11:34:04 Starting new HTTP request on 13
01/09/09 11:34:05 Starting new HTTP request on 14
01/09/09 11:34:05 Starting new HTTP request on 11
01/09/09 11:34:05 11 has finished!
01/09/09 11:34:05 Starting new HTTP request on 13
01/09/09 11:34:05 13 has finished!
01/09/09 11:34:05 Starting new HTTP request on 14
01/09/09 11:34:05 14 has finished!
01/09/09 11:34:05 Starting new HTTP request on 11
01/09/09 11:34:05 11 has finished!
01/09/09 11:34:05 Starting new HTTP request on 14
01/09/09 11:34:05 14 has finished!
01/09/09 11:34:05 Starting new HTTP request on 13
01/09/09 11:34:05 13 has finished!
01/09/09 11:34:05 Starting new HTTP request on 15
01/09/09 11:34:06 Starting new HTTP request on 11
01/09/09 11:34:06 11 has finished!
01/09/09 11:34:06 Starting new HTTP request on 14
01/09/09 11:34:06 14 has finished!
哪种看起来最多有5个线程,即使我这样创建100个:
int numberOfThreads = Convert.ToInt32(txtConcurrentThreads.Text);
List<BackgroundWorker> workers = new List<BackgroundWorker>();
for (int N = 0; N < numberOfThreads; N++)
{
BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += new DoWorkEventHandler(worker_DoWork);
worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
workers.Add(worker);
}
foreach(BackgroundWorker worker in workers)
{
worker.RunWorkerAsync();
}
任何人都可以告诉我发生了什么事吗?
温温酱
拉莫斯之舞