Distributed Transaction (ZZ)

xiaoxiao2021-03-06  45

Cheap computing power and increasing network bandwidth promote the development of components-based distributed computing procedures. As a component-based distributed program is a service architecture. It consists of different application components on a physically independent computer. For users, they are like a single application running on a machine. There are several factors to facilitate the application of distributed systems, not traditional centralized systems. · Distributed application: Some tasks itself is distributed. This feature determines multiple Agent cooperation. In this case, positioning and acquiring effective and most needed computing power and data have priority. · Reliability: Because the system's sharing, cooperation and distribution characteristics, there is no single failure point in the system. Better reliability can be met using new fault tolerance, recovery, and distributing synchronization techniques. · Scalability: The demand for applications is growing, the correct design system, can process more loads by adding new services and hardware. · Performance: These problems are increasingly complex due to more applications involving more applications. In order to solve the increasingly complex problem, we need faster computers that have higher computing power under acceptable prices. · Economic: Get the same level of computing power, using the system of systems distributed in multiple machines can be lower than the user, the heterogeneous application system on the heterogeneous computer through the network is like a single station. Standard application system on physical machines. To achieve such transparency, the distribution is that the system needs to be transparent in the following respects. · Data positioning: For system users, they don't need to know which place in the network. Failure: For system users, they don't need to pay attention to data consistency. Copy: System users don't need to know how data is Copyed · Distribution: System users do not need to know how computational power and data allow users to transparently save, access, and operations to multiple computers through the distributed distributed system, and maintain data when the system is faulty. Integrity. Divide the management of distributed data and transactions into both levels and global two levels. Local data managers or resource managers can access and operate local data and resources. Resource managers provide data transparent positioning, data model, and security and authorization control of the database. Local trading manager is responsible for handling initialization, monitoring, and termination of computing system transactions. The distributed transaction system depends on the transactions related to the network to extend the scope of the local trading system. The transaction is a set of groups of statements representing a working unit that they must be executed as a unit. Trading is a sequence in resource operations such as read, write or update. These operation sequences convert the system from a steady state into a new steady state. In order to reflect the entity in the system, a transaction should have the following characteristics: · Atomic: This feature does not do or all do not do it. The sequence of operation is or successful or failed. A transaction should be considered a single operating unit. The completed transaction should be submitted, and the unfinished transaction should be rolled back or restored to its start state. Never only some work is submitted. · Consistency: A transaction reflects a continuity between resources. Consistency care is the fact that correctly reflects the state of resources. Examples of consistency have database completion, uniqueness of primary key in the table. · Independence: A transaction should not expose his outcome to other concurrent transactions before it is submitted. Independence ensures that the data being updated will not be accessed. Another name independent is serialized. · Persistence: The result of a completed transaction should be saved, and cannot be cleared from the database due to system errors. Resource managers should ensure that the results of the transaction will not be changed when the system fails. The basic principle of transaction processing In order to reflect the true state of the entity, each transaction should have the above four characteristics. The application components and resources of the centralized computing environment are positioned to a single machine, and the transaction management only includes a local data manager running on a single machine. Unlike this, all resources in distributed computing environments are distributed in multiple systems. In this case, transaction management includes two levels of local and global. A local transaction includes activities in a single local resource management. A distributed or global transaction is performed in multiple systems.

It performs a collaborative work that requires a global transaction management system and the system involved in the system. Resource managers and trading managers are also two major elements of a trading system as a transaction system. In a centralized system, transaction processing monitors and resource managers are integrated into DBMS services. To support the more advanced features based on components-based distributed systems, it is necessary to separate the TP monitor from the resource manager. The most common structure of the transaction management classification trading enterprise system is as follows: • Small mode TP: This structure does not require any independent transaction management middleware. Each SQL statement is considered to be a separate transaction. This way is used to use the database stored procedure to process updates. Since most of the RDBMS providers provide some integrated TP tools, each transaction is defined as a stored procedure. This approach has a replication server. The primary server data is updated by the stored procedure, and the second data is replicated by using a replication server. · Mathematical TP: This method is used for business-level trading systems. It needs to provide an interface to the original system. It uses a distributed transaction manager to handle transaction updates. It is divided into two subclasses, one, using a separate trading manager, such as CICS, Encina, Tuxedo or TOPEND. Second, the TP monitor is placed in the application server like a WebSphere or IPlanet application server or Microsoft's trading server. There are two ways to illustrate the transaction. · Planning: In a planned trading specification, a group or an operational sequence is defined as a transaction. The most common way is to mark threads that perform transaction processing operations. Transactions can be suspended by canceling. The transaction is restarted later by clear replication transaction context (cluster starting point to restart points). Submit request commands all the participation of resource manager permanently records the impact of trading operations. Rollback requests to let resource manager revoke the impact of transaction operations. · Declaring: Component-based transaction processing system, like the COM of EJB-based application servers and Microsoft's trading servers, supports Declarative trading specifications. This way, when configuration, the component is marked as a transaction. This has two meanings. First, the responsibilities of the transaction are transferred from the application to the host container of the component. Second, the effective time of the transaction is delayed from the application of the application to the formation configuration. Propath is a global or distributed transaction consisting of some sub-transactions, which is used as a single heavy accessible atomic unit. The responsibility of the global trading manager is to manage distributed transactions by adjusting different resource managers to access data in different systems. Since there are multiple application components and resource participation in a transaction, the transaction manager should establish and record the status of the transaction when transaction occurs. This feature can be obtained by using a transaction context. Transaction contexts are resource transaction operations and one link between components that call these operations. During the transaction process, all threads involved in the transaction share the same transaction context. During a transaction process, the scope of the transaction context is logically wrapped all the operations on the transaction resource. The transaction manager needs to analyze the transaction request and break down into multiple sub-transactions, copy the transaction context, and send them to the associated resource manager. Under the control of the resource manager, the transaction context is usually transparent. The resource manager relies on the process of serving the resource to inform the trading manager to join the transaction. The trading manager maintains the trajectory of all resources added to the transaction, and adjusts the transaction performance of resource managers through two-way submission and recovery protocols. At the end of the transaction, all the resources used to be removed, whether the submission is still rolled, and all resources are removed. The transaction manager must monitor the implementation of the transaction decision to submit a change in returning transactions to ensure the atomicity of the transaction. Two-section submission protocols in the two-way submission transactions and all transactions have ensured that the resource manager or submit or abandon the transaction. As shown in the figure below, when the application sends a transaction submission request, the transaction manager sends prePare_to_commit requests to all called resource managers. All resource managers sequentially send a response to preparation for yourself.

Just when all resource managers are ready to submit, the transaction manager sends a submission request commit to all resource managers. Alternatively, the transaction manager sends a rollback request (ABORT) to the resource manager, the transaction is rolled back. Although 2PC guarantees the autonomy of the transaction, the necessary processing load is too heavy, often generating an update conflict, especially when there is duplicate data. Data replication is a way to reduce conflicts, which is useful when transder-based update reproduction is not required. Most distributed systems are parallel to match the needs of the application accordingly in both ways. It is equilibrated between two paragraph submit (2PC) and replication server methods. Both of them differ from one of the transaction stages and another operation is a periodic update. Guidelines are 1) Saiping Data Copy 2) If the data needs to be synchronized as a transaction, the number of copies is less and 2PC, 3) 4) If the network and nodes are unreliable, the replication server is used. Synchronous control is another critical feature. It allows multiple users to access data at the same time, increasing the system throughput and execution. When obtaining the same logic results, the system allows transactions to synchronize as if they are executed continuously. Cooperative control agrees that multiple transactions are simultaneously read and update data, which includes the management of resources required for transaction scheduling and transaction performance. The serialization of most transactions is relied on lock mechanisms, such as two-stage locking methods, time counseling. Two-stage lock algorithms are the most common applications in a distributed transaction system that can achieve synchronous update and cooperation. Typically, suppliers combine cooperative control technology such as 2PL, consistency control technology such as 2PC, timeout control in order to solve dead locks, combined into a single implementation for global distributed transaction management. The queue transaction processing direct trading process is synchronized, and the initial trading creator is blocked until the trading manager starts running. Unfortunately, the client of the transaction or the server communication will sometimes fail. Sometimes, some transactions have a high request, which requires priority processing. This synchronous transaction processing mode cannot process these situations well. This has led to the development of the use of the asynchronous transaction processing mode of the queue. The queue is a trading resource, and the actions on the queue include enter the team and out. Two mechanism processing queues are defined in the J2EE platform. One is to use the native JMS API and the other is to use the message bean, which is defined in EJB2.0. The developer of the JMS API application component in the transaction should not use the JMS request-answering example in a single transaction. Until the transaction is submitted, a JMS message will not be delivered to its ultimate goal, and the acceptance of the response in the same transaction will never happen. Because a container manages a transaction that represents the JMS session of Bean. The parameters of the CreateQueESession (Boolen Transacted, Int AcknowledgeMode) and CreateTopSession (Booleantransacted, int AcknowledgeMode) are ignored. We recommend that component developers specify a handled session to provide 0 as a value of Acknowledgement. Keep in mind the JMS Acknowledge () method is important in a transaction or in a transaction that does not specify, this is important. The confirmation of an undetermined transaction context message is processed by a container with JMS Auto_AcknowledgedGe symbol. Message-Driven Beans Message Drive Beans A Message Drive Bean is a consumer of asynchronous messages, which is called by the container when a JMS message arrives. From a customer's point of view, the message driver bean is a consumer of JMS messages. It has completed some business logic on the server. The client accesses the JMS target (queue or the subject) via the JMS to access the message to the JMS target (queue or the subject), because the message driver bean class is a message listener. The message driver bean does not have a Home and Remote interface, which is stateless. They are like stateless Session beans: When they do not include a message on a client, all bean instances are the same.

