Page 1 of 1 1
Topic Options
#189521 - 2008-09-08 02:10 AM File I/O Over Network
MySpoonIs2Big Offline
Fresh Scripter

Registered: 2008-08-24
Posts: 11
If my script reads several entries from an 'ini' file over a network, does KiXtart close the file between operations? Or does the file stay in local memory until the KiXtart environment is closed?
Top
#189522 - 2008-09-08 03:03 AM Re: File I/O Over Network [Re: MySpoonIs2Big]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
It depends on how you are reading it. If you are using an OPEN() it will remain open till closed or the session is closed. If you are using ReadProfile, then it is open only for the read and then closed again. At least that has been my experience. Others may have a different opinion.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#189523 - 2008-09-08 03:38 AM Re: File I/O Over Network [Re: Gargoyle]
MySpoonIs2Big Offline
Fresh Scripter

Registered: 2008-08-24
Posts: 11
Thanks for the quick response. That's what I've been suspecting.

But, while you're here, I'd like to ask: what is the cost of this in terms of bandwidth? Are there any recommended "best practices" that to guide me here?

Top
#189524 - 2008-09-08 04:53 AM Re: File I/O Over Network [Re: MySpoonIs2Big]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Unless you are already stessing the level of your available bandwidth, this is a very insignificant amount of traffic. In general I have seen that a READPROFILESTRING = 2/3 packets (up to 10 with the ACK/SynAck sequence)
_________________________
Today is the tomorrow you worried about yesterday.

Top
#189525 - 2008-09-08 05:14 AM Re: File I/O Over Network [Re: Gargoyle]
MySpoonIs2Big Offline
Fresh Scripter

Registered: 2008-08-24
Posts: 11
Thanks
Top
#189532 - 2008-09-08 12:54 PM Re: File I/O Over Network [Re: MySpoonIs2Big]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
The performance hit using network based INI files can be dramatic.

I updated my login script earlier this year to cache the ini file on the local system. Performance improvement was significant! On a 128Kbps Frame Relay link (our slowest), the login script took about 80 seconds to run without caching, reading about 30 INI settings. This was reduced to about 12 seconds by caching when the cached file is current, or 15 seconds when it wasn't.

If I only need to read/write a few settings, I do it over the network, but any more than 5 values and I find another way, including caching (for read-only files) or a central service (for read/write).

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#189535 - 2008-09-08 02:28 PM Re: File I/O Over Network [Re: Glenn Barnas]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Good point Glenn, I was in reference to a single value read not multiple reads where it opens and reads for each value. That could really start adding up quickly.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#189652 - 2008-09-13 04:11 PM Re: File I/O Over Network [Re: Gargoyle]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
The problem for large .INI file is that the API (as far as I recall) retrieves the whole file every time it has to read from or write to the .INI file.
_________________________
There are two types of vessels, submarines and targets.

Top
#189654 - 2008-09-13 05:49 PM Re: File I/O Over Network [Re: Sealeopard]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Do you consider 7-10K a "large" INI file?

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#189655 - 2008-09-13 09:53 PM Re: File I/O Over Network [Re: Glenn Barnas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Yes, for an average .ini file I think you will find them to be 1K or under. ODBCINST.INI is the largest one on my system and it's only 4K

Now consider reading 100 items from a 7K file. You now just read 700K but their is network overhead every time you make that call. Which means you get that overhead hit your system 100 times as well.

Not that it's crippling slow on a modern hi-speed network, but using another method for slow links might be better.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.033 seconds in which 0.011 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org