Movatterモバイル変換


[0]ホーム

URL:


JP2009026029A - Transaction control apparatus, transaction control method, transaction control program, and storage medium storing the program - Google Patents

Transaction control apparatus, transaction control method, transaction control program, and storage medium storing the program
Download PDF

Info

Publication number
JP2009026029A
JP2009026029AJP2007187971AJP2007187971AJP2009026029AJP 2009026029 AJP2009026029 AJP 2009026029AJP 2007187971 AJP2007187971 AJP 2007187971AJP 2007187971 AJP2007187971 AJP 2007187971AJP 2009026029 AJP2009026029 AJP 2009026029A
Authority
JP
Japan
Prior art keywords
transaction
connection
access
database
commit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2007187971A
Other languages
Japanese (ja)
Inventor
Masakazu Yamanaka
真和 山中
Toshibumi Enomoto
俊文 榎本
Masashi Yamamuro
雅司 山室
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nippon Telegraph and Telephone CorpfiledCriticalNippon Telegraph and Telephone Corp
Priority to JP2007187971ApriorityCriticalpatent/JP2009026029A/en
Publication of JP2009026029ApublicationCriticalpatent/JP2009026029A/en
Pendinglegal-statusCriticalCurrent

Links

Images

Landscapes

Abstract

Translated fromJapanese

【課題】複数のコネクションを用いてトランザクションを実行する場合において、COMMITの回数を削減し、トランザクションの速度を高速化する。
【解決手段】データベースに対し、複数のコネクションを用いてトランザクションを実行するトランザクション制御装置において、トランザクションA〜Iを接続C1〜C3に振り分け、再構築する。そして、それぞれの接続における複数のトランザクションを一まとめにしてCOMMITを実行する。また、トランザクション制御装置は、データベースの同じデータにアクセスする可能性のあるトランザクション同士を同じ接続にまとめるようにする。
【選択図】図1
In a case where a transaction is executed using a plurality of connections, the number of times of COMMIT is reduced and the transaction speed is increased.
In a transaction control apparatus that executes transactions using a plurality of connections to a database, transactions A to I are distributed to connections C 1 to C 3 and reconstructed. Then, COMMIT is executed by putting together a plurality of transactions in each connection. In addition, the transaction control device collects transactions that may access the same data in the database into the same connection.
[Selection] Figure 1

Description

Translated fromJapanese

本発明は、トランザクション制御技術に関する。  The present invention relates to a transaction control technique.

従来から、データベースに対する操作単位としてトランザクションが用いられている。このトランザクションとは、データベースに対する一連の操作を1つの処理単位でまとめたものである。例えば、操作言語としてSQL(Structured Query Language)を用いる場合、トランザクションの開始時にBEGIN(ビギン)、終了時にCOMMIT(コミット)という操作を発行する。つまり、
BEGIN;
データベースに対する一連の処理
COMMIT;
というような操作を発行する。このトランザクションでは、各SQLとして指定された処理は「すべて成功」か「すべて失敗」のいずれかであることが保証される。つまり、一連の処理が途中で終了しないようにする。
Conventionally, a transaction is used as an operation unit for a database. This transaction is a series of operations for a database that are grouped into one processing unit. For example, when SQL (Structured Query Language) is used as the operation language, an operation of BEGIN (begin) is issued at the start of a transaction and COMMIT (commit) is issued at the end. That means
BEGIN;
A series of operations on the database
COMMIT;
Issue an operation like this. In this transaction, it is guaranteed that the processing designated as each SQL is either “all successful” or “all failed”. That is, a series of processing is not terminated in the middle.

このようにしてトランザクションによりデータベースに対し処理を実行する場合、処理を高速にするため、データベースに対し複数のSQLを並列に実行する技術がある。つまり、アプリケーションがデータベースに対し、複数の接続を確立し、各接続を利用して並列にトランザクション処理を実行することで、処理の高速化を図っている。図8は、本発明の比較例となる技術を説明する図である。図8に示すように、例えば、アプリケーションサーバが発行したトランザクション(実行すべきトランザクション)が、トランザクションA〜Iであるとき、このトランザクションA〜Iを接続C1〜C3の3つの接続に分ける。そして、トランザクションA〜Iを接続C1〜C3で並列実行する。
特開平9−50393号公報
When processing is performed on a database by a transaction in this way, there is a technique for executing a plurality of SQLs in parallel on the database in order to speed up processing. In other words, the application establishes a plurality of connections to the database, and uses each connection to execute transaction processing in parallel, thereby speeding up the processing. FIG. 8 is a diagram for explaining a technique as a comparative example of the present invention. As shown in FIG. 8, for example, when transactions issued by the application server (transactions to be executed) are transactions A to I, the transactions A to I are divided into three connections C1 to C3. Transactions A to I are executed in parallel on connections C1 to C3.
Japanese Patent Laid-Open No. 9-50393

しかし、前記した技術のようにトランザクションを並列に実行する場合において、1つのトランザクションが比較的短いと、頻繁にCOMMITが実行されることになる。このCOMMITは実行負荷の大きい処理であるため、トランザクション実行時に速度の低下を招く。  However, when transactions are executed in parallel as in the technique described above, if one transaction is relatively short, COMMIT is frequently executed. Since this COMMIT is a process with a large execution load, the speed is reduced when a transaction is executed.

さらに、このように複数のトランザクションを並列に実行すると、それぞれのトランザクションが最新のデータを参照できないこともある。  Furthermore, when a plurality of transactions are executed in parallel in this way, each transaction may not be able to refer to the latest data.

例えば、データベースの領域Aのデータを変更するトランザクションと並列に、別のトランザクションがこの領域Aのデータを参照する場合において、最初のトランザクションの処理が完了していないと、その別のトランザクションは古い方のデータを参照することになる。つまり、トランザクションは最新のデータを参照できないため、サービス全体に悪影響を与えるおそれがある。そのため、従来、DBMS(データベースマネジメントシステム)において、同じ領域のデータを参照しようとするトランザクションを複数受け付けたときは、いったんそれらのトランザクションをストップし、最初からそのトランザクションをやり直すといった制御を行っていた。しかし、DBMSにおいてこのようなトランザクションのやり直しを頻繁に行うと、却って処理速度の低下を招くことになる。  For example, in the case where another transaction refers to data in this area A in parallel with a transaction that changes data in the area A of the database, if the processing of the first transaction is not completed, the other transaction is the oldest one. Will be referred to. In other words, since the transaction cannot refer to the latest data, the entire service may be adversely affected. For this reason, conventionally, in a DBMS (database management system), when a plurality of transactions that refer to data in the same area are accepted, such transactions are temporarily stopped and the transaction is re-executed from the beginning. However, if such a transaction is re-executed frequently in the DBMS, the processing speed is reduced.

そこで本発明は、前記した課題を解決し、COMMITの回数を削減し、トランザクションの速度を高速化するトランザクション制御手段を提供することを目的とする。  Therefore, an object of the present invention is to provide a transaction control means that solves the above-described problems, reduces the number of times of COMMIT, and increases the transaction speed.

前記した課題を解決するため、請求項1に記載の発明は、データベースに格納されたデータに対し、複数のコネクションを用いて複数のトランザクションを並列に実行するトランザクション制御装置であって、前記トランザクションの入力を受け付けるトランザクション入力部と、前記データベースとの間で前記複数のコネクションを確立するコネクション確立部と、前記確立されたコネクションごとに、当該コネクションを用いてアクセスする前記データベースのアクセス先を示したアクセス履歴を記憶する記憶部と、前記入力されたトランザクションを解析し、当該トランザクションの前記データベースにおけるアクセス先を特定するトランザクション解析部と、前記入力されたトランザクションの処理を実行するトランザクション実行部と、(1)前記記憶部に記憶されたアクセス履歴から、当該トランザクションのアクセス先を含むアクセス履歴を1つ発見したとき、前記アクセス履歴に対応するコネクションを、当該トランザクションに用いるコネクションとして選択し、当該トランザクションにおける前記データベースへのアクセス先を、前記選択したコネクションに関するアクセス履歴に記録し、前記選択されたコネクションを用いて、前記トランザクション実行部に、前記トランザクションのCOMMIT前までの処理の実行を指示し、前記トランザクション実行部において前記トランザクションのCOMMIT前までの処理を所定数以上実行したとき、前記コネクションそれぞれにおける前記トランザクションのCOMMITの実行を指示し、(2)前記記憶部に記憶されたアクセス履歴から、当該トランザクションのアクセス先を含むアクセス履歴を複数発見したとき、前記記憶部に記憶されたアクセス履歴を消去し、前記トランザクション実行部に、前記コネクションそれぞれにおける前記トランザクションのCOMMITの実行を指示した後、前記入力されたトランザクションに用いるコネクションとして、前記確立されたコネクションから任意のコネクションを選択し、当該トランザクションにおける前記データベースへのアクセス先を、前記選択したコネクションに関するアクセス履歴に記録するトランザクション制御部と、を備えることを特徴とするトランザクション制御装置とした。  In order to solve the above-described problem, the invention described inclaim 1 is a transaction control apparatus that executes a plurality of transactions in parallel using a plurality of connections for data stored in a database, A transaction input unit that accepts input, a connection establishment unit that establishes the plurality of connections with the database, and an access that indicates an access destination of the database that is accessed using the connection for each of the established connections A storage unit that stores a history, a transaction analysis unit that analyzes the input transaction and identifies an access destination of the transaction in the database, and a transaction execution that executes processing of the input transaction (1) When one access history including the access destination of the transaction is found from the access history stored in the storage unit, a connection corresponding to the access history is selected as a connection used for the transaction, The access destination to the database in the transaction is recorded in the access history related to the selected connection, and the transaction execution unit is instructed to execute the process before COMMIT of the transaction using the selected connection. When the transaction execution unit executes a predetermined number of processes before COMMIT of the transaction, the transaction execution unit instructs execution of the COMMIT of the transaction in each connection, and (2) the storage unit When a plurality of access histories including the access destination of the transaction are found from the stored access histories, the access histories stored in the storage unit are deleted, and the transaction execution unit stores the COMMIT of the transaction in each of the connections. After instructing execution, an arbitrary connection is selected from the established connections as a connection to be used for the input transaction, and the access destination to the database in the transaction is recorded in the access history related to the selected connection. And a transaction control unit.

請求項6に記載の発明は、データベースとの間で確立されたコネクションごとに、当該コネクションを用いてアクセスする前記データベースのアクセス先を示したアクセス履歴を記憶する記憶部を備え、前記データベースに格納されたデータに対し、複数のコネクションを用いて複数のトランザクションを並列に実行するトランザクション制御装置が、前記トランザクションの入力を受け付けるステップと、前記データベースとの間で前記複数のコネクションを確立するステップと、前記入力されたトランザクションを解析し、当該トランザクションの前記データベースにおけるアクセス先を特定するステップと、(1)前記記憶部に記憶されたアクセス履歴から、当該トランザクションのアクセス先を含むアクセス履歴を1つ発見したとき、前記アクセス履歴に対応するコネクションを、当該トランザクションに用いるコネクションとして選択し、当該トランザクションにおける前記データベースへのアクセス先を、前記選択したコネクションに関するアクセス履歴に記録するステップと、前記選択されたコネクションを用いて、前記トランザクションのCOMMIT前までの処理を実行するステップと、前記トランザクションのCOMMIT前までの処理を所定数以上実行したとき、前記コネクションそれぞれにおける前記トランザクションのCOMMITを実行するステップとを実行し、(2)前記記憶部に記憶されたアクセス履歴から、当該トランザクションのアクセス先を含むアクセス履歴を複数発見したとき、前記記憶部に記憶されたすべてのアクセス履歴を消去するステップと、前記コネクションそれぞれにおける前記トランザクションのCOMMITを実行するステップと、前記入力されたトランザクションに用いるコネクションとして、前記確立されたコネクションから任意のコネクションを選択し、当該トランザクションにおける前記データベースへのアクセス先を、前記選択したコネクションに関するアクセス履歴に記録するステップと、を実行することを特徴とするトランザクション制御方法とした。  The invention according to claim 6 is provided with a storage unit that stores an access history indicating an access destination of the database accessed by using the connection for each connection established with the database, and stores the access history in the database. A transaction control device that executes a plurality of transactions in parallel using a plurality of connections with respect to the received data, a step of accepting the input of the transaction, and a step of establishing the plurality of connections with the database; Analyzing the input transaction and specifying an access destination of the transaction in the database; and (1) finding one access history including the access destination of the transaction from the access history stored in the storage unit. When Selecting a connection corresponding to the access history as a connection to be used for the transaction, and recording an access destination to the database in the transaction in an access history related to the selected connection, and using the selected connection Executing a process before the COMMIT of the transaction, and executing a COMMIT of the transaction in each of the connections when a predetermined number or more of the processes before the COMMIT of the transaction are executed, (2 ) When a plurality of access histories including the access destination of the transaction are found from the access histories stored in the storage unit, all access histories stored in the storage unit are deleted. Step, executing COMMIT of the transaction in each of the connections, and selecting an arbitrary connection from the established connections as a connection to be used for the input transaction, and specifying an access destination to the database in the transaction And a step of recording in an access history related to the selected connection.

