我现在遇到了一个奇怪的问题,因为我开发了一个程序,它可以从“主”程序中多次启动Client.exe。
我的服务器具有以下规范:
每当我遇到1400-1550个客户端(运行.exe)时,我的服务器崩溃,Windows因KERNELBASE.dll错误而死机。
为了模拟这个错误,我创建了这个小测试项目:
Main-Application,启动客户端:
Public Class Form1
Private Sub cmdStart_Click(sender As Object, e As EventArgs) Handles cmdStart.Click
Dim Programm As String = Application.StartupPath + "\Test.exe"
For i As Integer = 0 To txt_StartForms.Text
Process.Start(Programm)
Threading.Thread.Sleep(100)
lbl_StartedCount.Text = (i + 1).ToString
Next
End Sub
Private Sub cmdKillProcesses_Click(sender As Object, e As EventArgs) Handles cmdKillProcesses.Click
For Each P As Process In System.Diagnostics.Process.GetProcessesByName("Test")
P.Kill()
Next
End Sub
End Class
模拟客户端.exe的客户端:
Public Class Form1
Dim WithEvents TestClass As New DoRandomStuff
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
WindowState = FormWindowState.Minimized
Timer1.Start()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim thread As New Threading.Thread(Sub() TestClass.Start())
thread.Start()
Timer1.Stop()
End Sub
Private Sub Test_Test(Counter As Integer) Handles TestClass.CounterUP
Me.Invoke(Sub() Label1.Text = Counter.ToString)
End Sub
End Class
Public Class DoRandomStuff
Public Event CounterUP(Counter As Integer)
Public Sub Start()
While True
For i As Integer = 0 To 15
RaiseEvent CounterUP(i + 1)
Threading.Thread.Sleep(500)
Next
End While
End Sub
End Class
你有什么想法,为什么会有1500这样的限制?