Sunday, April 17, 2005

Who Are The Host Of Smile Jamaica Tvjjamaica

PostgreSQL and Mysql Transaction Processing in Distributed Systems

Transaction
A transaction is a logical unit of work, which does not necessarily consists of a single transaction in the database, rather, is generally a sequence of such operations by which a consistent state of the database is transformed into another consistent state, without retaining by force consistency all points in between. The important point here is to ensure that the database back to a consistent state at the end of the execution of a transaction.
A transaction is also invoking a remote procedure call (RPC) running a set of operations on a database under the principle of all or nothing.

The fundamental concept here is the notion of "consistent execution? or "reliable? associated with the concept of a query. The transaction concept is used within the domain of the database as a basic unit of computing consistent and reliable.

Example 3.1: Consider the following query in SQL to implement the 10% of the project budget? CAD / CAM? of the database? J?.

J (JNO, JNOMBRE, BUDGET, LOCATION)

UPDATE J

SET BUDGET = BUDGET * 1.1

WHERE JNOMBRE =? CAD / CAM?

This query can be specified using SQL notation, as a transaction giving it a name:

Begin_transaction ACTUALIZA_PRESUPUESTO

begin

UPDATE J

SET BUDGET = BUDGET * 1.1

JNOMBRE WHERE =? CAD / CAM?

End.

Example 3.2: Consider a booking agency for airlines with the following relationships.

FLIGHT (FNO, DATE, SRC, DEST, STSOLD CAP)

CUST (CNAME, ADDR, BAL)

FC (FNO, DATE, CNAME, SPECIAL)

A simplified version of a typical reservation can be implemented by the following transaction:

Begin_transaction BOOKING

begin

input (flight_no, date, customer_name)

EXEC SQL

FLIGHT UPDATE

STSOLD SET + 1 = STSOLD

WHERE FNO = flight_no

AND DATE = date

EXEC SQL

INSERT

INTO FC (FNO, DATE, CNAME, SPECIAL)

VALUES (flight_no, date, customer_name, null)

Output (?Reservación terminada?)

End.

recovery mechanisms

In order to support a favorable response to the execution of transactions, the DBMS (System Database Manager) should handle the transaction processing. That is, should ensure that if the transaction runs some changes and then a fault (for whatever reason) before it reaches the normal end of the transaction, those changes will be void. Thus, either the transaction takes place in full, or canceled in its entirety. In this way we can persuade a sequence of operations, which in essence is not atomic, be apparent from an external point of view. The system component responsible for achieving this look is known as Manager atomicity of transactions, and COMMIT operations (committing) and ROLLBACK (back) are the key to its operation.

COMMIT operation signals the successful completion of the transaction: it tells the transaction manager that has successfully completed a logical unit of work, the database is (or should be) back in a consistent state, and that can make permanent any changes made by that unit of work.

ROLLBACK operation, however, notes and unsuccessful term of the transaction: it tells the transaction manager that something went wrong, the database could be in an inconsistent state and that all changes made so far by the logical unit of work should go back or canceled.

Example 3.3: Considering Example 3.2, consider the case when there are no seats available for booking.

Begin_transaction RESERVACION2

begin

input (flight_no, date, customer_name);

EXEC SQL

SELECT STSOLD, CAP

INTO temp1, temp2

FROM FLIGHT

WHERE FNO = flight_no

AND DATE = date

If temp1 = temp2 Then

Output (? No There are seats available?)

Abort

else

EXEC SQL

UPDATE FLIGHT

SET STSOLD = STSOLD + 1

WHERE FNO = flight_no AND DATE = date

EXEC SQL

INSERT

INTO FC (FNO, DATE, CNAME, SPECIAL)

VALUES (flight_no, date, customer_name, null)

Commit

Output (? Reservation finished?)

endif

End.

ACID (Atomicity, Consistency, Isolation, Durability)

A transaction has four basic properties

Atomicity . A transaction is an indivisible unit of work, all its actions are a Success in failure ("all or nothing").
consistency. After running a transaction must leave the state system should correct or abort. If the transaction can not reach a final state must return the system to its original state.
Isolation. The behavior of a transaction is not affected by the fact that other transactions may be running concurrently, in other words, a transaction can not reveal their results to other concurrent transactions before they commit. The transaction must serialize all accesses to shared resources and ensure that no concurrent program interfere with their respective operations.
durability. The effects of a transaction are permanent after its recording. Your changes should survive system failures. (Persistence).
LOG
ROLLBACK operation is based on the use of a? Logbook?. The DBMS (System Database Manager) maintains a daily log or on tape or disk (most commonly), which are recorded details of all update operations, in particular, initial and final values \u200b\u200bof the modified object. Therefore, if it is necessary to cancel any specific change in the system can use the entry for the blog to restore the original value of the restored object.
synchronization points
COMMIT and ROLLBACK operations establish what is called a synchronization point which represents the boundary between two consecutive transactions, or the end of a unit working logic, and therefore the point at which the base data is (or should be) in a state of consistency. The only operations that establish a sync point are COMMIT, ROLLBACK and the beginning of a program. When you set a sync point:
    Commit or cancel all changes made by the program from the previous synchronization point.
    all possible positioning is lost in the database.
    release all records are locked.
is important to note that COMMIT and ROLLBACK end the transaction, not the program.
TYPES OF TRANSACTIONS
    simple transactions. All operations are held at the same stage in a T

The transaction begins and ends with a begin_transaction either with or abort_transaction commit_transaction. The entire transaction is indivisible.

Transactions At first they were simple enough for its simplicity and its adaptation to brief bank. Currently Transactions have penetrated into all facets of the computer but have not proved more suitable, since they have a behavior

Fragile: In business transactions that extend for long periods.
Weak: In batch processing.
Null: Call to reverse.
A simple transaction takes no more than two or three seconds to avoid monopolizing critical system resources such as locks on the database. So OLTP programs are divided into short transactions executed one after another to produce results.
    simple distributed transactions. A simple T can run on multiple sites and update resources located within multiple resource managers.
    chained transactions (SYNCPOINT, chains and franchises). A SYNCPOINT is a point of synchronization that allows the newspaper kept the backlog within a transaction, thus allowing work to reverse the sin, abortion the transaction. However, this work is not stored permanently, so that if the system breaks down the work is lost. Chained transactions are a variation of durable SYNCPOINT to become the backlog. The sagas extend the string transactions to backtrack to a whole string if necessary.
    Nested Transactions. They offer the possibility to define transactions within other transactions. each subtransaction can issue a recording or rewind to the parts assigned work.
EARLY PROTOCOL LOG
is considered that a transaction is a unit of recovery. For if a transaction is successful, the system must ensure the permanent establishment of its modifications in the database, even if the systems fall into the next moment. It is quite possible, for example, a system crash after a COMMIT made, but before the changes physically recorded in the database, you can discover the values \u200b\u200bto be recorded by examining the relevant log entries. For this, the log should have recorded physically before it can complete processing a COMMIT statement. This important rule is known as the Protocol of Early Writing Blog. Thus, the restart procedure will recover all transactions successfully completed but whose modifications failed to physically recorded before the fall.
TYPES OF FAILURES
A local fault affects only the transaction that was submitted that failure, such as a? Overflow?. Such failures are recoverable by the support mechanisms of the COMMIT statement.
A global failure affects multiple transactions (and most probably to all) of the transactions being conducted in and the moment of failure. Such failures are divided into two types:
    system failures (eg electricity supply disruptions) which affect all transactions being made but not physically harm the database .
    Failure of storage media (eg heads landing on the disc), which if they cause damage to the database or a portion thereof, affecting at least the transactions that are using that portion.
RECOVERY SYSTEM FAILURES
The conventional method is based on establishing a synchronous? Checkpoint?, Which implies:
    physically Record content? buffers? Data on the physical database (commit the changes to the database).
    Record physically track of special checkpoint in the log physically, which includes a list of all transactions being made at the time of establishment of the checkpoint.
Example:
    failure was presented at the time tf.
    The latest checkpoint before TF was taken at the time tv.
    T1-type transactions were completed before time tv.
    type T2 transactions started before and completed tv time after time and before time tv tf.
    T3 type transactions were also initiated before time tv but were not completed before time tf.

    T4-type transactions were initiated after the TV time and completed before time tf.

    Finally, the transactions of the type T5 also started after the TV time but were not completed before time tf.

Upon restart the system must be canceled transactions types T3, T5 and must be performed again on the types of transactions T2 and T4. Note that T1-type transactions are outside the restart process, because changes are physically recorded in the database at the time tv as part of the checkpoint.
Upon reboot the following procedure is performed to identify the types of transactions T2-T5.
    Start with two lists of transactions, the list and the list CANCEL REPEAT. CANCEL to match list the list of all transactions included in the checkpoint log. REPEAT leave the list empty.
    Examine the log forward from checkpoint log.
    If you encounter a blog entry? Initiate transaction? for transaction T, T added to the list VOID.
    If you encounter a blog entry? Compromise? for transaction T, pass that transaction to the list list REPEAT CANCEL.
    When you reach the end of the log, and REPEAT CANCEL lists respectively identify the transaction types T3 and T5 and the T2 and T4 types.
