[go: up one dir, main page]

JP2008186358A - Data base access system and data base access method, and program - Google Patents

Data base access system and data base access method, and program Download PDF

Info

Publication number
JP2008186358A
JP2008186358A JP2007021160A JP2007021160A JP2008186358A JP 2008186358 A JP2008186358 A JP 2008186358A JP 2007021160 A JP2007021160 A JP 2007021160A JP 2007021160 A JP2007021160 A JP 2007021160A JP 2008186358 A JP2008186358 A JP 2008186358A
Authority
JP
Japan
Prior art keywords
database
session
sessions
unused
thread
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.)
Withdrawn
Application number
JP2007021160A
Other languages
Japanese (ja)
Inventor
Kazuhiro Uejima
一洋 上島
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.)
NEC Corp
Original Assignee
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP2007021160A priority Critical patent/JP2008186358A/en
Publication of JP2008186358A publication Critical patent/JP2008186358A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To increase efficiency of processing for database (DB) access. <P>SOLUTION: A DB session pool 22 maintains and manages a plurality of DB sessions to be connected with a database (DB) 30. An increase management thread 23 monitors unused sessions of the DB session pool 22 and increases the number of unused DB sessions when the number of unused DB sessions becomes equal to or below the predetermined number. An idle monitoring thread 24 monitors whether fixed time passes as the DB sessions are left unused and deletes the DB sessions which are not used for the fixed time or over. A business thread 21 performs an acquisition request of a DB session concerning a transaction in accordance with a transaction request to the DB session pool 22, notifies the increase management thread 23 about acquisition of the DB session and executes the transaction while referring to or updating the DB 30 connected by the acquired DB session. <P>COPYRIGHT: (C)2008,JPO&INPIT

Description

本発明は、データベースアクセスシステムおよびデータベースアクセス方法ならびにプログラムに係り、特に、データベースとの接続/切断処理を実行する技術に係る。   The present invention relates to a database access system, a database access method, and a program, and more particularly to a technique for executing connection / disconnection processing with a database.

計算機による業務処理では、データベース(DB)にアクセスして処理が行われることが一般的であって、複数の業務処理用のスレッド(以下業務スレッドという)によって実行される。データベースアクセスにおいて、プールがスペース不足に近づいたら、追加のストレージスペースを取得することで、管理者がこのリスクを軽減することを可能にするフリーセグメントプールを管理するシステムが特許文献1に開示されている。   In business processing by a computer, processing is generally performed by accessing a database (DB), and is executed by a plurality of business processing threads (hereinafter referred to as business threads). Patent Document 1 discloses a system for managing a free segment pool that enables an administrator to reduce this risk by acquiring additional storage space when the pool approaches a space shortage in database access. Yes.

なお、関連する技術として、特許文献2には、データベースアクセスに対するモニタリング及びチューニングをサービス単位で行うデータベースチューニング装置が開示されている。この装置は、利用者端末からサービス名を含む処理要求が入力されたとき、利用者端末とのセッションを特定するセッションIDおよび上記サービス名からなるセッション情報を含んだ統計情報を統計情報格納部に格納する処理を行うと共に、上記サービス名のサービスを構成するコンポーネントを実行する毎に、上記コンポーネントのSQL文或いは変更SQL文と、処理時間と、コンポーネント名とを統計情報に追加するデータベースアクセス手段を備えている。   As a related technique, Patent Document 2 discloses a database tuning apparatus that performs monitoring and tuning for database access in units of services. When a processing request including a service name is input from a user terminal, this apparatus stores statistical information including a session ID for identifying a session with the user terminal and session information including the service name in the statistical information storage unit. Database access means for performing the storing process and adding the SQL statement or change SQL statement of the component, the processing time, and the component name to the statistical information every time the component constituting the service with the service name is executed. I have.

また、関連する技術として、特許文献3には、セッション制御資源をプール管理し、LANに接続された任意の端末装置からの通信処理装置宛のセッション開設要求を、ホスト計算機に対して接続を許可するものと仮想的に定義したセッション開設要求として受信し、プール管理されたセッション制御資源を選択しそれを使用してセッションの確立を行う動的端末接続方式が記載されている。   As a related technique, Patent Document 3 discloses that pool management of session control resources is performed and a session establishment request addressed to a communication processing device from any terminal device connected to the LAN is permitted to be connected to the host computer. A dynamic terminal connection method is described in which a session control resource that is received as a session establishment request that is virtually defined as being to be selected, a pool-managed session control resource is selected, and a session is established using the selected resource.

特開2006−302258号公報JP 2006-302258 A 特開2006−277179号公報JP 2006-277179 A 特開平3−266156号公報JP-A-3-266156

1つのプロセスに存在する複数の業務スレッドからデータベースを参照もしくは更新する場合、最低でも同時に参照もしくは更新を行う業務スレッドの数と同数のDBセッションが必要である。この場合、(1)業務スレッドの数と同数のDBセッションをあらかじめ用意しておくか、あるいは、(2)プロセス上で一定数のDBセッションをあらかじめ用意し、業務スレッドからデータベースへの参照もしくは更新の要求が発生したときにDBセッションに空きがあればその業務スレッドへDBセッションを払い出し、空きがなければ新たにDBセッションを作成する必要がある。   When a database is referred to or updated from a plurality of business threads existing in one process, at least the same number of DB sessions as the number of business threads that are referred to or updated simultaneously are required. In this case, (1) Prepare the same number of DB sessions as the number of business threads in advance, or (2) Prepare a certain number of DB sessions on the process in advance and refer to or update the database from the business threads. When there is a vacant DB session when the request is issued, it is necessary to pay out the DB session to the business thread, and to create a new DB session if there is no vacancy.

