Transactional Component Services Introduction of MTS 2.0 -- by Ji Xu
What is MTS MTS stands for Microsoft Transaction Server. • MTS is the best technology for building server-centered applications on Windows NT • MTS simplifies the development and deploymentof server-centered applications built using Microsoft Component Object Model (COM) technologies. • MTS is ideal for developing line-of-business and electronic commerce applications with Web-based interfaces, leveraging powerful development tools for scalable, three-tiered development, and building production-quality applications with distributed object technologies.
Three-Tiered Computing Every application, from spreadsheets on personal computers to accounts payable systems on mainframes, has three components: • Presentation components focus on interacting with the user. • Application logic components perform calculations and determine the flow of the application. • Data components manage information that must persist across sessions, planned shutdowns, and systems failures.
2-Tiered vs. 3-Tiered 2-tiered architecture 3-tiered architecture
Reusing two-tiered application logic usually means cutting and pasting code between applications. Databases must maintain connections to each active client. To prevent corruption, once one client has asked for access to a specific piece of data, databases lock the data to prevent other clients from accessing the same data at the same time. Other clients must wait for the database to release the locks before they can proceed with their work. The security model used in two-tiered systems doesn't work well outside trusted LAN environments. Developers can develop reusable application components. Application components can share database connections. Access to resources are through native protocols and application interfaces instead of through data gateways. This improves performance and allows application owners to control access to their data. Middle-tiered application components can be secured centrally using a common infrastructure. Access can be granted or denied on a component-by-component basis, simplifying administration. 2-Tiered vs. 3-Tiered (cont.)
MTS Overview • In MTS applications, application logic components run under the control of MTS on servers and are invoked by presentation-centered components running on clients through Microsoft's Distributed COM (DCOM) technologies. Clients can be a mixture of conventional applications and Active Server Page (ASP) scripts running within Microsoft Internet Information Server (IIS). • Application logic components can access a number of different databases. Access to databases and resources is done through MTS Resource Dispensers that perform services such as connection pooling automatically. MTS also supports automatic transactions so that access to data and resources is done with all-or-nothing protection.
MTS Component Code Template Developers can build presentation and application logic components with any tool or programming language that can generate COM-compliant dynamic-link libraries (DLLs).
Transactions in MTS Consider a simple bank funds transfer application assembled from three components —Transfer, Credit, and Debit—each built by a different developer. • Credit adds an amount to a checking account database. • Debit subtracts an amount from a savings account database. • Transfer moves money from checking to savings by calling Credit and Debit. Assume that Transfer begins work by calling Debit and Credit. Debit succeeds and subtracts $100 from a database. Credit fails because its database was unable to commit successfully. Unless the developer of Transfer has programmed what to do if one of the components has failed, the application will withdraw $100 from the savings account without putting it in a corresponding checking account.
Transaction in MTS (cont.) • MTS makes transaction management transparent to the component developer. • Developers can even use different tools and languages to build their components. • They simply declare components to be transactional using the Transaction Server Explorer. • When a component begins execution, MTS starts a transaction automatically if one is required. • When the component accesses a resource such as a database, MTS automatically enlists the resource in the transaction. If the component calls another component, the called component also joins the transaction automatically. • When all components in a transaction complete their work, MTS initiates a full two-phase commit to either commit or abort the work.
Summary • MTS 2.0 is the easiest way to build and deploy COM-based applications on Windows NT. Developers can use popular development tools such as JAVA, C++ and Visual Basic. • MTS 2.0 offers comprehensive component functionality, such as automatic transaction support, access to popular databases, message queuing products, and mainframe-based applications. • MTS 2.0 is fully integrated with other Windows NT features for ease of Internet/intranet application development, Windows NT clustering services for fail over protection, MSMQ for reliable, loosely coupled communication, and the Windows NT security environment for simplified resource control.