COM+ 1.x Overview

COM+ 1.x Overview
Frank E. Redmond III
Program Manager
COM+
Microsoft Corporation
1-301
COM+ 1.x Goal
Provide services that will increase the
overall scalability, availability, and
manageability of COM+ 1.0
applications
Agenda



Scalability Enhancements
Availability Enhancements
Manageability Enhancements
Scalability Enhancements


Process Recycling
Configurable Isolation Level
Process Recycling

Problem: The performance of most
applications degrades over time





Reliance on third-party code of
uncertain quality
Memory leaks
Non-scalable resource usage
Solution: Shut down and restart the
application’s process
Developer Benefit: A quick fix for
known problems and a guard
against unexpected ones
Process Recycling

Configured using COM+ Admin SDK

Application.RecycleLifetimeLimit


Application.RecycleCallLimit


# of activations
Application.RecycleMemoryLimit


# of calls
Application.RecycleActivationLimit


Elapsed time
Amount of memory used
Application.RecycleExpirationTimeout

Delay before recycled process is terminated
Process Recycling

Retrieve the InstanceID for the application


ICOMAdminCatalog2::GetInstanceIDFromAppID
Recycle the process!


ICOMAdminCatalog2::RecycleProcess
Specify reason for recycling






CRR_LIFETIME_LIMIT
CRR_ACTIVATION_LIMIT
CRR_CALL_LIMIT
CRR_MEMORY_LIMIT
CRR_RECYCLED_FROM_UI
CRR_NO_REASON_SUPPLIED
Process Recycling

Interested parties notified via COM+
Events

ICOMProcessRecycle::ProcessRecycled(
[in] BSTR bstrAppID,
[in] BSTR bstrInstanceID,
[in] DWORD dRecycleReason)
ICOMAdminCatalog2::RecycleProcess(…)
DllHost.exe
COM+ System App
If IsCallerInRole(“Administrator”)
{
CoRecycleThisDllHost(…)
StartTimer(…)
}
OLE32
CoRecycleThisDllHost(…)
{
…
FireProcessRecycledEvent(…)
}
Configurable Isolation Level


Isolation level = The extent to which
changes made outside a transaction
are ‘visible’ to that transaction
‘Visibility’ of external changes
(isolation level) controlled using
locks
Configurable Isolation Level

Locks used to control…



Whether current TX can ‘see’
uncommitted data - Dirty Reads
Whether other TX’s can modify
existing data before the current TX
ends - Unrepeatable Reads
Whether other TX’s can add new data
before the current TX ends - Phantom
Reads
Configurable Isolation Level
Isolation Level
Dirty Reads Unrepeatable Reads Phantom Reads
Read Uncommitted
Read Committed
Repeatable Read
Serializable


Yes
No
No
No
Yes
Yes
No
No
Lower Isolation level = Less
locking, more concurrency, higher
potential for incorrect data
Higher Isolation level = More
locking, less concurrency, lower
potential for incorrect data
Yes
Yes
Yes
No
Configurable Isolation Level

Problem: COM+ 1.0 uses highest
possible isolation level
(SERIALIZABLE) to guarantee
correct data




Overkill for some applications
Better to be safe the sorry 
Solution: Allow developers to
choose the desired isolation level
Developer Benefit: Potential for
increased concurrency,
performance, and scalability
Configurable Isolation Level

Root component determines the
isolation level for the entire TX


CCI downstream component w/
isolation level higher than root =
E_ISOLEVELMISMATCH
Component isolation level = ‘None’
means any isolation level ok


Isolation Level = ‘None’ on root
component defaults to SERIALIZABLE
Better to be safe than sorry 
Configurable Isolation Level

Configured using the COM+ Admin
SDK

Component.IsolationLevel
Agenda



Scalability Enhancements
Availability Enhancements
Manageability Enhancements
Availability Enhancements


Applications as NT Services
Memory Gates
Applications as NT Services



Problem: COM+ 1.0 Applications
cannot run as NT services
Solution: Allow COM+ 1.x
applications to run as NT services
Developer Benefit:



COM+ applications can be started at
system boot or in order
COM+ applications can be run as
LocalSystem
COM+ applications can be easily made
Cluster-aware
Applications as NT Services

Configured using the COM+ Admin
SDK

Application.RunAsService
Memory Gates

Problem: Creating components in lowmemory situations




Enough memory to create component but
not enough to actually use it
Low-memory error-handling code typically
not well debugged
Solution: Don’t allow servers to be
loaded or components to be created in
low-memory situations
Developer Benefit: Increased reliability
by avoiding not-so-well-debugged lowmemory error-handling code
Memory Gates

Process creation memory gate


Object creation memory gate


E_OUTOFMEMORY if > 90% of virtual
memory being used
E_OUTOFMEMORY if > 95% of virtual
memory being used
Both gates checked in Service
Control Manager (SCM)
Agenda



Scalability Enhancements
Availability Enhancements
Manageability Enhancements
Manageability Enhancements





Pause/Disable Applications
Process Dump
Alias Components
Public/Private Components
Application Partitions
Pause/Disable Applications



Problem: No way to control
component activations
Solution: Allow
administrative/programmatic
control of component activation
Developer Benefit: COM+
applications more manageable
Pause/Disable Applications

