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

Configuration parameter in SQL database

Hi all,

For some reasons, we've had to move away from the configuration files and
are now storing all the configuration parameters for our applications in a
SQL table. We have developped a library to manage the access to these
parameters and all our projects are now using this component. Our
applications vary can be web applications, web services, windows services,
even MS Office Addins.

Now here is the question that we are asking ourselves.

Shoud we or should we not keep the value of the parameters in static members?

Some developpers in the team would rather use dynamic members so that any
change to the underlying parameter in the table would be immediately
reflected without the need to restart the application pool in IIS or the
windows service.

Any comment or advice would be much appreciated to help us make our decision.

Cheers,

Stephane Varin
Jun 27 '08 #1
7 1415
Well, we have the same basic concept here with one of our tables that stores
general configuration data across our applications as well.

If you're storing those values inside static members on the objects the only
way you're going to allow them to update when the database changes is by
reloading the appdomain they're hosted in. Typically this involves restarting
the application or service that is running unless you're managing the
appdomains yourself, which can get very complicated.

I would agree with the developers on your team that want to store the
configuration data dynamically. Your solutions will end up requiring less
maintenance, which in turn gives you time to work on other things. When the
data has to change (which it probably will) you won't need someone to go
around restarting everything.

Just my opinion, but I'd have to agree with your team.

"StephaneVarin" wrote:
Hi all,

For some reasons, we've had to move away from the configuration files and
are now storing all the configuration parameters for our applications in a
SQL table. We have developped a library to manage the access to these
parameters and all our projects are now using this component. Our
applications vary can be web applications, web services, windows services,
even MS Office Addins.

Now here is the question that we are asking ourselves.

Shoud we or should we not keep the value of the parameters in static members?

Some developpers in the team would rather use dynamic members so that any
change to the underlying parameter in the table would be immediately
reflected without the need to restart the application pool in IIS or the
windows service.

Any comment or advice would be much appreciated to help us make our decision.

Cheers,

Stephane Varin
Jun 27 '08 #2
There is a middle ground; you could cache the values with a moderate
duration - even a minute or two would save a *lot* of round-trips, while
negating the need to reset the app each time. There are various cache
layers that could do this for you; even the System.Web cache can be used
standalone (since 2.0; not in 1.1). Or kust keep an expiry DateTime.

Marc
Jun 27 '08 #3
What about the overhead on our SQL server ?

The way I see it, our applications would be making tens of calls to this
database for each and every action, times the number of users...potentially
thousands of request to retrieve the same value over and over...

Do the benefits (avoiding the need to restart the application when a
parameter is changed) justify this culprit?

Configuration parameters are by essence fairly stable values, and the need
to change them usually arises when deploying a new version of the product,
which implies a restart anyway...

Well, I am very uncomfortable with this idea, I have to admit...

"Jeff Winn" wrote:
Well, we have the same basic concept here with one of our tables that stores
general configuration data across our applications as well.

If you're storing those values inside static members on the objects the only
way you're going to allow them to update when the database changes is by
reloading the appdomain they're hosted in. Typically this involves restarting
the application or service that is running unless you're managing the
appdomains yourself, which can get very complicated.

I would agree with the developers on your team that want to store the
configuration data dynamically. Your solutions will end up requiring less
maintenance, which in turn gives you time to work on other things. When the
data has to change (which it probably will) you won't need someone to go
around restarting everything.

Just my opinion, but I'd have to agree with your team.

"StephaneVarin" wrote:
Hi all,

For some reasons, we've had to move away from the configuration files and
are now storing all the configuration parameters for our applications in a
SQL table. We have developped a library to manage the access to these
parameters and all our projects are now using this component. Our
applications vary can be web applications, web services, windows services,
even MS Office Addins.

Now here is the question that we are asking ourselves.

Shoud we or should we not keep the value of the parameters in static members?

Some developpers in the team would rather use dynamic members so that any
change to the underlying parameter in the table would be immediately
reflected without the need to restart the application pool in IIS or the
windows service.

Any comment or advice would be much appreciated to help us make our decision.

Cheers,

Stephane Varin
Jun 27 '08 #4
Hello Stephane,

Thank you for the positive feedbacks of my initial reply.