このようにすることで、トランザクション制御装置は、トランザクションを複数のコネクションを用いて並列実行する場合、所定数以上のトランザクションを実行した後でCOMMITを実行する。従って、COMMITの回数を削減し、トランザクションの速度を高速化することができる。また、このトランザクション制御装置は、コネクションごとのアクセス履歴から、当該トランザクションと同じアクセス先へアクセスする可能性のあるアクセス履歴を1つ発見したとき、そのアクセス履歴に示されるコネクションを用いてトランザクションを実行するようにする。つまり、同じアクセス先へアクセスする可能性があるトランザクションは同じコネクションを用いるようにする。そして、トランザクション制御装置は、当該トランザクションと同じアクセス先へアクセスする可能性のあるアクセス履歴を複数発見したとき、各コネクションのトランザクションのCOMMITを実行し、アクセス履歴も消去する。このようにすることで、同じアクセス先へアクセスする可能性のあるトランザクションが複数のコネクションにより並列実行されることがなくなる。つまり、各トランザクションが最新のデータを参照できなくなるのを防止できる。  By doing so, the transaction control apparatus executes COMMIT after executing a predetermined number of transactions or more when executing transactions in parallel using a plurality of connections. Therefore, it is possible to reduce the number of times of COMMIT and increase the transaction speed. In addition, when the transaction control device finds one access history that may access the same access destination as the transaction from the access history for each connection, the transaction control apparatus executes the transaction using the connection indicated in the access history. To do. In other words, transactions that may access the same access destination use the same connection. When the transaction control device finds a plurality of access histories that may access the same access destination as the transaction, the transaction control device executes the COMMIT of the transaction of each connection and erases the access history. By doing so, transactions that may access the same access destination are not executed in parallel by a plurality of connections. That is, it is possible to prevent each transaction from referring to the latest data.

請求項2に記載の発明は、請求項1に記載のトランザクション制御装置において、前記トランザクション制御部は、前記記憶部に記憶されたアクセス履歴から、当該トランザクションのアクセス先を含むアクセス履歴を発見できなかったとき、前記入力されたトランザクションに用いるコネクションとして、前記確立されたコネクションから任意のコネクションを選択し、当該トランザクションにおける前記データベースへのアクセス先を、前記選択したコネクションに関するアクセス履歴に記録することを特徴とするトランザクション制御装置とした。  The invention according toclaim 2 is the transaction control apparatus according toclaim 1, wherein the transaction control unit cannot find an access history including an access destination of the transaction from the access history stored in the storage unit. In this case, an arbitrary connection is selected from the established connections as a connection to be used for the input transaction, and an access destination to the database in the transaction is recorded in an access history related to the selected connection. The transaction control device is as follows.

このような構成によれば、トランザクション制御装置は、同じアクセス先へアクセスする可能性のあるアクセス履歴を発見できなかったとき、確立された任意のコネクションの中から選択したコネクションを用いてトランザクションを実行する。  According to such a configuration, when the transaction control apparatus cannot find an access history that may access the same access destination, it executes a transaction using a connection selected from any established connections. To do.

請求項3に記載の発明は、請求項1または請求項2に記載のトランザクション制御装置において、前記トランザクション制御部は、前回のCOMMITの実行指示から所定時間経過したとき、前記トランザクション実行部に前記トランザクションそれぞれのCOMMITの実行を指示することを特徴とするトランザクション制御装置とした。  According to a third aspect of the present invention, in the transaction control device according to the first or second aspect, the transaction control unit sends the transaction execution unit to the transaction execution unit when a predetermined time has elapsed since the previous COMMIT execution instruction. The transaction control apparatus is characterized by instructing execution of each COMMIT.

このような構成によれば、トランザクション制御装置は、COMMITの回数を削減し、トランザクションの速度を高速化することができる。  According to such a configuration, the transaction control apparatus can reduce the number of times of COMMIT and increase the transaction speed.

請求項4に記載の発明は、請求項1ないし請求項3のいずれか1項に記載のトランザクション制御装置において、前記記憶部は、過去の前記トランザクションの実行結果を蓄積したデータベースキャッシュを備え、前記トランザクション制御部は、前記データベースキャッシュにおける実行結果に当該トランザクションのアクセス先を含むデータがあるか否かを判断し、前記データベースキャッシュにおける実行結果に、当該トランザクションのアクセス先を含むデータがあると判断したとき、前記データベースキャッシュにおける実行結果をもとに当該トランザクションを実行し、当該トランザクションの実行結果を前記データベースキャッシュに蓄積し、前記データベースキャッシュにおける実行結果に、当該トランザクションのアクセス先を含むデータがないと判断したとき、前記データベースのデータに対し当該トランザクションを実行するトランザクション制御装置とした。  According to a fourth aspect of the present invention, in the transaction control device according to any one of the first to third aspects, the storage unit includes a database cache that accumulates past execution results of the transaction, The transaction control unit determines whether or not the execution result in the database cache includes data including the access destination of the transaction, and determines that the execution result in the database cache includes data including the access destination of the transaction The transaction is executed based on the execution result in the database cache, the execution result of the transaction is accumulated in the database cache, and the access result of the transaction is stored in the execution result in the database cache. When it is determined that there is no data including the first, and a transaction controller for executing the transaction on the data in the database.

このような構成によれば、トランザクション制御装置は、データベースキャッシュに蓄積されたデータにより当該トランザクションが実行可能と判断したとき、このデータベースキャッシュに蓄積されたデータで当該トランザクションを実行するので、トランザクションの速度をさらに高速化できる。  According to such a configuration, when the transaction control apparatus determines that the transaction can be executed based on the data stored in the database cache, the transaction control apparatus executes the transaction using the data stored in the database cache. Can be further speeded up.

請求項5に記載の発明は、請求項1ないし請求項4のいずれか1項に記載のトランザクション制御装置において、前記トランザクションおよび前記アクセス履歴に示される前記データベースのアクセス先は、SQL(Structured Query Language)を用いた条件により記述され、前記トランザクション制御部は、前記記憶部に記憶されたアクセス履歴から、当該トランザクションのアクセス先を含むアクセス履歴を探すとき、前記トランザクションおよび前記アクセス履歴におけるSQLのFROM句およびWHERE句により示される条件を参照して探すことを特徴とするトランザクション制御装置とした。  According to a fifth aspect of the present invention, in the transaction control apparatus according to any one of the first to fourth aspects, the access destination of the database indicated in the transaction and the access history is an SQL (Structured Query Language). When the transaction control unit searches the access history including the access destination of the transaction from the access history stored in the storage unit, the transaction FROM and the SQL FROM phrase in the access history are described. And a transaction control device characterized by searching with reference to the conditions indicated by the WHERE clause.

このような構成によれば、トランザクション制御装置は、アクセス履歴から、特定したトランザクションのアクセス先を含むアクセス履歴を探すとき、SQLのFROM句およびWHERE句を参照して探すことができる。  According to such a configuration, when searching for an access history including the access destination of the identified transaction from the access history, the transaction control device can search by referring to the FROM clause and the WHERE clause of SQL.

請求項7に記載の発明は、請求項6に記載のトランザクション制御方法をコンピュータであるトランザクション処理装置に実行させることを特徴とするトランザクション制御プログラムとした。  The invention according to claim 7 is a transaction control program characterized by causing a transaction processing apparatus, which is a computer, to execute the transaction control method according to claim 6.

このようなプログラムによれば、請求項6に記載のトランザクション制御方法を一般的なコンピュータに実行させることができる。  According to such a program, the transaction control method according to the sixth aspect can be executed by a general computer.

請求項8に記載の発明は、請求項7に記載のトランザクション制御プログラムを記憶したコンピュータに読取り可能な記憶媒体とした。  The invention described in claim 8 is a computer-readable storage medium storing the transaction control program according to claim 7.

このような記憶媒体に記憶されたプログラムをコンピュータにインストールすることで、このコンピュータに請求項6に記載のトランザクション制御方法を実行させることができる。  By installing the program stored in such a storage medium in a computer, the computer can execute the transaction control method according to claim 6.

本発明によれば、トランザクションにおけるCOMMITの回数を削減し、トランザクションの速度を高速化することができる。特に、短いトランザクションを扱う場合、トランザクション全体のCOMMITの回数を大幅に削減できる。  According to the present invention, the number of COMMITs in a transaction can be reduced and the transaction speed can be increased. In particular, when handling a short transaction, the number of COMMITs for the entire transaction can be greatly reduced.

以下、本発明を実施するための最良の形態(以下、実施の形態という)を第1の実施の形態および第2の実施の形態に分けて説明する。まず、各実施の形態のトランザクション制御装置の動作概要を、図1を用いて説明する。図1は、各実施の形態のトランザクション制御装置の動作概要を概念的に示した図である。  Hereinafter, the best mode for carrying out the present invention (hereinafter referred to as an “embodiment”) will be described by dividing it into a first embodiment and a second embodiment. First, an outline of the operation of the transaction control apparatus according to each embodiment will be described with reference to FIG. FIG. 1 is a diagram conceptually showing an operation outline of the transaction control apparatus according to each embodiment.

例えば、各実施の形態のトランザクション制御装置は、アプリケーションサーバからトランザクションA〜Iを受け付けると、このトランザクションA〜Iを接続C1〜C3に振り分け、再構築する。つまり、接続(コネクション)C1においてトランザクションC,F,Gを実行した後、この3つのトランザクションC,F,GのCOMMIT(コミット)をまとめて実行する。また、接続C2においてトランザクションA,Hを実行した後、このトランザクションA,Hの2つのCOMMITをまとめて実行する。さらに、接続C3においてもトランザクションB,D,Eを実行した後、このトランザクションB,D,Eの3つのCOMMITをまとめて実行する。それからトランザクションI以降の処理にとりかかる。このようにトランザクション制御装置は実行すべきトランザクションをそれぞれ再構築し、複数のトランザクションを一まとめにしてCOMMITを実行するのでCOMMITの実行回数を減らすことができる。なお、トランザクション制御装置は、受け付けたトランザクションのSQLの内容から、データベースの同じデータにアクセスする可能性のあるトランザクション同士を同じ接続にまとめるようにする。つまり、データベースの同じデータにアクセスする可能性のあるトランザクションを複数の接続にまたがって実行しないようにする。このようにすることで、トランザクション制御装置は複数の接続を用いてトランザクションを並列実行する場合であっても、各トランザクションの参照データに不整合が生じるのを防止できる。  For example, when receiving the transactions A to I from the application server, the transaction control device of each embodiment distributes the transactions A to I to the connections C1 to C3 and reconstructs them. That is, after the transactions C, F, and G are executed in the connection C1, the COMMIT (commit) of these three transactions C, F, and G is executed collectively. Further, after the transactions A and H are executed in the connection C2, the two COMMITs of the transactions A and H are executed together. Further, after the transactions B, D, and E are executed also on the connection C3, the three COMMITs of the transactions B, D, and E are collectively executed. Then, the processing after transaction I is started. In this way, the transaction control device reconstructs the transactions to be executed and executes the COMMIT by putting a plurality of transactions together, thereby reducing the number of times COMMIT is executed. Note that the transaction control apparatus collects transactions that may access the same data in the database into the same connection based on the SQL contents of the accepted transactions. In other words, avoid transactions that might access the same data in the database across multiple connections. By doing so, the transaction control apparatus can prevent inconsistency in the reference data of each transaction even when the transactions are executed in parallel using a plurality of connections.

