Hello all,
I just wanted to have everyones opinion on the idea I will describe below.
As many of you may know it is possible to cluster the session scope and
store it in a sessionstore which can be either a database, a cache or the
file system. Now often people have applications in a cluster that need to
stay in synch. So for instance if you reinit an application on one server,
you should initialize all others in the cluster too. So Micha and I
discussed already a while ago what options (back then for Railo) are
available.
I just wanted to throw out the following ideas:
-
Cluster the complete application scope just in the same way the
session scope is clustered
in the Application.cfc one would write:
this.applicationstorage = cache|datasource|file|memory;
this.applicationcluster = true|false;
o Pros
§ Easy to implement as a user
§ A pointer from the session scope to the application scope would be
possible again
o Cons
§ Singletons are serialized as well so they have to be deserialized for
every request (if applicationcluster is set to false)
§ Values are not immediately available if a request sets a value, but only
if the request has finished and the value has been rewritten to the storage
§ Serialization and deserialization can be time consuming, since people
tend to store a lot in the application scope
-
Cluster a subKey of the application scope. This means that the
application.cfc could look like this;
this.applicationstorage = cache|datasource|file|memory;
this.applicationstorageKey = cluster; // means that the
application.cluster key and all values below are stored in the
applicationstorage
this.applicationcluster = true|false;
o Pros
§ The higher performance would be useable for the non-clustered part of the
application scope
§ No serialization necessary
§ Since only a subset is clustered, the performance can be enhanced by not
overloading the clustered key with data.
§ The complete application scope would still be clusterable if the key is
set to .
o Cons
§ None that I can see
A general con is, that variables set on one server in a clustered
application scope are not immediately available to any other server, until
the next request on any other server might read the application scope from
the storage.
Obviously the keys in the clustered parts of the application scope are only
allowing serializable values.
This idea is lingering with us for a while already and we could have used it
in many occasions. I am very intrigued by it and I would appreciate your
thoughts.
Sincerely
Gert Franz
RASIA GmbH
Spittelgasse 7
5103 Moeriken-Wildegg
Email: mailto:Gert_Franz @Gert_Franz
Skype: gert.franz
Phone Switzerland: +41 76 5680 231