Presentation is loading. Please wait.

Presentation is loading. Please wait.

Maximizing COM+ Application Throughput Steve Swartz Program Manager COM+ Team Microsoft Corporation 1-402.

Similar presentations


Presentation on theme: "Maximizing COM+ Application Throughput Steve Swartz Program Manager COM+ Team Microsoft Corporation 1-402."— Presentation transcript:

1 Maximizing COM+ Application Throughput Steve Swartz Program Manager COM+ Team Microsoft Corporation 1-402

2

3 Overview Throughput: What and How Throughput: What and How COM+ Threading COM+ Threading COM+ Process Pooling COM+ Process Pooling COM+ Synchronization COM+ Synchronization COM+ Activation COM+ Activation

4 Demo

5 Throughput Throughput defined Throughput defined Throughput and infrastructure Throughput and infrastructure Throughput and scalability Throughput and scalability Throughput and performance Throughput and performance Performance vs. scalability Performance vs. scalability

6 Throughput and Resources Maximizing throughput means using resources efficiently Maximizing throughput means using resources efficiently Minimize create/destroy costs Minimize create/destroy costs Acquire late/release early Acquire late/release early Avoid creating too many resources Avoid creating too many resources Avoid waiting for resource Avoid waiting for resource Avoid requiring particular resources Avoid requiring particular resources Avoid holding unused resources Avoid holding unused resources

7 Throughput and COM+ COM+ services relevant to throughput: COM+ services relevant to throughput: Thread models & pools Thread models & pools Synchronization domains Synchronization domains Process pools Process pools JIT and Object Pools JIT and Object Pools

8 Costs to keep in mind XProcess vs. XThread calls XProcess vs. XThread calls Regular vs. context marshalling Regular vs. context marshalling Activations and calls Activations and calls Cross-machine hops vs. localization Cross-machine hops vs. localization

9 Overview Throughput: What and How Throughput: What and How COM+ Threading COM+ Threading COM+ Process Pooling COM+ Process Pooling COM+ Synchronization COM+ Synchronization COM+ Activation COM+ Activation

10 COM+ Threading Models Apartments vs. threads Apartments vs. threads Single threaded apartments Single threaded apartments Concurrency & reentrancy Concurrency & reentrancy Thread-local storage Thread-local storage STAs are a bottleneck STAs are a bottleneck The multi-threaded apartment The multi-threaded apartment The neutral apartment The neutral apartment

11 COM Threads RPC Thread Pool (MTA) Main STA MTA Pool Process

12 COM+ Threads RPC Thread Pool (MTA) Main STA MTA Pool STA Pool Process

13 STA Pool vs. MTA Pool STA pooled objects STA pooled objects Contend for a specific thread Contend for a specific thread Cannot take advantage of new threads Cannot take advantage of new threads MTA pooled objects MTA pooled objects Contend for all threads Contend for all threads Can take advantage of new threads Can take advantage of new threads

14 Example: STA Pool What you have to change to use the STA Thread Pool: What you have to change to use the STA Thread Pool:

15 Server App Hints Server App==OutOfProc COM+ App Server App==OutOfProc COM+ App Stick to one thread model Stick to one thread model Concentrate on parent objects Concentrate on parent objects Avoid shared child objects Avoid shared child objects Neutral apartment for infrastructure objects Neutral apartment for infrastructure objects

16 Library App Hints Library App==InProc COM+ App Library App==InProc COM+ App Behavior of caller matters Behavior of caller matters Are your object references shared? Are your object references shared? Are you called from different kinds of apartments? Are you called from different kinds of apartments? Specify known callers threading model Specify known callers threading model Both for single user/unknown caller Both for single user/unknown caller Neutral for many user Neutral for many user

17 Overview Throughput: What and How Throughput: What and How COM+ Threading COM+ Threading COM+ Process Pooling COM+ Process Pooling COM+ Synchronization COM+ Synchronization COM+ Activation COM+ Activation

