我试图模仿300,000个消费者正在访问服务器的场景.所以我试图通过从并发线程反复查询服务器来创建伪客户端.
但要清除的第一个障碍是,是否有可能在PC上运行300,000个线程?这是一个代码,我用它来查看我可以获得多少个最大线程,然后用实际函数替换测试函数:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace CheckThread
{
class Program
{
static int count;
public static void TestThread(int i)
{
while (true)
{
Console.Write("\rThread Executing : {0}", i);
Thread.Sleep(500);
}
}
static void Main(string[] args)
{
count = 0;
int limit = 0;
if (args.Length != 1)
{
Console.WriteLine("Usage CheckThread <number of threads>");
return;
}
else
{
limit = Convert.ToInt32(args[0]);
}
Console.WriteLine();
while (count < limit)
{
ThreadStart newThread = new ThreadStart(delegate { …Run Code Online (Sandbox Code Playgroud) 我是c#中regex东西的新手.我阅读了我可以得到的任何东西,并尝试提出一个正则表达式来从我的日志中提取日期时间值.这就是我正在使用的:
value = Regex.Match("abc 2012?-?12?-?23 01:13:51.253",
@"\b20[0-9][0-9]?-[0-1][0-9]?-?[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9].\d+")
.Value;
Run Code Online (Sandbox Code Playgroud)
但每当我获得"价值"时.有人可以帮助我,我做错了什么?
提前致谢.