您的位置:寻梦网首页编程乐园Java天地JSP 专辑JSP001 HTML 离线版
Java 天地
JSP001 HTML 离线版
精选文章 >> websphere >> First Eye at IBM WAS(3)

由 george 发布于: 2001-03-05 06:00

Post

Understabding Ditributed Computing is of importance for understanding WAS, so I post the artical to introduce some basic concepts involved in distributed computing including concise review of transaction.

Distributed computing and WebSphere Application
Server

WebSphere Application Server provides an environment for open distributed computing. Users and processes on a wide variety of platforms can interact by using the facilities provided by WebSphere. Both the Advanced Application Server and the Enterprise Application Server provide a distributed computing environment.

Three-tiered client/server computing

A common way of organizing software to run on distributed systems is to separate functionality into two parts--clients and servers. A client is a program that uses services provided by other programs called servers. The client makes a request for a service, and a server performs that service. Server functionality often involves some sort of resource management, in which a server synchronizes and manages access to the resource, responding to client requests with either data or status information. Client programs typically handle user interactions and often request data or initiate some data modification on behalf of a user.

For example, a client can provide a form on which a user (a person using a Web browser, for example) can enter orders for a product. The client sends this order information to the server,which checks the product database and performs tasks needed for billing and shipping. A single server is typically used by multiple clients. For example, dozens or hundreds of clients can interact with a handful of servers that control database access.

A common design of client/server systems uses three tiers: a client that interacts with the user,an application server that contains the business logic of the application, and a resource manager that stores data. This approach is shown in Figure 1. In this model, the client is isolated from having to know anything about the actual resource manager. If you change the database you are using, the server may have to be modified, but the client does not need to be
modified. Because there are usually fewer copies of the server than the client, and because the servers are often in locations that are easier to update (for example, on central machines rather than on PCs running on users' desks), the update procedure is also simplified.
Furthermore, this approach provides additional security. Only the servers, not the clients, need access to the data controlled by the resource manager.

Figure 1. Three-tiered client/server architecture

WebSphere Application Server provides the middle tier in this architecture, allowing clients--applets, Visual Basic(R) clients, C++ clients, and so on--to interact with data resources (RDBMS,and so on) as well as with existing applications.

A transaction is a set of operations that transforms data from one consistent state to another.This set of operations is an indivisible unit of work, and in some contexts, a transaction is referred to as a logical unit of work (LUW). A transaction is a tool for distributed systems programming that simplifies failure scenarios.

Transactions provide the ACID properties:

Atomicity: A transaction's changes are atomic: either all operations that are part of the
transaction happen, or none happen.

Consistency: A transaction moves data between consistent states.

Isolation: Even though transactions can run (or be executed) concurrently, no transaction sees another's work in progress. The transactions appear to run serially.

Durability: After a transaction completes successfully, its changes survive subsequent failures.

As an example, consider a transaction that transfers money from one account to another. Such a transfer involves deducting money from one account and depositing it in another. Withdrawing the money from one account and depositing it in the other account are two parts of an atomic transaction: if both parts cannot be completed, neither must happen. If multiple requests are processed against an account at the same time, they must be isolated so that only a single transaction can affect the account at one time. If the bank's central computer fails just
after the transfer, the correct balance must still be shown when the system becomes available again: the change must be durable. Note that consistency is a function of the application; if money is to be transferred from one account to another, the application must subtract the same
amount of money from one account that it adds to the other account.

Transactions can be completed in one of two ways: they can commit or roll back. A successful transaction is said to commit. An unsuccessful transaction is said to roll back. Any data modifications made by a rolled back transaction must be completely undone. In the above example, if money is withdrawn from one account but a failure prevents the money from being deposited in the other account, any changes made to the first account must be completely
undone. The next time any source queries the account balance, the correct balance must be shown.

A distributed transaction is one that runs in multiple processes, usually on several machines.Each process works for the transaction.

Distributed transactions, like local transactions, must adhere to the ACID properties. However, maintaining these properties is greatly complicated for distributed transactions because a failure can occur in any process, yet even in the event of such a failure, each process must
undo any work already done on behalf of the transaction.

A distributed transaction processing system maintains the ACID properties in distributed transactions by using two features:

Recoverable processes: Recoverable processes log their actions and thus can restore earlier states if a failure occurs.

A commit protocol: A commit protocol enables multiple processes to coordinate the committing or aborting of a transaction. The most common commit protocol, and the one used throughout WebSphere Application Server, is the two-phase commit protocol.



资料来源: JSP001.com