DAC and SingleTon pattern
-
Does a Data Access Component has any impact on the Web application performance if it is designed using SingleTon design pattern?
Satish
Can you please put some more details about how you are implementing web application using Singleton pattern? :)
dnpro "Very bad programmer" My Latest Articles RichTextBox Control with Find functionality LogViewer - A Simple Log Listening Utility
-
Can you please put some more details about how you are implementing web application using Singleton pattern? :)
dnpro "Very bad programmer" My Latest Articles RichTextBox Control with Find functionality LogViewer - A Simple Log Listening Utility
DAC is implemented in sigleton pattern not the webapp. My concern is when DAC is singleton, single instance will be shared across all the session. When single instance is being served by one user request and other user is trying for it should second user need to wait for it to get access? I am totally confused how it will share the single instance across all the session. If the single instance serve each user request sequentially one after other, application will become slow, or mybe i am thinking completely wrong way. Please clarify me, Thanks in advance
Satish
modified on Thursday, January 29, 2009 3:42 AM
-
DAC is implemented in sigleton pattern not the webapp. My concern is when DAC is singleton, single instance will be shared across all the session. When single instance is being served by one user request and other user is trying for it should second user need to wait for it to get access? I am totally confused how it will share the single instance across all the session. If the single instance serve each user request sequentially one after other, application will become slow, or mybe i am thinking completely wrong way. Please clarify me, Thanks in advance
Satish
modified on Thursday, January 29, 2009 3:42 AM
Hi, it depends how your DAC is implemented. If you are using thread-synchronization methods (like locks, Monitors etc.) then your DAC does not support multiple requests at once. This will force the second user to wait until the first one is done using the DAC (depends really on the implementation). If you didn't use synchronization methods, then your DAC can be accessed by multiple users at the same time. Singleton only means that you are using one single instance on a class. It doesn't say anything about multi-threading. But if you use a singleton in a multi-threaded environment (like a webserver) you have to pay attention that multi-threading is not a problem for your DAC (side-effects). Singleton is a design-pattern <-> serving one request at a time is a threading issue. Hope this helps a bit. Regards Sebastian
It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.
-
Hi, it depends how your DAC is implemented. If you are using thread-synchronization methods (like locks, Monitors etc.) then your DAC does not support multiple requests at once. This will force the second user to wait until the first one is done using the DAC (depends really on the implementation). If you didn't use synchronization methods, then your DAC can be accessed by multiple users at the same time. Singleton only means that you are using one single instance on a class. It doesn't say anything about multi-threading. But if you use a singleton in a multi-threaded environment (like a webserver) you have to pay attention that multi-threading is not a problem for your DAC (side-effects). Singleton is a design-pattern <-> serving one request at a time is a threading issue. Hope this helps a bit. Regards Sebastian
It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.
-
DAC is implemented in sigleton pattern not the webapp. My concern is when DAC is singleton, single instance will be shared across all the session. When single instance is being served by one user request and other user is trying for it should second user need to wait for it to get access? I am totally confused how it will share the single instance across all the session. If the single instance serve each user request sequentially one after other, application will become slow, or mybe i am thinking completely wrong way. Please clarify me, Thanks in advance
Satish
modified on Thursday, January 29, 2009 3:42 AM
satz32 wrote:
My concern is when DAC is singleton, single instance will be shared across all the session.
This depends if DAC is running in separate Application Domain and serving to multiple application instance via Web Service or any other interoperability methodology. Otherwise every application will have associated DAC running in same application domain, No matter how it is implemented.
satz32 wrote:
I am totally confused how it will share the single instance across all the session. If the single instance serve each user request sequentially one after other, application will become slow, or mybe i am thinking completely wrong way.
You can easily figure out if DAC is running in separate instance by inspecting application architecture.
dnpro "Very bad programmer" My Latest Articles RichTextBox Control with Find functionality LogViewer - A Simple Log Listening Utility