Solved

File IO Speed on different locations on the same Hard Disk

Posted on 2007-11-18
11
421 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

OfficeMate Freezes on login or does not load after login credentials are input.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

680 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