473,395 Members | 1,701 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,395 software developers and data experts.

Is the reading/writing to the registry slow?

UJ
I have a system that has five programs that all communicate with each other
via Message Queues. Works well. One program is a watchdog that will make
sure the others are up and going. Currently I have it store info it gets
from when the programs check in into a DataSet (XML file). Problem is, that
file now has to be used by other programs to find out version information
(the file is ALWAYS less that 1K.) The record itself is only five fields and
there are five records usually in the dataset.

I'm running into problems with file contention and I was thinking instead of
writing to a file how about if I use the registry? I've tried using Mutexs
and having problems with it. SQL/Database is not an option.

So I wanted to know, is reading/writing to the registry frequently (each
program would write to it every minute, one of the programs would read it
every minute.) problematic?

If I'm doing lots of reading/writing will it do anything to the machine;
i.e. - slow it down, cause problems with the registry, cause problems in
Windows ?

Is the size of the registry an issue ?

TIA - Jeff.
Aug 18 '06 #1
5 5039
Hi,

As far as I know, reading and writing operations against the Windows
Registry are pretty fast!
I would not worry too much about the "Registry size". Especially
because you say that there are only 5 records (each holding 5 fields)
in the dataset. This would boil down to 5 Registry keys with 5 subkey's
each. That should not be a problem!

However, you will be abusing the registry. The registry isn't exactly
designed for holding "process state info" (although it can be used that
way). I do not really understand what you're needing the "file" (or the
registry) for. Why don't you just keep the data you need in memory? You
could use message queues to query for the data, instead of using a file
for this.

Good luck,

Alke Wiebenga

UJ schreef:
I have a system that has five programs that all communicate with each other
via Message Queues. Works well. One program is a watchdog that will make
sure the others are up and going. Currently I have it store info it gets
from when the programs check in into a DataSet (XML file). Problem is, that
file now has to be used by other programs to find out version information
(the file is ALWAYS less that 1K.) The record itself is only five fields and
there are five records usually in the dataset.

I'm running into problems with file contention and I was thinking instead of
writing to a file how about if I use the registry? I've tried using Mutexs
and having problems with it. SQL/Database is not an option.

So I wanted to know, is reading/writing to the registry frequently (each
program would write to it every minute, one of the programs would read it
every minute.) problematic?

If I'm doing lots of reading/writing will it do anything to the machine;
i.e. - slow it down, cause problems with the registry, cause problems in
Windows ?

Is the size of the registry an issue ?

TIA - Jeff.
Aug 18 '06 #2
While I am not so sure that using the Registry as a sort of temporary Data
Store is the best way to solve your issue, no, Registry access is very fast.
In fact, if you download yourself a copy of RegMon and have it running you'll
see all kinds of registry traffic going on in your pc even if you arent'
actually doing anything.
HTH,
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"UJ" wrote:
I have a system that has five programs that all communicate with each other
via Message Queues. Works well. One program is a watchdog that will make
sure the others are up and going. Currently I have it store info it gets
from when the programs check in into a DataSet (XML file). Problem is, that
file now has to be used by other programs to find out version information
(the file is ALWAYS less that 1K.) The record itself is only five fields and
there are five records usually in the dataset.

I'm running into problems with file contention and I was thinking instead of
writing to a file how about if I use the registry? I've tried using Mutexs
and having problems with it. SQL/Database is not an option.

So I wanted to know, is reading/writing to the registry frequently (each
program would write to it every minute, one of the programs would read it
every minute.) problematic?

If I'm doing lots of reading/writing will it do anything to the machine;
i.e. - slow it down, cause problems with the registry, cause problems in
Windows ?

Is the size of the registry an issue ?

TIA - Jeff.
Aug 18 '06 #3
Personally I'd advise you to stick with files and mutexes - it is a very
simple solutions, and should be very portable between environments (if that
ever becomes an issue), plus it avoids all sorts of registry access
permissions / identity issues. You didn't respond to yesterday's question to
explain what these contention issues /were/ (the real symptoms) - care to
elaborate?

Marc
Aug 18 '06 #4
UJ
I've got a file that is created by a program. Other programs that are
running need to access that file. (This file contains things like what
programs are running, when was the last time we heard from the program, what
version the program is, ....) I tried first doing a mutex but somewhere
along the way something would happen where the mutex wouldn't get released
right. So the other programs couldn't get at the file. Or if they did, they
had to wait for a period of time before they gave up on the mutex and read
the file anyway.