Pause – Prevents future activations



Existing component
instances/references unaffected
CoCreateInstance & CoGetClassObject
return E_APP_PAUSED for paused apps
Only works for COM+ Server applications




Does not work for COM+ library applications
Does not work for ‘classic’ COM components
ICOMAdminCatalog::PauseApplication
Resume – Allows future activations

ICOMAdminCatalog::ResumeApplication
Pause/Disable Applications

Disable – Prevents future activations



Existing component instances/references
unaffected
CoCreateInstance & CoGetClassObject return
E_APP_DISABLED for disabled apps
Works for COM+ applications (server and
library) and individual COM+ components



Does not work for ‘classic’ COM components
Enable – Allows future activations
Application::Enabled/Component::Enabled
attribute in COM+ Catalog

Enabled status maintained between reboots
Process Dump



Problem: Difficult to troubleshoot
COM+ applications in production
environment
Solution: Allow administrator to
dump the entire state of a process
without terminating it
Developer Benefit: COM+
applications much easier to
troubleshoot
Process Dump

Process dump generated using
userdump.exe


Leaves target process virtually
unscathed



User-mode process dump tool takes
snapshots of running processes
Does not “invade” target process
Target process can continue to run
after snapshot is taken
COM+ gives userdump.exe full
pathname of dump file
Process Dump

Dump file configured per COM+
application using the COM+ Admin
SDK

Application.DumpFilePath

Path only (no filename) COM+ generates
filename based on application name


Application.MaxDumpFiles


MyApp001, MyApp002, etc.
Avoids overwriting existing dump files
COM+ does NOT:


Install userdump.exe
Do dump file management (Deleting,
archiving, etc.)
Alias Components




CLSID = Implementation (code) +
Configuration Requirements
Problem: Implementation sharing
done at source code level
Solution: Allow implementation
sharing to be done at binary
COMponent level
Developer Benefits:



Less code to write, debug, maintain!
Lower development cost!
Faster time to market!
Alias Components

Many CLSIDs sharing a single
binary (DLL) implementation

Configurations may be different!
CLSID1
CLSID2
CLSID3
CLSID1
CLSID4
Public/Private Components


Problem: All COM+ components are
public
Solution: Allow both public and private
components




Similar concept as public/private methods of
VB or C++
Public components can be activated from
other applications
Private components can only be seen and
activated from other components within the
same application
Developer Benefit: More control of
functionality exposure

Component-based application development
is even easier
Application Partitions



Problem: Only a single
application/component
configuration is allowed on a single
machine
Solution: Allow multiple
configurations of a single
application/component on a single
machine
Developer Benefit: Easier to
manage a few large servers vs.
many small servers
Application Partitions

Partitions represent logical machine
boundaries within a single physical
machine



E.g. Test Partition, Production
Partition, etc…
‘Base Partition’ represents the actual
physical machine
COM+ applications are installed into
one or more partitions

Allows multiple COM+ application
installations/configurations on a
single machine!
Application Partitions

Partitions are grouped into partition
sets





Partition set represents a group of
logical machines
One partition in the set is always
marked as the ‘Default’ partition
Users/OUs are assigned to a single
partition set
Users can only access components
from partitions in their partition set
Everyone can access the base
partition
Application Partitions


Users/OUs bound to a partition set
Partition set composed of partitions
Active Directory
Org Unit
Partition
Set
User
Partition
Application
Machine
Application Partitions

CCI behavior varies based on
caller’s ‘partition context’

If ‘partition context’ exists, CCI
searches for:




Private component
Public component in ‘current’ partition
Public component in base partition
If ‘partition context’ does not exist…

CCI establishes it based on caller identity,
then searches for:


Public component in ‘current’ partition
Public component in base partition
Application Partitions
COM+
Partition 1
Partition 2
App 1
App 2
App 1
App 3
CLSID1
CLSID2
CLSID3
CLSID4
CLSID5
CLSID1
Base Partition
Lib 1
CLSID1
CLSID5
Demo Time!!!!!
Summary



Build component-based
applications using COM+ 1.0 today!
Microsoft will continue to provide
new and innovate component
services tomorrow and into the
future!
Benefit: Cheaper/Easier to build
scalable, reliable, manageable
component-based applications!
Additional COM+ Sessions

Monday




1- 301COM+ 1.x Overview
1- 404 Understanding COM+ Security
Pt.1
1- 405 Understanding COM+ Security
Pt.2
Tuesday



1- 306 Intro to COM+ Partitions
1- 309 Using COM+ Queued
Components
1- 308 Using COM+ Events
Additional COM+ Sessions

Wednesday




1- 305 Increasing Your Windows DNA
Application Scalability w/ Load
Balancing
1- 402 COM+ Internals
1- 403 Maximizing COM+ Application
Throughput
Thursday



1- 401 COM+ Base Services
1- 307 Measuring Windows DNA
Application Performance
1- 201 Understanding SOAP
Additional Resources

Microsoft COM Website


MSDN Website



http://msdn.microsoft.com
Microsoft Platform SDK


http://www.microsoft.com/com
http://msdn.microsoft.com/developer/sdk/platform.asp
Platt, Understanding COM+. Microsoft
Press, 1999.
DCOM mailing list

http://msdn.microsoft.com/workshop/essentials/mail.asp