≪第1の実施の形態≫
図2を用いて本発明の第1の実施の形態を説明する。図2は、本発明の第1の実施の形態におけるシステムの構成を示した図である。
<< First Embodiment >>
A first embodiment of the present invention will be described with reference to FIG. FIG. 2 is a diagram showing a system configuration in the first embodiment of the present invention.

<システムの全体構成>
システムは、アプリケーションサーバ1と、トランザクション制御装置2と、データベース3とを含んで構成される。このアプリケーションサーバ1と、トランザクション制御装置2と、データベース3とは、CPU(Central Processing Unit)、RAM(Random Access Memory)等のメモリ、入出力インタフェース等を備えるコンピュータにより実現される。このアプリケーションサーバ1と、トランザクション制御装置2と、データベース3とは、図示しないネットワークで通信可能に接続されるものとする。
<Overall system configuration>
The system includes anapplication server 1, atransaction control device 2, and a database 3. Theapplication server 1, thetransaction control device 2, and the database 3 are realized by a computer having a memory such as a CPU (Central Processing Unit) and a RAM (Random Access Memory), an input / output interface, and the like. It is assumed that theapplication server 1, thetransaction control device 2, and the database 3 are communicably connected via a network (not shown).

アプリケーションサーバ1は、例えば、データベース3を用いて大量のログデータ処理を実行するサーバであり、このログデータ処理のためのトランザクションをトランザクション制御装置2へ送信し、このトランザクション制御装置2経由でデータベース3に対し処理を実行する。このトランザクション制御装置2はデータベース3との間でコネクション(接続)を複数確立し、この接続を用いてデータベース3に対し、トランザクションを実行する。  Theapplication server 1 is, for example, a server that executes a large amount of log data processing using the database 3, and transmits a transaction for this log data processing to thetransaction control device 2. Process. Thetransaction control apparatus 2 establishes a plurality of connections (connections) with the database 3 and executes a transaction with respect to the database 3 using these connections.

このデータベース3は、DBMSを備え、このアプリケーションサーバ1からのトランザクションの対象であるログデータ(アプリケーションサーバ1における加工途中のログデータ等)を格納する。例えば、このデータベース3は、図2に示すように、(key0,key1, val(value))=(0,1,A),(0,2,B),(1,1,C)というデータを持つtab_aを格納する。  The database 3 includes a DBMS and stores log data (such as log data being processed in the application server 1) that is a target of a transaction from theapplication server 1. For example, as shown in FIG. 2, the database 3 has data (key0, key1, val (value)) = (0,1, A), (0,2, B), (1,1, C). Store tab_a with.

なお、ここでは、トランザクション制御装置2は、アプリケーションサーバ1とは別個の装置として説明するが、このトランザクション制御装置2の機能をアプリケーションサーバ1のミドルウェアとして組み込んでもよい。  Here, thetransaction control device 2 is described as a device separate from theapplication server 1, but the function of thetransaction control device 2 may be incorporated as middleware of theapplication server 1.

<トランザクション制御装置>
トランザクション制御装置2は、入力部20と、トランザクション入力部21と、トランザクション解析部22と、記憶部23と、トランザクション並列実行部24と、トランザクション制御部25と、コネクション確立部27と、出力部28とを含んで構成される。このトランザクション制御装置2には、このトランザクション制御装置2へ各種データを入力する入力装置(例えば、キーボードやマウス)や、このトランザクション制御装置2の演算処理結果を出力する出力装置(例えば、液晶モニタ等)が接続されていてもよい。
<Transaction control device>
Thetransaction control device 2 includes aninput unit 20, atransaction input unit 21, atransaction analysis unit 22, astorage unit 23, a transactionparallel execution unit 24, atransaction control unit 25, aconnection establishment unit 27, and anoutput unit 28. It is comprised including. Thetransaction control device 2 includes an input device (for example, a keyboard and a mouse) for inputting various data to thetransaction control device 2, and an output device (for example, a liquid crystal monitor) for outputting a calculation processing result of the transaction control device 2. ) May be connected.

入力部20は、このトランザクション制御装置2に対する各種設定の入力等を受け付ける。  Theinput unit 20 receives input of various settings for thetransaction control device 2.

トランザクション入力部21は、アプリケーションサーバ1から送信されたトランザクション(トランザクションBTi)の入力を受け付ける。このトランザクションは、例えば、図2の吹き出し110に示すようにトランザクションBT0,BT1,BT2という連続したトランザクションを受け付ける。  Thetransaction input unit 21 receives an input of a transaction (transaction BTi) transmitted from theapplication server 1. As this transaction, for example, as shown in aballoon 110 in FIG. 2, consecutive transactions BT0, BT1, and BT2 are accepted.

このトランザクションBTiは、データベース3に対する書き込みや読み込みに関する条件を示したものであり、例えば、SQLにより記述される。例えば、トランザクションBT0,BT1,BT2はそれぞれ、
・トランザクションBT0:
BEGIN;
SELECT* FROM tab_a WHERE key0=0;
UPDATE tab_a SET val=‘D’WHERE key0=0;
COMMIT;
(tab_aのkey0=0のレコードの値をDに更新する)
・トランザクションBT1:
BEGIN;
SELECT* FROM tab_a WHERE key0=0;
COMMIT;
(tab_aのkey0=0を参照する)
・トランザクションBT2:
BEGIN;
SELECT* FROM tab_a WHERE key1=1;
COMMIT;
(tab_aのkey1=1を参照する)
といったものである。なお、この記述言語はSQL以外の言語を用いるようにしてもよい。
This transaction BTi indicates the conditions related to writing and reading to the database 3, and is described in, for example, SQL. For example, transactions BT0, BT1, and BT2 are respectively
-Transaction BT0:
BEGIN;
SELECT * FROM tab_a WHERE key0 = 0;
UPDATE tab_a SET val = 'D'WHERE key0 = 0;
COMMIT;
(Update the value of the key_0 record of tab_a to D)
-Transaction BT1:
BEGIN;
SELECT * FROM tab_a WHERE key0 = 0;
COMMIT;
(Refer to key0 = 0 of tab_a)
Transaction BT2:
BEGIN;
SELECT * FROM tab_a WHERE key1 = 1;
COMMIT;
(Refer to key1 = 1 of tab_a)
It is something like that. The description language may be a language other than SQL.

トランザクション解析部22は、入力されたトランザクションを解析し、このトランザクションのデータベース3におけるアクセス先を特定する。具体的には、トランザクション解析部22は、入力されたトランザクションのFROM句とWHERE句とを読み出す。  Thetransaction analysis unit 22 analyzes the input transaction and specifies the access destination of the transaction in the database 3. Specifically, thetransaction analysis unit 22 reads the FROM phrase and the WHERE phrase of the input transaction.

記憶部23は、アクセス履歴231(231A,231B,231C)を記憶する。このアクセス履歴231(231A,231B,231C)は、このトランザクション制御装置2が確立したコネクション(接続C1,C2,C3)ごとに当該接続を用いたデータベース3のアクセス先を示した情報である。このアクセス履歴231は、図2に示すように接続ごとに、当該接続を使ってアクセスしたトランザクションのFROM句とWHERE句に示された内容が記録される。  Thestorage unit 23 stores an access history 231 (231A, 231B, 231C). The access history 231 (231A, 231B, 231C) is information indicating the access destination of the database 3 using the connection for each connection (connection C1, C2, C3) established by thetransaction control device 2. In theaccess history 231, as shown in FIG. 2, for each connection, the contents shown in the FROM phrase and the WHERE phrase of the transaction accessed using the connection are recorded.

例えば、図2に示すアクセス履歴231Aは、接続C1により、トランザクション実行部241(241A)が、
SELECT* FROM tab_a WHERE key0=0;
UPDATE tab_a SET val=‘D’WHERE key0=0;
(tab_aのkey0=0のレコードの値をDに更新する)
というトランザクションを実行することを示す。トランザクション制御部25は、このようなアクセス履歴231を参照することで、各接続が、データベース3のどの部分を対象にトランザクションを実行しているのかを把握できる。これにより、トランザクション制御装置2は、各接続で並列してデータベース3の同じ部分にアクセスしないようにできる。
For example, theaccess history 231A shown in FIG. 2 is obtained by the transaction execution unit 241 (241A) by the connection C1.
SELECT * FROM tab_a WHERE key0 = 0;
UPDATE tab_a SET val = 'D'WHERE key0 = 0;
(Update the value of the key_0 record of tab_a to D)
Indicates that the transaction is executed. Thetransaction control unit 25 can grasp which part of the database 3 is executing the transaction for each connection by referring to such anaccess history 231. Thereby, thetransaction control apparatus 2 can prevent access to the same part of the database 3 in parallel with each connection.

なお、この記憶部23は、RAM、HDD(Hard Disk Drive)等の記憶媒体により実現される。  Thestorage unit 23 is realized by a storage medium such as a RAM or an HDD (Hard Disk Drive).

トランザクション並列実行部24は、コネクション確立部27により確立された接続を用いてデータベース3のデータに対しトランザクションを実行する。このようなトランザクション並列実行部24は、接続ごとに、当該トランザクションを実行するトランザクション実行部241(241A,241B,241C)を備える。このトランザクション実行部241は、データベース3に対し、トランザクションそれぞれのCOMMIT前までの処理を実行する。そして、トランザクション制御部25(後記)からの指示に基づきこのトランザクションのCOMMITを実行する。  The transactionparallel execution unit 24 executes a transaction on the data in the database 3 using the connection established by theconnection establishment unit 27. Such a transactionparallel execution unit 24 includes a transaction execution unit 241 (241A, 241B, 241C) that executes the transaction for each connection. Thetransaction execution unit 241 executes processing up to each transaction before the COMMIT for the database 3. Then, the COMMIT of this transaction is executed based on an instruction from the transaction control unit 25 (described later).

トランザクション制御部25は、記憶部23に記憶されたアクセス履歴231を参照して、入力されたトランザクションに用いる接続を選択する。このトランザクション制御部25は、記憶部23に記憶されたアクセス履歴231から、当該トランザクションのアクセス先を含むアクセス履歴231を1つ発見したとき、この発見したアクセス履歴231に示される接続を、当該トランザクションに用いる接続として選択する。また、ここで選択した接続のアクセス履歴231に当該トランザクションに示されるアクセス先を記録する。さらに、トランザクション制御部25は、トランザクション実行部241においてこのトランザクションのCOMMIT前までの処理を所定数以上実行したとき、このトランザクションそれぞれのCOMMITの実行を指示する。つまり、トランザクション制御部25は、トランザクションのCOMMITをまとめて実行させる。これによりトランザクションのCOMMITの回数を削減できる。なお、このCOMMITの実行の判断には記憶部23に記憶される閾値(図示せず)を参照する。さらに、このトランザクション制御部25は、記憶部23に記憶されたアクセス履歴231から、当該トランザクションのアクセス先を含む可能性のあるアクセス履歴231を複数発見したとき、トランザクション並列実行部24に各トランザクションのCOMMITの実行させたあとで、当該トランザクションに用いる接続を選択する。また、ここで選択した接続のアクセス履歴231に当該トランザクションに示されるアクセス先を記録する。  Thetransaction control unit 25 refers to theaccess history 231 stored in thestorage unit 23 and selects a connection to be used for the input transaction. When thetransaction control unit 25 finds oneaccess history 231 including the access destination of the transaction from theaccess history 231 stored in thestorage unit 23, thetransaction control unit 25 determines the connection indicated in the foundaccess history 231 as the transaction. Select as the connection to use. In addition, the access destination indicated in the transaction is recorded in theaccess history 231 of the connection selected here. Further, when thetransaction execution unit 241 executes a predetermined number or more processes before the COMMIT of the transaction, thetransaction control unit 25 instructs the execution of the COMMIT of each transaction. That is, thetransaction control unit 25 collectively executes the transaction COMMIT. As a result, the number of COMMIT of the transaction can be reduced. Note that a threshold value (not shown) stored in thestorage unit 23 is referred to in determining the execution of COMMIT. Further, when thetransaction control unit 25 finds a plurality ofaccess histories 231 that may include the access destination of the transaction from theaccess history 231 stored in thestorage unit 23, thetransaction control unit 25 sends the transactionparallel execution unit 24 to each transaction. After executing COMMIT, the connection used for the transaction is selected. In addition, the access destination indicated in the transaction is recorded in theaccess history 231 of the connection selected here.

