473,320 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Choosing location for large temp files?

MC
I'm developing an application that needs a large (up to 4 GB) amount of temporary file space on a local (not network-attached) disk. What are some good tactics to use in a C# program to make sure the swap space is suitable? There can be some interaction with the user to choose the swap file location, but the more the program can find out about it, the better.
Nov 2 '08 #1
3 2585
On Sun, 02 Nov 2008 12:04:36 -0700, MC
<fo**************@www.ai.uga.edu.slash.mcwrote:
I'm developing an application that needs a large (up to 4 GB) amount of
temporary file space on a local (not network-attached) disk. What are
some good tactics to use in a C# program to make sure the swap space is
suitable? There can be some interaction with the user to choose the
swap file location, but the more the program can find out about it, the
better.
Can you be more specific about what criteria defines "suitable"?

I would think that the two major questions are: capacity, and i/o speed.
But, from a file-system coherence point of view, if we assume this is
truly a temporary file, deleted when the application exits normally, then
you may prefer to store the file in the user's own "Application Data"
subdirectory somewhere, as long as that meets whatever other criteria you
have.

Wherever you put the file, you should be careful, of course, to provide
features in your program to try to recover from errors that might have
prevented the deletion of the temp file; otherwise, the disk could be
consumed quickly.

To give the file system the best chance to optimize how the file is stored
on disk, you'll want to seek to the file's last extent when creating it so
that the file system can know how large the file is going to be and can
allocate space for it. If the file system has logic in it to maintain
contiguous file structure when possible, it will then be able to do that.
Otherwise, you may see performance suffer as the file gets fragmented from
repeated extensions as you decide you need more and more space.

Extending the file immediately on creation also has the advantage that it
allows you to confirm capacity right away. That way, you won't run into
problems later not being able to append to the file when you need to.

As for i/o speed, once you've created the file, you can run some profiling
code to write and read from the file, timing access to the file to ensure
adequate performance. For some applications, this is not so important and
you might just wind up warning the user that if they don't show you a
faster volume to use for the file, throughput will be lower. For other
applications, such as video capture or DVD burning, i/o speed may be
critical and you might want to refuse to use the volume altogether if it
can't keep up with your minimum speed requirements.

That's what _I_ think of when I think "suitable". But if the above
doesn't seem to address your question, you might want to clarify what
"suitable" means to you. :)

Pete
Nov 2 '08 #2
MC
Thanks. Are there system calls that will tell me (for instance) whether a disk drive is local or network-attached, and how much space it has available?
Nov 2 '08 #3
On Sun, 02 Nov 2008 15:06:58 -0700, MC
<fo**************@www.ai.uga.edu.slash.mcwrote:
Thanks. Are there system calls that will tell me (for instance) whether
a disk drive is local or network-attached, and how much space it has
available?
I believe the answer to both questions is "yes" (actually, I'm certain
about the latter, and pretty sure about the former), but I don't have the
specifics off the top of my head. It's possible that you'll have to go
through the unmanaged API to get that information.

Pete
Nov 2 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Allan Cammish | last post by:
I am writing a web based application that uses an ActiveX control on a web page to install files on the user's computer. These files will then be opened using programs on the user's computer such...
4
by: Matthew Crema | last post by:
Hello, Say I have 1000 text files and each is a list of 32768 integers. I have written a C program to read this data into a large matrix. I am using fopen in combination with fscanf to read...
0
by: Jeff Dillon | last post by:
When I browse to a simple .aspx page, I get the error: Unable to create temp file in path 'c:\windows\system32\inetsrv\%SystemRoot%\TEMP\': The directory name is invalid. My TEMP variable is...
1
by: Ram | last post by:
Hey, I have a ASP.NET web application, And whenever I try to debug a JScript/VBScript block (using- "stop", or - "debugger;") I get the following error: "There Is No Source Code Available For The...
7
by: matvdl | last post by:
I have migrated my asp application to asp.net some time ago - but I am still having some difficulties in understanding the best way to mange some tasks. I currently have a page that loads a aspx...
20
by: John | last post by:
Hi When I create a setup for my application, it installs all files for the app in C:\Program Files\MyCo\MyApp folder. How can I have some of the files to be installed under :\Program...
1
by: mikehixson | last post by:
Hi, As I understand ASP.NET 2.0 caches large POSTs to disk when the POST is greater than 256 bytes by default. The default location for the cached data on my machine is following: ...
0
by: rbanerji | last post by:
I have an IE toolbar which gets hold of the IWebBrowser. I then imlplement the event DocumentComplete. In the event I get hold of the Document as a IHTMLDocument. Now here is my question. For an...
36
by: sh.vipin | last post by:
how to make large macro paste the code as it is Problem Explanation '-- For example in the program below /* a.c - starts here */ #define DECL_VARS() \ unsigned int a0;\ unsigned int a1;\...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.