Solved

Reduce CPU Utilization

Posted on 2011-09-13
10
616 Views
Last Modified: 2013-11-27
Dear EE Members

We developed project in Visual Studio 2010 C#.net, to download and upload the thousand files through sftp and update the log the with file name, time stamp and path details for every file in the SQL 2005 database. we are using three timers first one for upload process file, second one for download the process file and third one for download the log file, each timer will access the SQL Database when sending and receiving the file. During this all process CPU Utilization is going more then 80%. How we can reduce this CPU Utilization.

Thanks
0
Comment
Question by:mivbinfotech
10 Comments
 
LVL 22

Expert Comment

by:eeRoot
ID: 36529248
Is the app multi-threaded or able to make use of multiple CPU cores?  Is it a 32 bit or 64 bit app?  Is the app set up so you can throttle the number of files being processed simultaneously?  There are several options for debugging and tracing through code, I couldn't say which one would be the most useful to you, it depends on how you've structured the code.

http://stackoverflow.com/questions/27610/how-to-add-simple-tracing-in-c
0
 
LVL 15

Expert Comment

by:x77
ID: 36530474
There are a lot of component that can waste CPU on your process.

   - Sftp - What is your Provider ?
   - Update database only 1 time per file ?
   - Have you any method to query remote Directory ?

. Net 2.0 includes a class to transfer files over Ftp.
  It supports also listfiles on remote directory, but when you need also exact dates and sizes it is a bad option (WebRequestMethods.Ftp.GetFileSize and WebRequestMethods.Ftp.GetDateTimestamp very slow).
0
 
LVL 16

Expert Comment

by:SteveJ
ID: 36552550
If you are using a Gb NIC and putting lots of data on the wire you will drive CPU high.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 2

Accepted Solution

by:
mivbinfotech earned 0 total points
ID: 37249654
what we did is we separated the SFTP processes and others, so SFTP works only when transferring files and the other relevant processes are separate,    

we have managed to cut CPU time by almost half
0
 
LVL 21

Expert Comment

by:mastoo
ID: 37250354
Follow eeRoot's link or buy a code profiler to get a breakout of where your code spends the most time, rather than even educated guesses.  And I'll add to the guesses that it could be context switching if you have too many threads, or if sql is local it could be the sql.
0
 
LVL 2

Author Closing Comment

by:mivbinfotech
ID: 37290363
solved
0
 
LVL 2

Author Comment

by:mivbinfotech
ID: 37268676
solved
0
 
LVL 16

Expert Comment

by:SteveJ
ID: 37269850
If someone helped, give them points.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Printing 1 51
ASP.NET(C#) Eliminating weekends from a date range 2 36
SQL Query Help Top 1 and Distinct? 6 26
MailAddress in vb 4 16
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question