The introduction of Caching in ASP.NET with the SqlCacheDependency Class is
the MSDN article:
http://msdn.microsoft.com/en-us/library/ms178604.aspx
It depicts the main features of ASP.NET SQL cache dependency, and tells the
different implementation of the mechanism in SQL server 2000 and 2005: SQL
server 2005 has the built-in support of Query Notification, whereas, SQL
server 2000 replies on polling which is less efficient.

To use the SQL Cache Dependency in the environment of ASP.NET 2.0 + SQL
Server 2005, please follow these two steps:

*Step 1. (SQL Server) Enable "Query Notification" in SQL server 2005*
http://msdn.microsoft.com/en-us/library/ms172133.aspx
with the SQL command:

ALTER DATABASE [DB Name] SET ENABLE_BROKER;

Note1: Before the run of this command, please make sure all the SQL
connections of the DB are disconnected. Otherwise, the command will hang.
Note2: Certain versions of SQL server 2005 don't include Notification
services:
http://technet.microsoft.com/en-us/l.../ms143500.aspx

*Step 2. (ASP.NET) Write code to use SqlCacheDependency*
http://msdn.microsoft.com/en-us/library/9dz445ks.aspx
This is a step-by-step demo of SqlCacheDependency in ASP.NET. If you are
interested in how to use it in Windows application, please refer to:
http://msdn.microsoft.com/en-us/library/a52dhwx7.aspx

A frequently used tip is to put the code:
SqlDependency.Start(GetConnectionString());
Into global.asax Application_Start function:

protected void Application_Start(object sender, EventArgs e)
{
SqlDependency.Start(GetConnectionString());
}

When you call this method, the runtime sets up the relationship between the
application domain and the connection string that will be used later during
the notification registration process.

For more reading of SQL Cache Dependency samples:
http://www.writebetterbits.com/2008/...2005-database_
11.html
This is a good demo of SQL Cache Dependency with LINQ

By the way, you may find some articles like these online:
http://www.codeproject.com/KB/aspnet...ASPNET_20.aspx
http://www.codeproject.com/KB/web-ca...endencies.aspx
They are about SQL Cache Dependency for SQL server 2000, which requires the
commands:
aspnet_regsql -ed -E -d School
aspnet_regsql -et -E -d School -t Users
These are not necessary in SQL server 2005.

Please let me know if you have any other concerns, or need anything else.

Regards,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
Jun 27 '08 #5
SOmething else to consider.

Greg Leake has created a "mini framework" about this configuration setting
up.

http://msdn.microsoft.com/en-us/netf.../bb499684.aspx
Focus on the configuration framework, and less on the WCF.

Basically, if you update a config setting (in the db), it pushes out all the
information.

Not sure if that's what you're after, but he did alot of work on it.


"StephaneVarin" <st******@newsgroups.nospamwrote in message
news:0A**********************************@microsof t.com...
Hi all,

For some reasons, we've had to move away from the configuration files and
are now storing all the configuration parameters for our applications in a
SQL table. We have developped a library to manage the access to these
parameters and all our projects are now using this component. Our
applications vary can be web applications, web services, windows services,
even MS Office Addins.

Now here is the question that we are asking ourselves.

Shoud we or should we not keep the value of the parameters in static
members?

Some developpers in the team would rather use dynamic members so that any
change to the underlying parameter in the table would be immediately
reflected without the need to restart the application pool in IIS or the
windows service.

Any comment or advice would be much appreciated to help us make our
decision.

Cheers,

Stephane Varin

Jun 27 '08 #6
Hello Sloan and Stephane,

I agree that the "mini framework" in the .NET StockTrader Sample, i.e.
"Configuration Service", can be another consideration. As far as I know, the
source code of the configuration service is not published, so I cannot tell
its exact idea of the update callback. It might be using the similar
mechanism to SQL Cache Dependency. For more reading about the service,
please refer to the document:
http://download.microsoft.com/downlo...nicalGuide.pdf

Regards,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

"sloan" <sl***@ipass.netwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
SOmething else to consider.

Greg Leake has created a "mini framework" about this configuration setting
up.

http://msdn.microsoft.com/en-us/netf.../bb499684.aspx
Focus on the configuration framework, and less on the WCF.

Basically, if you update a config setting (in the db), it pushes out all
the information.

Not sure if that's what you're after, but he did alot of work on it.


"StephaneVarin" <st******@newsgroups.nospamwrote in message
news:0A**********************************@microsof t.com...
>Hi all,

