I'm interested in seeing a bit of discussion about using singletons in
ASP.NET 2.0.
Currently I've designed a singleton that gets a reference to it's
single instance stored inside the ASP.NET application object. This is
done to persist and make available live information across multiple
sessions.
I've read a little bit (almost nothing) about how singletons don't play
nicely in clustered scenarios and would like to hear more on the
subject.
As mentioned above, my class is only a singleton because it's only
reference is stored in the application object. Because of this, I
could just as easily NOT write singleton and simply instantiate the
same object in the same place as where I'm storing the reference
(application handler on application start). From what I can see, the application object is the only place ASP.NET
makes available a facility to put code that lives throughout the
application.
How does clustering really impact a singleton or a single instance of a
class stored in the application object? 5 1495
the impact of a cluster on a singleton depends on the functionality of the
singleton. if the singleton is a cache of read only data, then there is
none. if the singleton is a cache of realtime data coming from the web site,
then there is.
say you singleton was a counter of logged in users implemented as a static
counter. a version of the counter would exist on each cluster member, and
updating one has no effect on the others. you would then have to write code
so that the singltons updated each other.
any class can implement the singleton pattern thru the static (shaed in vb)
methods or properties.
-- bruce (sqlwork.com)
"Omega" <at******@gmail .com> wrote in message
news:11******** **************@ q12g2000cwa.goo glegroups.com.. . I'm interested in seeing a bit of discussion about using singletons in ASP.NET 2.0.
Currently I've designed a singleton that gets a reference to it's single instance stored inside the ASP.NET application object. This is done to persist and make available live information across multiple sessions.
I've read a little bit (almost nothing) about how singletons don't play nicely in clustered scenarios and would like to hear more on the subject.
As mentioned above, my class is only a singleton because it's only reference is stored in the application object. Because of this, I could just as easily NOT write singleton and simply instantiate the same object in the same place as where I'm storing the reference (application handler on application start).
From what I can see, the application object is the only place ASP.NET makes available a facility to put code that lives throughout the application.
How does clustering really impact a singleton or a single instance of a class stored in the application object?
Application state is per-worker process. Which means a cluster of 2 or more
servers will each have their own application state. This means you can't
have true singletons by using the Application object. If you need a true
singleton, you need to find a way to share it across each server. A
somewhat complicated but highly efficient way is to use .NET Remoting.
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
"Omega" <at******@gmail .com> wrote in message
news:11******** **************@ q12g2000cwa.goo glegroups.com.. . I'm interested in seeing a bit of discussion about using singletons in ASP.NET 2.0.
Currently I've designed a singleton that gets a reference to it's single instance stored inside the ASP.NET application object. This is done to persist and make available live information across multiple sessions.
I've read a little bit (almost nothing) about how singletons don't play nicely in clustered scenarios and would like to hear more on the subject.
As mentioned above, my class is only a singleton because it's only reference is stored in the application object. Because of this, I could just as easily NOT write singleton and simply instantiate the same object in the same place as where I'm storing the reference (application handler on application start).
From what I can see, the application object is the only place ASP.NET makes available a facility to put code that lives throughout the application.
How does clustering really impact a singleton or a single instance of a class stored in the application object?
VERY informative from both of you. Thank you.
Understanding more how the pages work as a process on the system
certainly paints a clearer picture.
Having not read a book on running ASP.NET 2.0 sites, I can't really
make any guesses on how it would behave.
Can either of you reccomend a book that covers the insides & outs of
the MS application server? I'm interested in learning every little
detail to ensure that my programs are well tuned.
Best online Searchable book is Google, but stay away from Booble
SA
"Omega" <at******@gmail .com> wrote in message
news:11******** **************@ u72g2000cwu.goo glegroups.com.. . VERY informative from both of you. Thank you.
Understanding more how the pages work as a process on the system certainly paints a clearer picture.
Having not read a book on running ASP.NET 2.0 sites, I can't really make any guesses on how it would behave.
Can either of you reccomend a book that covers the insides & outs of the MS application server? I'm interested in learning every little detail to ensure that my programs are well tuned.
I find that online searches don't always result in the structure and
focus needed to cover something with as many facets as IIS & ASP.NET
2.0 administration. Looking at the snap-in, I can see many things that
could be done great justice with some explanation. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: stephan beal |
last post by:
Good morning, C++ users,
i've been hesitating to post this, primarily because i know that most of you
here are *way* ahead of me in C++ and i'm a little embarassed about the
possibility of some gross errors in what i'll be posting...
That said, please go easy on me. :)
About 2 weeks ago i wrote a paper, called Context Singletons, where i
discuss some of the uses of context-specific Singleton-like objects. During
|
by: Tito |
last post by:
I have two questions about the singletons' chapter of Alexei Alexandrescu's
"C++ Modern Design".
1. In the beginning of the chapter Alexei states that a "singleton" class
implementation made of static member functions has the problem that the
functions are not virtual, so that you have to touch the class' code in
order to change the behaviour. But, how is a singleton meant to be inherited
from? Is not the concrete class of the unique...
|
by: Dominik Rau |
last post by:
Hi.
I've got the following problem here: In my application, I use a lot of
Singletons, that are implemented as described in Gamma et al. (shortened):
//.h
class Singleton{
public:
static Singleton* the();
private:
static Singleton* _instance;
|
by: 6tc1 |
last post by:
Hi all, I'm having a problem where in my solution that contains
multiple projects - I instantiate a singleton class in one assembly and
then if another assembly tries to use that singleton class another
instance of it is created.
Basically:
--Assembly 1 (the executable)--
-Main.cs-
|
by: John Fly |
last post by:
I'm working on a large project(from scratch). The program is
essentially a data file processor, the overall view is this:
A data file is read in, validated and stored in a memory structure
similar to a database or XML representation. Rules to modify the stored
data will be executed, then the data will be transformed into an output
format.
Think something similar to FormatA -> XML -> Manipulate XML -> FormatB
| |
by: Steven Watanabe |
last post by:
PEP 8 says, "Comparisons to singletons like None should always be done
with 'is' or 'is not', never the equality operators." I know that "is"
is an identity operator, "==" and "!=" are the equality operators, but
I'm not sure what other singletons are being referred to here.
Also, I've seen code that does things like:
if foo is 3:
if foo is not '':
|
by: =?Utf-8?B?R29yZG8=?= |
last post by:
Hello everyone,
I've been trying for some time now to move to C++/CLI, but I have several
large legacy C++ static libraries I need to use. When I set up a simple
solution with a C++/CLI Winforms app and a C++ native static library, they
work well together _unless_ I have, it seems, any static variables defined in
any function in the native library.
The libraries I'm trying to use all have Meyers Singletons in them, so they
need to have...
|
by: adam.timberlake |
last post by:
I was reading an article on TalkPHP (http://www.talkphp.com/
showthread.php?t=1304) about singletons but I'm afraid I don't
understand why I need to use them. I understand how to code them
perfectly, it's just the theory I'm having some problems with. I did
try searching on Wikipedia but it didn't yield any satisfactory
reasoning, for me.
Could someone explain it to me in basic terms, please. I initially
came across singletons when I...
|
by: Craig Allen |
last post by:
Hey, forgive me for just diving in, but I have a question I was
thinking of asking on another list but it really is a general question
so let me ask it here. It's about how to approach making singletons.
Background: I've been programming in python seriously for about a year
now, maybe a little longer depending how you count, and the system I
am making is sophisticated enough that I've had to enter into a few
idioms which were beyond my...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |