PC Review


Reply
Thread Tools Rate Thread

Caching config section values

 
 
Thorsten Tarrach
Guest
Posts: n/a
 
      19th Aug 2009
Hi everyone,

I currently trying to increase the performance of my HTTP module. This
module is written entirely in C# and plugged into IIS7. In order to work the
module needs some settings from the web.config file. An instrumented run
shows that reading from the config file using a class derived from
ConfigurationSection is very slow.
So I thought about caching these values. It would appear that saving them in
a global variable is safe because the application restarts each time the
web.config file is updated.

I just want to double-check with you that this is proper procedure.

Thanks, Thorsten

 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      19th Aug 2009
"Thorsten Tarrach" <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> Hi everyone,
>
> I currently trying to increase the performance of my HTTP module. This
> module is written entirely in C# and plugged into IIS7. In order to
> work the module needs some settings from the web.config file. An
> instrumented run shows that reading from the config file using a class
> derived from ConfigurationSection is very slow.
> So I thought about caching these values. It would appear that saving
> them in a global variable is safe because the application restarts
> each time the web.config file is updated.
>
> I just want to double-check with you that this is proper procedure.


I often create a Singleton class that can pull up configuration elements
when the application starts. Once it is in memory (as a static class -
Shared in VB), I can grab the instance over and over again. This
increases start up by a few seconds, maybe, but it is a one time hit
when the app starts.

In other words, you are aiming in a right direction if the consistent
pull from config is slowing your app down.

Peace and Grace,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Reply With Quote
 
Thorsten Tarrach
Guest
Posts: n/a
 
      20th Aug 2009
Thanks Gregory,

that's good to know.

Thorsten

"Gregory A. Beamer" <(E-Mail Removed)> wrote in message
news:Xns9C6C6C9E6CC5Agbworld@207.46.248.16...
> "Thorsten Tarrach" <(E-Mail Removed)> wrote in
> news:(E-Mail Removed):
>
>> Hi everyone,
>>
>> I currently trying to increase the performance of my HTTP module. This
>> module is written entirely in C# and plugged into IIS7. In order to
>> work the module needs some settings from the web.config file. An
>> instrumented run shows that reading from the config file using a class
>> derived from ConfigurationSection is very slow.
>> So I thought about caching these values. It would appear that saving
>> them in a global variable is safe because the application restarts
>> each time the web.config file is updated.
>>
>> I just want to double-check with you that this is proper procedure.

>
> I often create a Singleton class that can pull up configuration elements
> when the application starts. Once it is in memory (as a static class -
> Shared in VB), I can grab the instance over and over again. This
> increases start up by a few seconds, maybe, but it is a one time hit
> when the app starts.
>
> In other words, you are aiming in a right direction if the consistent
> pull from config is slowing your app down.
>
> Peace and Grace,
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
>
> Twitter: @gbworld
> Blog: http://gregorybeamer.spaces.live.com
>
> *******************************************
> | Think outside the box! |
> *******************************************


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Picking up the caching value from a Web.config -- please help almurph@altavista.com Microsoft C# .NET 1 28th Mar 2008 05:30 PM
How to get values from custom config section? Showjumper Microsoft ASP .NET 1 25th Sep 2007 10:00 PM
Web.Config AppSettings & Caching Fred Nelson Microsoft ASP .NET 17 7th Mar 2006 07:04 PM
more values in one section of app.config Patrick Microsoft C# .NET 3 6th Oct 2003 01:46 PM
more values in one section of app.config Patrick Microsoft Dot NET 4 6th Oct 2003 01:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:58 PM.