MTS is primarily a container for in-process
server side components.
In database applications, Transactions
ensure integrity of data by combining a set of
actions into a single atomic unit. A transaction is
said to be committed if all the actions succeed as
a whole and a rollback occurs if they fail. MTS
allows you to define and use transactions within COM
objects.
MTS can also be defined as a component-based
programming model. An MTS
component is a type of COM component that executes in
the MTS run-time environment. To be qualified as an
MTS component, it has to meet all the requirements of
a COM component and the component should be developed
as a DLL. Components that are implemented as EXEs
cannot run in an MTS environment.
Just as a COM component can be modelled
on the basis of interfaces and their implementation,
MTS enforces modelling based on the component's state and behavior. This allows
applications to coordinate their state across
multiple machines. Since they are composed of COM
objects, MTS applications can be implemented in a
variety of different languages including Visual Basic,
Java, C++ and even COBOL!
MTS handles communication between
components through DCOM and HTTP protocols. This
allows MTS to expose its components both to 16-bit
and 32-bit applications from anywhere on the net or
the web.
Some of the unique features that MTS
brings into the component world are:
A unique Threading model : Components that use the
Thread Neutral model (TNA), mark themselves as Free
Threaded or Both. MTS handles thread synchronization
for you by automatically creating threads when
required and preventing you from creating threads of
your own from within MTS components. MTS defines an Activity as a single execution context
( single logical thread of execution ) across
different machines. MTS prevents more than one thread
from calling into an Activity at any single point in
time.
Roles and Packages : MTS takes
Security to a totally new level. Packages are defined
as a collection of MTS components that make up an
application. Roles are a logical
group of users of an MTS application. Security is
administered to the whole package instead of its
individual components. MTS thus separates the
application security model from the OS's security
model. This way, the security level of an MTS
application can be programatically set.
Just in Time(JIT) Activation : MTS
components are created only when they are required
and are released as soon as they have finished. This
concept called Object pooling increases the
efficacy of object life-time management by calling
methods on one of the object's interfaces to tell it
when to obtain and free resources.
The MTS run-time is divided into three
different parts:
|
The Surrogate process (MTS.EXE) |
|
An NT Service called the
Microsoft Distributed Transaction Coordinator
( MS DTC ) |
|
An Administrative tool called
the MTS Explorer |
The Surrogate Process: MTS can wrap
components to provide a single execution context
without you having to write components specifically
for MTS. Once a component is registered as an MTS
object, MTS.EXE will create a surrogate object or a
class factory wrapper for that component and a context
object through COM containment. This
surrogate object now calls the class factory of the
original component. This means that whenever calls
are made to any component, MTS intercepts these calls.
This allows MTS to provide facilities without either
the client or the component having to be specifically
written for MTS. One of the responsibilities of the
context object is to cache the typelib info for each
interface so that MTS can do object pooling
efficiently.
Microsoft Distributed
Transaction Coordinator: The DTC
facilitates distributed transactions. If an MTS
object were to fail during a transaction, all other
objects in the transaction are aborted regardless of
what machine they are running on. This service helps
create transaction context objects that are used
in the component context objects and helps in
ensuring proper rollback of transactions. It is the
MS DTC which provides MTS the scalability and the
fail-safety required of any TP monitor program.
Resource Managers and Resource
Dispensers : While the DTC coordinates
transactions, it relies on the resource providers to
understand particular types of data and know how to
commit or rollback changes on those resources.
Resource Managers handle data that is not lost should
the system fail. If the system should fail, the state
of a dispenser is not maintained because, Resource
Dispensers handle non-durable data. MTS comes with
one resource manager SQL Server 6.5 and a couple of
resource dispensers ODBC Resource dispenser and
Shared Property Manager.
MTS Explorer : To the
system administrator, this is the visible part of MTS.
It has a couple of main roles. It manages the objects
that MTS can use and it allows the administrator to
monitor the state of running objects.
In MTS, methods are invoked across a
network or machine boundaries, using a modified
version of DCE's RPC (like DCOM) or are directly
accessed using the Microsoft Message Queue Sever (MSMQ).
Distributed security services are provided
by the NT Lan Manager (NTLM) security protocol
supported by both Windows and Windows NT.
MTS today relies on the Domain Name
System (DNS) for Directory services. With NT 5.0,
both DCOM and consequently MTS, will make use of a
combination of the Lightweight Directory Access
Protocol (LDAP) and DNS for providing directory
services.
More on this soon...