473,583 Members | 3,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Writing flat file to network is slow

Hi

I am working with a VB 2005 program which has been converted from VB6.
It writes data out to a flat file, with code like the following line

WriteLine(riFil eNo, "Hist", lsAssetID, lsRecordType, lsXNbr, lsFiscYr,
"Beg", CStr(H.BegBalAc cDepn), CStr(H.BegBalCo st), CStr(H.BegBalCo stReval),
CStr(H.BegBalDe pCost), CStr(H.BegBalDe pnReval))

The program is running from within a Virtual PC
If it is writing to a file on drive c:, the job takes about 30 seconds.
If it is writing to a file on a network drive, it takes about 20 minutes.

If it writes to drive C:, then I copy the file to the network drive, the
copy operation takes just a couple of seconds.
There is very little traffic on the network.

What are possible reasons for it running so slowly when my code writes to
the network drive?

Thanks

Barry

--
Barry Flynn
Complete Solutions DG

Jun 14 '07 #1
3 2685
Barry Flynn wrote:
I am working with a VB 2005 program which has been converted from VB6.
It writes data out to a flat file, with code like the following line

WriteLine(riFil eNo, "Hist", lsAssetID, lsRecordType, lsXNbr, lsFiscYr,
"Beg", CStr(H.BegBalAc cDepn), CStr(H.BegBalCo st),
CStr(H.BegBalCo stReval), CStr(H.BegBalDe pCost),
CStr(H.BegBalDe pnReval))
The program is running from within a Virtual PC
If it is writing to a file on drive c:, the job takes about 30
seconds. If it is writing to a file on a network drive, it takes
about 20 minutes.
If it writes to drive C:, then I copy the file to the network drive,
the copy operation takes just a couple of seconds.
There is very little traffic on the network.

What are possible reasons for it running so slowly when my code
writes to the network drive?
For a start, you could try running it on a non-virtual PC to see if that's
creating a bottleneck.

Also, is the file so large that you can't put all the data in a
stringbuilder and then write that in one go to the [network] drive?

Andrew
Jun 14 '07 #2

"Andrew Morton" <ak*@in-press.co.uk.inv alidwrote in message
news:Of******** ******@TK2MSFTN GP04.phx.gbl...
Barry Flynn wrote:
>I am working with a VB 2005 program which has been converted from VB6.
It writes data out to a flat file, with code like the following line

WriteLine(riFi leNo, "Hist", lsAssetID, lsRecordType, lsXNbr, lsFiscYr,
"Beg", CStr(H.BegBalAc cDepn), CStr(H.BegBalCo st),
CStr(H.BegBalC ostReval), CStr(H.BegBalDe pCost),
CStr(H.BegBalD epnReval))
The program is running from within a Virtual PC
If it is writing to a file on drive c:, the job takes about 30
seconds. If it is writing to a file on a network drive, it takes
about 20 minutes.
If it writes to drive C:, then I copy the file to the network drive,
the copy operation takes just a couple of seconds.
There is very little traffic on the network.

What are possible reasons for it running so slowly when my code
writes to the network drive?

For a start, you could try running it on a non-virtual PC to see if that's
creating a bottleneck.

Also, is the file so large that you can't put all the data in a
stringbuilder and then write that in one go to the [network] drive?

Andrew
Andrew - thanks for the suggesrions.
For a start, you could try running it on a non-virtual PC to see if that's
creating a bottleneck.
Unfortunately, that's a little difficult.
It runs in the Microsoft Dynamics SL environment, and the "real PC" has a
conflicting (VB6) version of that environment.
However, I thought that (a) the fact that it runs in a few seconds when
writng to drive c:, coupled with (b) the fact that I can copy the file to
the network in a few seconds, sort-of suggested that the virtual pc wasn't
the guilty party.
I recognze that a virtual pc is likely to be slower than a "real one", but
this job takes about 40 times as long when writing to the network.
Also, is the file so large that you can't put all the data in a
stringbuilder and then write that in one go to the [network] drive?
Yes I agree that it would be better to use string builders, and probably
streams.
If I was writimg the program from scratch, I probably would do that.
This prog was converted from a VB6 version, and contains a lot of these
WriteLine statements as it writes different data from several different
tables.
So there's a bit of work involved in changing it.

I do intend to do some testing to see if different ways of writing the data
make a difference.
However, I thought that the fact that it runs in a few seconds when writing
to a local drive indicated that use of stringbuilders etc. might not make a
huge difference.

Thanks

Barry

--
Barry Flynn
Complete Solutions DG
Jun 14 '07 #3
Barry Flynn wrote:
I do intend to do some testing to see if different ways of writing
the data make a difference.
However, I thought that the fact that it runs in a few seconds when
writing to a local drive indicated that use of stringbuilders etc.
might not make a huge difference.
Ah, but then you could write the whole file in one go so buffers might have
more efficient use made of them [sorry about that grammar]. The local file
system will use 32KB buffers (I think) whereas sending it out from a virtual
PC through real hardware and over a network, well, I can only make guesses.

Andrew
Jun 14 '07 #4

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

Similar topics

385
17053
by: Xah Lee | last post by:
Jargons of Info Tech industry (A Love of Jargons) Xah Lee, 2002 Feb People in the computing field like to spur the use of spurious jargons. The less educated they are, the more they like extraneous jargons, such as in the Unix & Perl community. Unlike mathematicians, where in mathematics there are no fewer jargons but each and every...
12
3745
by: Chris Springer | last post by:
I'd like to get some feedback on the issue of storing data out to disk and where to store it. I've never been in a production environment in programming so you'll have to bear with me... My question is about storing data in a database. Yes I understand that you can link to a database in your program and read and write to the database etc...
6
1219
by: Chad A. Beckner | last post by:
Hi everyone, Ok, here's the deal. I have a laptop installed with VS 2005. I'm programming in C#. When I am at home, connected to my LinkSys router, it saves fine. However, whenever I am anywhere else, it saves very slowly (takes about 1 minute), on the same file(s). Any ideas? Thanks! Chad
5
4799
by: Sheldon | last post by:
Hi everyone, I have a short program the writes the output data to an acsii file: import sys import os import string import gisdata from Numeric import *
12
5562
by: benjamin.krulewitch | last post by:
I'm debugging an issue with a C program that causes the computer to crash, and I'm attempting to log information immediately before the crash occurs. I us my BKprintLog function (see below) to write information into a log file. The problem is, i'm not confident that information i write to the log gets saved onto the hard drive before the...
35
9318
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from 500000 to 3200000 of a file whose size is say 20MB... how do i request a download which starts directly at 500000th byte... thank u cheers
2
6122
by: murthydb2 | last post by:
Hi My requirement is that i have to write a stored procedure in db2 and that will be executed in a batch file . Any system error or validation error that occurs inside the db2 sp during the execution need to be written in external flat file ( Log file to know the error ) . Is there anything similar in db2 like UTL_FILE in oracle...
15
5257
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to show - text boxes, input boxes, buttons, hyperlinks ie the usual. The data is not obtained directly from a database.
0
7824
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8176
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7931
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8191
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5699
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1426
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1154
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.