Solved

File IO Speed on different locations on the same Hard Disk

Posted on 2007-11-18
11
418 Views
Last Modified: 2013-12-04
I am using C# (VS2005) on an XP machine. I noticed a rather baffling thing, I am storing a lot of data on my application close event. I use the Current User -> Local Settings path to store the data (typically C:\Documents and Settings\Arif\Local Settings\Application Data). It takes around 50 Seconds to store the entire data. By chance I happened to change the storage path to Bin folder of my Application, now it took only 10 seconds to store the same data. Could not understand why, has anyone noticed this before? Is there any logical reason why this would happen.
Could it be that it requires the piece of code to security validations before accessing the Local Settings folder while Bin is immediately accessibl.  How can I improve the performance here in case I want to store it in the Local Settings folder only?

Thanks
0
Comment
Question by:arif_eqbal
  • 6
  • 3
  • 2
11 Comments
 
LVL 25

Expert Comment

by:imitchie
ID: 20310469
it is possible that your disk writes have just moved to an area on your disk that is on the far outer ring. defragging your hd regularly should make the times more consistent no matter where you place it. the NTFS system is agnostic to where you put it, a file in C:\Documents and Settings.... could be right next to one in C:\Program Files.... or some fragments may be together and others as far away as you can imagine.  if anything, local settings would be far more relaxed in security than program files
0
 
LVL 25

Expert Comment

by:imitchie
ID: 20310511
i guess the unasked question was, if you now switch it back to Local Settings, does it go back to 50s? if not, then it's got nothing to do with location
0
 
LVL 19

Author Comment

by:arif_eqbal
ID: 20310687
Well imitchie,
it does take 50s again if I switch back to the old location, this is pretty consistent, Bin takes less time and Local Storage more.
Also, to confirm your earlier comment I tried the same on a different machine (AMD 64 Bit, with XP) and again the same mismatch.
Just wanted to mention here I am using the IsolatedStorage, however, I feel the basic question remains unchaged, because all isolatedStorage does is give me a stream with a file on the path of Local Settings, and I have tested it that getting the stream does not take any time at all, its after that while writing that it takes 50 seconds. I feel there's a scope of improvement here since, if instead of opening the file in the IsolatedStorage location I open it on Bin folder I get 5 times better performance.
0
 
LVL 25

Expert Comment

by:imitchie
ID: 20310712
are you able to do other timings, time taken from start of streaming to end of streaming - raw disk access after all security checks? i've never heard of it taking 40s to check access. given these are both your machines, would you have configured them exactly the same way? is the setup 1 disk per machine, or do you have raid 0/1?
0
 
LVL 25

Expert Comment

by:imitchie
ID: 20310718
another thing to check is, have you configured the path to the app\bin folder as an exception in antivirus software?
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 25

Expert Comment

by:imitchie
ID: 20310722
are you on a domain with roaming set up? it could be mirroring the profile to make it inheritable from other machines.
0
 
LVL 25

Expert Comment

by:imitchie
ID: 20310725
try scrolling to the 3rd and 2nd last comments on this page:
http://episteme.arstechnica.com/eve/forums/a/tpc/f/99609816/m/801002212831
30 second wait sound similar to your 40s lag
0
 
LVL 8

Accepted Solution

by:
doraiswamy earned 500 total points
ID: 20310731
a) Try some folders other than bin or Documents and Settings and see what impact there is on performance.

b) Copy your project exe file to the docs and settings folder and see if running it from there makes a difference.

c) It may be possible that if both your exe and data files are in the same physical area of disk, there may be fewer seeks for the drive to make - this is true if your application is large enough that all of it is not loaded into memory at the same time, and page faults are generated.
0
 
LVL 19

Author Comment

by:arif_eqbal
ID: 20310866
doraiswamy - I have tried different machines now, and different locations on the same machine/disk. In fact I checked the exact location used by IsolatedStorage and hardcoded that path its 5 times faster if I use any path compared to IsolatedStorage.

imitchie - went through the IsolatedStorage concepts on MSDN in some detail it might be slightly slower but not as drastically as I am experiencing. No I am not on a roaming set up, and I have tested it on 3 normal single disk machines so far. Don't intend to test on a Raid because that's not going to be the case at client anyway.
Just went through the link you sent, would read it minutely again, though different problem but yes it might be due to the same reason.
I can just dump this idea of IsloatedStorage altogether but not before giving it a good try. Could not digest the fact that it can degrade performance to this extent by using such a simple thing. IsolatedStorage does not do anything more than give me access to a secured and rather unknown location on the disk, must be something somewhere which would be pulling it down.

Thanks
0
 
LVL 19

Author Comment

by:arif_eqbal
ID: 20372670
Didn't get a very convincing reason for the time lag on the Net, in fact there are only very basic information about the isolated Storage on the Net. Looks like a less explored feature.
Also, I ran into some issues when I strong Named my application, some version colnflicts. It seems the List<T> does not go very well with the isolated storage when the version (just minor version) has changed for your app.
Putting it here just for information.
Thanks
0
 
LVL 8

Expert Comment

by:doraiswamy
ID: 20372866
Arif, thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Users of Windows 10 Professional can disable automatic reboots using the policy editor. This tool is not included in the Windows home edition. But don't worry! Follow the instructions below to install (a Win7) policy editor on your Windows 10 Home e…
Security measures require Windows be logged in using Standard User login (not Administrator).  Yet, sometimes an application has to be run “As Administrator” from a Standard User login.  This paper describes how to create a shortcut icon to launch a…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now