コネクション確立部27は、外部装置(ここでは、データベース3)との間でコネクション(接続)を確立する。  Theconnection establishment unit 27 establishes a connection (connection) with an external device (in this case, the database 3).

出力部28は、このトランザクション制御装置2がデータベース3等、外部装置へデータを出力するときの出力インタフェースである。  Theoutput unit 28 is an output interface when thetransaction control device 2 outputs data to an external device such as the database 3.

なお、このうち、入力部20、トランザクション入力部21および出力部28は、外部とのデータ入出力を行うための入出力インタフェースにより実現される。また、トランザクション解析部22、トランザクション並列実行部24、トランザクション制御部25およびコネクション確立部27は、CPUによるプログラム実行処理により実現してもよいし、専用のハードウェアにより実現してもよい。プログラム実行処理により実現する場合、記憶部23内にトランザクション制御プログラムが格納される。  Of these, theinput unit 20, thetransaction input unit 21, and theoutput unit 28 are realized by an input / output interface for performing data input / output with the outside. In addition, thetransaction analysis unit 22, the transactionparallel execution unit 24, thetransaction control unit 25, and theconnection establishment unit 27 may be realized by a program execution process by the CPU or may be realized by dedicated hardware. When realized by program execution processing, a transaction control program is stored in thestorage unit 23.

<動作手順>
次に、図2を参照しつつ、図3を用いてトランザクション制御装置2の動作手順を説明する。図3は、図2のトランザクション制御装置の動作手順を示すフローチャートである。
<Operation procedure>
Next, the operation procedure of thetransaction control apparatus 2 will be described with reference to FIG. FIG. 3 is a flowchart showing an operation procedure of the transaction control apparatus of FIG.

ここでは、トランザクション制御装置2において実行するトランザクションが1つの列として並び、そのトランザクションの列をBTi(i=0,,,∞)とし、各接続に振り分けた後のトランザクションの列をNTj(j=0,,,∞)とする。また、トランザクション制御装置2が確立した接続の数、つまりトランザクションの並列実行数をNとした場合、各接続をCk(k=1,,,N)とする。  Here, transactions executed in thetransaction control apparatus 2 are arranged as one column, the transaction column is BTi (i = 0 ,,, ∞), and the transaction column after distribution to each connection is NTj (j = 0 ,, ∞). Further, assuming that the number of connections established by thetransaction control device 2, that is, the number of parallel executions of transactions is N, each connection is Ck (k = 1,..., N).

まず、図2のトランザクション制御装置2は、事前にコネクション確立部27により接続Ckを確立しておく。そして、トランザクション制御装置2は、i=0をセットし(S300)、トランザクション入力部21において、トランザクションBTiの入力を受け付ける(S301)。次に、トランザクション解析部22においてトランザクションBTiを解析し、トランザクションBTiのアクセス先に関する情報を得る(S302)。つまり、トランザクション解析部22は、このトランザクションBTiにおけるSQLのFROM句やWHERE句を解析し、データベース3のどのレコードに対するアクセスであるかを解析する。  First, thetransaction control device 2 in FIG. 2 establishes the connection Ck by theconnection establishment unit 27 in advance. Then, thetransaction control device 2 sets i = 0 (S300), and thetransaction input unit 21 receives the input of the transaction BTi (S301). Next, thetransaction analysis unit 22 analyzes the transaction BTi, and obtains information on the access destination of the transaction BTi (S302). That is, thetransaction analysis unit 22 analyzes the SQL FROM phrase and WHERE phrase in the transaction BTi, and analyzes which record in the database 3 is accessed.

次に、トランザクション制御部25は、記憶部23に、このトランザクションBTiのアクセス先を含む可能性のあるアクセス履歴231があるか否かを判断する(S303)。例えば、S301で受け付けたトランザクションBTiが、「SELECT* FROM tab_a WHERE key0=0;(tab_aのkey0=0を参照する)」であるとき、トランザクション制御部25は、記憶部23にこの「tab_a」に関する情報が記録されたアクセス履歴231があるか否かを判断する。つまり、トランザクション制御部25は、トランザクションBTiおよびアクセス履歴231のFROM句およびWHERE句により示される条件を参照して、このトランザクションBTiのアクセス先を含む可能性のあるアクセス履歴231を探す。  Next, thetransaction control unit 25 determines whether or not there is anaccess history 231 that may include the access destination of the transaction BTi in the storage unit 23 (S303). For example, when the transaction BTi accepted in S301 is “SELECT * FROM tab_a WHERE key0 = 0; (refer to key0 = 0 of tab_a)”, thetransaction control unit 25 relates to “tab_a” in thestorage unit 23. It is determined whether there is anaccess history 231 in which information is recorded. That is, thetransaction control unit 25 refers to the conditions indicated by the FROM clause and the WHERE clause of the transaction BTi and theaccess history 231 and searches for anaccess history 231 that may include the access destination of the transaction BTi.

このトランザクションBTiのアクセス先を含む可能性のあるアクセス履歴231がなかった場合(S303のNo)、トランザクション制御部25は、確立されている接続Ckの中から、このトランザクションBTiの実行に用いる接続Ckを選択する(S310)。ここでの接続Ckの選択はランダムに行ってよい。  When there is noaccess history 231 that may include the access destination of this transaction BTi (No in S303), thetransaction control unit 25 selects the connection Ck used to execute this transaction BTi from the established connection Ck. Is selected (S310). The selection of the connection Ck here may be performed at random.

そして、トランザクション制御部25は、この選択した接続Ckに関するアクセス履歴231に、このトランザクションBTiのアクセス先に関する情報を記録する(S311)。例えば、トランザクション制御部25は、接続C3を選択した場合、この接続C3に関するアクセス履歴231Cに、このトランザクションBTiのアクセス先に関する情報(SELECT* FROM tab_a WHERE key0=0;(tab_aのkey0=0を参照する)等)を記録する。  Then, thetransaction control unit 25 records information related to the access destination of the transaction BTi in theaccess history 231 related to the selected connection Ck (S311). For example, when thetransaction control unit 25 selects the connection C3, theaccess history 231C regarding the connection C3 includes information on the access destination of the transaction BTi (SELECT * FROM tab_a WHERE key0 = 0; (see key0 = 0 of tab_a Record) etc.).

そして、トランザクション制御部25は、S310で選択した接続Ckを用いてトランザクション並列実行部24にトランザクションBTiのCOMMIT前までの処理を実行するよう指示する。つまり、S310で選択した接続Ckを用いるトランザクションNTjにおいて、このトランザクションBTiを実行するようにする。これにより、トランザクション並列実行部24は、S310で選択した接続Ckを用いて、データベース3にアクセスし、トランザクションBTiのコミット(COMMIT)前までの処理を実行する(S312)。  Then, thetransaction control unit 25 instructs the transactionparallel execution unit 24 to execute the process before COMMIT of the transaction BTi using the connection Ck selected in S310. That is, the transaction BTi is executed in the transaction NTj using the connection Ck selected in S310. As a result, the transactionparallel execution unit 24 accesses the database 3 using the connection Ck selected in S310, and executes the processing before the transaction BTi is committed (COMMIT) (S312).

この後、トランザクション制御部25は、トランザクション並列実行部24において、所定数以上のトランザクションBTiを実行したか否かを判断し(S313)、まだ所定数以上のトランザクションBTiを実行していなければ(S313のNo)、iの値を+1インクリメントし(S314)、S301へ戻る。つまり、次のトランザクションBTiの処理に移る。  Thereafter, thetransaction control unit 25 determines whether or not the transactionparallel execution unit 24 has executed a predetermined number or more of transactions BTi (S313). If the transaction BTi has not yet executed a predetermined number or more of transactions BTi (S313). No), i is incremented by 1 (S314), and the process returns to S301. That is, the process proceeds to the next transaction BTi.

一方、既に所定数以上のトランザクションBTiを実行していれば(S313のYes)、トランザクション並列実行部24はすべての接続CkのトランザクションNTjでCOMMITを実行する(S315)。つまり、トランザクション並列実行部24はまだCOMMITが実行されていなかったすべての接続CkにおいてトランザクションBTiのCOMMITを実行する。そして、トランザクション制御部25は、記憶部23のすべての接続Ckに関するアクセス履歴231を消去し(S316)、S301へ戻る。  On the other hand, if a predetermined number or more of transactions BTi have already been executed (Yes in S313), the transactionparallel execution unit 24 executes COMMIT with the transactions NTj of all the connections Ck (S315). That is, the transactionparallel execution unit 24 executes the COMMIT of the transaction BTi in all the connections Ck for which COMMIT has not yet been executed. Then, thetransaction control unit 25 deletes theaccess history 231 regarding all the connections Ck in the storage unit 23 (S316), and returns to S301.

このように、トランザクション制御装置2は、トランザクションBTiが入力されるたびにCOMMITを実行することを避け、所定数のトランザクションBTiのCOMMITをまとめて実行する。従って、全体としてのCOMMITの回数を削減できる。  As described above, thetransaction control device 2 avoids executing COMMIT every time the transaction BTi is input, and executes the COMMIT of a predetermined number of transactions BTi collectively. Therefore, the number of COMMITs as a whole can be reduced.

なお、S303において、このトランザクションBTiのアクセス先に関する情報が記録されている可能性のあるアクセス履歴231があった場合(S303のYes)、トランザクション制御部25は、このアクセス履歴231は、1つの接続Ckについてのみか否かを判断する(S304)。例えば、トランザクション制御部25は、記憶部23にこの「tab_a」に関する情報が記録されたアクセス履歴231が複数あるか否かを判断する。  In S303, when there is anaccess history 231 in which information related to the access destination of this transaction BTi may be recorded (Yes in S303), thetransaction control unit 25 indicates that thisaccess history 231 is a single connection. It is determined whether or not only about Ck (S304). For example, thetransaction control unit 25 determines whether or not there are a plurality ofaccess histories 231 in which information related to “tab_a” is recorded in thestorage unit 23.

ここで、このトランザクションBTiのアクセス先に関する情報が記録されているアクセス履歴231は、1つの接続Ckについてのみであるとき(S304のYes)、トランザクション制御部25は、当該接続CkをトランザクションBTiの実行に用いる接続として選択する(S305)。そして、S311へ進む。  Here, when theaccess history 231 in which information related to the access destination of the transaction BTi is recorded is only for one connection Ck (Yes in S304), thetransaction control unit 25 executes the connection Bk for the transaction BTi. Is selected as a connection to be used (S305). Then, the process proceeds to S311.

一方、このトランザクションBTiのアクセス先に関する情報が記録されているアクセス履歴231が、複数あったとき(S304のNo)、トランザクション並列実行部24はすべての接続CkのトランザクションNTjでCOMMITを実行する(S315)。そして、すべての接続Ckに関するアクセス履歴231を消去する(S316)。この後、S301へ戻る。  On the other hand, when there are a plurality ofaccess histories 231 in which information related to the access destination of the transaction BTi is recorded (No in S304), the transactionparallel execution unit 24 executes COMMIT with the transactions NTj of all the connections Ck (S315). ). Then, theaccess history 231 relating to all the connections Ck is deleted (S316). Thereafter, the process returns to S301.

つまり、トランザクション制御部25は、記憶部23に格納されているアクセス履歴231の中から、当該トランザクションBTiと同じアクセス先へ既にアクセスしている可能性がある接続Ck(トランザクションNTj)を複数発見したとき、まず、すべてのトランザクションNTjにおいてCOMMITを実行する。そして、トランザクション制御部25は、各接続Ckのアクセス履歴231を消去(クリア)する。そして、トランザクション制御部25は、このトランザクションBTiの処理を実行する接続Ckを選びなおす。このようにすることで、トランザクション制御部25は、同じアクセス先へ既にアクセスしている可能性がある複数の接続Ckにおいて並列にトランザクションBTiを実行することがなくなる。つまり、各トランザクションBTiは、データベース3の最新のデータを参照することになるので、データの不整合が生じなくなる。  That is, thetransaction control unit 25 has found a plurality of connections Ck (transaction NTj) that may have already accessed the same access destination as the transaction BTi from theaccess history 231 stored in thestorage unit 23. First, COMMIT is executed in all transactions NTj. Then, thetransaction control unit 25 deletes (clears) theaccess history 231 of each connection Ck. Then, thetransaction control unit 25 reselects the connection Ck for executing the processing of the transaction BTi. By doing so, thetransaction control unit 25 does not execute the transaction BTi in parallel in a plurality of connections Ck that may have already accessed the same access destination. That is, since each transaction BTi refers to the latest data in the database 3, data inconsistency does not occur.

<第1の実施の形態の例>
次に、図2、図3および図4を参照して、トランザクション制御装置2の動作手順を具体的に説明する。図4は、各実施の形態のトランザクションを例示した図である。
<Example of First Embodiment>
Next, the operation procedure of thetransaction control apparatus 2 will be specifically described with reference to FIG. 2, FIG. 3, and FIG. FIG. 4 is a diagram illustrating a transaction according to each embodiment.

ここでは、データベース3に、
create table a(
key0 int8,
key1 int8,
value char(008)
);
で定義されるテーブルaが格納され、トランザクション制御装置2は、key0およびkey1を介してテーブルaを操作するトランザクションBT1,BT2,BT3,BT4を実行する場合を例に説明する。このトランザクションBT1〜BT4の内容は、図4に示すとおりである。ここで、トランザクション制御装置2からデータベース3への接続Ckは、図2に示したように接続C1〜C3の3つであり、この3つで並列にトランザクションBTiを実行するものとする。
Here, in database 3,
create table a (
key0 int8,
key1 int8,
value char (008)
);
The case where the table a defined in (1) is stored and thetransaction control apparatus 2 executes transactions BT1, BT2, BT3, and BT4 that operate the table a via key0 and key1 will be described as an example. The contents of the transactions BT1 to BT4 are as shown in FIG. Here, there are three connections Ck from thetransaction control apparatus 2 to the database 3 as shown in FIG. 2, and the transactions BTi are executed in parallel with these three connections C1 to C3.

まず、トランザクション制御装置2が、トランザクションBT1を実行する場合、アクセス履歴231はすべて空であるので(図3のS303のNo参照)、どの接続CkでトランザクションBT1のトランザクションを実行してもよい。ここで、例えば、トランザクション制御装置2のトランザクション制御部25が接続C3を選んだ場合、この接続C3についてのアクセス履歴231(231C)に、key0の値が「1」のデータに対してアクセスがあったことを記録しておく(S311参照)。そして、トランザクション並列実行部24のトランザクション実行部241(241C)は、トランザクションBT1におけるSQLをトランザクションNT1として実行する(S312参照)。但し、ここではまだCOMMITは実行しない。  First, when thetransaction control device 2 executes the transaction BT1, theaccess history 231 is all empty (see No in S303 in FIG. 3), so the transaction BT1 may be executed by any connection Ck. Here, for example, when thetransaction control unit 25 of thetransaction control device 2 selects the connection C3, the access history 231 (231C) for this connection C3 has access to the data whose key0 value is “1”. (See S311). Then, the transaction execution unit 241 (241C) of the transactionparallel execution unit 24 executes the SQL in the transaction BT1 as the transaction NT1 (see S312). However, COMMIT is not yet executed here.

次に、トランザクション制御装置2が、トランザクションBT2を実行する場合、どのアクセス履歴231にもkey0の値が「2」のデータに対してアクセスがあったことは記録されていないので、どの接続CkでトランザクションBT2のトランザクションを実行してもよい。ここで、例えば、トランザクション制御装置2のトランザクション制御部25が接続C2を選んだ場合、この接続C2についてのアクセス履歴231(231B)に、key0の値が「2」のデータに対してアクセスがあったことを記録しておく。そして、トランザクション並列実行部24のトランザクション実行部241(241B)は、トランザクションBT2におけるSQLをトランザクションNT2として実行する。但し、ここではまだCOMMITは実行しない。  Next, when thetransaction control device 2 executes the transaction BT2, it is not recorded in anyaccess history 231 that there is an access to data whose key0 value is “2”. The transaction BT2 may be executed. Here, for example, when thetransaction control unit 25 of thetransaction control device 2 selects the connection C2, the access history 231 (231B) for the connection C2 has access to the data whose key0 value is “2”. Record that. Then, the transaction execution unit 241 (241B) of the transactionparallel execution unit 24 executes the SQL in the transaction BT2 as the transaction NT2. However, COMMIT is not yet executed here.

続いて、トランザクション制御装置2が、トランザクションBT3を実行する場合、既にアクセス履歴231にkey0の値が「1」のデータに対してアクセスがあったことが記録されている。このため、トランザクション制御部25は、トランザクションBT3のトランザクションを接続C3で実行する。そして、接続C3についてのアクセス履歴231(231C)に、key0の値が「1」のデータに対してアクセスがあったことを記録しておく。そして、トランザクション並列実行部24のトランザクション実行部241(241C)は、トランザクションBT3におけるSQLをトランザクションNT3として実行する。但し、ここではまだCOMMITは実行しない。  Subsequently, when thetransaction control device 2 executes the transaction BT3, it is recorded in theaccess history 231 that the data whose key0 value is “1” has already been accessed. For this reason, thetransaction control unit 25 executes the transaction of the transaction BT3 through the connection C3. Then, it is recorded in the access history 231 (231C) for the connection C3 that there is an access to data whose key0 value is “1”. Then, the transaction execution unit 241 (241C) of the transactionparallel execution unit 24 executes the SQL in the transaction BT3 as the transaction NT3. However, COMMIT is not yet executed here.

最後に、トランザクション制御装置2が、トランザクションBT4を実行する場合、アクセス履歴231Cにkey0の値が「1」のデータに対してアクセスがあったことと、アクセス履歴231Bにkey0の値が「2」のデータに対してアクセスがあったこととが記載されている。しかし、このトランザクションBT4が参照しようとしている、key1の値が「1」のデータが、これらのデータと同じであるとは断定できない。つまり、key1の値が「1」のデータがこれらのデータと同じである可能性がある。従って、トランザクション制御部25は、記憶部23にトランザクションBT4のアクセス先を含む可能性のあるアクセス履歴231が複数あると判断し(図3のS303のYes→S304のNo参照)、トランザクション並列実行部24は接続C1〜C3のすべてのトランザクションNTjでCOMMITを実行する(S315参照)。そして、トランザクション制御部25は、すべての接続C1〜C3に関するアクセス履歴231A〜231Cを消去する(S316参照)。その後、トランザクション制御部25は、いずれかの接続Ckを選択し、トランザクションBT4に関するアクセス履歴231を記録する(S311参照)。  Finally, when thetransaction control device 2 executes the transaction BT4, theaccess history 231C has accessed the data whose key0 value is “1”, and the key 0 value of theaccess history 231B is “2”. It is described that there was access to the data. However, it cannot be determined that the data whose key1 value is “1” that the transaction BT4 intends to reference is the same as these data. That is, there is a possibility that the data whose key1 value is “1” is the same as these data. Accordingly, thetransaction control unit 25 determines that there are a plurality ofaccess histories 231 that may include the access destination of the transaction BT4 in the storage unit 23 (Yes in S303 in FIG. 3 → see No in S304), and the transactionparallel execution unit 24 executes COMMIT in all transactions NTj of connections C1 to C3 (see S315). Then, thetransaction control unit 25 deletes theaccess histories 231A to 231C related to all the connections C1 to C3 (see S316). Thereafter, thetransaction control unit 25 selects one of the connections Ck and records theaccess history 231 related to the transaction BT4 (see S311).

なお、ここでは、key0およびkey1の値の関係が不明な場合について説明したが、key0およびkey1の値の関係が予め分かっている場合、以下のようにしてもよい。すなわち、トランザクション制御部25は、key0およびkey1の値の関係に基づき、各アクセス履歴231に記録されたkey0の値が「1」のレコードや、key0の値が「2」のレコードが、トランザクションBT4が参照しようとしているkey1の値が「1」であるレコードと同じか否かを判断する。ここで、トランザクションBT4が参照しようとしているデータが、いずれかのアクセス履歴231に記録された参照データと同じと判断された場合、その参照データが記録されたアクセス履歴231の接続Ckを用いて、トランザクションBT4を実行する。  Here, the case where the relationship between the values of key0 and key1 is unknown has been described, but when the relationship between the values of key0 and key1 is known in advance, the following may be performed. In other words, based on the relationship between the values of key0 and key1, thetransaction control unit 25 determines that a record with a key0 value “1” or a record with a key0 value “2” recorded in eachaccess history 231 is a transaction BT4. It is determined whether or not the key1 value to be referred to is the same as the record whose value is “1”. Here, when it is determined that the data that the transaction BT4 is to refer to is the same as the reference data recorded in anyaccess history 231, the connection Ck of theaccess history 231 in which the reference data is recorded is used. Transaction BT4 is executed.

≪第2の実施の形態≫
次に、本発明の第2の実施の形態を説明する。図5は、本発明の第2の実施の形態におけるシステムの構成を示した図である。前記した第1の実施の形態と同様の構成要素は同じ符号を付して、説明を省略する。
<< Second Embodiment >>
Next, a second embodiment of the present invention will be described. FIG. 5 is a diagram showing a system configuration in the second embodiment of the present invention. Constituent elements similar to those in the first embodiment described above are denoted by the same reference numerals, and description thereof is omitted.

図5に示すように、第2の実施の形態におけるシステムのトランザクション制御装置2Aは、データベース3に対するトランザクションの実行結果を蓄積したデータベースキャッシュ29を備えることを特徴とする。このデータベースキャッシュ29は、例えば、トランザクション並列実行部24が、過去にデータベース3に対し実行したトランザクションBTiの結果である(key0,key1,value)=(0,1,A),(0,2,B)を記憶する。  As shown in FIG. 5, the transaction control apparatus 2A of the system according to the second embodiment is characterized by including adatabase cache 29 in which the execution results of transactions for the database 3 are accumulated. Thedatabase cache 29 is, for example, a result of a transaction BTi executed by the transactionparallel execution unit 24 on the database 3 in the past (key0, key1, value) = (0,1, A), (0,2, B) Memorize.

このようなトランザクション制御装置2Aの動作手順を、図6を用いて説明する。図6は、図5のトランザクション制御装置の動作手順を示すフローチャートである。図6のS600、S601はそれぞれ、図3のS300、S301と同じであるので説明を省略し、S602から説明する。  The operation procedure of the transaction control apparatus 2A will be described with reference to FIG. FIG. 6 is a flowchart showing an operation procedure of the transaction control apparatus of FIG. S600 and S601 in FIG. 6 are the same as S300 and S301 in FIG.

トランザクション制御装置2Aのトランザクション解析部22は、入力されたトランザクションBTiにおけるSQLのFROM句やWHERE句を解析し、このトランザクションBTiのアクセス先に関する情報を得る(S602)。そして、トランザクション制御部25は、データベースキャッシュ29上のデータで、このトランザクションBTiが実行可能か否かを判断する(S603)。つまり、トランザクション制御部25は、データベースキャッシュ29に、このトランザクションBTiのアクセス先に関する情報があるか否かを判断する。例えば、入力された、トランザクションBTiが「SELECT* FROM tab_a WHERE key0=0;(tab_aのkey0=0を参照する)」であった場合、この「key0=0」の参照結果が、データベースキャッシュ29に登録されているか否かを判断する。  Thetransaction analysis unit 22 of the transaction control apparatus 2A analyzes the SQL FROM phrase and WHERE phrase in the input transaction BTi, and obtains information on the access destination of the transaction BTi (S602). Then, thetransaction control unit 25 determines whether or not this transaction BTi can be executed with the data on the database cache 29 (S603). That is, thetransaction control unit 25 determines whether or not thedatabase cache 29 has information regarding the access destination of the transaction BTi. For example, if the input transaction BTi is “SELECT * FROM tab_a WHERE key0 = 0; (refer to key0 = 0 of tab_a)”, the reference result of “key0 = 0” is stored in thedatabase cache 29. Determine if it is registered.

