0

我在 web 服务器上有大约 60 个 web 应用程序,所有这些应用程序在 web.config 中都有一些相同的 appsetting 值。这些设置会在应用程序启动后立即加载到内存中。我想将这些值集中在一个配置文件中,以供所有应用程序加载。

我的问题是,如果我同时加载所有应用程序,同时访问同一个配置文件会有任何性能问题吗?

干杯

4

3 回答 3

0

读锁通常不是独占的,因此任何数量的应用程序都可以同时从同一个文件中读取。如果您没有特别要求阅读排他性,那应该没问题。

您应该查看如何将配置文件加载到每个应用程序中。

有关详细信息,请参阅http://en.wikipedia.org/wiki/File_locking

于 2010-12-17T10:13:11.833 回答
0

可能是因为您需要磁盘 IO 才能访问该文件。但是,如果这些值保留在内存中,我会说之后的性能问题将是最小的。只需确保在不锁定文件的情况下读出文件(我相信使用FileShare.ReadWrite枚举)。

于 2010-12-17T10:13:13.930 回答
0

You might even see a small performance improvement since the file will be cached by the operation system when the first application reads the file, subsequent files will read directly from memory.

But the only way to know for sure is to measure and see.

于 2010-12-17T11:50:56.543 回答