MySpoonIs2Big
(Fresh Scripter)
2008-09-08 02:10 AM
File I/O Over Network

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?

Gargoyle
(MM club member)
2008-09-08 03:03 AM
Re: File I/O Over Network

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.

MySpoonIs2Big
(Fresh Scripter)
2008-09-08 03:38 AM
Re: File I/O Over Network

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?


Gargoyle
(MM club member)
2008-09-08 04:53 AM
Re: File I/O Over Network

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)

MySpoonIs2Big
(Fresh Scripter)
2008-09-08 05:14 AM
Re: File I/O Over Network

Thanks

Glenn BarnasAdministrator
(KiX Supporter)
2008-09-08 12:54 PM
Re: File I/O Over Network

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


Gargoyle
(MM club member)
2008-09-08 02:28 PM
Re: File I/O Over Network

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.

Sealeopard
(KiX Master)
2008-09-13 04:11 PM
Re: File I/O Over Network

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.

Glenn BarnasAdministrator
(KiX Supporter)
2008-09-13 05:49 PM
Re: File I/O Over Network

Do you consider 7-10K a "large" INI file?

Glenn


NTDOCAdministrator
(KiX Master)
2008-09-13 09:53 PM
Re: File I/O Over Network

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.