ここで、トランザクション制御部25は、データベースキャッシュ29上のデータでこのトランザクションBTiが実行可能と判断したとき(S603のYes)、データベースキャッシュ29上の該当データを利用してトランザクションBTiを実行する(S604)。そして、S615へ進み、iの値を+1インクリメントする。このS615の処理は、前記した図3のS314と同じである。  When thetransaction control unit 25 determines that the transaction BTi can be executed with the data on the database cache 29 (Yes in S603), thetransaction control unit 25 executes the transaction BTi using the corresponding data on the database cache 29 (S604). ). In step S615, the value of i is incremented by +1. The process of S615 is the same as S314 in FIG.

一方、トランザクション制御部25は、データベースキャッシュ29上のデータでこのトランザクションBTiが実行不可能と判断したとき(S603のNo)、S605へ進む。この後のS605〜S607、S610〜S612、S614〜S617の処理は、それぞれ前記した図3のS303〜S305、S310〜S312、S313〜S316の処理と同様なので説明を省略する。なお、S605において、トランザクション制御装置2Aは、まず、データベースキャッシュ29に蓄積された過去のトランザクションBTiの追加・更新結果をすべてデータベース3へ反映する。それから、トランザクション制御部25は、このトランザクションBTiの実行に用いる接続Ckを選択し(S610)、この選択された接続Ckを用いて、データベース3に対しトランザクションBTiを実行する(S612)。このようにすることで、トランザクションBTiは、このトランザクションBTiよりも前に実行すべきトランザクションの内容が反映されたデータベース3に対し、処理を実行することができる。  On the other hand, when thetransaction control unit 25 determines that the transaction BTi cannot be executed with the data on the database cache 29 (No in S603), thetransaction control unit 25 proceeds to S605. The subsequent processing of S605 to S607, S610 to S612, and S614 to S617 is the same as the processing of S303 to S305, S310 to S312, and S313 to S316 in FIG. In step S <b> 605, thetransaction control apparatus 2 </ b> A first reflects all addition / update results of past transactions BTi accumulated in thedatabase cache 29 in the database 3. Then, thetransaction control unit 25 selects a connection Ck used to execute the transaction BTi (S610), and executes the transaction BTi for the database 3 using the selected connection Ck (S612). By doing so, the transaction BTi can execute processing on the database 3 in which the contents of the transaction to be executed before the transaction BTi are reflected.

なお、S612においてトランザクション並列実行部24がトランザクションBTiを実行した後、このトランザクションの実行結果をデータベースキャッシュ29上に記録する(S613)。このようにトランザクション制御装置2Aは、データベースキャッシュ29に蓄積されたトランザクションの実行結果を用いるので、トランザクション処理を高速化できる。また、フローチャートでの説明は省略したが、トランザクション並列実行部24においてCOMMITを実行中に、トランザクションBTiの入力を受け付けたときには、データベースキャッシュ29のデータを用いてトランザクションBTiを実行する。これにより、COMMITの実行によりトランザクションBTiが停止するのを防止できる。  Note that after the transactionparallel execution unit 24 executes the transaction BTi in S612, the execution result of this transaction is recorded on the database cache 29 (S613). As described above, the transaction control apparatus 2A uses the execution result of the transaction stored in thedatabase cache 29, so that the transaction processing can be accelerated. Although description in the flowchart is omitted, when the transactionparallel execution unit 24 receives the input of the transaction BTi while executing COMMIT, the transaction BTi is executed using the data in thedatabase cache 29. Thereby, it is possible to prevent the transaction BTi from being stopped due to the execution of COMMIT.

<第2の実施の形態の例>
次に、図4、図5および図6を参照して、第2の実施の形態の具体例を説明する。第2の実施の形態のデータベース3にはテーブルaが格納され、入力されるトランザクションBTiは図4に示したトランザクションBT1〜BT4である場合を例に説明する。
<Example of Second Embodiment>
Next, a specific example of the second embodiment will be described with reference to FIGS. 4, 5, and 6. An example will be described in which the table a is stored in the database 3 of the second embodiment and the input transaction BTi is the transactions BT1 to BT4 shown in FIG.

トランザクション制御装置2A(図5参照)のトランザクション解析部22は、入力されたトランザクションBT1におけるSQLのFROM句やWHERE句を解析する(図6のS602参照)。そして、トランザクション制御部25は、データベースキャッシュ29上のデータで、このトランザクションBT1が実行可能か否かを判断する(S603参照)。このトランザクションBT1は、単なるレコードの追加操作であり、トランザクション制御部25はデータベースキャッシュ29上にレコードを追加すればよい。つまり、データベース3を直接参照する必要はない。従って、トランザクション制御部25は、データベースキャッシュ29上のデータで、このトランザクションBT1が実行可能と判断する(S603のYes参照)。そして、トランザクション制御部25はこのトランザクションBT1を実行し(S604参照)、データベースキャッシュ29上にレコードを追加する。  Thetransaction analysis unit 22 of the transaction control apparatus 2A (see FIG. 5) analyzes the SQL FROM phrase and WHERE phrase in the input transaction BT1 (see S602 in FIG. 6). Then, thetransaction control unit 25 determines whether or not this transaction BT1 can be executed with the data on the database cache 29 (see S603). The transaction BT1 is simply a record addition operation, and thetransaction control unit 25 may add a record to thedatabase cache 29. That is, it is not necessary to refer to the database 3 directly. Therefore, thetransaction control unit 25 determines that the transaction BT1 can be executed with the data on the database cache 29 (see Yes in S603). Then, thetransaction control unit 25 executes the transaction BT1 (see S604) and adds a record on thedatabase cache 29.

次に、トランザクション解析部22は、トランザクションBT2について解析し(S602参照)、トランザクション制御部25は、このトランザクションBT2がデータベースキャッシュ29上のデータで実行可能か否かを判断する(S603参照)。例えば、このトランザクションBT2は、key0が「2」であるレコードに対してvalueの値を「1」に更新するものである。従って、データベースキャッシュ29上にkey0が「2」のレコードがあるか否かを判断する(S603参照)。ここで、トランザクション制御部25は、データベースキャッシュ29上のデータでこのトランザクションBT2が実行可能と判断したとき(S603のYes参照)、データベースキャッシュ29上のkey0が「2」であるレコードに対してvalueの値を「1」に更新する(S604参照)。  Next, thetransaction analysis unit 22 analyzes the transaction BT2 (see S602), and thetransaction control unit 25 determines whether or not the transaction BT2 can be executed with data on the database cache 29 (see S603). For example, this transaction BT2 updates the value value to “1” for the record whose key 0 is “2”. Therefore, it is determined whether or not there is a record whose key 0 is “2” on the database cache 29 (see S603). Here, when thetransaction control unit 25 determines that the transaction BT2 can be executed with the data on the database cache 29 (see Yes in S603), the value is set for the record whose key 0 on thedatabase cache 29 is “2”. Is updated to “1” (see S604).

一方、トランザクション制御部25が、データベースキャッシュ29上のデータでこのトランザクションBT2が実行不可能と判断したとき(S603のNo参照)、どの接続Ckにおけるアクセス履歴231においてもkey0が「2」のデータに対するアクセスは記録されていないため(S605のNo参照)、このトランザクションBT2の実行に用いる接続Ckをランダムに選択してよいと判断できる。そこで、例えば、トランザクション制御部25は、このトランザクションBT2の実行に用いる接続Ckとして接続C2を選択すると(S610参照)、この選択した接続C2に関するアクセス履歴231Bに、key0が「2」のデータに対するアクセスがあったことを記録しておく(S611参照)、その後、トランザクション実行部241(241B)は、このトランザクションBT2におけるSQLをトランザクションNT2として実行する。但し、COMMITはまだ実行しない。  On the other hand, when thetransaction control unit 25 determines that the transaction BT2 cannot be executed with the data in the database cache 29 (see No in S603), thekey 0 is the data “2” in theaccess history 231 in any connection Ck. Since access is not recorded (see No in S605), it can be determined that the connection Ck used for execution of the transaction BT2 may be selected at random. Therefore, for example, when thetransaction control unit 25 selects the connection C2 as the connection Ck used to execute the transaction BT2 (see S610), the access to the data with thekey 0 of “2” is accessed in theaccess history 231B regarding the selected connection C2. The transaction execution unit 241 (241B) then executes the SQL in the transaction BT2 as the transaction NT2. However, COMMIT is not executed yet.

次に、トランザクション解析部22は、トランザクションBT3について解析し(S602参照)、トランザクション制御部25は、トランザクションBT3について、データベースキャッシュ29上のデータで実行可能か否かを判断する(S603参照)。このトランザクションBT3は、key0が「1」であるレコードに対してvalueの値を参照するものである。よって、トランザクション制御部25は、データベースキャッシュ29上のトランザクションBT1の実行結果のデータを利用してトランザクションBT3を実行可能と判断する(S603のYes参照)。そして、トランザクション制御部25は、データベースキャッシュ29上からトランザクションBT1の実行結果のデータを利用してトランザクションBT3を実行する(S604参照)。つまり、トランザクション制御装置2Aは、データベース3へアクセスすることなくトランザクションBT2を実行する。  Next, thetransaction analysis unit 22 analyzes the transaction BT3 (see S602), and thetransaction control unit 25 determines whether the transaction BT3 can be executed with the data on the database cache 29 (see S603). This transaction BT3 refers to the value value for the record whose key 0 is “1”. Therefore, thetransaction control unit 25 determines that the transaction BT3 can be executed using the data of the execution result of the transaction BT1 on the database cache 29 (see Yes in S603). Then, thetransaction control unit 25 executes the transaction BT3 from thedatabase cache 29 using the data of the execution result of the transaction BT1 (see S604). That is, the transaction control device 2A executes the transaction BT2 without accessing the database 3.

次に、トランザクション解析部22は、トランザクションBT4について解析し(S602参照)、トランザクション制御部25は、トランザクションBT4について、データベースキャッシュ29上のデータで実行可能か否かを判断する(S603参照)。この段階で、データベースキャッシュ29上にはkey0が「1」であるレコードと、key0が「2」であるレコードへのトランザクションBTiの実行結果が蓄積されている。しかし、これらのレコードが、このトランザクションBT4のアクセス先であるkey1が「1」であるレコードと同じか否かは分からない。従って、このトランザクションBT4について、データベースキャッシュ29上のデータで実行不可能と判断する(S603のNo参照)。そして、トランザクション制御装置2Aは、まず、データベースキャッシュ29上の過去のトランザクションBTiの実行結果をすべてデータベース3へ反映する。つまり、key0が「1」であるデータの挿入や、key0が「2」であるデータに対する更新をデータベース3に対して実行する。また、このkey1が「1」であるレコードへのトランザクションBTiの実行結果は、まだアクセス履歴231に記録されていないので(S605のNo)、トランザクション制御部25は、このトランザクションBT4の実行に用いる接続Ckをランダムに選択し(S610参照)、選択した接続Ckに関するアクセス履歴231にトランザクションBT4のアクセス先に関する情報を記録する(S611参照)。  Next, thetransaction analysis unit 22 analyzes the transaction BT4 (see S602), and thetransaction control unit 25 determines whether the transaction BT4 can be executed with the data on the database cache 29 (see S603). At this stage, the execution result of the transaction BTi for the record whose key 0 is “1” and the record whose key 0 is “2” is stored in thedatabase cache 29. However, it is not known whether or not these records are the same as the record whose key1 that is the access destination of the transaction BT4 is “1”. Therefore, it is determined that the transaction BT4 cannot be executed with the data on the database cache 29 (see No in S603). Then, the transaction control apparatus 2A first reflects all execution results of past transactions BTi on thedatabase cache 29 in the database 3. That is, insertion of data whose key 0 is “1” and update of data whose key 0 is “2” are executed on the database 3. Further, since the execution result of the transaction BTi to the record whose key1 is “1” is not yet recorded in the access history 231 (No in S605), thetransaction control unit 25 uses the connection used for executing this transaction BT4. Ck is selected at random (see S610), and information related to the access destination of the transaction BT4 is recorded in theaccess history 231 related to the selected connection Ck (see S611).