上記(1)の方法では、常に業務スレッド数分のDBセッションを保持することになり、業務スレッドがデータベースの参照もしくは更新を行っていない状態ではリソースの無駄となる。一方、上記(2)の方法では、空きのDBセッションがなかった場合には、要求が発生してからDBセッションを作成するため、DBセッションを作成する処理時間に相当する分、業務スレッドの処理に遅延が発生してしまう。   In the method (1), DB sessions corresponding to the number of business threads are always held, and resources are wasted when the business threads are not referring to or updating the database. On the other hand, in the above method (2), when there is no free DB session, the DB session is created after the request is generated, and therefore the processing of the business thread is equivalent to the processing time for creating the DB session. Will cause a delay.

このようなリソースの無駄および遅延の発生を解決するための技術は、従来知られておらず、解決されるべき課題として望まれていた。したがって、本発明の目的は、業務スレッドから参照もしくは更新を行うデータベースへの接続を、業務処理が開始してから終了するまでに要する時間を短縮すると共に、サーバ内で連携しているプロセスが共有するリソースを効率化するデータベースアクセスシステムおよびデータベースアクセス方法ならびにプログラムを提供することにある。   A technique for solving such a waste of resources and occurrence of delay has not been known so far and has been desired as a problem to be solved. Therefore, an object of the present invention is to reduce the time required for business processes from starting to ending the connection to the database to be referenced or updated from the business thread, and to share the processes linked in the server. It is an object to provide a database access system, a database access method, and a program for improving the efficiency of resources.

本発明の1つのアスペクトに係るデータベースアクセスシステムは、データベースと接続するための複数のデータベースセッションを維持管理するデータベースセッション管理部と、データベースセッション管理部における未使用のデータベースセッションを監視し、未使用のデータベースセッションの数が所定数以下となった場合に未使用のデータベースセッションの数を増加させる増加管理スレッドと、データベースセッション管理部におけるデータベースセッションが未使用のまま一定時間経過しているかを監視し、一定時間以上使用されなかったデータベースセッションを削除するアイドル監視スレッドと、到来するトランザクション要求に対応してトランザクションに係るデータベースセッションの取得要求をデータベースセッション管理部に対して行い、データベースセッションの取得を増加管理スレッドに通知すると共に、取得したデータベースセッションによって接続されるデータベースを参照あるいは更新しながらトランザクションを実行する業務スレッドと、を備える。   A database access system according to an aspect of the present invention includes a database session management unit that maintains and manages a plurality of database sessions for connecting to a database, and monitors unused database sessions in the database session management unit. Monitor the increase management thread that increases the number of unused database sessions when the number of database sessions is less than or equal to the predetermined number, and whether the database sessions in the database session management unit have not been used for a certain period of time, An idle monitoring thread that deletes a database session that has not been used for a certain period of time, and a database session acquisition request for a transaction corresponding to an incoming transaction request. Performed for emissions management unit, it notifies the acquisition of the database session increasing management thread comprises a work thread executing the transaction with reference or update the database to be connected by the acquired database session, the.

本発明のデータベースアクセスシステムにおいて、アイドル監視スレッドは、未使用のまま経過しているデータベースセッションを所定の時間間隔で調べるようにしてもよい。   In the database access system of the present invention, the idle monitoring thread may check database sessions that have not been used at predetermined time intervals.

本発明のデータベースアクセスシステムにおいて、それぞれのデータベースセッションは、最終使用時刻を保持し、アイドル監視スレッドは、現時刻と最終使用時刻とを比較することでデータベースセッションが未使用のまま一定時間以上使用されなかったと判断するようにしてもよい。   In the database access system of the present invention, each database session holds the last use time, and the idle monitoring thread is used for a predetermined time or more while the database session is unused by comparing the current time with the last use time. You may make it judge that there was not.

本発明のデータベースアクセスシステムにおいて、増加管理スレッドは、データベースセッションの取得が通知された場合に未使用のデータベースセッションの数を1減少させ、使用中のデータベースセッションの数を1増加させると共に、未使用のデータベースセッションの数が所定数以下となった場合には未使用のデータベースセッションを予め定めた接続増加数分増加させるようにしてもよい。   In the database access system of the present invention, the increase management thread decreases the number of unused database sessions by 1 when notified of acquisition of a database session, increases the number of database sessions in use by 1, and is unused. When the number of database sessions becomes equal to or less than the predetermined number, unused database sessions may be increased by a predetermined number of increased connections.

本発明の他のアスペクトに係るデータベースアクセス方法は、(a)データベースと接続する所定の数のデータベースセッションをデータベースセッションプールに作成するステップと、(b)データベースへの参照/更新を行うためにデータベースセッションプールに対してデータベースセッションの払い出しを要求して払い出しを受けるステップと、(c)払い出しの結果、データベースセッションプールに残っているデータベースセッションの数が所定値を下回った場合、所定の接続増加数分の追加のデータベースセッションをデータベースと接続し、追加のデータベースセッションをデータベースセッションプールに追加するステップと、(d)所定時間間隔でデータベースセッションの使用状況を調べ、未使用で所定の切断間隔時間以上経過していたデータベースセッションをデータベースから切断しデータベースセッションプールから削除するステップと、を含む。   A database access method according to another aspect of the present invention includes: (a) a step of creating a predetermined number of database sessions connected to a database in a database session pool; and (b) a database for performing reference / update to the database. Requesting the session pool to issue a database session, and (c) if the number of database sessions remaining in the database session pool falls below a predetermined value as a result of the payment, a predetermined increase in the number of connections Connecting an additional database session to the database and adding the additional database session to the database session pool; (d) examining the database session usage at a predetermined time interval, and unused and at a predetermined disconnection interval; Including the step of deleting elapsed have been a database session disconnection from a database session pool from the database over.

