Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 833983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:36:22+00:00 2026-05-15T04:36:22+00:00

I have a lot of Singleton implementation in asp.net application and want to move

  • 0

I have a lot of Singleton implementation in asp.net application and want to move my application to IIS Web Garden environment for some performance reasons.

CMIIW, moving to IIS Web Garden with n worker process, there will be one singleton object created in each worker process, which make it not a single object anymore because n > 1.

can I make all those singleton objects, singleton again in IIS Web Garden?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:36:22+00:00Added an answer on May 15, 2026 at 4:36 am

    I don’t believe you can ( unless you can get those IIS workers to use objects in shared memory somehow ).

    This is a scope issue. Your singleton instance uses process space as its scope. And like you’ve said, your implementation now spans multiple processes. By definition, on most operating systems, singletons will be tied to a certain process-space, since it’s tied to a single class instance or object.

    Do you really need a singleton? That’s a very important question to ask before using that pattern. As Wikipedia says, some consider it an anti-pattern ( or code smell, etc. ).

    Examples of alternate designs that may work include…

    1. You can have multiple objects synchronize against a central store or with each other.
    2. Use object serialization if applicable.
    3. Use a Windows Service and some form of IPC, eg. System.Runtime.Remoting.Channels.Ipc

    I like option 3 for large websites. A companion Windows Service is very helpful in general for large websites. Lots of things like sending mail, batch jobs, etc. should already be decoupled from the frontend processing worker process. You can push the singleton server object into that process and use client objects in your IIS worker processes.

    If your singleton class works with multiple objects that share state or just share initial state, then options 1 and 2 should work respectively.

    Edit

    From your comments it sounds like the first option in the form of a Distributed Cache should work for you.

    There are lots of distributed cache implementations out there.

    1. Microsoft AppFabric ( formerly called Velocity ) is their very recent move into this space.
    2. Memcached ASP.Net Provider
    3. NCache ( MSDN Article ) – Custom ASP.Net Cache provider of OutProc support. There should be other custom Cache providers out there.
    4. Roll out your own distributed cache using Windows Services and IPC ( option 3 )

    PS. Since you’re specifically looking into chat. I’d definitely recommend researching Comet ( Comet implementation for ASP.NET?, and WebSync, etc )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a server application (singleton, simple .NET console application) that talks to a
I have lot of code in my Tornado app which looks like this: @tornado.web.asynchronous
I have an application which takes some pictures. My whole application is based on
I have a lot of classes in my project accessed by a singleton like
Suppose you have a Singleton A whose getInstance() throws some Exceptions. Further suppose that
I'm currently using a singleton on my web application so that there is always
I have a singleton that holds a lot of information on my App (ACCU.class).
I'm looking for good performance when sending a lot of e-mails. I have heard
I have an asp.net-mvc site and I am using LinFu to do IOC. I
We have a lot of class code which has some boilerplate like the following:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.