そして、トランザクション並列実行部24は、選択した接続Ckを用いてトランザクションBT4のCOMMIT前までの処理を実行し(S612参照)、トランザクション制御部25は、データベースキャッシュ29上にこのトランザクションBT4においてアクセスしたデータを記録する(S613参照)。  Then, the transactionparallel execution unit 24 uses the selected connection Ck to execute the processing up to COMMIT of the transaction BT4 (see S612), and thetransaction control unit 25 accesses the data accessed on thedatabase cache 29 in the transaction BT4. Is recorded (see S613).

このようにすることで、トランザクション制御装置2Aは、アプリケーションサーバ1から同じデータをアクセス先とするトランザクションBTiを受け付けたとき、データベース3にアクセスする必要がなくなる。つまり、トランザクションを高速に実行できる。  In this way, the transaction control device 2A does not need to access the database 3 when receiving a transaction BTi having the same data as the access destination from theapplication server 1. In other words, transactions can be executed at high speed.

なお、前記した各実施の形態において、トランザクション制御装置2,2Aは、トランザクションを所定回数以上実行したときに、このトランザクションのCOMMITを実行することとしたが、これに限定されない。例えば、トランザクション制御装置2,2Aが前回のCOMMITの実行から所定時間経過したときに、前記トランザクションのCOMMITを実行するようにしてもよい。  In each of the embodiments described above, thetransaction control devices 2 and 2A execute the COMMIT of the transaction when the transaction is executed a predetermined number of times or more. However, the present invention is not limited to this. For example, thetransaction control devices 2 and 2A may execute the COMMIT of the transaction when a predetermined time has elapsed since the previous COMMIT.

さらに、前記した各実施の形態において、トランザクションはデータベース3に対し処理を行うトランザクションとしたが、これ以外の処理を行うトランザクションであってもよい。  Further, in each of the above-described embodiments, the transaction is a transaction for performing processing on the database 3, but may be a transaction for performing other processing.

本実施の形態に係るトランザクション制御装置2,2Aは、前記したような処理を実行させるトランザクション制御プログラムによって実現することができ、そのプログラムをコンピュータによる読み取り可能な記憶媒体(CD−ROM等)に記憶して提供することが可能である。また、そのプログラムを、ネットワークを通して提供することも可能である。  Thetransaction control devices 2 and 2A according to the present embodiment can be realized by a transaction control program for executing the processing as described above, and the program is stored in a computer-readable storage medium (CD-ROM or the like). Can be provided. It is also possible to provide the program through a network.

次に、図7を用いて本発明の実施例を説明する。図7は、本発明の実施例であるアクセス内容検査システムを説明する図である。ここでは、第2の実施の形態のトランザクション制御装置2A(図5参照)をアクセス内容検査システム70に実装した場合について説明する。このアクセス内容検査システム70は、クライアント76とサーバ71との間のメッセージと、サーバ71とデータベース75との間のメッセージを検査し、クライアント76からデータベース75への不正アクセスの有無を検査する。  Next, an embodiment of the present invention will be described with reference to FIG. FIG. 7 is a diagram illustrating an access content inspection system that is an embodiment of the present invention. Here, a case where the transaction control apparatus 2A (see FIG. 5) according to the second embodiment is mounted on the access content inspection system 70 will be described. The access content inspection system 70 inspects a message between the client 76 and the server 71 and a message between the server 71 and thedatabase 75 to inspect whether there is an unauthorized access from the client 76 to thedatabase 75.

アクセス内容検査システム70は、メッセージの検査を行う検査用マシン72と、過去のメッセージ保存用のデータベース73とを備える。この検査用マシン72は、アプリケーションサーバ1およびトランザクション制御装置2A(図5参照)の機能を備えるマシンである。つまり、この検査用マシン72は、過去のメッセージ保存用のデータベース73の参照結果を蓄積するデータベースキャッシュ(データベースキャッシュ29)を備える。また、過去のメッセージ保存用のデータベース73は、データベース3(図5参照)に相当する。この検査用マシン72は、クライアント76からサーバ71へのメッセージと、このメッセージに基づきサーバ71からデータベース75へ送信されるメッセージとを取得すると、過去のメッセージ保存用のデータベース73に蓄積された過去のメッセージを参照して、このメッセージが不正アクセスに関するメッセージか否かを判断する。  The access content inspection system 70 includes an inspection machine 72 for inspecting a message and adatabase 73 for storing past messages. This inspection machine 72 is a machine having the functions of theapplication server 1 and the transaction control device 2A (see FIG. 5). That is, the inspection machine 72 includes a database cache (database cache 29) for accumulating the reference results of the pastmessage storage database 73. The pastmessage storage database 73 corresponds to the database 3 (see FIG. 5). When the inspection machine 72 acquires a message from the client 76 to the server 71 and a message transmitted from the server 71 to thedatabase 75 based on the message, the past machine 72 stores the past messages stored in the pastmessage storage database 73. By referring to the message, it is determined whether or not this message is a message related to unauthorized access.

この検査用マシン72の環境は、
CPU:Pentium4 Xenon 3.06 GHz,
メモリ:2 Gbytes,
ディスク:1 disk,
OS(Operating System):Fedora 5,
DBMS:PostgreSQL 8.1.4,
DBの初期データサイズ:600MB,
SUN:jdk1.50+JDBC3.0
である。
The environment of the inspection machine 72 is
CPU: Pentium4 Xenon 3.06 GHz,
Memory: 2 Gbytes,
Disk: 1 disk,
OS (Operating System): Fedora 5,
DBMS: PostgreSQL 8.1.4,
Initial DB data size: 600MB,
SUN: jdk1.50 + JDBC3.0
It is.

この過去のメッセージ保存用のデータベース73に格納されるテーブルの定義は、
create table status_tab(
order_id integer,
status integer,
price integer,
item_name text
);
である。
The definition of the table stored in thedatabase 73 for storing past messages is as follows:
create table status_tab (
order_id integer,
status integer,
price integer,
item_name text
);
It is.

またトランザクションは、以下の3種類である($nは変数)。
BT0:
BEGIN;
SELECT* FROM STATUS_TAB WHERE order_id=$1;
COMMIT;
BT1:
BEGIN;
INSERT INTO STATUS_TAB VALUES ($1,$2,$3,$4);
COMMIT;
BT2:
BEGIN;
UPDATE STATUS_TAB SET status =$1,
price =$2,
item_name=$3,
WHERE order_id=$4;
COMMIT;
There are three types of transactions ($ n is a variable):
BT0:
BEGIN;
SELECT * FROM STATUS_TAB WHERE order_id = $ 1;
COMMIT;
BT1:
BEGIN;
INSERT INTO STATUS_TAB VALUES ($ 1, $ 2, $ 3, $ 4);
COMMIT;
BT2:
BEGIN;
UPDATE STATUS_TAB SET status = $ 1,
price = $ 2,
item_name = $ 3,
WHERE order_id = $ 4;
COMMIT;

また、比較例では、検査用マシン72はデータベースキャッシュを用いるが、トランザクション制御装置2Aの機能は実装しなかった。つまり、トランザクション再構築によるCOMMITの回数削減は行わなかった。ここでの測定内容としては、検査対象のサーバ71におけるレスポンスを測定した。なお、ここでのレスポンスとは、クライアント76がサーバ71に処理を要求してから、アクセス内容検査システム70による検査を含むすべての処理を完了するまでにかかる時間のことをいう。このレスポンスを30分間連続して測定したところ、その平均値は、
比較例:2124[msec]
本実施例:2020[msec]
であった。但し、検査用マシン72でメッセージの検査を行わない場合のサーバ71からのレスポンスの平均値は1976.5[msec]である。このため実質、検査用マシン72での検査に要する時間は、1976.5[msec]を差し引いた
比較例:148[msec]
本実施例:45[msec]
である。従って、本実施例によれば、比較例よりも検査に要する時間が約70%短縮されることが確認された。
In the comparative example, the inspection machine 72 uses a database cache, but the function of the transaction control device 2A is not implemented. In other words, the number of times of COMMIT was not reduced by transaction reconstruction. As the measurement contents here, the response in the server 71 to be inspected was measured. Here, the response means the time taken from the client 76 requesting the processing to the server 71 until the completion of all processing including the inspection by the access content inspection system 70. When this response was measured continuously for 30 minutes, the average value was
Comparative example: 2124 [msec]
Example: 2020 [msec]
Met. However, the average value of responses from the server 71 when the inspection machine 72 does not inspect the message is 1976.5 [msec]. For this reason, the actual time required for the inspection by the inspection machine 72 is a comparative example obtained by subtracting 1976.5 [msec]: 148 [msec]
Example: 45 [msec]
It is. Therefore, according to this example, it was confirmed that the time required for the inspection was shortened by about 70% compared with the comparative example.

各実施の形態のトランザクション制御装置の特徴を概念的に示した図であるIt is the figure which showed notionally the characteristic of the transaction control apparatus of each embodiment本発明の第1の実施の形態におけるシステムの構成を示した図である。It is the figure which showed the structure of the system in the 1st Embodiment of this invention.図2のトランザクション制御装置の動作手順を示すフローチャートである。It is a flowchart which shows the operation | movement procedure of the transaction control apparatus of FIG.各実施の形態のトランザクションを例示した図である。It is the figure which illustrated the transaction of each embodiment.本発明の第2の実施の形態におけるシステムの構成を示した図である。It is the figure which showed the structure of the system in the 2nd Embodiment of this invention.図5のトランザクション制御装置の動作手順を示すフローチャートである。It is a flowchart which shows the operation | movement procedure of the transaction control apparatus of FIG.本発明の実施例であるアクセス内容検査システムを説明する図である。It is a figure explaining the access content inspection system which is an Example of this invention.本発明の比較例となる技術を説明する図である。It is a figure explaining the technique used as the comparative example of this invention.

符号の説明Explanation of symbols

1 アプリケーションサーバ
2,2A トランザクション制御装置
3 データベース
20 入力部
21 トランザクション入力部
22 トランザクション解析部
23 記憶部
24 トランザクション並列実行部
25 トランザクション制御部
27 コネクション確立部
28 出力部
29 データベースキャッシュ
231(231A,231B,231C) アクセス履歴
241(241A,241B,241C) トランザクション実行部
DESCRIPTION OFSYMBOLS 1Application server 2,2A Transaction control apparatus 3Database 20Input part 21Transaction input part 22Transaction analysis part 23Storage part 24 Transactionparallel execution part 25Transaction control part 27Connection establishment part 28Output part 29 Database cache 231 (231A, 231B, 231C) Access history 241 (241A, 241B, 241C) Transaction execution unit

Claims (8)