本発明のデータベースアクセス方法において、ステップ(d)において、それぞれのデータベースセッションは、最終使用時刻を保持し、現時刻と最終使用時刻とを比較することでデータベースセッションが未使用のまま一定時間以上使用されなかったと判断するようにしてもよい。   In the database access method of the present invention, in step (d), each database session retains the last use time and compares the current time with the last use time so that the database session remains unused and used for a certain period of time. You may make it judge that it was not done.

本発明のデータベースアクセス方法において、ステップ(c)において、払い出しの結果、未使用のデータベースセッションの数を1減少させ、使用中のデータベースセッションの数を1増加させると共に、未使用のデータベースセッションの数が所定数以下となった場合には未使用のデータベースセッションを予め定めた接続増加数分増加させるようにしてもよい。   In the database access method of the present invention, in step (c), as a result of the payout, the number of unused database sessions is decreased by 1, the number of database sessions in use is increased by 1, and the number of unused database sessions. May be increased by a predetermined increase in the number of database sessions.

本発明のさらに他のアスペクトに係るプログラムは、データベースアクセスシステムを構成するコンピュータに、データベースと接続するための複数のデータベースセッションを維持管理するデータベースセッション管理処理と、データベースセッション管理処理において未使用のデータベースセッションを監視し、未使用のデータベースセッションの数が所定数以下となった場合に未使用のデータベースセッションの数を増加させる増加管理スレッドと、データベースセッション管理処理においてデータベースセッションが未使用のまま一定時間経過しているかを監視し、一定時間以上使用されなかったデータベースセッションを削除するアイドル監視スレッドと、到来するトランザクション要求に対応してトランザクションに係るデータベースセッションの取得要求をデータベースセッション管理処理に対して行い、データベースセッションの取得を増加管理スレッドに通知すると共に、取得したデータベースセッションによって接続されるデータベースを参照あるいは更新しながらトランザクションを実行する業務スレッドと、を実行させる。   A program according to still another aspect of the present invention includes a database session management process for maintaining and managing a plurality of database sessions for connecting to a database in a computer constituting a database access system, and an unused database in the database session management process Monitors sessions and increases management threads to increase the number of unused database sessions when the number of unused database sessions falls below a predetermined number, and for a certain period of time while database sessions remain unused in database session management processing Idle monitoring thread that monitors whether it has passed and deletes database sessions that have not been used for a certain period of time, and data related to transactions in response to incoming transaction requests A transaction session that executes a transaction while referring to or updating the database connected by the acquired database session, and notifies the increase management thread of the acquisition of the database session. Is executed.

本発明によれば、増加管理スレッド上でDBセッションを作成することで業務スレッドの処理を遅延させず、また一定時間以上使用されなかったDBセッションをアイドル監視スレッドで削除することで業務処理プロセスが使用するDBセッションの数を維持し、不要なDBセッションを保持しないようにしてDBセッションの数を適切に調整することが可能となる。したがって、業務スレッドの処理を遅延させることなく、サーバ内で動作している他プロセスと共有しているメモリ量、ソケット数及びDBサーバのセッションといったリソースを不要に確保しないようにすることができる。このため、共有するリソースを他プロセスと連携する時に効率化を図ることができる。   According to the present invention, it is possible to create a DB session on the increase management thread so as not to delay the processing of the business thread, and to delete the DB session that has not been used for a certain period of time by the idle monitoring thread, thereby It is possible to appropriately adjust the number of DB sessions while maintaining the number of DB sessions to be used and not holding unnecessary DB sessions. Therefore, it is possible to avoid unnecessarily securing resources such as the amount of memory, the number of sockets, and the session of the DB server that are shared with other processes operating in the server without delaying the processing of the business thread. For this reason, efficiency can be achieved when the shared resource is linked with another process.

図1は、本発明の実施形態に係るデータベースアクセスシステムの構成を示すブロック図である。図1において、データベースアクセスシステムは、サーバ等の業務処理プロセス20において実現され、業務処理プロセス20は、クライアントAP(アプリケーション)10からの処理要求(トランザクション要求)によって、データベース30に対し参照あるいは更新を行いながら、所望の処理を実行する。   FIG. 1 is a block diagram showing a configuration of a database access system according to an embodiment of the present invention. In FIG. 1, the database access system is realized in a business processing process 20 such as a server, and the business processing process 20 refers to or updates the database 30 by a processing request (transaction request) from a client AP (application) 10. While performing, a desired process is executed.

業務処理プロセス20は、1つ以上の業務スレッド21、DB(データベース)セッションプール22、増加管理スレッド23、アイドル監視スレッド24、動作定義情報25を含む。DBセッションプール22は、DBセッション40a〜40j、40k〜40nを含む。DBセッション40a〜40j、40k〜40nのそれぞれは、最終使用時刻50が記載される。動作定義情報25は、最大接続数41、初期接続数42、接続増加数43、増加しきい値44、アイドル切断間隔45、アイドル監視間隔46の各情報を含む。データベースアクセスシステムを構成するコンピュータによってプログラムを実行することで、業務スレッド21、DBセッションプール22、アイドル監視スレッド24、増加管理スレッド23のそれぞれにおける処理がなされる。   The business process 20 includes one or more business threads 21, a DB (database) session pool 22, an increase management thread 23, an idle monitoring thread 24, and operation definition information 25. The DB session pool 22 includes DB sessions 40a to 40j and 40k to 40n. The last use time 50 is described in each of the DB sessions 40a to 40j and 40k to 40n. The operation definition information 25 includes information on a maximum connection number 41, an initial connection number 42, a connection increase number 43, an increase threshold value 44, an idle disconnection interval 45, and an idle monitoring interval 46. Processing in each of the business thread 21, the DB session pool 22, the idle monitoring thread 24, and the increase management thread 23 is performed by executing a program by a computer constituting the database access system.

