我开发了一个 Windows 服务,它可以按计划备份我的文件和文件夹。它执行以下任务:
1 - 读取文件夹和文件列表
2 - 压缩它们并将它们放在临时目录中(将大文件分成 50MB 块)
3 - 将临时文件夹的内容上传到 FTP
4 - 删除临时文件夹
现在临时文件夹的大小可能在 3GB 左右,服务每天运行两次。现在我的服务器随机重启(不是在服务创建或上传数据期间),我开始认为这可能是导致我的服务器重启的 I/O 问题。
在 .NET 中优化我的服务器的最佳方法是什么?我可以将 PriorityClass 设置为BelowNormal,但我认为这不会有帮助。我的 onStart 看起来像这样....
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
Try
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal
Dim s As New BackupLibraryV2.main
Catch ex As Exception
BackupLibraryV2.util.LogEntry("", ex.Message, DateTime.Now, DateTime.Now)
End Try
End Sub
(我应该在新线程中启动服务吗???)
还有其他建议可以尝试优化我的服务器以减少 CPU 密集度吗?
这是重启日志:
crash dump file: C:\Windows\Minidump\120212-14227-01.dmp
This was probably caused by the following module: ntoskrnl.exe (nt+0x7EFC0)
Bugcheck code: 0x3B (0xC0000005, 0xFFFFF800019A7382, 0xFFFFF88008DFA9E0, 0x0)
Error: SYSTEM_SERVICE_EXCEPTION
file path: C:\Windows\system32\ntoskrnl.exe
product: Microsoft® Windows® Operating System
company: Microsoft Corporation
description: NT Kernel & System
Bug check description: This indicates that an exception happened while executing a routine that transitions from non-privileged code to privileged code.
This appears to be a typical software driver bug and is not likely to be caused by a hardware problem.
The crash took place in the Windows kernel. Possibly this problem is caused by another driver that cannot be identified at this time.