For some reasons, we've had to move away from the configuration files and
are now storing all the configuration parameters for our applications in
a
SQL table. We have developped a library to manage the access to these
parameters and all our projects are now using this component. Our
applications vary can be web applications, web services, windows
services,
even MS Office Addins.

Now here is the question that we are asking ourselves.

Shoud we or should we not keep the value of the parameters in static
members?

Some developpers in the team would rather use dynamic members so that any
change to the underlying parameter in the table would be immediately
reflected without the need to restart the application pool in IIS or the
windows service.

Any comment or advice would be much appreciated to help us make our
decision.

Cheers,

Stephane Varin


Jun 30 '08 #7
Greg (Leake) has a new version out. It is more friendly then the first
version.
All code is available I believe.

At least that's what he said at TechEd2008.

"Jialiang Ge [MSFT]" <ji****@online.microsoft.comwrote in message
news:uv**************@TK2MSFTNGP06.phx.gbl...
Hello Sloan and Stephane,

I agree that the "mini framework" in the .NET StockTrader Sample, i.e.
"Configuration Service", can be another consideration. As far as I know,
the source code of the configuration service is not published, so I cannot
tell its exact idea of the update callback. It might be using the similar
mechanism to SQL Cache Dependency. For more reading about the service,
please refer to the document:
http://download.microsoft.com/downlo...nicalGuide.pdf

Regards,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no
rights.
=================================================

"sloan" <sl***@ipass.netwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>SOmething else to consider.

Greg Leake has created a "mini framework" about this configuration
setting up.

http://msdn.microsoft.com/en-us/netf.../bb499684.aspx
Focus on the configuration framework, and less on the WCF.

Basically, if you update a config setting (in the db), it pushes out all
the information.

Not sure if that's what you're after, but he did alot of work on it.


"StephaneVarin" <st******@newsgroups.nospamwrote in message
news:0A**********************************@microso ft.com...
>>Hi all,

For some reasons, we've had to move away from the configuration files
and
are now storing all the configuration parameters for our applications in
a
SQL table. We have developped a library to manage the access to these
parameters and all our projects are now using this component. Our
applications vary can be web applications, web services, windows
services,
even MS Office Addins.

Now here is the question that we are asking ourselves.

Shoud we or should we not keep the value of the parameters in static
members?

Some developpers in the team would rather use dynamic members so that
any
change to the underlying parameter in the table would be immediately
reflected without the need to restart the application pool in IIS or the
windows service.

Any comment or advice would be much appreciated to help us make our
decision.

Cheers,

Stephane Varin



Jul 3 '08 #8

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

Similar topics

5
by: Tom Martin | last post by:
I'm a Java Web developer NEWBIE that has inherited a website that fails every 2 hours due to poor connection pooling between Tomcat 4.0.6 and mySQL. In efforts to resolve this problem, I've...
7
by: Famille Delorme | last post by:
Sorry if this discussion are already submited, but I don't find anything really interresting for me. And sorry for my bad english, it is not my native language. I wrote a program in Python for a...
2
by: serge calderara | last post by:
Dear all, I have a windows application linked to a database. I was wondering about one point. Do I have to go for a configuration file anyway or can I store all my application in this...
0
by: Monica Ferrero | last post by:
Hi! I'm not sure if this is the most adequate mySQL list for this post. If not, please indicat me which one I should use... I'm using Tomcat 4.1.24 with Apache 2 and MySQL 4.0.13. I have the...
1
by: serge calderara | last post by:
dear all, I have problem accessing section group in my configuration application file. I got an error saying thta I can have only one section ???? here is my application configuration looks...
1
by: Mark | last post by:
In the "Adminstration: Performance" manual (DB2 V8.1 for LUW), it describes the following dbm (database manager) configuration parms. Since these are set at the dbm level, do we calculate the...
3
by: Mark | last post by:
In a DB2 V8.1 performance tuning document from a 3rd party vendor, I found this statement. Can anyone verify this? "DB2 requires 100 bytes of memory for every buffer pool and extended storage...
2
by: Patrick | last post by:
I am using the Microsoft enterprise Library (June 2005) with .NET Framework 1.1 on a Windows 2003 IIS6 web server. with an ASP.NET 1.1 application, I have a dataConfiguration.config as listed at...
10
by: Woody Ling | last post by:
In 32 bits DB2 environment, is it meaningful to set sheapthres larger than 256MB for the following case.. 1. Intra-parallel is ON 2. Intra-parallel is OFF
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.