クライアントAP10は、業務処理プロセス20に対し処理要求を行う。処理要求がなされた業務処理プロセス20は、プロセス内にある業務スレッド21に対し要求された処理を実行させる。   The client AP 10 makes a processing request to the business processing process 20. The business process 20 that has received the processing request causes the business thread 21 in the process to execute the requested processing.

業務処理プロセス20は、起動する際に初期接続数42によって予め定めた数分のDBセッション40a〜40jをデータベース30と接続し、DBセッションプール22として作成する。   When the business process 20 is started, the number of DB sessions 40 a to 40 j determined in advance by the initial connection number 42 is connected to the database 30 to create a DB session pool 22.

業務スレッド21は、クライアントAP10からの処理要求を受け、データベース30への参照/更新を行うためにDBセッションプール22に対してDBセッションの払い出しを要求する。払い出しを受けた業務スレッド21は、予めプログラムされた業務処理に従ってデータベース30に対し必要なデータの参照及び業務処理の結果更新を実施し、業務処理を行う。DBセッションプール22から未使用(空き)のDBセッションが払い出された結果、DBセッションプール22に残っている未使用(空き)のDBセッションの数が増加しきい値44で定められた値を下回ったとする。この場合、DBセッションの払い出し要求を行った業務スレッド21は、増加管理スレッド23に対し増加通知を行い、業務処理を継続する。   The business thread 21 receives a processing request from the client AP 10 and requests the DB session pool 22 to pay out a DB session in order to refer / update the database 30. The business thread 21 that has received the payout performs business processing by referring to the database 30 and updating the result of the business processing in accordance with the business processing programmed in advance. The number of unused (empty) DB sessions remaining in the DB session pool 22 as a result of paying out unused (empty) DB sessions from the DB session pool 22 is the value determined by the increase threshold 44. Suppose that it falls below. In this case, the business thread 21 that has issued the DB session payout request notifies the increase management thread 23 of the increase and continues the business process.

また、業務スレッド21は、データベース30への参照/更新を終了した場合、使用していたDBセッションをDBセッションプール22へ返却し、返却されたDBセッションには最終使用時刻50を記録する。返却されたDBセッションは、業務スレッド21からの払い出し要求があった際に再度払い出される。なお、この場合、払い出し先の業務スレッド21は、前回使用した業務スレッドと同一とは限らない。   Further, when the reference / update to the database 30 is completed, the business thread 21 returns the used DB session to the DB session pool 22 and records the last use time 50 in the returned DB session. The returned DB session is paid out again when there is a payout request from the business thread 21. In this case, the payout destination business thread 21 is not necessarily the same as the business thread used last time.

DBセッションプール22は、DBセッション40a〜40j、追加されるDBセッション40k〜40nを含む。それぞれのDBセッションは、データベース30と接続され、業務スレッド21からの要求に応じて払い出され、業務スレッド21によってアクセスのあった最終使用時刻50が記載される。   The DB session pool 22 includes DB sessions 40a to 40j and added DB sessions 40k to 40n. Each DB session is connected to the database 30, paid out in response to a request from the business thread 21, and the last use time 50 accessed by the business thread 21 is described.

増加管理スレッド23は、業務スレッド21からの増加通知を受け、データベース30に接続要求を行う。また、接続増加数43の数分の追加のDBセッション40k〜40nを作成する。そして、DBセッション40k〜40nをDBセッションプール22に追加し、以後追加されたDBセッション40k〜40nは、未使用(空き)のDBセッションとしてDBセッション40a〜40jに含まれる。DBセッションプール22には、常に業務スレッド21からのDBセッションの払い出し要求に対して払いだせるDBセッション40a〜40jを用意する。   The increase management thread 23 receives an increase notification from the business thread 21 and makes a connection request to the database 30. Also, additional DB sessions 40k to 40n corresponding to the number of connection increases 43 are created. Then, the DB sessions 40k to 40n are added to the DB session pool 22, and the added DB sessions 40k to 40n are included in the DB sessions 40a to 40j as unused (free) DB sessions. In the DB session pool 22, DB sessions 40 a to 40 j that can always be paid in response to a DB session payout request from the business thread 21 are prepared.

アイドル(IDLE)監視スレッド24は、アイドル監視間隔46で定められた時間間隔で動作し、DBセッションプール22にあるDBセッション40a〜40kの使用状況を調べる。調べた結果、現在の時刻が、DBセッション40a〜40kの各DBセッションに記録されている最終使用時刻50からアイドル切断間隔45以上経過していた場合、時間経過していたDBセッションをデータベース30から切断し、DBセッションプール22から削除する。   The idle (IDLE) monitoring thread 24 operates at a time interval determined by the idle monitoring interval 46 and checks the usage status of the DB sessions 40 a to 40 k in the DB session pool 22. As a result of the examination, if the current time is more than the idle disconnection interval 45 or more from the last use time 50 recorded in each DB session of the DB sessions 40a to 40k, the DB session that has passed the time is retrieved from the database 30. Disconnect and delete from the DB session pool 22.

次に、以上のように構成されるデータベースアクセスシステムの動作について説明する。図2は、本発明の実施形態に係るデータベースアクセスシステムの動作を示すフローチャートである。   Next, the operation of the database access system configured as described above will be described. FIG. 2 is a flowchart showing the operation of the database access system according to the embodiment of the present invention.

ステップS10の待機状態において、業務スレッド21がクライアントAP10からの処理要求を受けた場合、業務処理を開始し、DBセッションプール22へデータベース30の参照/更新を行うためのDBセッションを要求する。   In the standby state of step S10, when the business thread 21 receives a processing request from the client AP 10, it starts business processing and requests a DB session for referring / updating the database 30 to the DB session pool 22.

