Welcome to Windows Communication Foundation (WCF)
Top Tasks :

WCF Team Bloggers

Browse by Tags

All Tags » Indigo » Service Archite... » Hosting   (RSS)

  • Hosted Service Shutdown

    I've talked a bit in the past about the tradeoffs of using IIS to host your service applications. In order to use IIS as a host, you must give up some level of control about how your application functions. This is similarly true with any other host you might imagine, even if we use host in a broader sense than just WCF services, such as with SQL Server. By selecting a host, you exchange control over certain aspects in your application in return for getting certain services for free. For example, IIS gives you a configuration model, tooling, health management, process activation, and other services. A service hosted inside of a Windows process might receive a different set of benefits. In order to make a good selection of a host, you have to understand these tradeoffs and be able to apply them to your application scenario to make a hosting decision. As an example, consider the aspect of service lifetime. When you host a service application in IIS, you give up some control over when the service is stopped, started, and executed. Your service will be activated by message arrivals. Your service may be stopped at any time based on the needs of the host, such as due to a lack of available memory, a lack of recent activity, or because of receiving a certain number of requests. These service shutdowns may or may not be predictable to you or give you an opportunity to react to them. A service that stops and starts at times necessitates a different strategy of design than a service that runs all of the time. A process that is long-running but intermittent needs to have some way to persist progress so that starting and stopping does not lose important work. A process that is continuously long-running might have different concerns, such as remaining extremely stable and carefully cleaning up resources. Both strategies can lead to the same goal and there's no reason to believe that there has to be a significant difference in performance or latency between the two. However, the two strategies are very different and very much aligned to different hosting models. When you commit to using a particular host with your application, you should take some time to understand how your application can best be adapted to the host's expectations. Similarly, when you are designing an application before committing to using a particular host, you should understand what the important constraints are for each of the hosts that you are considering. This obviously requires some planning to have Read More...
  • Managed Services Engine June CTP

    I'm a big fan of using service virtualization to solve a variety of problems with developing and managing web services. The Managed Services Engine is a solution built on top of WCF to supply a repository-based runtime and management tool for service virtualization. I hope to someday put the solutions team out of business by making service virtualization easier to do in the product. For now though, the Managed Services Engine is one of the better web service virtualization systems that I've seen. You can get their new June CTP on CodePlex , which replaces the previous beta release from last October. Read More...
  • Serialization of Client Calls

    I'm making multiple calls to a service and all of the other calls sit waiting until the first call completes. How do I make the service process multiple calls at the same time? If a service doesn't accept multiple, simultaneous calls from your client, then you have to figure out whether the problem is actually on the client or service. On the client side, what typically goes wrong here is that the first call blocks all other progress. After the first call completes, you can see multiple calls going out to the service. This is caused by the first call being responsible for opening the connection to the service. You can choose to either open a connection to the service manually by calling Open on the client, or otherwise the first call will automatically open a connection if there isn't one already. Until the connection to the server is established, none of the other calls can proceed and that causes the blocking behavior. The solution is to always open the client connection yourself ahead of time by calling Open so that this process is hopefully complete by the time you want to start making calls. If every call blocks, even after the first one, then this is probably due to the service configuration. There are two knobs that control whether multiple calls are allowed into the service called InstanceContextMode and ConcurrencyMode. You can set both of these knobs through a service behavior. InstanceContextMode controls how often we'll create a new instance. There will only ever be one context if you pick Single and there can be multiple contexts if you pick PerSession or PerCall. PerSession is probably the sweet spot but requires your channel stack to serve up sessionful channels, as from buffered TCP or from reliable messaging. It can be expensive to make your channel stack sessionful if it does not already support sessions from the protocols that you've picked. ConcurrencyMode controls how many threads we'll let into a service instance. There will only ever be one thread per instance if you pick Single or Reentrant, although Reentrant allows a thread to leave from a call and later come back in. There can be more than one thread per instance if you pick Multiple. You really don't have a choice about ConcurrencyMode because you either wrote the service to support multiple threads or you didn't. I don't see a compelling reason for your service to support multiple threads but restrict it to only have one. You should now be able to spot how InstanceContextMode and Read More...

Copyright © 2006 Microsoft Corporation. All Rights Reserved. | Terms of Use | Privacy Statement | Contact Us