Books MVC ASP.NET C# SQL Server WCF Written Test HR Round Subscribe C# Videos C# Programs Buy DVD

Saturday, January 14, 2012

WCF Interview Questions on Concurrency


Click here for all SQL Server Interview Questions


Click here for all WCF Interview Questions


Click here for all ASP.NET Interview Questions


Click here for all C# Interview Questions


Click here for Written Test or practical ASP.NET Interview Questions asked in MNC's


What are the different concurreny modes available in WCF?
1. Single
2. Reentrant
3. Multiple


Are WCF services protected from concurrent access by default?
Yes, WCF services are protected from concurrent access by default, as the concurrency mode of a WCF service is set to Single by default.


Explain Single Concurrency Mode?
In a Single concurrency mode only one request is processed by the same service instance. A lock is acquired while a request is processed by a service instance. Other threads, if any, are queued, until they timeout. Once the lock is released when the current request completes, next thread in the queue can then access the objects.


What effect does Single concurreny mode setting have on PerCall, PerSession and Singleton services?
PerCall services and Single Concurreny mode : A new service instance is allocated for each thread. Here, concurrency is not an issue and Single mode setting has no impact on the throughput and concurrent calls can be processed.

PerSession services and Single Concurreny mode : Service instances are protected against multithreaded clients. Single mode impacts throughput of single client but multiple clients can get through and concurrent calls can be processed.

Singleton services and Single Concurreny mode : Service instances are protected against any concurrent calls. Single concurrency mode impacts throughput of singleton. Multiple threads and clients cannot get through and no concurrent calls can be processed.


Explain Reentrant Concurrency Mode?
Reentrant concurrency mode is useful when services issue callbacks to clients, If callback operations are not one-way. Services release the acquired lock upon exit to make the callback and another thread is able to acquire the lock. In this case, return from callback will queue.


What effect does Reentrant concurreny mode setting have on PerCall, PerSession and Singleton services?
PerCall services and Reentrant Concurreny mode : In a case where PerCall services may need reentrancy, if we set the concurrency mode to Single, deadlock is guaranteed, where as if it is In Reentrant mode, we will have no problem.

PerSession services and Reentrant Concurreny mode : PerSession services allow a multithreaded client to access the service instance

Singleton services and Reentrant Concurreny mode : Singleton services allow any threads to access the service instance


What is the effect of Multiple concurrency mode on PerSession services with multithreaded clients?
PerSession services with multithreaded clients can have increased throughput, with Multiple concurrency mode, as no locks are acquired when requests are being processed by a service instance. However, care should be taken to protect shared resources.


What are different .NET multithreading techniques available to protect a shared resource?
1. Monitor
2. Mutex
3. Semaphore
4. ReadWriterLock
5. Interlocked


What are the factors that can influence overall throughput for a service, when multiple concurrency mode is enabled?
1. Instancing mode
2. Concurrency mode
3. Throttling behavior


What is ServiceThrottleBehavior?
ServiceThrottleBehavior provides several settings for throughput control, as shown below.

MaxConcurrentCalls: Maximum concurrent requests allowed. The default is 16 .

MaxConcurrentInstances: Maximum concurrent service instances allowed . The default is int.MaxValue.

MaxConcurrentSessions: Maximum concurrent active sessions. This includes transport, reliable, secure, and application sessions. The default is 10.


Click here for all SQL Server Interview Questions


Click here for all WCF Interview Questions


Click here for all ASP.NET Interview Questions


Click here for all C# Interview Questions


Click here for Written Test or practical ASP.NET Interview Questions asked in MNC's
 
Disclaimer - Terms of use - Contact Us