DBセッションを要求されたDBセッションプール22は、空きのDBセッションがDBセッション40a〜40kにあった場合、要求元の業務スレッド21へDBセッションを払い出す。この結果、使用中のDBセッションの数が1増加し、未使用のDBセッションの数が1減少する(ステップS11)。   The DB session pool 22 requested for the DB session pays out the DB session to the requesting business thread 21 when there is an empty DB session in the DB sessions 40a to 40k. As a result, the number of DB sessions in use increases by 1, and the number of unused DB sessions decreases by 1 (step S11).

業務スレッド21は、払い出されたDBセッションを使用し、データベースの参照/更新を行い、業務処理を完了する。業務処理を完了した業務スレッド21は、DBセッションをDBセッションプール22へ返却する。また、DBセッションを返却する際にDBセッションの最終使用時刻50に返却時刻を記録する。返却されたDBセッションは、業務スレッド21から要求が発生した場合に再度払いだされる。なお、DBセッションが再度払いだされる先の業務スレッド21は、前回の払い出し先業務スレッド21と同一とは限らない。業務スレッド21は、DBセッションの払い出しを受けた際、DBセッションプール22に残っている空きのDBセッションの個数を確認する(ステップS12)。確認した個数が増加しきい値44以下の数となっていた場合(ステップS12のY)、増加管理スレッド23へ空きのDBセッションが増加しきい値44以下になったことを通知する。   The business thread 21 uses the paid-out DB session to refer / update the database and complete the business process. The business thread 21 that has completed the business processing returns the DB session to the DB session pool 22. Further, when returning the DB session, the return time is recorded at the last use time 50 of the DB session. The returned DB session is paid out again when a request is generated from the business thread 21. Note that the business thread 21 to which the DB session is paid out again is not necessarily the same as the previous payout destination business thread 21. When receiving a DB session payout, the business thread 21 checks the number of empty DB sessions remaining in the DB session pool 22 (step S12). When the confirmed number is equal to or less than the increase threshold 44 (Y in step S12), the increase management thread 23 is notified that the free DB session is equal to or less than the increase threshold 44.

増加管理スレッド23は、業務スレッド21から通知を受けると動作を開始する。増加管理スレッド23は、接続増加数43で定められた数だけ、業務処理プロセス20からデータベース30の参照/更新を行うための追加のDBセッション40k〜40nを1つずつ作成する。作成された追加のDBセッション40k〜40nは、DBセッションプール22のDBセッション40a〜40jに含まれるようになる(ステップS13)。   The increase management thread 23 starts its operation upon receiving a notification from the business thread 21. The increase management thread 23 creates additional DB sessions 40k to 40n for referring / updating the database 30 from the business process 20 by the number determined by the connection increase number 43 one by one. The created additional DB sessions 40k to 40n are included in the DB sessions 40a to 40j of the DB session pool 22 (step S13).

なお、増加管理スレッド23は、追加DBセッションを1つ作成した結果、業務処理プロセス内におけるDBセッションの数が最大接続数41となった場合、接続増加数分の追加DBセッションを作成していなくても動作を終了する。動作を終了した増加管理スレッド23は、再び業務スレッド21から通知を受けると動作を開始する。増加管理スレッド23は、動作中に業務スレッドから通知を受けた場合には、その通知に対しては何も行わない。   If the number of DB sessions in the business process becomes the maximum number of connections 41 as a result of creating one additional DB session, the increase management thread 23 has not created additional DB sessions for the increased number of connections. Even the operation ends. The increase management thread 23 that has finished the operation starts the operation when receiving a notification from the business thread 21 again. When the increase management thread 23 receives a notification from the business thread during the operation, the increase management thread 23 does not perform anything for the notification.

一方、ステップS10の待機状態において、アイドル監視スレッド24は、アイドル監視間隔46で定められた時間の間隔で動作する。   On the other hand, in the standby state in step S 10, the idle monitoring thread 24 operates at an interval of time determined by the idle monitoring interval 46.

アイドル監視スレッド24は、アイドル監視間隔が経過した場合、DBセッションプール22にある空きのDBセッションの調査を開始する。アイドル監視スレッド24は、調査したDBセッションの最終使用時刻50と現在時刻とを比較する(ステップS14)。比較の結果、現在時刻と最終使用時刻50との差がアイドル切断間隔45以上であった場合(ステップS14のY)、そのDBセッションをデータベース30から切断し、DBセッションプール22及び業務処理プロセス20から消去する(ステップS15)。   When the idle monitoring interval elapses, the idle monitoring thread 24 starts investigating an empty DB session in the DB session pool 22. The idle monitoring thread 24 compares the last use time 50 of the examined DB session with the current time (step S14). As a result of the comparison, if the difference between the current time and the last use time 50 is equal to or greater than the idle disconnection interval 45 (Y in step S14), the DB session is disconnected from the database 30, and the DB session pool 22 and the business process 20 Is deleted (step S15).

以上のように動作するデータベースアクセスシステムは、処理に時間のかかるデータベース接続および切断処理において、アイドル監視スレッド24が切断処理を受け持ち、増加管理スレッド23が接続処理を受け持つ。また、接続処理の契機を業務スレッド21からの通知とし、切断処理をアイドル切断間隔45によるものとする。さらに、業務スレッド21は、クライアントAP10から発生するトランザクション要求の処理とDBセッションの取得要求のみを行う。このようにデータベースアクセスシステムを動作させることで、セッション数とトランザクションの流量バランスが取れているときは、増加管理スレッド23には処理負担が発生しにくく、実行頻度の多い切断処理スレッドの処理負担も発生しにくくすることができる。したがって、時間のかかる処理による負担を業務スレッド21から解放し、ひいてはプロセス全体における処理負担を軽減することができる。   In the database access system operating as described above, the idle monitoring thread 24 is responsible for the disconnection process and the increase management thread 23 is responsible for the connection process in the database connection and disconnection process that takes time. Further, it is assumed that the connection process is triggered by the notification from the business thread 21 and the disconnection process is performed at the idle disconnect interval 45. Furthermore, the business thread 21 performs only the processing of transaction requests generated from the client AP 10 and the DB session acquisition request. By operating the database access system in this way, when the number of sessions and the flow rate of the transaction are balanced, it is difficult for the increase management thread 23 to generate a processing load, and the processing load of the disconnection processing thread that is frequently executed is also increased. It can be made difficult to occur. Therefore, it is possible to release a burden caused by time-consuming processing from the business thread 21, thereby reducing the processing burden on the entire process.

