Reputation: 1669
I developed a Windows service which does the backups of my Files and Folders on scheduled bases. it performs the following Tasks:
1 - Reads the List of Folders and Files
2 - Zip Them up and place them on a temp directory (Breaks big files into 50MB chunks)
3 - Uploads the content of temp folder to FTP
4 - Deletes the temp folder
now the size of temp folder could be around 3GB, and service runs like twice daily. Now my server restarts at random times (not during service is creating or uploading data), i am starting to think this could be I/O issue which causes my server to restart.
What is the best way to optimize my server in .NET? I can set the PriorityClass to BelowNormal but I dont think it will help. My onStart Looks Like this....
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
(Should I start Service in a new Thread ???)
Are there any other suggestions which I can try to optimize my server to be less CPU intensive?
Here is the reboot Log:
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.
Upvotes: 0
Views: 429
Reputation: 150108
It is very unlikely that the crash is caused by your application code. The statement in the event log
This appears to be a typical software driver bug
is probably spot on.
Since your application is doing a fair amount of IO, it could trigger a problem in an IO subsystem driver. Do you have an IO system that uses drivers not delivered as part of your Windows installation, or did you update the IO drivers from a manufacturer? If so, try running an older version of the drivers.
Should I start Service in a new Thread?
Your OnStart event handler should promptly return control to the system. Do your processing on a separate thread.
I can set the PriorityClass to BelowNormal but I dont think it will help
BelowNormal is probably a reasonable setting for a background task like this (depending on what else the server does), but you're right, it should not impact the server restart at all.
Are there any other suggestions which I can try to optimize my server to be less CPU intensive?
Why are you concerned about CPU utilization? Is it from the ZIP operation? If so, you might consider using 7Zip. It is free, can be either called from the command line or linked from a .NET program, and gives you the ability to set the desired compression level (higher compression = more CPU and memory use), and allows you to control the number of threads used for compression. It is compatible with ZIP if that is required, and also offers a superior, proprietary .7z compression format.
Upvotes: 3