views:

65

answers:

2

If have I have multiple processes accessing a registry value thousands of times per second, will there be any significant performance implications of reading this registry value?

The value of the registry value will never change, it will be read only. I guess another question is that is reading the registry value a blocking operation?

The registry value is for storing database connection details, accessed by an ASP.NET applications, Win Forms applications, and WCF services.

Thanks,

Stuart

+2  A: 

The registry is fast, really fast. But thousands of times per second? At the very least, cache the value in each application so you only have to read it once on app startup.

Greg Hewgill
After the first access, the windows registry is already caching the value for you, isn't it? You should store the value locally just for locality benefits unless you expect the value to spin, though, for sure.
Greg D
Yes, frequently accessed values are likely to be cached by the registry manager. However, you'll probably incur a context switch on each call so it's still better to cache locally.
Greg Hewgill
Thank you for your answer, it's set me on my way. Cheers.
Simian
+1  A: 

Windows registry is just a file that happens to have more protection around it than other files.

Just like any file, however, there will be a performance hit as it is accessed.

I would suggest that you read your values once, on application startup and store them in memory, passing them to your objects as required.

ChrisBD