本来、DBセッションの空きがなくなったときには、業務スレッド21ではDBセッションの作成が完了するのを待機する必要があった。これに対し、DBセッションの空きが一定数以下になりDBセッションが不足しそうになった時には、業務スレッド21とは異なる増加管理スレッド23が新たな追加のDBセッションを作成し、業務スレッド21上でDBセッション作成待ちによる時間の遅延を防ぐことで処理効率が向上する。また、アイドル監視スレッド24で長時間使用されなかったDBセッションの有無を定期的に監視し、一定時間以上使用されなかったDBセッションを削除することによってDBセッションの数を適切に保ちサーバリソースの無駄を防ぐことができる。   Originally, when the DB session is full, the business thread 21 has to wait for the creation of the DB session to be completed. On the other hand, when the number of vacant DB sessions becomes less than a certain number and the DB sessions are likely to be insufficient, the increase management thread 23 different from the business thread 21 creates a new additional DB session, and on the business thread 21 Processing efficiency is improved by preventing a time delay due to waiting for DB session creation. Further, the idle monitoring thread 24 periodically monitors the presence or absence of a DB session that has not been used for a long time, and by deleting DB sessions that have not been used for a certain period of time, the number of DB sessions is maintained appropriately, and server resources are wasted. Can be prevented.

以上のようなデータベースアクセスシステムによれば、必要となるDBセッションが枯渇する前に、業務スレッドとは異なるバックグラウンドのスレッドでDBセッションを増加させることで業務スレッドの処理遅延を防ぐ。さらに、起動時に必要以上のDBセッションを用意することによる無駄なリソース使用を防ぐ。そして、長時間使用されてないDBセッションを定期的に切断することで、業務処理プロセスが使用するDBセッションの数を維持し、不要なDBセッションを保持せず適切な数に調整することが可能となる。これにより、サーバ内で動作している他のプロセスと共有しているメモリ量、ソケット数及びDBサーバのセッションといったリソースを必要以上に確保せず、サーバ内で共有するリソースを他のプロセスと連携をする際に効率化を図ることが出来る。   According to the database access system as described above, the processing delay of the business thread is prevented by increasing the number of DB sessions with a background thread different from the business thread before the necessary DB sessions are exhausted. Furthermore, useless use of resources by preparing more DB sessions than necessary at the time of activation is prevented. By periodically disconnecting DB sessions that have not been used for a long time, it is possible to maintain the number of DB sessions used by business processing processes and adjust the number to an appropriate number without holding unnecessary DB sessions. It becomes. As a result, resources such as the amount of memory shared with other processes running in the server, the number of sockets, and database server sessions are not reserved more than necessary, and resources shared within the server are linked with other processes. It is possible to improve the efficiency when performing.

本発明の実施形態に係るデータベースアクセスシステムの構成を示すブロック図である。It is a block diagram which shows the structure of the database access system which concerns on embodiment of this invention. 本発明の実施形態に係るデータベースアクセスシステムの動作を示すフローチャートである。It is a flowchart which shows operation | movement of the database access system which concerns on embodiment of this invention.

符号の説明Explanation of symbols

10 クライアントAP
20 業務処理プロセス
21 業務スレッド
22 DB(データベース)セッションプール
23 増加管理スレッド
24 アイドル監視スレッド
25 動作定義情報
30 データベース
40a〜40j、40k〜40n DBセッション
41 最大接続数
42 初期接続数
43 接続増加数
44 増加しきい値
45 アイドル切断間隔
46 アイドル監視間隔
50 最終使用時刻
10 Client AP
20 business processing process 21 business thread 22 DB (database) session pool 23 increase management thread 24 idle monitoring thread 25 operation definition information 30 database 40a-40j, 40k-40n DB session 41 maximum connection number 42 initial connection number 43 connection increase number 44 Increase threshold 45 Idle disconnect interval 46 Idle monitor interval 50 Last use time

Claims (13)