So I took out the mutex and had the originator create the files multiple
times in different directories for the different programs. (It should be
noted that the file is created minute and the programs poll the file every
once in a while.) This seemed to work OK but seems real cumbersome.

I suppose another way to do it would be to use a Message Queue to request
the dataset from the program that is creating it and send it out to
everybody. Everybody else could keep the thing in memory and not even bother
writing it out.

TIA - Jeff.

"Marc Gravell" <ma**********@gmail.comwrote in message
news:u0*************@TK2MSFTNGP02.phx.gbl...
Personally I'd advise you to stick with files and mutexes - it is a very
simple solutions, and should be very portable between environments (if
that ever becomes an issue), plus it avoids all sorts of registry access
permissions / identity issues. You didn't respond to yesterday's question
to explain what these contention issues /were/ (the real symptoms) - care
to elaborate?

Marc

Aug 18 '06 #5
Such process 'management' tasks are best implemented using System.Management
namespace classes (WMI).
Let the producer (the watchdog) fire an event type
(InstrumentationType.Event) into the WMI subsystem whenever something
changes that is of interest to the consumer(s), let the consumers (the
programs) register an event watcher, no files needed no polling, instant
eventing.

Willy.


"UJ" <fr**@nowhere.comwrote in message
news:Ox**************@TK2MSFTNGP05.phx.gbl...
| I've got a file that is created by a program. Other programs that are
| running need to access that file. (This file contains things like what
| programs are running, when was the last time we heard from the program,
what
| version the program is, ....) I tried first doing a mutex but somewhere
| along the way something would happen where the mutex wouldn't get released
| right. So the other programs couldn't get at the file. Or if they did,
they
| had to wait for a period of time before they gave up on the mutex and read
| the file anyway.
|
| So I took out the mutex and had the originator create the files multiple
| times in different directories for the different programs. (It should be
| noted that the file is created minute and the programs poll the file every
| once in a while.) This seemed to work OK but seems real cumbersome.
|
| I suppose another way to do it would be to use a Message Queue to request
| the dataset from the program that is creating it and send it out to
| everybody. Everybody else could keep the thing in memory and not even
bother
| writing it out.
|
| TIA - Jeff.
|
| "Marc Gravell" <ma**********@gmail.comwrote in message
| news:u0*************@TK2MSFTNGP02.phx.gbl...
| Personally I'd advise you to stick with files and mutexes - it is a very
| simple solutions, and should be very portable between environments (if
| that ever becomes an issue), plus it avoids all sorts of registry access
| permissions / identity issues. You didn't respond to yesterday's
question
| to explain what these contention issues /were/ (the real symptoms) -
care
| to elaborate?
| >
| Marc
| >
|
|
Aug 21 '06 #6

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

Similar topics

4
by: Lee | last post by:
I have created a custom log for my apps to write to. Writing to the log seems to be no problem, it's when I go to read it I get unexpected results. I have an application that reads the log and...
5
by: Dhilip Kumar | last post by:
Hi All, I'm writing a Windows Service app using C#. I need to read some configuration settings before the service starts up. These settings will be used by the service in its operation. ...
6
by: Bry | last post by:
I'm having problems writing (and reading) boolean data to the registry. // Write a boolean value to the registry // I've not included the obvious bits of code in these samples bool myBool =...
1
by: Peter John | last post by:
I am using the following code to read from and write to the registry. The writing works fine but reading always fails. Can anyone suggest what is going wrong? Imports Microsoft.Win32 Public...
4
by: RhavoX | last post by:
Hi. This may be a very stupid question but I'll leave you to judge it ;) I know there were lots of questions about this but none of the answers suits me. I'm wondering how to get the BINARY type...
1
by: projectVBA | last post by:
Hi , I wrote some add in for PowerPoint and i'm trying to find an automatic way to load it every time PowerPoint starts. I found Microsoft Code example (see below ) BUT the problem is : I can't...
2
by: terryastone | last post by:
I have an application that reads some registry values stored in the Local Machine\Software\... key. In XP, I can see these values using RegEdit. In my application I can read the values at...
5
by: Andrus | last post by:
For file based export-import with existing programs I need to implement dbf format file read/write from my .NET 2 winforms application. It is not possible to force users to install something so...
29
by: Guillaume Dargaud | last post by:
Hello all, anybody knows if there's some ANSI-C conformant code around that can read Windows-style .ini files ? I don't care about writing to it but I need to be able to read it from various OSs,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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...

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.