Translated fromJapanese
データベースに格納されたデータに対し、複数のコネクションを用いて複数のトランザクションを並列に実行するトランザクション制御装置であって、
前記トランザクションの入力を受け付けるトランザクション入力部と、
前記データベースとの間で前記コネクションを確立するコネクション確立部と、
前記確立されたコネクションごとに、当該コネクションを用いてアクセスする前記データベースのアクセス先を示したアクセス履歴を記憶する記憶部と、
前記入力されたトランザクションを解析し、当該トランザクションの前記データベースにおけるアクセス先を特定するトランザクション解析部と、
前記入力されたトランザクションの処理を実行するトランザクション実行部と、
(1)前記記憶部に記憶されたアクセス履歴から、当該トランザクションのアクセス先を含むアクセス履歴を1つ発見したとき、前記アクセス履歴に対応するコネクションを、当該トランザクションに用いるコネクションとして選択し、当該トランザクションにおける前記データベースへのアクセス先を、前記選択したコネクションに関するアクセス履歴に記録し、前記選択したコネクションを用いて、前記トランザクション実行部に、前記トランザクションのCOMMIT前までの処理の実行を指示し、前記トランザクション実行部において前記トランザクションのCOMMIT前までの処理を所定数以上実行したとき、前記コネクションそれぞれにおける前記トランザクションのCOMMITの実行を指示し、
(2)前記記憶部に記憶されたアクセス履歴から、当該トランザクションのアクセス先を含むアクセス履歴を複数発見したとき、前記記憶部に記憶されたアクセス履歴を消去し、前記トランザクション実行部に、前記コネクションそれぞれにおける前記トランザクションのCOMMITの実行を指示した後、前記入力されたトランザクションに用いるコネクションとして、前記確立されたコネクションから任意のコネクションを選択し、当該トランザクションにおける前記データベースへのアクセス先を、前記選択したコネクションに関するアクセス履歴に記録するトランザクション制御部と、
を備えることを特徴とするトランザクション制御装置。
A transaction control device that executes a plurality of transactions in parallel using a plurality of connections for data stored in a database,
A transaction input unit for receiving the input of the transaction;
A connection establishment unit for establishing the connection with the database;
A storage unit that stores an access history indicating an access destination of the database to be accessed using the connection for each established connection;
A transaction analysis unit that analyzes the input transaction and identifies an access destination in the database of the transaction;
A transaction execution unit that executes processing of the input transaction;
(1) When one access history including the access destination of the transaction is found from the access history stored in the storage unit, a connection corresponding to the access history is selected as a connection used for the transaction, and the transaction The access destination to the database is recorded in the access history related to the selected connection, and the transaction execution unit is instructed to execute the process before COMMIT of the transaction using the selected connection. When the execution unit executes a predetermined number of processes before COMMIT of the transaction, it instructs execution of the COMMIT of the transaction in each connection,
(2) When a plurality of access histories including the access destination of the transaction are found from the access histories stored in the storage unit, the access histories stored in the storage unit are erased, and the connection to the transaction execution unit After instructing execution of COMMIT of the transaction in each, an arbitrary connection is selected from the established connections as a connection to be used for the input transaction, and the access destination to the database in the transaction is selected. A transaction control unit that records the access history related to the connection;
A transaction control apparatus comprising:
前記トランザクション制御部は、
前記記憶部に記憶されたアクセス履歴から、当該トランザクションのアクセス先を含むアクセス履歴を発見できなかったとき、
前記入力されたトランザクションに用いるコネクションとして、前記確立されたコネクションから任意のコネクションを選択し、当該トランザクションにおける前記データベースへのアクセス先を、前記選択したコネクションに関するアクセス履歴に記録することを特徴とする請求項1に記載のトランザクション制御装置。
The transaction control unit
When the access history including the access destination of the transaction cannot be found from the access history stored in the storage unit,
An arbitrary connection is selected from the established connections as a connection to be used for the input transaction, and an access destination to the database in the transaction is recorded in an access history related to the selected connection. Item 4. The transaction control device according to Item 1.
前記トランザクション制御部は、
前回のCOMMITの実行指示から所定時間経過したとき、前記トランザクション実行部に前記トランザクションそれぞれのCOMMITの実行を指示することを特徴とする請求項1または請求項2に記載のトランザクション制御装置。
The transaction control unit
The transaction control apparatus according to claim 1 or 2, wherein when a predetermined time has elapsed from a previous COMMIT execution instruction, the transaction execution unit is instructed to execute each COMMIT of the transaction.
前記記憶部は、
過去の前記トランザクションの実行結果を蓄積したデータベースキャッシュを備え、
前記トランザクション制御部は、
前記データベースキャッシュにおける実行結果に当該トランザクションのアクセス先を含むデータがあるか否かを判断し、
前記データベースキャッシュにおける実行結果に、当該トランザクションのアクセス先を含むデータがあると判断したとき、前記データベースキャッシュにおける実行結果をもとに当該トランザクションを実行し、当該トランザクションの実行結果を前記データベースキャッシュに蓄積し、
前記データベースキャッシュにおける実行結果に、当該トランザクションのアクセス先を含むデータがないと判断したとき、前記データベースのデータに対し当該トランザクションを実行する請求項1ないし請求項3のいずれか1項に記載のトランザクション制御装置。
The storage unit
A database cache for accumulating past transaction execution results;
The transaction control unit
Determining whether there is data including the access destination of the transaction in the execution result in the database cache;
When it is determined that there is data including the access destination of the transaction in the execution result in the database cache, the transaction is executed based on the execution result in the database cache, and the execution result of the transaction is stored in the database cache And
4. The transaction according to claim 1, wherein when it is determined that there is no data including an access destination of the transaction in the execution result in the database cache, the transaction is executed on the data in the database. Control device.
前記トランザクションおよび前記アクセス履歴に示される前記データベースのアクセス先は、SQL(Structured Query Language)を用いた条件により記述され、
前記トランザクション制御部は、
前記記憶部に記憶されたアクセス履歴から、当該トランザクションのアクセス先を含むアクセス履歴を探すとき、前記トランザクションおよび前記アクセス履歴におけるSQLのFROM句およびWHERE句により示される条件を参照して探すことを特徴とする請求項1ないし請求項4のいずれか1項に記載のトランザクション制御装置。
The access destination of the database indicated in the transaction and the access history is described by a condition using SQL (Structured Query Language),
The transaction control unit
When searching for an access history including the access destination of the transaction from the access history stored in the storage unit, the search is performed by referring to the conditions indicated by the SQL FROM clause and WHERE clause in the transaction and the access history. The transaction control device according to claim 1, wherein:
データベースとの間で確立されたコネクションごとに、当該コネクションを用いてアクセスする前記データベースのアクセス先を示したアクセス履歴を記憶する記憶部を備え、前記データベースに格納されたデータに対し、複数のコネクションを用いて複数のトランザクションを並列に実行するトランザクション制御装置が、
前記トランザクションの入力を受け付けるステップと、
前記データベースとの間で前記コネクションを確立するステップと、
前記入力されたトランザクションを解析し、当該トランザクションの前記データベースにおけるアクセス先を特定するステップと、
(1)前記記憶部に記憶されたアクセス履歴から、当該トランザクションのアクセス先を含むアクセス履歴を1つ発見したとき、
前記アクセス履歴に対応するコネクションを、当該トランザクションに用いるコネクションとして選択し、当該トランザクションにおける前記データベースへのアクセス先を、前記選択したコネクションに関するアクセス履歴に記録するステップと、
前記選択したコネクションを用いて、前記トランザクションのCOMMIT前までの処理を実行するステップと、
前記トランザクションのCOMMIT前までの処理を所定数以上実行したとき、
前記コネクションそれぞれにおける前記トランザクションのCOMMITを実行するステップとを実行し、
(2)前記記憶部に記憶されたアクセス履歴から、当該トランザクションのアクセス先を含むアクセス履歴を複数発見したとき、
前記記憶部に記憶されたすべてのアクセス履歴を消去するステップと、
前記コネクションそれぞれにおける前記トランザクションのCOMMITを実行するステップと、
前記入力されたトランザクションに用いるコネクションとして、前記確立されたコネクションから任意のコネクションを選択し、当該トランザクションにおける前記データベースへのアクセス先を、前記選択したコネクションに関するアクセス履歴に記録するステップと、
を実行することを特徴とするトランザクション制御方法。
For each connection established with a database, the storage unit stores an access history indicating an access destination of the database to be accessed using the connection, and a plurality of connections to the data stored in the database A transaction control device that executes a plurality of transactions in parallel using
Receiving an input of the transaction;
Establishing the connection with the database;
Analyzing the input transaction and identifying an access destination in the database of the transaction;
(1) When one access history including the access destination of the transaction is found from the access history stored in the storage unit,
Selecting a connection corresponding to the access history as a connection used for the transaction, and recording an access destination to the database in the transaction in an access history related to the selected connection;
Using the selected connection to execute processing before COMMIT of the transaction;
When a predetermined number of processes before COMMIT of the transaction are executed,
Performing a COMMIT of the transaction on each of the connections;
(2) When a plurality of access histories including the access destination of the transaction are found from the access histories stored in the storage unit,
Erasing all access histories stored in the storage unit;
Performing a COMMIT of the transaction on each of the connections;
Selecting an arbitrary connection from the established connections as a connection to be used for the input transaction, and recording an access destination to the database in the transaction in an access history related to the selected connection;
The transaction control method characterized by performing.
請求項6に記載のトランザクション制御方法をコンピュータであるトランザクション処理装置に実行させることを特徴とするトランザクション制御プログラム。  A transaction control program for causing a transaction processing apparatus, which is a computer, to execute the transaction control method according to claim 6. 請求項7に記載のトランザクション制御プログラムを記憶したコンピュータに読取り可能な記憶媒体。  A computer-readable storage medium storing the transaction control program according to claim 7.
JP2007187971A2007-07-192007-07-19 Transaction control apparatus, transaction control method, transaction control program, and storage medium storing the programPendingJP2009026029A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
JP2007187971AJP2009026029A (en)2007-07-192007-07-19 Transaction control apparatus, transaction control method, transaction control program, and storage medium storing the program

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
JP2007187971AJP2009026029A (en)2007-07-192007-07-19 Transaction control apparatus, transaction control method, transaction control program, and storage medium storing the program

Publications (1)

Publication NumberPublication Date
JP2009026029Atrue JP2009026029A (en)2009-02-05

Family

ID=40397787

Family Applications (1)

Application NumberTitlePriority DateFiling Date
JP2007187971APendingJP2009026029A (en)2007-07-192007-07-19 Transaction control apparatus, transaction control method, transaction control program, and storage medium storing the program

Country Status (1)

CountryLink
JP (1)JP2009026029A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
JP2011180649A (en)*2010-02-262011-09-15Nec CorpData processing system, data processing method, and data processing program
WO2014068820A1 (en)*2012-10-292014-05-08日本電気株式会社Transaction system
WO2020218550A1 (en)*2019-04-252020-10-29パナソニック インテレクチュアル プロパティ コーポレーション オブ アメリカControl method, data generation device, and program

Cited By (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
JP2011180649A (en)*2010-02-262011-09-15Nec CorpData processing system, data processing method, and data processing program
WO2014068820A1 (en)*2012-10-292014-05-08日本電気株式会社Transaction system
JP5949937B2 (en)*2012-10-292016-07-13日本電気株式会社 Transaction system
WO2020218550A1 (en)*2019-04-252020-10-29パナソニック インテレクチュアル プロパティ コーポレーション オブ アメリカControl method, data generation device, and program
JPWO2020218550A1 (en)*2019-04-252020-10-29
JP7478726B2 (en)2019-04-252024-05-07パナソニック インテレクチュアル プロパティ コーポレーション オブ アメリカ CONTROL METHOD, DATA GENERATION DEVICE, AND PROGRAM

Similar Documents

PublicationPublication DateTitle
US10691658B2 (en)Automatically optimizing resource usage on a target database management system to increase workload performance
US7721288B2 (en)Organizing transmission of repository data
US9811577B2 (en)Asynchronous data replication using an external buffer table
US8868595B2 (en)Enhanced control to users to populate a cache in a database system
CN109471851B (en)Data processing method, device, server and storage medium
JP6877435B2 (en) Database operation method and equipment
US10776354B2 (en)Efficient processing of data extents
CN106897123B (en)Database operation method and device
US20170242904A1 (en)Computer system and transaction processing management method
US11036701B2 (en)Data sampling in a storage system
CN110059096A (en)Data version management method, apparatus, equipment and storage medium
US7526469B2 (en)Method and system of database management with shared area
EP1850250A1 (en)Method and system for renewing an index
EP4433908A1 (en)Loading data in a target database system using different synchronization programs
TW201721471A (en)System, method and device for optimizing database operations
JP2009026029A (en) Transaction control apparatus, transaction control method, transaction control program, and storage medium storing the program
CN104731641A (en)Method and system of replication of batch jobs of computing systems
WO2013145129A1 (en)Database management method, program and information processing device
JP2002123516A (en)System and method for evaluating web site and recording medium
CN117056427A (en)Data processing method and device in hybrid transaction analysis system and electronic equipment
US11625386B2 (en)Fast skip list purge
CN118647987A (en) Fast skip table scan and insertion
JP6688433B2 (en) Computer system
JP2024061205A (en)Machine learning support program, machine learning support method, and information processing apparatus
JP2019197309A (en)Index construction program, index construction method, and index construction device

[8]ページ先頭

©2009-2025 Movatter.jp