データベースと接続するための複数のデータベースセッションを維持管理するデータベースセッション管理部と、
前記データベースセッション管理部における未使用のデータベースセッションを監視し、未使用のデータベースセッションの数が所定数以下となった場合に未使用のデータベースセッションの数を増加させる増加管理スレッドと、
前記データベースセッション管理部におけるデータベースセッションが未使用のまま一定時間経過しているかを監視し、一定時間以上使用されなかったデータベースセッションを削除するアイドル監視スレッドと、
到来するトランザクション要求に対応してトランザクションに係るデータベースセッションの取得要求を前記データベースセッション管理部に対して行い、データベースセッションの取得を前記増加管理スレッドに通知すると共に、取得したデータベースセッションによって接続されるデータベースを参照あるいは更新しながらトランザクションを実行する業務スレッドと、
を備えることを特徴とするデータベースアクセスシステム。
A database session manager that maintains and manages multiple database sessions for connecting to the database;
An increase management thread that monitors unused database sessions in the database session management unit and increases the number of unused database sessions when the number of unused database sessions falls below a predetermined number;
An idle monitoring thread that monitors whether a database session in the database session management unit has not been used for a certain period of time and deletes a database session that has not been used for a certain period of time;
In response to an incoming transaction request, a database session acquisition request related to a transaction is made to the database session management unit, the database session acquisition is notified to the increase management thread, and the database connected by the acquired database session A business thread that executes transactions while referring to or updating
A database access system comprising:
前記アイドル監視スレッドは、未使用のまま経過しているデータベースセッションを所定の時間間隔で調べることを特徴とする請求項1記載のデータベースアクセスシステム。   The database access system according to claim 1, wherein the idle monitoring thread checks a database session that has not been used at predetermined time intervals. それぞれのデータベースセッションは、最終使用時刻を保持し、
前記アイドル監視スレッドは、現時刻と前記最終使用時刻とを比較することでデータベースセッションが未使用のまま一定時間以上使用されなかったと判断することを特徴とする請求項2記載のデータベースアクセスシステム。
Each database session has a last used time,
The database access system according to claim 2, wherein the idle monitoring thread determines that the database session has not been used for a certain period of time without being used by comparing the current time with the last use time.
前記増加管理スレッドは、データベースセッションの取得が通知された場合に未使用のデータベースセッションの数を1減少させ、使用中のデータベースセッションの数を1増加させると共に、未使用のデータベースセッションの数が所定数以下となった場合には未使用のデータベースセッションを予め定めた接続増加数分増加させることを特徴とする請求項1記載データベースアクセスシステム。   The increase management thread decreases the number of unused database sessions by 1 when notified of acquisition of a database session, increases the number of database sessions in use by 1, and sets the number of unused database sessions to a predetermined value. 2. The database access system according to claim 1, wherein when the number is less than the number, the number of unused database sessions is increased by a predetermined number of connections. (a)データベースと接続する所定の数のデータベースセッションをデータベースセッションプールに作成するステップと、
(b)前記データベースへの参照/更新を行うために前記データベースセッションプールに対してデータベースセッションの払い出しを要求して払い出しを受けるステップと、
(c)前記払い出しの結果、前記データベースセッションプールに残っているデータベースセッションの数が所定値を下回った場合、所定の接続増加数分の追加のデータベースセッションを前記データベースと接続し、追加のデータベースセッションを前記データベースセッションプールに追加するステップと、
(d)所定時間間隔でデータベースセッションの使用状況を調べ、未使用で所定の切断間隔時間以上経過していたデータベースセッションを前記データベースから切断し前記データベースセッションプールから削除するステップと、
を含むことを特徴とするデータベースアクセス方法。
(A) creating a predetermined number of database sessions connected to the database in a database session pool;
(B) requesting the database session pool to issue a database session in order to perform reference / update to the database, and receiving the payment;
(C) If the number of database sessions remaining in the database session pool falls below a predetermined value as a result of the payout, an additional database session is connected to the database for a predetermined connection increase number, and the additional database session Adding to the database session pool;
(D) examining the usage status of the database session at a predetermined time interval, disconnecting the database session that has not been used and has passed the predetermined disconnection interval time from the database, and deleting the database session from the database session pool;
A database access method comprising:
前記ステップ(d)において、それぞれのデータベースセッションは、最終使用時刻を保持し、現時刻と最終使用時刻とを比較することでデータベースセッションが未使用のまま一定時間以上使用されなかったと判断することを特徴とする請求項5記載のデータベースアクセス方法。   In the step (d), each database session holds the last use time, and compares the current time with the last use time to determine that the database session is unused and has not been used for a certain period of time. The database access method according to claim 5, wherein: 前記ステップ(c)において、払い出しの結果、未使用のデータベースセッションの数を1減少させ、使用中のデータベースセッションの数を1増加させると共に、未使用のデータベースセッションの数が所定数以下となった場合には未使用のデータベースセッションを予め定めた接続増加数分増加させることを特徴とする請求項5記載データベースアクセス方法。   In the step (c), as a result of the payout, the number of unused database sessions is decreased by 1, the number of database sessions in use is increased by 1, and the number of unused database sessions is less than a predetermined number. 6. The database access method according to claim 5, wherein an unused database session is increased by a predetermined number of connection increases. データベースアクセスシステムを構成するコンピュータに、
データベースと接続するための複数のデータベースセッションを維持管理するデータベースセッション管理処理と、
前記データベースセッション管理処理において未使用のデータベースセッションを監視し、未使用のデータベースセッションの数が所定数以下となった場合に未使用のデータベースセッションの数を増加させる増加管理スレッドと、
前記データベースセッション管理処理においてデータベースセッションが未使用のまま一定時間経過しているかを監視し、一定時間以上使用されなかったデータベースセッションを削除するアイドル監視スレッドと、
到来するトランザクション要求に対応してトランザクションに係るデータベースセッションの取得要求を前記データベースセッション管理処理に対して行い、データベースセッションの取得を前記増加管理スレッドに通知すると共に、取得したデータベースセッションによって接続されるデータベースを参照あるいは更新しながらトランザクションを実行する業務スレッドと、
を実行させるプログラム。
On the computer that configures the database access system,
A database session management process for maintaining and managing multiple database sessions for connecting to the database;
An increase management thread that monitors unused database sessions in the database session management process, and increases the number of unused database sessions when the number of unused database sessions falls below a predetermined number;
An idle monitoring thread that monitors whether a database session has been unused for a certain period of time in the database session management process and deletes a database session that has not been used for a certain period of time;
In response to an incoming transaction request, a database session acquisition request relating to a transaction is made to the database session management process, the database session acquisition is notified to the increase management thread, and the database connected by the acquired database session A business thread that executes transactions while referring to or updating
A program that executes
前記アイドル監視スレッドは、未使用のまま経過しているデータベースセッションを所定の時間間隔で調べることを特徴とする請求項8記載のプログラム。   9. The program according to claim 8, wherein the idle monitoring thread examines a database session that has passed unused at a predetermined time interval. それぞれのデータベースセッションは、最終使用時刻を保持し、
前記アイドル監視スレッドは、現時刻と最終使用時刻とを比較することでデータベースセッションが未使用のまま一定時間以上使用されなかったと判断することを特徴とする請求項9記載のプログラム。
Each database session has a last used time,
The program according to claim 9, wherein the idle monitoring thread determines that the database session is unused and has not been used for a certain period of time by comparing the current time with the last use time.
前記増加管理スレッドは、データベースセッションの取得が通知された場合に未使用のデータベースセッションの数を1減少させ、使用中のデータベースセッションの数を1増加させると共に、未使用のデータベースセッションの数が所定数以下となった場合には未使用のデータベースセッションを予め定めた接続増加数分増加させることを特徴とする請求項8記載のプログラム。   The increase management thread decreases the number of unused database sessions by 1 when notified of acquisition of a database session, increases the number of database sessions in use by 1, and sets the number of unused database sessions to a predetermined value. 9. The program according to claim 8, wherein when the number is less than or equal to the number, the number of unused database sessions is increased by a predetermined number of connections. 前記データベースセッション管理処理、増加管理スレッド、アイドル監視スレッド、および業務スレッドは、業務処理プロセス中で実行されることを特徴とする請求項8記載のプログラム。   9. The program according to claim 8, wherein the database session management process, the increase management thread, the idle monitoring thread, and the business thread are executed in a business process. 前記業務処理プロセスは、クライアントにおけるアプリケーションプログラムからの要求によって実行されることを特徴とする請求項12記載のプログラム。   The program according to claim 12, wherein the business process is executed by a request from an application program in a client.
JP2007021160A 2007-01-31 2007-01-31 Data base access system and data base access method, and program Withdrawn JP2008186358A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007021160A JP2008186358A (en) 2007-01-31 2007-01-31 Data base access system and data base access method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007021160A JP2008186358A (en) 2007-01-31 2007-01-31 Data base access system and data base access method, and program