18 Process Pooling??? Process pools can help throughput when youve got: Process pools can help throughput when youve got: Single-threaded applications Single-threaded applications Applications that serialize the processing of requests Applications that serialize the processing of requests Apps prone to server sized slowdowns or bottlenecks Apps prone to server sized slowdowns or bottlenecks

19 Example: Process Pooling What you have to change to use Process Pools: What you have to change to use Process Pools:

20 Overview Throughput: What and How Throughput: What and How COM+ Threading COM+ Threading COM+ Process Pooling COM+ Process Pooling COM+ Synchronization COM+ Synchronization COM+ Activation COM+ Activation

21 STA Synchronization Prevents concurrent access Prevents concurrent access Allows reentrancy (to avoid deadlocks) Allows reentrancy (to avoid deadlocks) Allows multiple copies (in different apartments) Allows multiple copies (in different apartments) A Throughput Bottleneck A Throughput Bottleneck

22 COM+ Activities Synchronization domains Synchronization domains Four levels of configuration Four levels of configuration Requires New Requires New Requires Requires Supports Supports Not supported Not supported Cross-apartment, not out-of-proc Cross-apartment, not out-of-proc

23 COM+ Synchronization Prevents concurrent access Prevents concurrent access Allows reentrancy Allows reentrancy Allows multiple copies Allows multiple copies Can be used in MTA Can be used in MTA Less of a throughput bottleneck Less of a throughput bottleneck

24 Example: Synchronization What you have to change to use COM+ synchronization What you have to change to use COM+ synchronization

25 Overview Throughput: What and How Throughput: What and How COM+ Threading COM+ Threading COM+ Process Pooling COM+ Process Pooling COM+ Synchronization COM+ Synchronization COM+ Activation COM+ Activation

26 Programming Models COM+: Fewer longer-lived clients COM+: Fewer longer-lived clients IIS: Many transient clients IIS: Many transient clients Focus on COM+ model, BUT… Focus on COM+ model, BUT… … IIS is COM+s longer-lived client … IIS is COM+s longer-lived client

27 Optimizing COM+ Activation JIT JIT Object Pooling Object Pooling Recent TPC-C benchmarks Recent TPC-C benchmarks

28 JIT On Activation, Proxy/Stub created On Activation, Proxy/Stub created Object created at first use Object created at first use Object controls its own lifetime Object controls its own lifetime JIT enables scalable programming model JIT enables scalable programming model JIT is not useful by itself JIT is not useful by itself

29 Object Pooling Pool of stateful instantiations Pool of stateful instantiations Request/wait architecture Request/wait architecture When should I pool objects When should I pool objects When create costs are relatively high When create costs are relatively high When use costs are relatively low When use costs are relatively low When an object will be reused often When an object will be reused often Experiment! Experiment! Dont pool objects with client- specific state Dont pool objects with client- specific state

30 Object & Connection Pools Object Pools are 2x faster Object Pools are 2x faster Object Pools are asynchronous Object Pools are asynchronous Object Pools handle min/max well Object Pools handle min/max well Object Pools handle more resources Object Pools handle more resources Object Pools handle more resource types Object Pools handle more resource types

31 JIT and Object Pooling JIT caches COM infrastructure JIT caches COM infrastructure Object pool caches state, objects Object pool caches state, objects Together, they Together, they Minimize overhead of starting work Minimize overhead of starting work Minimize size of resource caches Minimize size of resource caches Maximize throughput Maximize throughput

32 Example: JIT and Object Pooling What you have to change to use JIT and Object Pooling: What you have to change to use JIT and Object Pooling: Client does not call Release() Client does not call Release() Server must call SetComplete() Server must call SetComplete() Server must implement IObjectControl Server must implement IObjectControl Server must be thread-neutral Server must be thread-neutral Server must enlist itself Server must enlist itself

33 Example: JIT and Object Pooling Queued Pool of MTA Threads JITted Objects in Object Pool ISAPI SQL Server

34


Download ppt "Maximizing COM+ Application Throughput Steve Swartz Program Manager COM+ Team Microsoft Corporation 1-402."

Similar presentations


Ads by Google