A message driver bean instance is created by a container as a consumer processing message process. Container controls its lifetime. However, instance variables for instances of instance messaging beans can maintain their own status through the message operation of the client. This situation includes an open database connection and a reference to the EJB object. Message-driven bean mode is developing into a business bean, which is asynchronous to process accepted JMS messages. The development work is as simple as other JMS message listeners. Relying on the message-driven bean instance pool provided by the container, it can also process a string message at the same time. The transparent target of standard distributed TP environments requires the ability to work together between the transaction manager and TMS with resource managers. Currently, there are two open standards, namely X / Open DTP mode, and ISO TP mode. Trading managers who come to different providers in an open environment can communicate with each other through ISO TP protocol. ISO TP does not follow more. In another aspect, the X / Open distributed transaction processing mode is a standard proposed by an open organization. Currently, most commercial transaction processing and relational database solution providers follow this standard. The main principle of this model: · Application components implements transaction operations · Resource Manager to control resources · Trading Manager and resource manager to handle a global trading below is the main side, TX interface that is particularly mentioned in this mode: this interface is located Requests and transaction managers are implemented by traders. It provides transactions by providing the application component and transaction operation binding. • XA interface: This interface is located between resource managers and traders. When transaction managers (or TP monitors) and RDBMS or EIS's resource manager supports XA interface, they can be organized together. This is the most important excuse of the standard has been accepted by the industry in the X / Open DTP Standardx / Open DTP mode has been widely used in the industry. Commercial trading management software is like TXSeries / Encina, Tuxedo, Topend and AT & T GIS support TX interfaces. Most commercial databases such as Oracle, Sybase, Informix, and Microsoft SQL Server and message middleware, such as IBM's MQSeries, and Microsoft's MSMQ Server implements XA interfaces. Some J2EE Configurations Some J2EE Structure J2EE is a schema-based framework. Support for transactions is the main aspects of the J2EE architecture. Component providers can provide trading boundaries in component code using Java Trading API (JTA). On the other hand, with the publication of the trading specifications supporting the enterprise beans, the transaction can be automatically started and completed by the container. The J2EE server implements the transaction manager and a communication protocol for the trading manager and the database system that supports JDBC API, including the replication mechanism of the transaction context, and optional distributed two-segment submission. The J2EE platform currently supports flat transactions, which cannot be nested in such transactions. There is such a possibility, a transaction request uses the Serverlets and JSP pages to access multiple EJBs in a transaction. Each component allows one or more connections to access one or more resource manager Figure 4. Recommended J2EE Configurations. It is necessary to emphasize that although multiple solutions are available for a specific application. Different, in all possible configurations, we strongly recommend the following "Case I: Stand-Alone Client <-> EJB Container <-> RDBMS / Eis Resources This structure is from two-layer customer server mode. . In general, there is a fat client written with SWING, which communicates directly with commercial logic in EJB. This EJB is located in an EJB container in the application server. · Case II: Browser <-> Web Container <-> RDBMS / Eis Resources This configuration is common in a small-scale web application.

转载请注明原文地址:https://www.9cbs.com/read-80716.html

New Post(0)