Publications (1)

Publication Number Publication Date
JP2008186358A true JP2008186358A (en) 2008-08-14

Family

ID=39729331

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007021160A Withdrawn JP2008186358A (en) 2007-01-31 2007-01-31 Data base access system and data base access method, and program

Country Status (1)

Country Link
JP (1) JP2008186358A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012194895A (en) * 2011-03-17 2012-10-11 Bank Of Tokyo-Mitsubishi Ufj Ltd Transaction processing system and operation method for transaction processing system
JP2013242800A (en) * 2012-05-22 2013-12-05 Toshiba Tec Corp Server device and program
JP2021521574A (en) * 2018-05-11 2021-08-26 サイトリックス システムズ,インコーポレイテッド Connecting to an anonymous session on a client device via a helper
CN113543293A (en) * 2021-06-21 2021-10-22 天翼物联科技有限公司 Narrow-band Internet of things terminal supporting low-power-consumption operation and control method thereof

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012194895A (en) * 2011-03-17 2012-10-11 Bank Of Tokyo-Mitsubishi Ufj Ltd Transaction processing system and operation method for transaction processing system
US8825796B2 (en) 2011-03-17 2014-09-02 The Bank Of Tokyo-Mitsubishi Ufj, Ltd. Transaction processing system and operation of the transaction process system
JP2013242800A (en) * 2012-05-22 2013-12-05 Toshiba Tec Corp Server device and program
JP2021521574A (en) * 2018-05-11 2021-08-26 サイトリックス システムズ,インコーポレイテッド Connecting to an anonymous session on a client device via a helper
JP7027612B2 (en) 2018-05-11 2022-03-01 サイトリックス システムズ,インコーポレイテッド Connecting to an anonymous session on a client device via a helper
US11722461B2 (en) 2018-05-11 2023-08-08 Citrix Systems, Inc. Connecting client devices to anonymous sessions via helpers
CN113543293A (en) * 2021-06-21 2021-10-22 天翼物联科技有限公司 Narrow-band Internet of things terminal supporting low-power-consumption operation and control method thereof
CN113543293B (en) * 2021-06-21 2023-06-27 天翼物联科技有限公司 Narrowband Internet of things terminal supporting low-power-consumption operation and control method thereof

Similar Documents

Publication Publication Date Title
US9729488B2 (en) On-demand mailbox synchronization and migration system
CN111158878B (en) Resource transfer request thread control method, device and storage medium
US7328213B2 (en) Transaction processing method, transaction control apparatus and program thereof
US20160170792A1 (en) Management system and method for controlling management system
CN101771723A (en) Data synchronization method
CN108681777A (en) A kind of method and apparatus of the machine learning program operation based on distributed system
JP6405255B2 (en) COMMUNICATION SYSTEM, QUEUE MANAGEMENT SERVER, AND COMMUNICATION METHOD
CN112039970A (en) Distributed business lock service method, server, system and storage medium
CN113282395A (en) Redis-based job request scheduling method, device, equipment and medium
CN104281489B (en) Multithreading requesting method and system under SOA framework
US10409656B2 (en) Efficiently receiving messages across a large number of messaging entities
CN106357791A (en) Method, device and system for processing services
CN109726007B (en) A container arrangement quota management method and device, and a container arrangement system
CN108153794B (en) Page cache data refreshing method, device and system
JP2008186358A (en) Data base access system and data base access method, and program
CN101778131A (en) Data synchronization system
CN101789963A (en) Data synchronization system
CN114595069B (en) Service offline method and device, electronic equipment and storage medium
CN103746839B (en) PaaS systems and PaaS are using the VM node scheduling methods in pond
CN109257256A (en) Apparatus monitoring method, device, computer equipment and storage medium
JP2001229058A (en) Database server processing method
CN108234481B (en) A method and distributed system for controlling multi-machine distributed access to external systems
CN102760155B (en) A kind of transaction control method and device based on database
CN112804279B (en) Request processing method and device
CN116662040B (en) Message distribution method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
A761 Written withdrawal of application

Free format text: JAPANESE INTERMEDIATE CODE: A761

Effective date: 20100401