views:

60

answers:

5

Today in a design meeting we discussed the topic of where to store configuration and state of a distributed application.

It turns out that in that meeting, some developers understand different things when they hear configuration or state. Some even think that configuration and state are exactly the same thing.

My very shortly summarized understanding is that configuration describes how you want the system to behave, and the system should parse that config and take actions to reach a certain state that reflects an implementation and consolidation of that config.

For example, an Apache server may have a config that tells it to have between 15 and 30 worker processes. When the server starts, it will most likely start 15 of them, arriving to a state of having 15 worker processes. As requests come in it might change its state to have up to 30 active worker processes.

I couldn't however convince the developers in question that these two concepts are different, and googling doesn't give me more eloquent references that explain better than I can what the me almost obvious difference is.

Any suggestions or links on how to explain this better ? Or am I wrong ?

+1  A: 

You can reset a system, losing all state. Its configuration remains.

djna
+1  A: 

"Configuration" could be taken to include the intended lifelong state of the app -- the state that's there whether there's anything to do or not; the internal values that say how the non-hardcoded stuff happens. It's normally obtained from some external source like a configuration file, but the config is not actually the file itself, or even the contents of that file -- it's the app's behavior once the contents of that file have been parsed and applied.

cHao
A: 

As per Merriam-Webster (emphasis mine):

state noun, often attributive

1 a : mode or condition of being (a state of readiness)

con·fig·u·ra·tion noun

1 a : relative arrangement of parts or elements: as (1) : shape (2) : contour of land (3) : functional arrangement (a small business computer system in its simplest configuration)

b : something (as a figure, contour, pattern, or apparatus) that results from a particular arrangement of parts or components

I can see how you would associate the (b) meaning of configuration with state, but that's not the definition I usually think of when discussing a system's configuration. State describes behavior / properties at a specific moment in time, whereas I take configuration to mean the state in which a system is meant to or initialized to behave.

djacobson
A: 

sorry, i don't understand the question

Juku
This should be a comment.
Pekka
A: 

From a theoretical perspective, there is no difference between configuration and other data that is provided to a program from the outside. Both are classified as Input. I think that any attempt to define "configuration" as something special is going to be met with endless edge cases and exceptions, so that is not a natural category.

On the other hand, there is a clear difference between Input and State. Input is provided from the outside, while State is internal.

With this in mind, consider that some applications are designed to be stopped and restarted at any time to perform a very long running process. For those appliations the distinction between Input and State are minimized, since total program state must be serialized to persistant media in order to allow the program to continue where it left off in the future. This is especially common among distributed applications.

It is possible that for the particular application that you are working on, there really is no distinction between configuration and state.

Jeffrey L Whitledge