Then the system will check the log back, nullifying all transactions from the list VOID. Then review it forward again, again making all transactions in the Repeat list, which finalízale the recovery process.
FAILURE RECOVERY MEDIA STORAGE
A failure in the storage media is an accident in which physically destroys a portion of the database. The recovery of such failure involves essentially reload the database from a backup and then use the log (both active portion as the file in general) to make back all transactions completed since became the backup.
MONITORS TP (Transaction Processing)
A TP monitor is an operating system transaction processing that is main functions:

Process Management:

    Start server processes
    Channel work toward them
    monitor its proper implementation
    Balancing workloads
Transaction Manager
    guarantees the ACID properties for all the programs under their protection
monitors specialize in managing transactions from their point of origin (usually in the client), and through one or more servers, then back to the originating client. When a T ends, the TP monitor should ensure that all systems are involved in it in a consistent state. Thus, a TP monitor know how to run T, route them between different systems, implementing load balancing and put them back on track after a crash. All this regardless of the systems, or resource managers.
arise from the need to run applications capable of serving hundreds or thousands of customers, which monitors real-time connectivity to thousands of customers who expect service without consuming many resources.
Example: If a client needs to be treated for the following resources: 1 process, 1 connection, ½ Mb of RAM and a dozen open files, and also if 1000 customers are served at the same time would have the following situations:
a). No monitor TP

1000 customers 1000 connections

1000 processes

500 MB of RAM

10000 files open

SO low performance

b). With TP monitor

1000 customers TP MONITOR 50 connections

50 processes

25 MB RAM

500 files open

SO good performance

Usually in the PC server environments often have their applications online transaction processing (OLTP : Une On Transaction Processing) packaged as dynamic link libraries (DLL Dynamic Link Library). TP monitor, then assigns the execution of the DLL functions to server classes, background processes or threads waiting for a pre-launch work.

How does the TP monitor the act of channeling

When a client requests a service, the TP monitor even the intended process, which refers to the DLL function called by the client, invokes monitors its implementation and returns the results to the client. Once the work the server process returns the results and the process can be reused by another client. The OS keeps the DLL in memory that can be shared by other processes.

If the number of client requests received exceeds the number of server processes, the monitor dynamically start new ones (load balancing). Part of the load balancing of priorities is managing the requests received, so high priority applications are assigned to classes of high priority server. TP monitor also can divide their classes according to the type of application, desired response time, manage resources, fault tolerance requirements, etc.

A TP monitor can be seen as a client / server architecture consists of three layers: a GUI, application logic and resource managers.

BENEFITS OF A MONITOR TP

structure development of client / server. TP monitors provide a pre-built structure that helps build, operate and manage a client / server. Permits. build client / server applications robust and high performance.
protection walls. Implement protective walls between applications and resource managers, and between the same applications.
High Availability . TP monitors are designed to overcome all failures, you can create autoremediables systems, because they are always aware of the status of the resources of client / server under their control, they can detect a failure in the very moment they occur and decide if you restart the failed process or even switch back and process in another node. (Architectures without a single point of failure).
Load Balancing. TP monitors specializing in process management and technical support both static and dynamic loading; support requests with priority and can double dynamically server processes on the same or a different node.
Easy to expand functions. TP monitors encourage the creation of reusable modular procedures. The monitors only export the functions and not data, this could keep adding new features and allow the TP monitor distribute them to multiple servers. In this way one could build highly complex distributed applications by simply adding procedures.

reduced system cost. According to studies, if used TP monitors can save more than 30% of the total system cost, 40% in development costs and savings in resource acquisition.

Generally, we recommend using a TP monitor whether your client / server has more than 100 customers, which process five or more transactions per minute using three or more servers and / or uses two or more BD.
TYPES OF TRANSACTION PROCESSING
There is a qualifying transaction processing:
    TP
    light (lite TP) which is limited to integrate TP monitors BD administrators.
    heavy TP (TP heavy) where TP monitors extend the notion of transaction to all the resources used for processing transactions.
We can make a series of comparisons between them:
a) Scope of the recording
TP light





TP heavy

b) Resource Management. While the TP makes only slight updates to BD, the heavy TP AGIO perform updates (keeping the properties of transactions) across multiple heterogeneous resource managers within the scope of a single transaction.

c) Process Management. The light TP load the procedure, executed and if ever stored in the cache for later use. The TP heavy pre-launch feature servers, dynamic load balancing, planning according to priorities, protective walls, redirection to other servers, etc.

d) Summons client / server . TP usually has its own lightweight way to invoke the RPG server and have no authentication mechanisms, or are integrated into global directories.

e) Performance . The procedures are much faster Trligero because much reduced traffic network and require less hardware.

Source: Fernando A. http://www.ittehuacan.edu.mx/ittehuacan/
More

0 comments:

Post a Comment