JP2010198258A - Cache maintenance device, method and program thereof - Google Patents
Cache maintenance device, method and program thereof Download PDFInfo
- Publication number
- JP2010198258A JP2010198258A JP2009041612A JP2009041612A JP2010198258A JP 2010198258 A JP2010198258 A JP 2010198258A JP 2009041612 A JP2009041612 A JP 2009041612A JP 2009041612 A JP2009041612 A JP 2009041612A JP 2010198258 A JP2010198258 A JP 2010198258A
- Authority
- JP
- Japan
- Prior art keywords
- maintenance
- cache
- condition
- allowable delay
- count
- 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
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
Description
本発明は、1以上のコンピュータのメモリで構成されるキャッシュにデータベースからのデータを保存する分散メモリキャッシュにおける、キャッシュエントリをメンテナンスするキャッシュメンテナンス技術に関する。 The present invention relates to a cache maintenance technique for maintaining cache entries in a distributed memory cache that stores data from a database in a cache constituted by one or more computer memories.
今日、インターネットの爆発的な普及に伴い、多くのサービスがインターネットを通じて提供されている。インターネットを通じて提供されるサービスとしては、例えば、オンラインショッピング、オンラインバンキング、ソーシャルネットワーキングサービス(SNS)があげられる。これらのサービスを提供するシステムは、殆どの場合、ユーザのアカウント情報や商品情報、ユーザによる投稿記事等のデータを保管するデータベース(DB)と、アプリケーションとで構成される。このアプリケーションは、サービスに合わせてデータベースに問い合わせ(クエリ)を発行し、データベースから返却されるデータを用いて、ユーザに提示する結果を作成する。 Today, with the explosion of the Internet, many services are provided through the Internet. Examples of services provided through the Internet include online shopping, online banking, and social networking service (SNS). In most cases, a system that provides these services includes a database (DB) that stores data such as user account information, product information, and posted articles by the user, and an application. This application issues a query to the database in accordance with the service, and creates a result to be presented to the user by using data returned from the database.
これらのシステムでは、ユーザの増加等の原因によりデータベースヘのアクセス数が大きく増加した場合、データベースの帯域幅やCPU資源を使い果たし、パフォーマンスの低下やサーバダウンが発生することがある。また、これらのシステムでは、アクセス数が増加しない場合でも、データベースへの問い合わせが複雑な場合、問い合わせの結果を返却するのに長い時間がかかってしまう。 In these systems, when the number of accesses to the database greatly increases due to an increase in the number of users, the database bandwidth and CPU resources may be exhausted, resulting in performance degradation and server down. In these systems, even if the number of accesses does not increase, if the query to the database is complicated, it takes a long time to return the query result.
そこで、上記のデータベースの処理負荷や参照性能の問題を解決する手法として、データベースとは別に、高速なアクセスが可能な記憶領域(キャッシュ)にこのデータベースヘの問い合わせ結果を利用して作られたデータを格納することが行われている。このキャッシュを利用するシステムは、例えば、データベースには永続性とクエリの処理とに優れたリレーショナルデータベースシステム(RDBMS)、及び、キャッシュには応答性とスケーラビリティとに優れた分散メモリキャッシュで構成できる。 Therefore, as a technique to solve the above-mentioned database processing load and reference performance problems, data created by using this database query result in a storage area (cache) that can be accessed at high speed separately from the database. Is being stored. A system using this cache can be composed of, for example, a relational database system (RDBMS) excellent in persistence and query processing for a database, and a distributed memory cache excellent in responsiveness and scalability.
ここで、キャッシュからデータを取得する場合、アプリケーションは、必要なデータがキャッシュ上に存在するか否かを確認する。キャッシュ上に当該データが存在しなかった場合、データベースからデータを取得するのと同時に、キャッシュにユーザからのリクエストを関連付けたデータを格納する。以降、同一のデータが必要になった場合、アプリケーションは、キャッシュからこのデータを読み出して利用する。これによって、データベースにアクセスする必要がなくなるため、キャッシュを用いたシステムでは、高速にデータを参照可能とする他、データベースヘのアクセス数を低減してデータベースの負荷を軽減することができる。 Here, when acquiring data from the cache, the application checks whether the necessary data exists on the cache. If the data does not exist in the cache, the data associated with the request from the user is stored in the cache at the same time as obtaining the data from the database. Thereafter, when the same data is required, the application reads this data from the cache and uses it. This eliminates the need to access the database, so that a system using a cache can make it possible to refer to data at high speed and reduce the number of accesses to the database to reduce the load on the database.
一方、キャッシュを利用する場合、データベースに更新処理(登録、更新、削除)が発生すると,キャッシュに保存されたデータとデータベースに格納されたデータとに不整合が発生する可能性がある。例えば、データベースで更新されたデータをキャッシュで参照する場合、キャッシュに保存されたデータは更新されていないため、アプリケーションは、更新前の古いデータを参照してしまう。 On the other hand, when the cache is used, if update processing (registration, update, deletion) occurs in the database, there is a possibility that inconsistency occurs between the data stored in the cache and the data stored in the database. For example, when referring to data updated in the database in the cache, the data stored in the cache is not updated, and thus the application refers to old data before update.
従来から、この問題を解決するために、データベースに対して更新が行われた際、キャッシュの一貫性(cache consistency)を保つためのキャッシュメンテナンス技術が提案されている。 Conventionally, in order to solve this problem, a cache maintenance technique for maintaining cache consistency when a database is updated has been proposed.
この技術としては、キャッシュを無効化(invalidation)するものが提案されている(例えば、非特許文献1参照)。この非特許文献1に記載の無効化方式では、データベースに対してキャッシュに不整合が発生するような更新が行われた場合、データベースがキャッシュに対して無効化メッセージを送信して、キャッシュで不整合が発生するデータを無効化し、キャッシュに保存された更新前のデータが参照されてしまうことを防止する。
As this technique, one that invalidates a cache has been proposed (see, for example, Non-Patent Document 1). In the invalidation method described in
また、この無効化後に、データベースに再度問い合わせを行うことでキャッシュに保存された全データを入れ替えて最新に保つ、再問い合わせ方式も提案されている(例えば、非特許文献2及び非特許文献5参照)。
In addition, a re-query method has also been proposed in which all data stored in the cache is replaced and kept up-to-date by making a query to the database again after the invalidation (see, for example, Non-Patent
また、キャッシュに保存されたデータが再利用可能であるような環境において、再問い合わせ方式によってキャッシュに保存された全データを入れ替えるのではなく、更新された差分のみを計算してこの差分をキャッシュに反映し、既にキャッシュに保存されているデータを生して最新に保つ、差分更新方式も提案されている(例えば、非特許文献3及び非特許文献4参照)。
Also, in an environment where the data stored in the cache is reusable, instead of replacing all the data stored in the cache by the re-query method, only the updated difference is calculated and this difference is stored in the cache. There has also been proposed a differential update method that reflects and maintains data that is already stored in the cache (see, for example, Non-Patent
<従来のキャッシュメンテナンス技術:第1例>
ここで、図24を参照し、従来のキャッシュメンテナンス技術の第1例を説明する。図24に示すように、キャッシュメンテナンスシステム900は、キャッシュメンテナンス装置9Aと、データベース9Bと、キャッシュ9Cとを備える。ここで、キャッシュメンテナンスシステム900は、インターネット等のネットワークNを介して、キャッシュメンテナンス装置9Aと、データベース9Bと、キャッシュ9Cとを接続している。
<Conventional cache maintenance technology: first example>
Here, a first example of the conventional cache maintenance technique will be described with reference to FIG. As shown in FIG. 24, the
キャッシュメンテナンス装置9Aは、キャッシュ9Cに保存されたデータに不整合が発生した場合、無効化方式又は再問い合わせ方式によって、キャッシュ9Cのメンテナンスを行うものである。このキャッシュメンテナンス装置9Aは、メンテナンス対象選択部91と、キャッシュメンテナンス部92とを備える。
The cache maintenance device 9A performs maintenance of the
データベース9Bは、キャッシュ9Cの対象となるデータを格納するリレーショナルデータベース等の一般的なデータベースである。このデータベース9Bは、アプリケーションの種類に応じて、様々なデータを格納する。
The
キャッシュ9Cは、1以上のコンピュータのメモリで構成された分散メモリキャッシュである。なお、キャッシュ9Cを構成する各コンピュータの図示は、省略した。
The
以下、キャッシュ9Cのメンテナンスについて詳細に説明する。メンテナンス対象選択部91は、データベース9Bに対して更新処理が行われた際、その更新の内容に基づいて、データベースの更新処理の影響を受けメンテナンスが必要となる、キャッシュ9Cのキャッシュエントリ(不図示)を選択するものである。ここで、メンテナンス対象選択部91は、例えば、データベース9Bに対する更新問い合わせの一部又は全部を元に、メンテナンス対象を検索可能とするマッピングテーブルを用意する方法を用いる。また、メンテナンス対象選択部91は、例えば、データベース9Bに対する更新問い合わせの一部又は全部を入力として、メンテナンス対象を検索するため問い合わせ文を予め用意する方法を用いる。さらに、メンテナンス対象選択部91は、更新処理のあったテーブルを元に作られたキャッシュエントリを全てメンテナンス対象とする方法を用いても良く、前記した非特許文献3に記載の技術を用いても良い。
Hereinafter, the maintenance of the
キャッシュメンテナンス部92は、メンテナンス対象選択部91が選択したメンテナンス対象のキャッシュエントリを無効化するための無効化メッセージを送信するものである。また、キャッシュメンテナンス部92は、再問い合わせ方式を採用する場合、無効化メッセージの送信後、データベース9Bに対して、このキャッシュエントリのデータを取得するための問い合わせを発行し、その問い合わせ結果をキャッシュ2Cに格納する。このようにして、キャッシュメンテナンスシステム900は、キャッシュのメンテナンスを行う。なお、無効化方式及び再問い合わせ方式の詳細については、前記した非特許文献1,2,3,5に記載されている。
The
<従来のキャッシュメンテナンス技術:第2例>
さらに、図25を参照し、従来のキャッシュメンテナンス技術の第2例を説明する(適宜図24参照)。図25においては、キャッシュメンテナンス装置9Aは、キャッシュ9Cに保存されたデータに不整合が発生した場合、差分更新方式によって、キャッシュ9Cのメンテナンスを行う。
<Conventional cache maintenance technology: second example>
Further, a second example of the conventional cache maintenance technique will be described with reference to FIG. 25 (see FIG. 24 as appropriate). In FIG. 25, the cache maintenance device 9A performs maintenance of the
図25に示すように、データベース9Bは、「message」というテーブル9T1と「follower」というテーブル9T2とを格納する。また、キャッシュ9Cは、テーブル9T1とテーブル9T2とを結合(JOIN)した結果である「timeline」というキャッシュエントリ9CEを保存する。
As illustrated in FIG. 25, the
ここで、テーブル9T1に新たなレコード(図25におけるid=6)が登録(INSERT)された場合、このレコードに基づいて、差分データを求めるための問い合わせ9Qを行う。その結果、求められた差分データ9Dを、keyに基づいて、キャッシュエントリ9CEを更新する。このように、従来の差分更新方式では、データベース9Bに対して更新処理が発生する都度、このキャッシュ更新処理を行う必要がある。
Here, when a new record (id = 6 in FIG. 25) is registered (INSERT) in the table 9T1, an inquiry 9Q for obtaining difference data is performed based on this record. As a result, the cache entry 9CE is updated based on the obtained difference data 9D based on the key. Thus, in the conventional differential update method, it is necessary to perform this cache update process every time an update process occurs for the
しかし、前記した無効化方式では、データベースに高い頻度で更新処理が発生した場合、キャッシュの無効化が多発するため、キャッシュヒット率が大きく低下してしまい、キャッシュの効果(参照速度の向上及び処理負荷の低減)が十分に得られないという問題がある。 However, in the invalidation method described above, when update processing occurs frequently in the database, cache invalidation occurs frequently, so that the cache hit rate is greatly reduced, and the cache effect (improvement of reference speed and processing) There is a problem that sufficient load reduction cannot be obtained.
また、前記した再問い合わせ方式及び差分更新方式では、データベースに高い頻度で更新処理が発生した場合、キャッシュメンテナンス時に毎回データベースヘの問い合わせが発生するため、データベースヘの問い合わせが多発し、データベースの処理負荷が増大し、パフォーマンスの低下やサーバダウンに繋がる。 Further, in the above-described re-query method and differential update method, if update processing occurs frequently in the database, the database is inquired every time during cache maintenance. Increase, leading to performance degradation and server down.
そこで、本発明は、データベースに高い頻度で更新処理が行われる環境においても、参照速度が低下せず、処理負荷の増大を最小限に抑えるキャッシュメンテナンス技術を提供することを目的とする。 Accordingly, an object of the present invention is to provide a cache maintenance technique that minimizes an increase in processing load without reducing the reference speed even in an environment where update processing is performed on a database with high frequency.
前記した課題を解決するため、本願第1発明に係るキャッシュメンテナンス装置は、1以上のコンピュータのメモリで構成されるキャッシュにデータベースからのデータを保存する分散メモリキャッシュにおける、前記データを前記キャッシュに保存する単位となるキャッシュエントリをメンテナンスするキャッシュメンテナンス装置において、前記キャッシュエントリをメンテナンスする条件であるメンテナンス条件を記憶するメンテナンス条件記憶部と、前記メンテナンス条件記憶部に記憶したメンテナンス条件を参照し、前記メンテナンス条件を満たすときにメンテナンス可能と判定するメンテナンス判定部と、前記メンテナンス判定部がメンテナンス可能と判定した場合、前記キャッシュエントリをメンテナンスするキャッシュメンテナンス部と、を備えることを特徴とする。 In order to solve the above-described problem, a cache maintenance apparatus according to the first invention of the present application stores the data in the cache in a distributed memory cache that stores data from a database in a cache constituted by one or more computer memories. In a cache maintenance device that maintains a cache entry as a unit to perform maintenance, a maintenance condition storage unit that stores a maintenance condition that is a condition for maintaining the cache entry, a maintenance condition stored in the maintenance condition storage unit, and the maintenance A maintenance determination unit that determines that maintenance is possible when a condition is satisfied, and a cache member that maintains the cache entry when the maintenance determination unit determines that maintenance is possible. Characterized in that it comprises a nonce portion.
かかる構成によれば、キャッシュメンテナンス装置は、データベースの更新処理によってキャッシュエントリとデータベースのデータとの間に不整合が発生したとき、常にキャッシュエントリのメンテナンスを行うのではなく、所定のメンテナンス条件を満たす場合にのみ、キャッシュエントリのメンテナンスを行うこととした。これによって、キャッシュメンテナンス装置は、データベースに高い頻度で更新処理が行われる環境においても、参照速度が低下せず、処理負荷の増大を最小限に抑えることができる。 According to such a configuration, when a mismatch occurs between the cache entry and the data in the database due to the database update process, the cache maintenance device does not always maintain the cache entry but satisfies a predetermined maintenance condition. Only in this case, it was decided to maintain the cache entry. As a result, the cache maintenance device can minimize the increase in processing load without reducing the reference speed even in an environment where update processing is frequently performed on the database.
なお、分散メモリキャッシュとは、1以上のコンピュータのメモリを連携して巨大な論理メモリ(キャッシュ)として扱う技術であり、keyとvalueとのペアによる単純なアクセスのみを提供する代わりに、ハッシュ分散による高いスケーラビリティを有することを特徴とする。 Note that the distributed memory cache is a technique that handles the memory of one or more computers in cooperation with each other as a huge logical memory (cache). Instead of providing only simple access using a pair of key and value, hash distribution is used. It is characterized by having high scalability.
なお、キャッシュエントリとは、データベースからのデータをキャッシュに保存する単位となるものであり、例えば、keyと対応付けてデータベースへの問い合わせ結果をキャッシュに保存したものである。 The cache entry is a unit for storing data from the database in the cache. For example, a cache entry is stored in the cache in association with the key.
なお、メンテナンスとは、データベースの更新処理によって、このデータとこのデータに対応するキャッシュエントリとの間に不整合が発生した際、無効化方式、再問い合わせ方式又は差分更新方式を用いてこのキャッシュエントリを無効化又はこのデータを整合した状態にすることである。 Note that maintenance means that when an inconsistency occurs between the data and the cache entry corresponding to this data due to database update processing, this cache entry is invalidated, re-inquired, or differentially updated. Or invalidate this data.
なお、無効化方式とは、データベースの更新処理によって、このデータとこのデータに対応するキャッシュエントリとの間に不整合が発生した際、そのキャッシュエントリを無効化し、不整合なデータがキャッシュエントリから読み出されるのを防ぐ方式である。 The invalidation method is to invalidate the cache entry when inconsistency occurs between this data and the cache entry corresponding to this data by updating the database, and the inconsistent data is transferred from the cache entry. This method prevents reading.
なお、再問い合わせ方式とは、データベースの更新処理によって、このデータとこのデータに対応するキャッシュエントリとの間に不整合が発生した際、そのキャッシュエントリに対応する問い合わせをデータベースに対して行い,その問い合わせ結果をキャッシュエントリに上書きすことで、キャッシュエントリとデータとを整合した状態にする方式である。 The re-inquiry method is to perform an inquiry corresponding to the cache entry to the database when inconsistency occurs between this data and the cache entry corresponding to the data due to the database update process. In this method, the cache entry is overwritten with the cache result so that the cache entry and the data are in a consistent state.
また、本願第2発明に係るキャッシュメンテナンス装置は、前回のメンテナンス時刻、及び、前回の前記メンテナンス時刻以後に前記データが更新された回数を示す更新回数の少なくとも一方を含む更新情報を記憶する更新情報記憶部と、予め設定された許容遅延回数及び許容遅延時間の少なくとも一方が入力され、当該入力に基づいて、前記メンテナンス条件を生成して前記メンテナンス条件記憶部に書き込むメンテナンス条件生成部と、をさらに備え、前記メンテナンス条件生成部は、前記許容遅延回数のみが入力された場合、前記更新回数が前記許容遅延回数を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、前記許容遅延時間のみが入力された場合、前回の前記メンテナンス時刻から現在時刻までを示す経過時間が前記許容遅延時間を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、前記許容遅延回数と前記許容遅延時間とが入力された場合、前記更新回数が前記許容遅延回数を超えたとき又は前記経過時間が前記許容遅延時間を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成することを特徴とする。 Further, the cache maintenance device according to the second aspect of the present invention stores update information including at least one of a previous maintenance time and an update count indicating the number of times the data has been updated since the previous maintenance time. A storage unit, and a maintenance condition generation unit that receives at least one of a preset allowable delay number and an allowable delay time, generates the maintenance condition based on the input, and writes the maintenance condition in the maintenance condition storage unit; The maintenance condition generation unit generates the maintenance condition that enables the maintenance when the update count exceeds the allowable delay count when only the allowable delay count is input, and includes only the allowable delay time. Is entered, it shows the time from the previous maintenance time to the current time. When the maintenance condition that enables the maintenance is generated when time exceeds the allowable delay time, and the allowable delay count and the allowable delay time are input, the update count exceeds the allowable delay count The maintenance condition that enables the maintenance is generated when the time or the elapsed time exceeds the allowable delay time.
かかる構成によれば、キャッシュメンテナンス装置は、メンテナンス条件を満たす場合にのみキャッシュエントリのメンテナンスを行い、メンテナンスの頻度を制御することとした。これによって、キャッシュメンテナンス装置は、無効化方式を採用したときは、メンテナンスによってキャッシュエントリが無効化される頻度が低減するので、キャッシュヒット率が大幅に向上する。また、キャッシュメンテナンス装置は、再問い合わせ方式を採用したときは、メンテナンス条件の判定の処理負荷がメンテナンスの頻度を少なくして削減できるメンテナンスコストよりも十分に小さいため、メンテナンスコストを大幅に削減できる。 According to such a configuration, the cache maintenance device performs the maintenance of the cache entry only when the maintenance condition is satisfied, and controls the maintenance frequency. As a result, when the cache maintenance apparatus adopts the invalidation method, the frequency at which the cache entry is invalidated by maintenance is reduced, so that the cache hit rate is greatly improved. Further, when the re-inquiry method is adopted, the cache maintenance device can significantly reduce the maintenance cost because the processing load for determining the maintenance condition is sufficiently smaller than the maintenance cost that can be reduced by reducing the frequency of maintenance.
なお、更新回数(メンテナンスカウント)とは、キャッシュエントリ毎に、前回のメンテナンス時刻以後にデータが更新された回数を示すものである。 The number of updates (maintenance count) indicates the number of times data has been updated since the previous maintenance time for each cache entry.
なお、許容遅延回数とは、データベースの更新処理によって、このデータとこのデータに対応するキャッシュエントリとの間で、許容遅延回数で指定した回数の不整合が発生したときに、1回のメンテナンスを行うことを示す数値である。 Note that the allowable number of delays means that maintenance is performed once when the number of inconsistencies specified by the allowable number of delays occurs between this data and the cache entry corresponding to this data due to the database update process. A numerical value indicating what to do.
なお、許容遅延時間とは、データベースの更新処理によって、このデータとこのデータに対応するキャッシュエントリとの間に不整合が発生した際、前回のメンテナンス時刻から許容遅延時間以上経過したキャッシュエントリをメンテナンスすることを示す時間である。 The allowable delay time refers to the maintenance of cache entries that have exceeded the allowable delay time from the previous maintenance time when a mismatch occurs between this data and the cache entry corresponding to this data due to the database update process. It is time to show that.
なお、メンテナンスコストとは、データベースサーバにおいて、メンテナンスに伴って費やされるCPU時間等の演算処理量である。 Note that the maintenance cost is an arithmetic processing amount such as CPU time spent for maintenance in the database server.
また、本願第3発明に係るキャッシュメンテナンス装置は、予め設定された許容遅延回数及び許容遅延時間の少なくとも一方が入力され、当該入力に基づいて、前記メンテナンス条件を生成して前記メンテナンス条件記憶部に書き込むメンテナンス条件生成部、をさらに備え、前記メンテナンス条件生成部は、前記許容遅延回数のみが入力された場合、更新回数が前記許容遅延回数を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、前記許容遅延時間のみが入力された場合、経過時間が前記許容遅延時間を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、前記許容遅延回数と前記許容遅延時間とが入力された場合、前記更新回数が前記許容遅延回数を超えたとき又は前記経過時間が前記許容遅延時間を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、前記メンテナンス判定部は、前記データベースのテーブルにおける差分データを格納した差分テーブルを参照し、当該差分テーブルのデータ件数を前記更新回数として算出すると共に、当該差分テーブルにおける最も古いデータを格納した時刻から現在時刻までを前記経過時間として算出し、算出した前記更新回数と前記経過時間とを用いて前記メンテナンス条件を満たすか判定し、前記キャッシュメンテナンス部は、前記差分テーブルに格納した前記差分データで前記キャッシュエントリを一括して更新すると共に、更新した前記差分データを前記差分テーブルから削除することを特徴とする。 In the cache maintenance device according to the third aspect of the present invention, at least one of a preset allowable delay count and an allowable delay time is input, and based on the input, the maintenance condition is generated and stored in the maintenance condition storage unit. A maintenance condition generation unit for writing, and when only the allowable delay number is input, the maintenance condition generation unit generates the maintenance condition that enables the maintenance when the number of updates exceeds the allowable delay number When only the allowable delay time is input, the maintenance condition that enables the maintenance when the elapsed time exceeds the allowable delay time is generated, and the allowable delay count and the allowable delay time are input. When the update count exceeds the allowable delay count or the elapsed time The maintenance condition that enables maintenance when a delay time is exceeded is generated, and the maintenance determination unit refers to a difference table that stores difference data in the database table and updates the number of data in the difference table And calculating from the time when the oldest data in the difference table is stored to the current time as the elapsed time, and determining whether the maintenance condition is satisfied using the calculated update count and the elapsed time. The cache maintenance unit collectively updates the cache entry with the difference data stored in the difference table, and deletes the updated difference data from the difference table.
かかる構成によれば、キャッシュメンテナンス装置は、メンテナンス条件を満たす場合にのみ差分データでキャッシュエントリを更新し、メンテナンスの頻度を制御することとした。これによって、キャッシュメンテナンス装置は、差分更新方式を採用したときは、メンテナンスによって逐次差分データをキャッシュエントリに更新する場合に比べて、問い合わせ処理及び通信処理のオーバーヘッドが大幅に少ないため、メンテナンスコストを大幅に削減できる。 According to such a configuration, the cache maintenance device updates the cache entry with the difference data only when the maintenance condition is satisfied, and controls the maintenance frequency. As a result, when the differential maintenance method is adopted, the cache maintenance device greatly reduces the maintenance cost because the overhead of inquiry processing and communication processing is significantly less than when incremental data is sequentially updated to the cache entry by maintenance. Can be reduced.
なお、差分更新方式とは、データベースの更新処理によって、このデータとこのデータに対応するキャッシュエントリとの間に不整合が発生した際、そのキャッシュエントリを整合した状態に更新するために必要な差分データを算出し,そのキャッシュエントリにこの差分データを反映させることで、キャッシュエントリとデータとを整合した状態にする方式である。 The difference update method is the difference required to update the cache entry to a consistent state when inconsistency occurs between this data and the cache entry corresponding to this data due to the database update process. In this method, the data is calculated and the difference data is reflected in the cache entry so that the cache entry and the data are in a consistent state.
また、本願第4発明に係るキャッシュメンテナンス装置は、前回のメンテナンス時刻、及び、前回の前記メンテナンス時刻以後に前記データが更新された回数を示す更新回数の少なくとも一方を含む更新情報を記憶する更新情報記憶部と、予め設定された許容遅延回数及び許容遅延時間の少なくとも一方と、メンテナンスコストの目標負荷値とが入力され、当該入力に基づいて、前記キャッシュエントリ毎に前記メンテナンス条件を生成して前記メンテナンス条件記憶部に書き込むメンテナンス条件生成部と、予め設定された統計期間における前記キャッシュエントリをメンテナンスした回数を示すメンテナンス回数の累積値を統計情報として算出する統計情報算出部と、をさらに備え、前記メンテナンス条件生成部は、前記メンテナンス回数の累積値に前記目標負荷値を乗じて削減目標値を算出し、前記許容遅延回数のみが入力された場合、前記更新回数が前記許容遅延回数を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、式(1)で算出した削減値を前記削減目標値から減算し、前記許容遅延時間のみが入力された場合、前回の前記メンテナンス時刻から現在時刻までを示す経過時間が前記許容遅延時間を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、式(2)で算出した削減値を前記削減目標値から減算し、前記許容遅延回数と前記許容遅延時間とが入力された場合、前記更新回数が前記許容遅延回数を超えたとき又は前記経過時間が前記許容遅延時間を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、式(3)で算出した削減値を前記削減目標値から減算し、前記削減目標値から前記削減値を減算した値が0以下になったときは、前記メンテナンス条件の生成を終了することを特徴とする。
A=Mi×(N−1)/N・・・式(1)
A=Mi×(1−T/S)・・・式(2)
A=MIN[{Mi×(N−1)/N},{Mi×(1−T/S)}]・・・式(3)
但し、式(1)〜式(3)において、Aは削減値、Miはメンテナンス回数の累積値、Nは許容遅延回数、Tは許容遅延時間、及び、Sは統計期間である。
Further, the cache maintenance device according to the fourth invention of the present application stores update information that stores update information including at least one of a previous maintenance time and an update count indicating the number of times the data has been updated since the previous maintenance time. A storage unit, at least one of a preset allowable delay number and allowable delay time, and a maintenance load target load value are input, and based on the input, the maintenance condition is generated for each cache entry, and the maintenance condition is generated. A maintenance condition generation unit that writes to the maintenance condition storage unit, and a statistical information calculation unit that calculates, as statistical information, a cumulative value of the number of maintenance times indicating the number of times the cache entry is maintained in a preset statistical period, and The maintenance condition generation unit When the reduction target value is calculated by multiplying the cumulative load value by the target load value and only the allowable delay count is input, the maintenance condition that enables the maintenance when the update count exceeds the allowable delay count And the reduction value calculated by the expression (1) is subtracted from the reduction target value and only the allowable delay time is input, the elapsed time indicating the previous maintenance time to the current time is the allowable delay. The maintenance condition that enables the maintenance when the time is exceeded is generated, the reduction value calculated by Equation (2) is subtracted from the reduction target value, and the allowable delay count and the allowable delay time are input. When the update count exceeds the allowable delay count or when the elapsed time exceeds the allowable delay time, the maintenance condition is enabled. When the value obtained by subtracting the reduction value calculated by Equation (3) from the reduction target value becomes 0 or less, the generation of the maintenance condition is terminated. It is characterized by doing.
A = Mi × (N−1) / N (1)
A = Mi × (1−T / S) (2)
A = MIN [{Mi × (N−1) / N}, {Mi × (1-T / S)}] (3)
In Equations (1) to (3), A is a reduction value, Mi is a cumulative value of the number of maintenance times, N is an allowable delay number, T is an allowable delay time, and S is a statistical period.
かかる構成によれば、キャッシュメンテナンス装置は、メンテナンス条件を満たす場合にのみキャッシュエントリのメンテナンスを行い、メンテナンスの頻度を制御することとした。これによって、キャッシュメンテナンス装置は、無効化方式を採用したときは、メンテナンスによってキャッシュエントリが無効化される頻度が低減するので、キャッシュヒット率が大幅に向上する。また、キャッシュメンテナンス装置は、再問い合わせ方式を採用したときは、メンテナンス条件の判定の処理負荷がメンテナンスの頻度を少なくして削減できるメンテナンスコストよりも十分に小さいため、メンテナンスコストを大幅に削減できる。さらに、キャッシュメンテナンス装置は、目標負荷を達成した後、不要なメンテナンスを行うことがなく、処理負荷をさらに削減できる。 According to such a configuration, the cache maintenance device performs the maintenance of the cache entry only when the maintenance condition is satisfied, and controls the maintenance frequency. As a result, when the cache maintenance apparatus adopts the invalidation method, the frequency at which the cache entry is invalidated by maintenance is reduced, so that the cache hit rate is greatly improved. Further, when the re-inquiry method is adopted, the cache maintenance device can significantly reduce the maintenance cost because the processing load for determining the maintenance condition is sufficiently smaller than the maintenance cost that can be reduced by reducing the frequency of maintenance. Furthermore, the cache maintenance device can further reduce the processing load without performing unnecessary maintenance after achieving the target load.
なお、目標負荷値とは、メンテナンスコストを削減する目標となる数値である。 The target load value is a numerical value that is a target for reducing the maintenance cost.
また、本願第5発明に係るキャッシュメンテナンス装置は、前記メンテナンス条件生成部が、前記メンテナンス条件を生成しておらず、かつ、前記メンテナンス回数の累積値が最大となる前記キャッシュエントリについて、前記メンテナンス条件を生成することを特徴とする。 Further, in the cache maintenance device according to the fifth invention of the present application, the maintenance condition generation unit does not generate the maintenance condition, and the maintenance condition for the cache entry in which the cumulative value of the number of maintenance times is maximized. Is generated.
かかる構成によれば、キャッシュメンテナンス装置は、メンテナンス回数の累積値が大きい順にキャッシュエントリを選択し、この順にキャッシュエントリのメンテナンスを行うこととした。ここで、メンテナンスの頻度が高いキャッシュエントリ程、メンテナンスの頻度を削減による効果(例えば、無効化方式を採用したときはキャッシュヒット率の向上、再問い合わせ方式を採用したときは処理負荷の削減)が大きくなる。従って、キャッシュメンテナンス装置は、メンテナンス条件を設定してメンテナンスを行うキャッシュエントリの数を必要最小限とし、キャッシュエントリの最新性の低下を最小限に抑える。 According to such a configuration, the cache maintenance device selects cache entries in descending order of the cumulative number of maintenance times, and performs cache entry maintenance in this order. Here, the effect of reducing the maintenance frequency for cache entries with higher maintenance frequency (for example, improving the cache hit rate when the invalidation method is used, and reducing the processing load when the requery method is used). growing. Therefore, the cache maintenance device sets the maintenance conditions and minimizes the number of cache entries to be maintained, thereby minimizing the deterioration in the freshness of the cache entries.
なお、最新性とは、キャッシュエントリから読み出したデータが最新である比率、つまり、不整合が発生しないデータの比率である。また、キャッシュエントリから読み出したデータが最新であるとは、データベースに問い合わせ結果として得られるデータと、キャッシュエントリから読み出したデータとが一致(整合)していることである。 Note that the freshness is a ratio at which data read from a cache entry is the latest, that is, a ratio of data in which inconsistency does not occur. The data read from the cache entry is the latest when the data obtained as a result of the inquiry to the database matches the data read from the cache entry.
また、本願第6発明に係るキャッシュメンテナンス装置は、前記統計情報算出部が、前記統計情報として、前記統計期間における前記キャッシュエントリが参照された参照回数の累積値を算出し、前記メンテナンス条件生成部は、前記メンテナンス条件を生成しておらず、かつ、前記参照回数の累積値が最小となる前記キャッシュエントリについて、前記メンテナンス条件を生成することを特徴とする。 Further, in the cache maintenance device according to the sixth aspect of the present invention, the statistical information calculation unit calculates, as the statistical information, an accumulated value of the number of times the cache entry is referred to in the statistical period, and the maintenance condition generation unit Is characterized in that the maintenance condition is generated for the cache entry in which the maintenance condition is not generated and the cumulative value of the reference count is minimized.
かかる構成によれば、キャッシュメンテナンス装置は、参照回数の累積値が小さい順にキャッシュエントリを選択し、この順にキャッシュエントリのメンテナンスを行うこととした。これによって、キャッシュメンテナンス装置は、メンテナンスによる悪影響が少ないキャッシュエントリから順にメンテナンスを行うことで、キャッシュエントリの最新性の低下を最小限に抑える。 According to such a configuration, the cache maintenance device selects cache entries in ascending order of the cumulative number of reference times, and performs cache entry maintenance in this order. As a result, the cache maintenance device performs maintenance in order from the cache entries that are less adversely affected by the maintenance, thereby minimizing the deterioration in the freshness of the cache entries.
また、本願第7発明に係るキャッシュメンテナンス装置は、前回のメンテナンス時刻、及び、前回の前記メンテナンス時刻以後に前記データが更新された回数を示す更新回数の少なくとも一方を含む更新情報を記憶する更新情報記憶部と、予め設定された許容遅延回数及び許容遅延時間の少なくとも一方が入力され、当該入力に基づいて、前記メンテナンス条件を生成して前記メンテナンス条件記憶部に書き込むメンテナンス条件生成部と、前記データベースの負荷を示す負荷値を測定するデータベース負荷測定部と、をさらに備え、前記メンテナンス条件生成部は、前記許容遅延回数のみが入力された場合、前記更新回数が前記許容遅延回数を超え、かつ、前記負荷値が予め設定された負荷条件を満たすときに前記メンテナンス可能となる前記メンテナンス条件を生成し、前記許容遅延時間のみが入力された場合、前回の前記メンテナンス時刻から現在時刻までを示す経過時間が前記許容遅延時間を超え、かつ、前記負荷値が前記負荷条件を満たすときに前記メンテナンス可能となる前記メンテナンス条件を生成し、前記許容遅延回数と前記許容遅延時間とが入力された場合、前記更新回数が前記許容遅延回数を超え又は前記経過時間が前記許容遅延時間を超え、かつ、前記負荷値が前記負荷条件を満たすときに前記メンテナンス可能となる前記メンテナンス条件を生成することを特徴とする。 Further, the cache maintenance device according to the seventh invention of the present application stores update information including at least one of a previous maintenance time and an update count indicating the number of times the data has been updated since the previous maintenance time. A storage unit, a maintenance condition generation unit that receives at least one of a preset allowable delay count and an allowable delay time, generates the maintenance condition based on the input, and writes the maintenance condition in the maintenance condition storage unit; and the database A database load measurement unit that measures a load value indicating the load of the maintenance condition generation unit, when only the allowable delay count is input, the update count exceeds the allowable delay count, and The maintenance is possible when the load value satisfies a preset load condition. When the maintenance condition is generated and only the allowable delay time is input, the elapsed time from the previous maintenance time to the current time exceeds the allowable delay time, and the load value satisfies the load condition When the maintenance condition that enables the maintenance is generated and the allowable delay count and the allowable delay time are input, the update count exceeds the allowable delay count or the elapsed time exceeds the allowable delay time. When the load value exceeds the load condition, the maintenance condition that enables the maintenance is generated.
かかる構成によれば、キャッシュメンテナンス装置は、メンテナンス条件を満たす場合にのみキャッシュエントリのメンテナンスを行い、メンテナンスの頻度を制御することとした。これによって、キャッシュメンテナンス装置は、無効化方式を採用したときは、メンテナンスによってキャッシュエントリが無効化される頻度が低減するので、キャッシュヒット率が大幅に向上する。また、キャッシュメンテナンス装置は、再問い合わせ方式を採用したときは、メンテナンス条件の判定の処理負荷がメンテナンスの頻度を少なくして削減できるメンテナンスコストよりも十分に小さいため、メンテナンスコストを大幅に削減できる。さらに、キャッシュメンテナンス装置は、負荷条件を設定することで、データベースの負荷に応じて、メンテナンスの頻度を制御することができる。これによって、キャッシュメンテナンス装置は、例えば、データベースサーバのCPU資源に余裕があるときにメンテナンスの頻度を低下させてCPU資源を節約するといった事態を防止し、データベースにパフォーマンスを十分に発揮させることができる。 According to such a configuration, the cache maintenance device performs the maintenance of the cache entry only when the maintenance condition is satisfied, and controls the maintenance frequency. As a result, when the cache maintenance apparatus adopts the invalidation method, the frequency at which the cache entry is invalidated by maintenance is reduced, so that the cache hit rate is greatly improved. Further, when the re-inquiry method is adopted, the cache maintenance device can significantly reduce the maintenance cost because the processing load for determining the maintenance condition is sufficiently smaller than the maintenance cost that can be reduced by reducing the frequency of maintenance. Furthermore, the cache maintenance device can control the frequency of maintenance according to the load of the database by setting the load condition. Thus, for example, the cache maintenance device can prevent the situation where the CPU resource is saved by reducing the frequency of maintenance when the CPU resource of the database server is sufficient, and the database can sufficiently exhibit the performance. .
また、本願第8発明に係るキャッシュメンテナンス方法は、1以上のコンピュータのメモリで構成されるキャッシュにデータベースからのデータを保存する分散メモリキャッシュにおける、前記データを前記キャッシュに保存する単位となるキャッシュエントリをメンテナンスするキャッシュメンテナンス方法において、前記キャッシュエントリをメンテナンスする条件であるメンテナンス条件を参照し、前記メンテナンス条件を満たすときにメンテナンス可能と判定するメンテナンス判定ステップと、前記メンテナンス判定ステップでメンテナンス可能と判定した場合、前記キャッシュエントリをメンテナンスするキャッシュメンテナンスステップと、を備えることを特徴とする。 The cache maintenance method according to the eighth aspect of the present invention is a cache entry as a unit for storing the data in the cache in a distributed memory cache that stores data from a database in a cache including one or more computer memories. In the cache maintenance method for maintaining the cache entry, a maintenance determination step that determines that maintenance is possible when the maintenance condition is satisfied is referred to with reference to a maintenance condition that is a condition for maintaining the cache entry, and maintenance is determined in the maintenance determination step A cache maintenance step for maintaining the cache entry.
かかる構成によれば、キャッシュメンテナンス方法は、データベースの更新処理によってキャッシュエントリに保存したデータとデータベースに格納したデータとの間に不整合が発生したとき、常にキャッシュエントリのメンテナンスを行うのではなく、所定のメンテナンス条件を満たす場合にのみ、キャッシュエントリのメンテナンスを行うこととした。これによって、キャッシュメンテナンス方法は、データベースに高い頻度で更新処理が行われる環境においても、参照速度が低下せず、処理負荷の増大を最小限に抑えることができる。 According to such a configuration, the cache maintenance method does not always maintain the cache entry when inconsistency occurs between the data stored in the cache entry by the database update process and the data stored in the database. Only when a predetermined maintenance condition is satisfied, the cache entry is maintained. As a result, the cache maintenance method can minimize the increase in processing load without reducing the reference speed even in an environment where update processing is frequently performed on the database.
また、本願第9発明に係るキャッシュメンテナンスプログラムは、コンピュータを、本願第1発明から本願第7発明の何れかのキャッシュメンテナンス装置を構成する各手段として機能させることを特徴とする。 A cache maintenance program according to the ninth invention of the present application causes a computer to function as each means constituting the cache maintenance device according to any of the first to seventh inventions of the present application.
かかる構成によれば、キャッシュメンテナンスプログラムは、データベースの更新処理によってキャッシュエントリに保存したデータとデータベースに格納したデータとの間に不整合が発生したとき、常にキャッシュエントリのメンテナンスを行うのではなく、所定のメンテナンス条件を満たす場合にのみ、キャッシュエントリのメンテナンスを行うこととした。これによって、キャッシュメンテナンスプログラムは、データベースに高い頻度で更新処理が行われる環境においても、参照速度が低下せず、処理負荷の増大を最小限に抑えることができる。 According to such a configuration, the cache maintenance program does not always maintain the cache entry when inconsistency occurs between the data stored in the cache entry by the database update process and the data stored in the database. Only when a predetermined maintenance condition is satisfied, the cache entry is maintained. As a result, the cache maintenance program can minimize the increase in processing load without reducing the reference speed even in an environment where update processing is frequently performed on the database.
本発明によれば、所定のメンテナンス条件を満たす場合にのみ、キャッシュエントリのメンテナンスを行うため、データベースに高い頻度で更新処理が行われる環境においても、参照速度が低下せず、処理負荷の増大を最小限に抑えることができる。 According to the present invention, the cache entry is maintained only when a predetermined maintenance condition is satisfied. Therefore, even in an environment where update processing is frequently performed on the database, the reference speed does not decrease and the processing load increases. Can be minimized.
以下、本発明の各実施形態について、適宜図面を参照しながら詳細に説明する。なお、各実施形態において、同一の機能を有する手段及び同一の構成には同一の符号を付し、説明を省略した。 Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings as appropriate. In each embodiment, means having the same function and the same configuration are denoted by the same reference numerals and description thereof is omitted.
(第1実施形態:無効化方式又は再問い合わせ方式)
[キャッシュメンテナンスシステムの概略]
図1を参照して、キャッシュメンテナンスシステム100の概略について説明する。図1に示すように、キャッシュメンテナンスシステム100は、キャッシュメンテナンス装置1と、データベース1Bと、キャッシュ1Cとを備える。ここで、キャッシュメンテナンスシステム100は、インターネット等のネットワークNを介して、キャッシュメンテナンス装置1と、データベース1Bと、キャッシュ1Cとを接続している。
(First embodiment: invalidation method or re-inquiry method)
[Outline of cache maintenance system]
An outline of the
キャッシュメンテナンス装置1は、データベース1Bに格納されたデータをキャッシュ1Cに保存する分散メモリキャッシュにおける、キャッシュエントリ1CEをメンテナンスするものであり、ここでは、無効化方式又は再問い合わせ方式を行う。なお、キャッシュメンテナンス装置1の構成については、後記する。
The
データベース1Bは、キャッシュ1Cの対象となるデータを格納するリレーショナルデータベース等の一般的なデータベースである。
The
キャッシュ1Cは、1以上のコンピュータのメモリで構成された分散メモリキャッシュである。ここで、キャッシュ1Cは、1個以上のキャッシュエントリ1CE1,1CE2・・・1CEnを有することになる(但し、nは1以上の整数)。 The cache 1C is a distributed memory cache composed of one or more computer memories. Here, the cache 1C has one or more cache entries 1CE 1 , 1CE 2 ... 1CE n (where n is an integer of 1 or more).
キャッシュエントリ1CEは、データベース1Bのデータを保存し、アプリケーションにデータを提供するものである。ここで、キャッシュエントリ1CE、データベース1Bに格納されたデータをそのまま保存しても良く、データベース1Bに格納されたデータを加工(例えば、WebアプリケーションであればHTML形式に加工)して保存しても良い。
The cache entry 1CE stores data in the
そして、データベース1Bに格納したデータとキャッシュエントリ1CEに保存したデータとの間に不整合が発生した場合、キャッシュメンテナンス装置1は、後記するメンテナンス条件を満たす場合、このキャッシュエントリ1CEのメンテナンスを行う。
When a mismatch occurs between the data stored in the
[キャッシュメンテナンス装置の構成]
以下、図1を参照して、キャッシュメンテナンス装置1の構成について説明する。図1に示すように、キャッシュメンテナンス装置1は、更新情報記憶部11と、メンテナンス条件記憶部21と、メンテナンス条件生成部31と、メンテナンス対象選択部41と、メンテナンス判定部51と、キャッシュメンテナンス部61とを備える。
[Configuration of cache maintenance device]
Hereinafter, the configuration of the
更新情報記憶部11は、キャッシュエントリ更新情報(更新情報)を記憶するハードディスク等の記憶手段である。このキャッシュエントリ更新情報は、前回のメンテナンス時刻、及び、前回のメンテナンス時刻以後にデータが更新された回数を示す更新回数(メンテナンスカウント)の少なくとも一方を含むものである。ここでは、図2に示すように、キャッシュエントリ更新情報は、キャッシュエントリ1CEを一意に識別するキャッシュエントリ識別子と、前回のメンテナンス時刻以後にデータが更新された回数を示す更新回数を示すメンテナンスカウントと、前回にメンテナンスが行われた時刻である前回のメンテナンス時刻とを有する。
The update
図1のメンテナンス条件記憶部21は、メンテナンス条件を記憶するハードディスク等の記憶手段である。このメンテナンス条件は、キャッシュエントリ1CEをメンテナンスする条件を示すものである。
The maintenance
また、メンテナンス条件生成部31は、予め設定された許容遅延回数及び許容遅延時間の少なくとも一方が入力され、この入力に基づいて、メンテナンス条件を生成してメンテナンス条件記憶部21に書き込むものである。ここで、メンテナンス条件生成部31は、設定ファイルから許容遅延回数及び許容遅延時間の少なくとも一方を読み取り、又は、図示を省略したキーボード、マウス等の入力部によって、許容遅延回数及び許容遅延時間の少なくとも一方が入力される。
The maintenance
そして、メンテナンス条件生成部31は、メンテナンス条件を生成する。具体的には、メンテナンス条件生成部31は、許容遅延回数のみが入力された場合、メンテナンスカウントが許容遅延回数を超えたときにメンテナンス可能となるメンテナンス条件を生成する。例えば、メンテナンス条件生成部31は、許容遅延回数「10回」が入力された場合、図3(a)に示すように、「メンテナンスカウント>10回」というメンテナンス条件を生成する。
And the maintenance condition production |
また、メンテナンス条件生成部31は、許容遅延時間のみが入力された場合、経過時間が許容遅延時間を超えたときにメンテナンス可能となるメンテナンス条件を生成する。例えば、メンテナンス条件生成部31は、許容遅延時間「10分」が入力された場合、図3(b)に示すように、「経過時間>10分」というメンテナンス条件を生成する。なお、経過時間は、前回のメンテナンス時刻から現在時刻までの時間である。また、現在時刻として、例えば、コンピュータの内蔵時計の時刻やNTP(Network Time Protocol)で取得した時刻を用いることができる。
In addition, when only the allowable delay time is input, the maintenance
また、メンテナンス条件生成部31は、許容遅延回数と許容遅延時間との両方が入力された場合、メンテナンスカウントが許容遅延回数を超えたとき又は経過時間が許容遅延時間を超えたときにメンテナンス可能となるメンテナンス条件を生成する。例えば、メンテナンス条件生成部31は、許容遅延回数「20回」と許容遅延時間「10分」とが入力された場合、図3(c)に示すように、「(メンテナンスカウント>20回)OR(経過時間>10分)」というメンテナンス条件を生成する。なお、図3(c)の「OR」は、OR条件であることを示す。なお、メンテナンス条件生成部31は、全てのキャッシュエントリ1CEで共通する、1個のメンテナンス条件を生成する。
In addition, when both the allowable delay count and the allowable delay time are input, the maintenance
図1のメンテナンス対象選択部41は、キャッシュ1Cの全てのキャッシュエントリ1CEのうち、メンテナンスの対象となるキャッシュエントリ1CEを選択するものである。ここで、メンテナンス対象選択部41は、キャッシュエントリ1CEを選択すると共に、キャッシュエントリ更新情報を更新しても良い。例えば、メンテナンス対象選択部41は、メンテナンスカウントをインクリメントし、前回のメンテナンス時刻を現在時刻に更新する。このとき、メンテナンス対象選択部41は、データベース1Bに対する更新問い合わせ(登録、更新、削除)の一部又は全部を元に、メンテナンス対象を検索可能とするマッピングテーブルを用意する方法を用いる。また、メンテナンス対象選択部41は、例えば、データベース1Bに対する更新問い合わせの一部又は全部を入力として、メンテナンス対象を検索するため問い合わせ文を予め用意する方法がある。さらに、メンテナンス対象選択部41は、更新処理のあったテーブルを元に作られたキャッシュエントリ1CEを全てメンテナンス対象とする方法を用いても良く、前記した非特許文献3に記載の技術を用いても良い。
The maintenance
メンテナンス判定部51は、メンテナンス条件記憶部21に記憶したメンテナンス条件を参照し、メンテナンス条件を満たすときにメンテナンス可能と判定するものである。ここで、メンテナンス判定部51は、更新情報記憶部11に記憶したキャッシュエントリ更新情報が更新された際、メンテナンス対象選択部41が選択したキャッシュエントリ1CEに対応するメンテナンスカウントと前回のメンテナンス時刻とを、更新情報記憶部11から読み出す。そして、メンテナンス判定部51は、メンテナンス条件にこの読み出したメンテナンスカウント及び前回のメンテナンス時刻の少なくとも一方を代入し、メンテナンス条件を満たすか否かを判定する。
The
キャッシュメンテナンス部61は、メンテナンス判定部51がメンテナンス可能と判定した場合、キャッシュエントリ1CEをメンテナンスするものである。ここで、無効化方式を採用した場合、キャッシュメンテナンス部61は、メンテナンス判定部51がメンテナンス可能と判定したら、メンテナンス対象選択部41が選択したキャッシュエントリ1CEを無効化することを示す無効化メッセージをキャッシュ1Cに送信する。
The
また、再問い合わせ方式を採用した場合、キャッシュメンテナンス部61は、無効化メッセージを送信した後、データベース1Bにこのキャッシュエントリ1CEに保存するデータを取得するための問い合わせを行う。そして、キャッシュメンテナンス部61は、この問い合わせ結果をキャッシュ1Cにキャッシュエントリ1CEとして保存する。なお、無効化方式及び再問い合わせ方式の詳細については、前記した非特許文献1,2,3,5に記載されている。
When the re-inquiry method is adopted, the
[キャッシュメンテナンス装置の動作]
<全体動作>
以下、図4を参照して、キャッシュメンテナンス装置1の全体動作について説明する(適宜図1参照)。まず、図4に示すように、キャッシュメンテナンス装置1は、メンテナンス条件生成部31によって、許容遅延回数及び許容遅延時間の少なくとも一方が入力され、この入力に基づいて、メンテナンス条件を生成してメンテナンス条件記憶部21に書き込む(ステップS1)。
[Operation of the cache maintenance device]
<Overall operation>
Hereinafter, the overall operation of the
ステップS1の処理に続いて、キャッシュメンテナンス装置1は、キャッシュエントリ1CEのメンテナンスを行う(ステップS2)。なお、ステップS2の詳細は、後記する。
Following the processing in step S1, the
ステップS2の処理に続いて、キャッシュメンテナンス装置1は、メンテナンス判定部51によって、メンテナンスを終了するか否かを判定する(ステップS3)。例えば、入力部にユーザからの終了命令が入力された場合、キャッシュメンテナンス装置1は、メンテナンス判定部51によって、メンテナンスを終了すると判定する。
Following the processing of step S2, the
ここで、メンテナンスを終了すると判定した場合(ステップS3でYes)、キャッシュメンテナンス装置1は、処理を終了する。一方、メンテナンスを終了しないと判定した場合(ステップS3でNo)、キャッシュメンテナンス装置1は、ステップS2の処理に戻る。
If it is determined that the maintenance is to be ended (Yes in step S3), the
<ステップS2の詳細:メンテナンス>
以下、図5を参照して、図4のステップS2(メンテナンス)の詳細について説明する。まず、キャッシュメンテナンス装置1は、メンテナンス対象選択部41によって、キャッシュ1Cの全てのキャッシュエントリ1CEのうち、メンテナンスの対象となるキャッシュエントリ1CEを判定する(ステップS20)。具体的には、キャッシュメンテナンス装置1は、メンテナンス対象選択部41によって、メンテナンスが行われていない未処理キャッシュエントリ識別値のリスト(未処理リスト)を出力する。
<Details of Step S2: Maintenance>
The details of step S2 (maintenance) in FIG. 4 will be described below with reference to FIG. First, in the
ステップS20の処理に続いて、キャッシュメンテナンス装置1は、メンテナンス対象選択部41によって、ステップS20で出力した未処理リストに基づいて、メンテナンスを行うキャッシュエントリ1CEを任意に選択する(ステップS21)。例えば、キャッシュメンテナンス装置1は、メンテナンス対象選択部41によって、この未処理リストに含まれるキャッシュエントリ識別子をソートし、ソート順にキャッシュエントリ1CEを選択する。また、例えば、キャッシュメンテナンス装置1は、メンテナンス対象選択部41によって、この未処理リストに含まれるキャッシュエントリ1CEをランダムに選択する。そして、キャッシュメンテナンス装置1は、メンテナンス対象選択部41によって、選択したキャッシュエントリ1CEを示すキャッシュエントリ識別子を出力する。
Following the processing in step S20, the
ステップS21の処理に続いて、キャッシュメンテナンス装置1は、メンテナンス対象選択部41によって、ステップS20で出力したキャッシュエントリ識別子に対応するキャッシュエントリ1CEについて、キャッシュエントリ更新情報のメンテナンスカウントを更新(インクリメント)する(ステップS22)。
Following the processing in step S21, the
ステップS22の処理に続いて、キャッシュメンテナンス装置1は、メンテナンス判定部51によって、メンテナンス条件を評価する(ステップS23)。そして、キャッシュメンテナンス装置1は、メンテナンス判定部51によって、この評価結果に応じた真偽値を出力する。なお、ステップS23の詳細は、後記する。
Following the processing of step S22, the
ステップS23の処理に続いて、キャッシュメンテナンス装置1は、メンテナンス判定部51によって、メンテナンス条件を満たすか否かを判定する(ステップS24)。例えば、キャッシュメンテナンス装置1は、メンテナンス判定部51によって、ステップS23で出力した真偽値が「真」のとき、メンテナンス条件を満たしメンテナンス可能と判定する。また、例えば、キャッシュメンテナンス装置1は、メンテナンス判定部51によって、ステップS23で出力した真偽値が「偽」のとき、メンテナンス条件を満たさずメンテナンス不可能と判定する。
Following the processing of step S23, the
ここで、メンテナンス可能と判定した場合(ステップ24でYes)、キャッシュメンテナンス装置1は、ステップS25の処理に進む。一方、メンテナンス不可能と判定した場合(ステップS24でNo)、キャッシュメンテナンス装置1は、ステップS27の処理に進む。
If it is determined that maintenance is possible (Yes in step 24), the
ステップ24の処理に続いて、キャッシュメンテナンス装置1は、キャッシュメンテナンス部61によって、ステップS20で出力したキャッシュエントリ識別子に対応するキャッシュエントリ1CEのメンテナンスを行う(ステップS25)。
Following the processing in
ステップ25の処理に続いて、キャッシュメンテナンス装置1は、キャッシュメンテナンス部61によって、ステップS20で出力したキャッシュエントリ識別子に対応するキャッシュエントリ1CEについて、キャッシュエントリ更新情報を更新する(ステップS26)。例えば、キャッシュメンテナンス装置1は、キャッシュメンテナンス部61によって、キャッシュエントリ更新情報のメンテナンスカウントを「0」に更新(リセット)し、前回のメンテナンス時刻を現在時刻で更新する。なお、ステップS26では、キャッシュエントリ更新情報として、キャッシュエントリ参照回数を記憶して利用する場合、これらの値の更新(リセット)を行っても良い。
Following the processing in step 25, the
ステップ26の処理又はステップS24でNoの後に続いて、キャッシュメンテナンス装置1は、キャッシュメンテナンス部61によって、ステップS20で出力した未処理リストに含まれる、全てのメンテナンス対象となるキャッシュエントリ1CEを処理(メンテナンス)したか否かを判定する(ステップS27)。
Following the processing in step 26 or No in step S24, the
ここで、全てのメンテナンス対象を処理したと判定した場合(ステップS27でYes)、キャッシュメンテナンス装置1は、メンテナンスを終了する。一方、全てのメンテナンス対象を処理していないと判定した場合(ステップS27でNo)、キャッシュメンテナンス装置1は、ステップS21の処理に戻る。
If it is determined that all the maintenance targets have been processed (Yes in step S27), the
<ステップS23の詳細:メンテナンス条件の評価>
以下、図6を参照して、図5のステップS23(メンテナンス条件を評価)の詳細について説明する。まず、キャッシュメンテナンス装置1は、メンテナンス判定部51によって、ステップS20で出力したキャッシュエントリ識別子に対応するキャッシュエントリ1CEについて、メンテナンス条件記憶部21を参照してメンテナンス条件を取得し、更新情報記憶部11を参照してキャッシュエントリ更新情報を取得する(ステップS231)。
<Details of Step S23: Evaluation of Maintenance Conditions>
The details of step S23 (evaluation of maintenance conditions) in FIG. 5 will be described below with reference to FIG. First, the
ステップS231の処理に続いて、キャッシュメンテナンス装置1は、メンテナンス判定部51によって、ステップS231で取得したメンテナンス条件にステップS231で取得したキャッシュエントリ更新情報を代入してメンテナンス条件を評価し、この評価結果に応じた真偽値を出力する(ステップS232)。
Subsequent to the processing of step S231, the
以上のように、第1実施形態に係るキャッシュメンテナンス装置1は、メンテナンス条件を満たす場合にのみ、キャッシュエントリ1CEのメンテナンスを行うため、データベース1Bに高い頻度で更新処理が行われる環境においても、参照速度が低下せず、処理負荷の増大を最小限に抑えることができる。また、キャッシュメンテナンス装置1は、無効化方式を採用したときは、メンテナンスによってキャッシュエントリ1CEが無効化される頻度が低減するので、キャッシュヒット率が大幅に向上する。さらに、キャッシュメンテナンス装置1は、再問い合わせ方式を採用したときは、メンテナンス条件の判定の処理負荷がメンテナンスの頻度を少なくして削減できるメンテナンスコストよりも十分に小さいため、メンテナンスコストを大幅に削減できる。
As described above, since the
なお、キャッシュメンテナンス装置1を独立した装置として説明したが、本発明は、これに限定されない。例えば、図7に示すように、本発明は、ディスプレイ等の表示部Oと、キーボード、マウス等の入力部Iと、演算装置Cと、メモリ、ハードディスク等の記憶装置HとをシステムバスBで接続した一般的なコンピュータで実現できる。具体的には、本発明は、このコンピュータの記憶装置Hを更新情報記憶部11及びメンテナンス条件記憶部21として協調動作させ、演算装置Cをメンテナンス条件生成部31、メンテナンス対象選択部41、メンテナンス判定部51及びキャッシュメンテナンス部61として協調動作させるキャッシュメンテナンスプログラムによって実現できる。このプログラムは、ネットワークNを介して配布しても良く、CD−ROMやフラッシュメモリ等の記録媒体に書き込んで配布しても良い。この点、以後の実施形態でも同様である。
Although the
(第2実施形態:差分更新方式)
[キャッシュメンテナンスシステムの概略]
以下、図8を参照して、第2実施形態に係るキャッシュメンテナンスシステム200の概略について、第1実施形態と異なる点を主に説明する。ここで、メンテナンスを行う際、不整合なキャッシュエントリ2CE内のデータを全て破棄してから再計算する再問い合わせ方式に比べ、キャッシュエントリ2CE内の一部分のみを更新する差分更新方式の方が、一般的には演算量が少なくなる。この差分更新方式は、どのようなキャッシュ2Cでも適用できるわけではなく、一定のデータベース環境を満たしている必要がある。キャッシュメンテナンスシステム200は、このような差分更新方式を採用する場合の一例である。
(Second embodiment: differential update method)
[Outline of cache maintenance system]
Hereinafter, with reference to FIG. 8, the outline of the
データベース2Bは、元から格納されているテーブルTに加えて、このテーブルT毎に、差分データを一時的に保存するための差分テーブルΔTを格納するリレーショナルデータベースである。この差分テーブルΔTは、テーブルTに登録(INSERT)されたレコードのみを格納するものである。なお、図8では、差分テーブルΔT及びテーブルTをそれぞれ1個示したが、差分テーブルΔT及びテーブルTは、それぞれ複数であっても良い。 The database 2B is a relational database that stores a difference table ΔT for temporarily storing difference data for each table T in addition to the table T stored from the beginning. This difference table ΔT stores only records registered (INSERT) in the table T. In FIG. 8, one difference table ΔT and one table T are shown, but there may be a plurality of difference tables ΔT and tables T.
キャッシュ2Cは、図1のキャッシュ1Cと同様のものである。また、キャッシュエントリ2CEは、データベース2Bの問い合わせ結果を保存の対象とする。 The cache 2C is the same as the cache 1C in FIG. The cache entry 2CE stores the inquiry result of the database 2B as a storage target.
[キャッシュメンテナンス装置の構成]
以下、第2実施形態に係るキャッシュメンテナンス装置2の構成について、第1実施形態と異なる点を主に説明する。図8に示すように、キャッシュメンテナンス装置2は、メンテナンス条件記憶部22と、メンテナンス条件生成部32と、メンテナンス判定部52と、キャッシュ差分メンテナンス部(キャッシュメンテナンス部)62とを備える。なお、キャッシュ差分メンテナンス部62が、請求項に記載のキャッシュメンテナンス部に相当する。
[Configuration of cache maintenance device]
In the following, the configuration of the
メンテナンス条件記憶部22は、メンテナンス条件を記憶するハードディスク等の記憶手段である。このメンテナンス条件は、後記するメンテナンス判定部52が、差分テーブルΔTに格納したデータの件数や最も古いデータの時刻等の情報と比較して、テーブルTに対応するキャッシュエントリ2CEの更新を行うか否かを判定する条件式である。例えば、メンテナンス条件は、差分テーブルΔTの差分データの件数をAnとすると、「An>10件」のような条件となる。
The maintenance
メンテナンス条件生成部32は、データベース2Bに格納されたテーブルT毎に、メンテナンス条件を生成してメンテナンス条件記憶部24に書き込むものである。なお、メンテナンス条件生成部32のメンテナンス条件の生成手法は、図1のメンテナンス条件生成部31と同様のものであるため、説明を省略する。
The maintenance
メンテナンス判定部52は、データベース2BのテーブルTにおける差分データを格納した差分テーブルΔTを参照し、差分テーブルΔTのデータ件数をメンテナンスカウントとして算出するものである。また、メンテナンス判定部52は、差分テーブルΔTにおける最も古いデータを格納した時刻から現在時刻までを経過時間として算出する。そして、メンテナンス判定部52は、メンテナンス条件記憶部22に記憶したメンテナンス条件を参照し、算出した更新回数と経過時間とをメンテナンス条件に代入して、このメンテナンス条件を満たすときにメンテナンス可能と判定する。
The
キャッシュ差分メンテナンス部62は、メンテナンス判定部52がメンテナンス可能と判定したキャッシュエントリ2CEについて、差分テーブルΔTに格納した差分データをキャッシュエントリ2CEに一括して更新(メンテナンス)するものである。そして、キャッシュ差分メンテナンス部62は、一括して更新した差分データを差分テーブルΔTから削除する。
The cache
以下、図9を参照して、キャッシュ差分メンテナンス部62によるメンテナンスについて、具体的に説明する(適宜図8参照)。図9に示すように、データベース2Bは、図示を省略した「message」というテーブルと、「Δmessage」という差分テーブルΔTと、「follower」というテーブルTとを格納している。この差分テーブルΔTは、idが6〜9の4レコードが格納されている。
Hereinafter, the maintenance by the cache
ここで、キャッシュエントリ2CEの更新(メンテナンス)を行う場合、キャッシュ差分メンテナンス部62は、1個のキャッシュエントリ2CEに複数の差分データを一括して更新するための一括差分データを求める。例えば、キャッシュ差分メンテナンス部62は、この一括差分データを求めるために、問い合わせQ2をデータベース2Bに行う。この問い合わせQ2は、図25の問い合わせ9Qと比べ、差分テーブルΔTの全レコードを用いている点、及び、キャッシュエントリ2CEのkeyを用いてグループ化を行う点が異なっている。そして、キャッシュ差分メンテナンス部62は、一括差分データを、キャッシュエントリ2CEのkeyに対応するグループ毎に、キャッシュエントリ2CEに更新する。つまり、キャッシュ差分メンテナンス部62は、1以上の差分データをキャッシュエントリ2CEに一括更新(メンテナンス)する。
Here, when updating (maintenance) the cache entry 2CE, the cache
[キャッシュメンテナンス装置の動作]
<ステップS2の詳細:メンテナンス>
キャッシュメンテナンス装置2は、図4と同じ全体動作を行うため、説明を省略する。以下、キャッシュメンテナンス装置2における、図4のステップS2の動作が異なるため、図10を参照し、これを説明する。
[Operation of the cache maintenance device]
<Details of Step S2: Maintenance>
The
予め、データベース2Bは、このデータベース2Bに対する更新を蓄積、つまり、差分テーブルを生成する(ステップS30)。ここで、データベース2Bは、このデータベース2Bに対する登録(INSERT)問い合わせが入力され、この問い合わせに記述されたレコードをテーブルTに登録する。このとき、データベース2Bは、このレコードを差分テーブルΔTにも登録する。なお、ステップS30の処理は、キャッシュメンテナンス装置2の動作でないことを明確にするため、破線で図示した。
In advance, the database 2B accumulates updates to the database 2B, that is, generates a difference table (step S30). Here, the database 2B receives a registration (INSERT) query for the database 2B and registers the record described in the query in the table T. At this time, the database 2B also registers this record in the difference table ΔT. In addition, in order to clarify that the process of step S30 is not operation | movement of the
ステップS31及びステップS32の処理は、図5のステップ23及びS24と同様のものであるため、説明を省略する。
The processing in step S31 and step S32 is the same as that in
ステップ32の処理に続いて、キャッシュメンテナンス装置2は、キャッシュ差分メンテナンス部62によって、キャッシュエントリ2CEの一括更新(メンテナンス)を行う(ステップS33)。
Following the processing of
<ステップS33の詳細:キャッシュエントリの一括更新>
以下、図11を参照して、図10のステップS33(キャッシュエントリの一括更新)の詳細について説明する。まず、キャッシュメンテナンス装置2は、キャッシュ差分メンテナンス部62によって、差分テーブルΔTとテーブルTとから、一括差分データを求める(ステップS331)。ここでは、キャッシュメンテナンス装置2は、キャッシュ差分メンテナンス部62によって、データベース2Bに図9の問い合わせQ2を行い、全てのキャッシュエントリ2CEについての一括差分データを求める。
<Details of Step S33: Batch Update of Cache Entries>
Hereinafter, with reference to FIG. 11, the details of step S33 (batch update of cache entries) of FIG. 10 will be described. First, the
ステップS331の処理に続いて、キャッシュメンテナンス装置2は、キャッシュ差分メンテナンス部62によって、ステップS331で求めた一括差分データで1個のキャッシュエントリ2CEを一括更新する(ステップS332)。そして、キャッシュメンテナンス装置2は、キャッシュ差分メンテナンス部62によって、一括差分データを更新したキャッシュエントリ2CEに対応するテーブルTの識別子(例えば、テーブルTの名称)と、一括更新が行われていないキャッシュエントリ2CEの一括差分データである未処理一括差分データとを出力する。
Following the processing in step S331, the
ステップS332の処理に続いて、キャッシュメンテナンス装置2は、キャッシュ差分メンテナンス部62によって、一括差分データを全て処理したか否かを判定する(ステップS333)。ここでは、キャッシュメンテナンス装置2は、キャッシュ差分メンテナンス部62によって、ステップS332で未処理一括差分データが出力されなかったとき、一括差分データを全て処理したと判定する。
Following the processing in step S332, the
ここで、一括差分データを全て処理したと判定した場合(ステップS333でYes)、キャッシュメンテナンス装置2は、ステップS334の処理に進む。一方、一括差分データを全て処理していないと判定した場合(ステップS333でNo)、キャッシュメンテナンス装置2は、ステップS332の処理に戻る。
If it is determined that all the batch difference data has been processed (Yes in step S333), the
ステップS333の処理に続いて、キャッシュメンテナンス装置2は、キャッシュ差分メンテナンス部62によって、ステップS332で更新した一括差分データを差分テーブルΔTから削除する(ステップS334)。ここでは、キャッシュメンテナンス装置2は、キャッシュ差分メンテナンス部62によって、ステップS332で出力した識別子が示す全てのテーブルTについて、このテーブルTの全レコードを削除(DELETE)する。
Following the processing in step S333, the
以上のように、第2実施形態に係るキャッシュメンテナンス装置2は、メンテナンス条件を満たす場合にのみ、キャッシュエントリ2CEのメンテナンスを行うため、データベース2Bに高い頻度で更新処理が行われる環境においても、参照速度が低下せず、処理負荷の増大を最小限に抑えることができる。また、キャッシュメンテナンス装置2は、メンテナンス条件を満たす場合にのみ差分データでキャッシュエントリ2CEを一括更新し、メンテナンスの頻度を制御することとした。これによって、キャッシュメンテナンス装置2は、差分更新方式を採用したときは、メンテナンスによって逐次差分データをキャッシュエントリ2CCEに更新する場合に比べて、問い合わせ処理及び通信処理のオーバーヘッドが大幅に少ないため、メンテナンスコストを大幅に削減できる。
As described above, since the
(第3実施形態:無効化方式又は再問い合わせ方式)
[キャッシュメンテナンス装置の構成]
以下、図12を参照して、第3実施形態に係るキャッシュメンテナンス装置3の構成について、第1実施形態と異なる点を主に説明する。キャッシュメンテナンス装置3は、統計情報を用いて、予め設定された目標負荷を達成するまでメンテナンスを行う点が、キャッシュメンテナンス装置1と大きく相違する。
(Third embodiment: Invalidation method or re-inquiry method)
[Configuration of cache maintenance device]
Hereinafter, with reference to FIG. 12, the configuration of the
このため、図12に示すように、キャッシュメンテナンス装置3は、更新情報記憶部13と、メンテナンス条件記憶部23と、メンテナンス条件生成部33と、メンテナンス対象選択部43と、メンテナンス判定部53と、キャッシュメンテナンス部63と、統計情報算出部73とを備える。
Therefore, as shown in FIG. 12, the
更新情報記憶部13は、キャッシュエントリ更新情報を記憶するハードディスク等の記憶手段である。ここでは、図13に示すように、キャッシュエントリ更新情報は、キャッシュエントリ識別子と、メンテナンスカウントと、前回のメンテナンス時刻と、累積参照回数と、累積メンテナンス回数とを有する。この累積参照回数は、予め設定された統計期間におけるキャッシュエントリ3CEが参照された参照回数の累積値である。また、この累積メンテナンス回数は、統計期間におけるキャッシュエントリ3CEをメンテナンスした回数を示すメンテナンス回数の累積値である。つまり、キャッシュエントリ更新情報のデータ項目のうち、累積参照回数及び累積メンテナンス回数がキャッシュエントリ統計情報(統計情報)となる。なお、累積参照回数及び累積メンテナンス回数は、後記する統計情報算出部73がキャッシュエントリ更新情報に書き込む。
The update
図12のメンテナンス条件記憶部23は、メンテナンス条件を記憶するハードディスク等の記憶手段である。ここでは、図14に示すように、メンテナンス条件は、キャッシュエントリ3CE毎に生成される。
The maintenance
図12のメンテナンス条件生成部33は、予め設定された許容遅延回数及び許容遅延時間の少なくとも一方と、メンテナンスコストの目標負荷値とが入力され、この入力に基づいて、キャッシュエントリ3CE毎に、メンテナンス条件を生成してメンテナンス条件記憶部23に書き込むものである。ここで、メンテナンス条件生成部33は、キャッシュエントリ3CE毎に、許容遅延回数及び許容遅延時間の少なくとも一方が入力される。さらに、メンテナンス条件生成部33は、設定ファイルから目標負荷値を読み取り、又は、入力部によって目標負荷値が入力される。ここで、この目標負荷値は、例えば、0を超え、かつ、100未満の値で入力される。
The maintenance
そして、メンテナンス条件生成部33は、目標負荷を達成するか、又は、全てのキャッシュエントリ3CEのメンテナンス条件を生成するまで、キャッシュエントリ3CE毎にメンテナンス条件を生成する。このとき、メンテナンス条件生成部33は、メンテナンス条件生成部33は、メンテナンス条件を生成しておらず、かつ、メンテナンス回数の累積値が最大となるキャッシュエントリ3CEを選択することが好ましい。又は、メンテナンス対象選択部43は、メンテナンス条件生成部33がメンテナンス条件を生成しておらず、かつ、参照回数の累積値が最小となるキャッシュエントリ3CEを選択することが好ましい。なお、メンテナンス条件の生成の詳細については、後記する。
Then, the maintenance
メンテナンス対象選択部43は、図1のメンテナンス対象選択部41と同様に、キャッシュエントリ3CEを選択するものである。
The maintenance
メンテナンス判定部53は、図1のメンテナンス判定部51と同様に、メンテナンス対象選択部43が選択したキャッシュエントリ3CEについて、メンテナンス条件記憶部21に記憶したメンテナンス条件を参照し、メンテナンス条件を満たすときにメンテナンス可能と判定するものである。
As with the
キャッシュメンテナンス部63は、図1のキャッシュメンテナンス部61と同様に、メンテナンス対象選択部43が選択したキャッシュエントリについて、メンテナンス判定部53がメンテナンス可能と判定した場合、キャッシュエントリ3CEをメンテナンスするものである。
Similarly to the
統計情報算出部73は、予め設定された統計期間における累積参照回数と、累積メンテナンス回数とを算出するものである。ここで、統計情報算出部73は、キャッシュメンテナンス装置3を統計期間運用して、累積参照回数及び累積メンテナンス回数を算出する。そして、統計情報算出部73は、この累積参照回数及び累積メンテナンス回数をキャッシュエントリ更新情報として、更新情報記憶部13に書き込む。
The statistical
[キャッシュメンテナンス装置の動作]
キャッシュメンテナンス装置3は、図4と同じ全体動作を行うため、説明を省略する。以下、キャッシュメンテナンス装置3における、図4のステップS1の動作が異なるため、図15を参照し、これを説明する。
[Operation of the cache maintenance device]
The
<ステップS1の詳細:メンテナンス条件の生成>
図15に示すように、キャッシュメンテナンス装置3は、統計情報算出部73によって、キャッシュエントリ統計情報を取得(算出)する(ステップS40)。そして、キャッシュメンテナンス装置3は、統計情報算出部73によって、このキャッシュエントリ統計情報を更新情報記憶部13に書き込む。なお、ステップS40の詳細は、後記する。
<Details of Step S1: Generation of Maintenance Conditions>
As shown in FIG. 15, the
ステップS40の処理に続いて、キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、許容遅延回数及び許容遅延時間の少なくとも一方と、メンテナンスコストの目標負荷値とを取得(入力)する(ステップS41)。
Following the processing of step S40, the
ステップS41の処理に続いて、キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、ステップS41で取得した目標負荷値に基づいて、削減目標値を算出する(ステップS42)。ここで、キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、キャッシュエントリ統計情報を参照して、式(4)を用いて、削減目標値を算出する。なお、式(4)では、Dgは削減目標値、ΣMiは全てのキャッシュエントリの累積メンテナンス回数を示し、Gは目標負荷値を示す。
Dg=ΣMi×G/100・・・式(4)
Following the processing of step S41, the
Dg = ΣMi × G / 100 (4)
ステップS42の処理に続いて、キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、メンテナンス条件を生成していないキャッシュエントリ3CEから、1個のキャッシュエントリ3CEを選択する(ステップS43)。そして、キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、選択した1個のキャッシュエントリ3CEを示すキャッシュエントリ識別子を出力する。なお、ステップS43の処理の詳細は、後記する。
Following the processing of step S42, the
ステップS43の処理に続いて、キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、ステップS43で出力したキャッシュエントリ識別子に対応するキャッシュエントリ3CEについて、メンテナンス条件を生成すると共に、削減値を算出する(ステップS44)。ここで、ステップS41で許容遅延回数のみが入力された場合、キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、式(1)を用いて削減値を算出し、式(5)で表されるメンテナンス条件を生成する。
A=Mi×(N−1)/N・・・式(1)
Mc>N ・・・式(5)
Following the processing in step S43, the
A = Mi × (N−1) / N (1)
Mc> N (5)
また、ステップS41で許容遅延時間のみが入力された場合、キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、式(2)を用いて削減値を算出し、式(6)で表されるメンテナンス条件を生成する。
A=Mi×(1−T/S)・・・式(2)
Pt>T ・・・式(6)
When only the allowable delay time is input in step S41, the
A = Mi × (1−T / S) (2)
Pt> T (6)
また、ステップS41で許容遅延回数と許容遅延時間との両方が入力された場合、キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、式(3)を用いて削減値を算出し、式(7)で表されるメンテナンス条件を生成する。
When both the allowable delay count and the allowable delay time are input in step S41, the
A=MIN[{Mi×(N−1)/N},{Mi×(1−T/S)}]・・・式(3)
(Mc>N)OR(Pt>T) ・・・式(7)
A = MIN [{Mi × (N−1) / N}, {Mi × (1-T / S)}] (3)
(Mc> N) OR (Pt> T) (7)
但し、前記した式(1)〜式(3)において、Aは削減値、Miはメンテナンス回数の累積値、Nは許容遅延回数、Tは許容遅延時間、及び、Sは統計期間である。また、前記した式(5)〜式(7)において、Mcはメンテナンスカウントを示し、Ptは経過時間を示し、ORはOR条件を示し、MINは最小値を出力する関数である。 In Equations (1) to (3), A is a reduction value, Mi is a cumulative value of the number of maintenance times, N is an allowable delay number, T is an allowable delay time, and S is a statistical period. Further, in the above formulas (5) to (7), Mc represents a maintenance count, Pt represents an elapsed time, OR represents an OR condition, and MIN is a function that outputs a minimum value.
また、キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、メンテナンス条件を生成する毎に、削減目標値(Dg)から削減値(A)を減算する。そして、キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、減算後の削減目標値を出力する。
Further, the
ステップS44の処理に続いて、キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、目標負荷を達成したか、又は、全てのキャッシュエントリ3CEのメンテナンス条件を生成した否かを判定する(ステップS45)。ここで、キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、ステップS44で出力した減算後の削減目標値が0以下の値となった場合、目標負荷を達成したと判定する。
Following the processing in step S44, the
ここで、目標負荷を達成したか、又は、全てのキャッシュエントリ3CEのメンテナンス条件を生成したと判定した場合(ステップ45でYes)、キャッシュメンテナンス装置3は、ステップS46の処理に進む。目標負荷を達成せず、かつ、全てのキャッシュエントリ3CEのメンテナンス条件を生成していないと判定した場合(ステップ45でNo)、キャッシュメンテナンス装置3は、ステップS43の処理に戻る。
If it is determined that the target load has been achieved or the maintenance conditions for all the cache entries 3CE have been generated (Yes in step 45), the
ステップS45の処理に続いて、キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、メンテナンス条件を生成していないキャッシュエントリ3CEが存在する場合、このキャッシュエントリ3CEについて、式(8)で表されるメンテナンス条件を生成する(ステップS46)。なお、式(8)は、データベース3Bのデータと、これに対応するキャッシュエントリ3CEとの間に不整合が発生した場合、目標負荷に関係なく、常にメンテナンスを行うことを示す。
Mc>1・・・式(8)
Following the processing of step S45, when there is a cache entry 3CE for which no maintenance condition has been generated by the maintenance
Mc> 1 Formula (8)
<ステップS40の詳細:キャッシュエントリ統計情報の取得>
以下、図16を参照して、図15のステップS40(キャッシュエントリ統計情報の取得)の詳細について説明する。まず、キャッシュメンテナンス装置3は、統計情報算出部73によって、設定ファイルから統計期間を読み取り、又は、入力部によって統計期間が入力される(ステップS401)。
<Details of Step S40: Acquisition of Cache Entry Statistics Information>
Hereinafter, the details of step S40 (acquisition of cache entry statistical information) in FIG. 15 will be described with reference to FIG. First, the
ステップS401の処理に続いて、キャッシュメンテナンス装置3は、統計情報算出部73によって、ステップS401で入力された統計期間における、参照回数及びメンテナンス回数を算出し、キャッシュエントリ統計情報に書き込む(ステップS402)。このメンテナンス回数は、無効化方式では無効化メッセージ、再問い合わせ方式及び差分更新方式ではキャッシュエントリ3CEへの書き込みリクエストの回数である。
Subsequent to the processing in step S401, the
ステップS402の処理に続いて、キャッシュメンテナンス装置3は、統計情報算出部73によって、ステップS401で入力された統計期間が終了したか否かを判定する(ステップS403)。ここで、統計期間が終了したと判定した場合(ステップ403でYes)、キャッシュメンテナンス装置3は、処理を終了する。一方、統計期間が終了していないと判定した場合(ステップ403でNo)、キャッシュメンテナンス装置3は、ステップS402の処理に戻る。
Following the processing of step S402, the
<ステップS43の詳細:キャッシュエントリの選択:第1例>
以下、図17を参照して、図15のステップS43(キャッシュエントリの選択)の第1例について説明する。キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、メンテナンス条件を生成しておらず、かつ、メンテナンス回数の累積値が最大となるキャッシュエントリ3CEを選択する(ステップS431)。
<Details of Step S43: Selection of Cache Entry: First Example>
Hereinafter, a first example of step S43 (selection of cache entry) in FIG. 15 will be described with reference to FIG. In the
これによって、キャッシュメンテナンス装置3は、メンテナンスの頻度が高いキャッシュ程、メンテナンスの頻度を削減による効果(例えば、無効化方式を採用したときはキャッシュヒット率の向上、再問い合わせ方式を採用したときは処理負荷の削減)が大きくなる。従って、キャッシュメンテナンス装置3は、メンテナンス条件を設定してメンテナンスを行うキャッシュの数を必要最小限とし、キャッシュの最新性の低下を最小限に抑える。
As a result, the
<ステップS43の詳細:キャッシュエントリの選択:第2例>
以下、図18を参照して、図15のステップS43(キャッシュエントリの選択)の第2例について説明する。キャッシュメンテナンス装置3は、メンテナンス条件生成部33によって、メンテナンス条件生成部33がメンテナンス条件を生成しておらず、かつ、参照回数の累積値が最小となるキャッシュエントリ3CEを選択する(ステップS432)。
<Details of Step S43: Selection of Cache Entry: Second Example>
Hereinafter, a second example of step S43 (selection of cache entry) in FIG. 15 will be described with reference to FIG. In the
これによって、キャッシュメンテナンス装置3は、メンテナンスによる悪影響が少ないキャッシュから順にメンテナンスを行うことで、キャッシュの最新性の低下を最小限に抑える。
As a result, the
以上のように、第3実施形態に係るキャッシュメンテナンス装置3は、メンテナンス条件を満たす場合にのみ、キャッシュエントリ3CEのメンテナンスを行うため、データベース3Bに高い頻度で更新処理が行われる環境においても、参照速度が低下せず、処理負荷の増大を最小限に抑えることができる。また、キャッシュメンテナンス装置3は、無効化方式を採用したときは、メンテナンスによってキャッシュが無効化される頻度が低減するので、キャッシュヒット率が大幅に向上する。さらに、キャッシュメンテナンス装置3は、再問い合わせ方式を採用したときは、メンテナンス条件の判定の処理負荷がメンテナンスの頻度を少なくして削減できるメンテナンスコストよりも十分に小さいため、メンテナンスコストを大幅に削減できる。さらに、キャッシュメンテナンス装置3は、目標負荷を達成した後、不要なメンテナンスを行うことがなく、処理負荷をさらに削減できる。
As described above, the
(第4実施形態:無効化方式又は再問い合わせ方式)
[キャッシュメンテナンス装置の構成]
以下、図19を参照して、第4実施形態に係るキャッシュメンテナンス装置4の構成について、第1実施形態と異なる点を主に説明する。キャッシュメンテナンス装置4は、データベースの負荷情報をメンテナンス条件に反映させる点が、キャッシュメンテナンス装置1と大きく相違する。
(Fourth embodiment: invalidation method or re-inquiry method)
[Configuration of cache maintenance device]
Hereinafter, the configuration of the
このため、図19に示すように、キャッシュメンテナンス装置4は、更新情報記憶部14と、メンテナンス条件記憶部24と、メンテナンス条件生成部34と、メンテナンス対象選択部44と、メンテナンス判定部54と、キャッシュメンテナンス部64と、データベース負荷測定部84とを備える。
For this reason, as shown in FIG. 19, the
メンテナンス条件記憶部24は、メンテナンス条件を記憶するハードディスク等の記憶手段である。ここでは、図20に示すように、メンテナンス条件は、後記する負荷条件が所定の閾値を超えるといった条件が付加される。なお、設定ファイルから負荷条件を読み取り、又は、入力部によって負荷条件が入力される。
The maintenance
図19のメンテナンス条件生成部34は、図1のメンテナンス条件生成部33と同様に、メンテナンス条件を生成してメンテナンス条件記憶部24に書き込むものである。このとき、メンテナンス条件生成部34は、このメンテナンス条件に、後記するデータベース負荷測定部80が測定した負荷値が負荷条件を満たすという条件を付加する。例えば、メンテナンス条件生成部34は、メンテナンス条件が「メンテナンスカウント>10回」の場合、「(メンテナンスカウント>10回)AND(CPU使用率>90%)」というような負荷条件をAND条件で付加する。
The maintenance
データベース負荷測定部84は、データベース4Bの負荷を示す負荷値を測定するものである。ここで、データベース負荷測定部84は、データベース4Bを有するサーバのCPU使用率、インターフェース使用率、メモリ使用率、ディスクI/O値等の負荷値を測定する。なお、負荷条件とは、負荷値が予め設定された閾値以上又は負荷値がこの閾値以下であるといった条件を示す。
The database
なお、更新情報記憶部14は、メンテナンス対象選択部44は、メンテナンス判定部54及びキャッシュメンテナンス部64は、図1の各手段と同様のものであるため、説明を省略する。
The update
[キャッシュメンテナンス装置の動作]
<ステップS1の詳細:メンテナンス条件の生成>
キャッシュメンテナンス装置4は、図4と同じ全体動作を行うため、説明を省略する。以下、キャッシュメンテナンス装置4における、図4のステップS1の動作が異なるため、図21を参照し、これを説明する。
[Operation of the cache maintenance device]
<Details of Step S1: Generation of Maintenance Conditions>
The
まず、キャッシュメンテナンス装置4は、メンテナンス条件生成部34によって、許容遅延回数及び許容遅延時間の少なくとも一方を取得(入力)する(ステップS50)。また、キャッシュメンテナンス装置4は、メンテナンス条件生成部34によって、メンテナンス条件を生成する(ステップS51)。そして、キャッシュメンテナンス装置4は、メンテナンス条件生成部34によって、メンテナンス条件に負荷条件をAND条件で付加する(ステップS52)。
First, the
<ステップS23の詳細:メンテナンス条件の評価>
以下、キャッシュメンテナンス装置4における、図5のステップS23の動作が異なるため、図21を参照し、これを説明する。まず、キャッシュメンテナンス装置4は、メンテナンス判定部54によって、メンテナンス対象となるキャッシュエントリ4CEについて、メンテナンス条件記憶部24を参照してメンテナンス条件を取得し、更新情報記憶部14を参照してキャッシュエントリ更新情報を取得する(ステップS60)。
<Details of Step S23: Evaluation of Maintenance Conditions>
Hereinafter, since the operation of step S23 in FIG. 5 in the
ステップS60の処理に続いて、キャッシュメンテナンス装置4は、データベース負荷測定部84によって、負荷値を測定する(ステップS61)。
Following the processing of step S60, the
ステップS61の処理に続いて、キャッシュメンテナンス装置4は、メンテナンス判定部54によって、ステップS60で取得したメンテナンス条件に、ステップS61で取得したキャッシュエントリ更新情報とステップS62で測定した負荷値とを代入してメンテナンス条件を評価し、この評価結果に応じた真偽値を出力する(ステップS62)。
Following the processing of step S61, the
以上のように、第4実施形態に係るキャッシュメンテナンス装置4は、メンテナンス条件を満たす場合にのみキャッシュエントリ4CEのメンテナンスを行い、メンテナンスの頻度を制御することとした。これによって、キャッシュメンテナンス装置4は、無効化方式を採用したときは、メンテナンスによってキャッシュが無効化される頻度が低減するので、キャッシュヒット率が大幅に向上する。また、キャッシュメンテナンス装置4は、再問い合わせ方式を採用したときは、メンテナンス条件の判定の処理負荷がメンテナンスの頻度を少なくして削減できるメンテナンスコストよりも十分に小さいため、メンテナンスコストを大幅に削減できる。さらに、キャッシュメンテナンス装置4は、負荷条件を設定することで、データベースの負荷に応じて、メンテナンスの頻度を制御することができる。これによって、キャッシュメンテナンス装置4は、例えば、データベースサーバのCPU資源に余裕があるときにメンテナンスの頻度を低下させてCPU資源を節約するといった事態を防止し、データベース4Bにパフォーマンスを十分に発揮させることができる。
As described above, the
なお、キャッシュメンテナンス装置4は、第1実施形態と同様の手法でメンテナンス条件を設定することとして説明したが、これに限定されない。キャッシュメンテナンス装置4は、第3実施形態と同様に、目標負荷を達成するまで、負荷条件が負荷されたメンテナンス条件を生成することとしても良い。この場合、キャッシュメンテナンス装置4は、メンテナンス回数が大きい順に、又は、参照回数が小さい順にメンテナンス条件を生成することとしても良い。
Although the
以下、本発明の実施例について説明する(適宜図8,図9参照)。ここでは、図8で示したキャッシュメンテナンスシステム200を以下の環境で実装し、このときのキャッシュメンテナンス装置2の検証結果を示して説明する。
Examples of the present invention will be described below (see FIGS. 8 and 9 as appropriate). Here, the
本実施では、アプリケーションサーバは、下記のサーバ1台で構成した。
CPU :Xeon(登録商標) X5470 3.3GHz×1
メモリ :32Gバイト
ハードディスク :1.5Tバイト(RAID10)
ミドルウェア :ruby1.8.5,MySQL5.0
In this embodiment, the application server is configured by one server described below.
CPU: Xeon (registered trademark) X5470 3.3 GHz × 1
Memory: 32GB Hard disk: 1.5TB (RAID10)
Middleware: ruby 1.8.5, MySQL5.0
また、本実施では、データベースサーバ2Bは、下記のサーバ1台で構成した。
CPU :Xeon(登録商標) X5355 2.66GHz×2
メモリ :16Gバイト
ハードディスク :1.5Tバイト(RAID10)
ミドルウェア :MySQL5.0,libmemcached0.23
In this embodiment, the database server 2B is composed of one server as described below.
CPU: Xeon (registered trademark) X5355 2.66 GHz × 2
Memory: 16 Gbytes Hard disk: 1.5 Tbytes (RAID10)
Middleware: MySQL5.0, libmcached0.23
また、本実施では、キャッシュ2Cは、下記のサーバ10台で構成した。
CPU :Celeron(登録商標) X430 1.8GHz×1
メモリ :2Gバイト
ハードディスク :500Gバイト
ミドルウェア :memcached1.2.6
In this embodiment, the cache 2C is composed of the following 10 servers.
CPU: Celeron (registered trademark) X430 1.8 GHz × 1
Memory: 2 GB Hard disk: 500 GB Middleware: memcached 1.2.6
また、本実施では、ミニブログサービスである「gooひとこと」を対象としてクローリングを行い、ユーザ同士の友好関係の情報(「follower」テーブル)と、各ユーザが投稿したメッセージの情報(「message」テーブル)とを取得し、これらをサンプルデータとしてデータベース2Bに格納した。このサンプルデータの詳細を下記に示す。
「message」テーブル :1128300件
「follower」テーブル:70803件
有効ユーザ数 :16596人
対象期間 :2008年5月〜11月
Also, in this embodiment, crawling is performed for the “blog” that is a mini blog service, information on friendship between users (“follower” table), and information on messages posted by each user (“message” table) ) And stored as sample data in the database 2B. Details of this sample data are shown below.
“Message” table: 1128300 “follower” table: 70803 Effective number of users: 16596 Target period: May to November 2008
そして、前記したデータの一部をデータベース2Bに登録(INSERT)する問い合わせを、2分間、高負荷となるように行い、このときの更新スループットの限界値を測定した。なお、許容遅延回数を10回に設定したものを実施例1とする。また、同一条件にて、従来技術(常時メンテナンス方式)による更新スループットの限界値も合わせて測定した。これを比較例1とする。 Then, an inquiry for registering (INSERT) a part of the above-described data in the database 2B was performed at a high load for 2 minutes, and the limit value of the update throughput at this time was measured. A case where the allowable number of delays is set to 10 is referred to as Example 1. In addition, under the same conditions, the limit value of the update throughput according to the conventional technique (always maintenance method) was also measured. This is referred to as Comparative Example 1.
以下に、実施例1,2及び比較例1の更新スループットの限界値を示す。なお、この更新スループットの限界値は、数値が高いほど、メンテナンスコストが小さいことを示す。
実施例1:213.4件/秒
比較例1: 89.6件/秒
The limit values of the update throughput of Examples 1 and 2 and Comparative Example 1 are shown below. The limit value of the update throughput indicates that the higher the numerical value, the lower the maintenance cost.
Example 1: 213.4 cases / second Comparative Example 1: 89.6 cases / second
前記した測定結果から、比較例1での更新スループットの限界値が89.6件/秒であるのに対し、実施例1の更新スループットの限界値は213.4件/秒となっており、更新スループットの限界値が向上してメンテナンスコストが低減されていることがわかる。 From the above measurement results, the limit value of the update throughput in Comparative Example 1 is 89.6 cases / second, whereas the limit value of the update throughput of Example 1 is 213.4 cases / second, It can be seen that the limit value of the update throughput is improved and the maintenance cost is reduced.
また、キャッシュメンテナンスシステム200において、許容遅延回数を徐々に増加させたものを実施例2として説明する。そして、実施例2における許容遅延回数と更新スループットの限界値との関係を測定し、この結果を図23に示す。なお、図23では、横軸が許容遅延回数であり、縦軸が更新スループットの限界値である。
In the
図23の結果から、実施例2では、許容遅延回数を増加させる程、更新スループットの限界値が向上することがわかる。ここで、比較例1と対して、実施例2は、更新スループットの限界値が最大で27倍となる。つまり、本発明に係るキャッシュメンテナンス装置2は、許容遅延回数を多くする程、メンテナンスコストを低減できることがわかる。
From the results of FIG. 23, it can be seen that in Example 2, the limit value of the update throughput is improved as the allowable number of delays is increased. Here, in comparison with Comparative Example 1, in Example 2, the limit value of the update throughput is 27 times at the maximum. That is, it can be seen that the
なお、図23において、許容遅延回数が1回の場合(図23の左端)、実施例2が、比較例1と略同等の測定結果となる点について補足する。実施例2では、許容遅延回数が1回の場合、比較例1と同じ頻度でメンテナンスを行うことになるのに加え、メンテナンス判定のコストが別途発生する。このため、図23の左端に示すように、実施例2と比較例1との測定結果が略同等になると考えられる。 In FIG. 23, when the allowable number of delays is 1 (the left end of FIG. 23), a supplementary explanation will be made on the point that Example 2 gives a measurement result substantially equivalent to Comparative Example 1. In the second embodiment, when the allowable number of delays is one, maintenance is performed at the same frequency as in the first comparative example, and in addition, a maintenance determination cost is additionally generated. For this reason, as shown in the left end of FIG. 23, it is thought that the measurement result of Example 2 and Comparative Example 1 becomes substantially equivalent.
・ キャッシュメンテナンス装置
1B,2B,3B,4B データベース
1C,2C,3C,4C キャッシュ
1CE,2CE,3CE,4CE キャッシュエントリ
11,13,14 更新情報記憶部
21,22,23,24 メンテナンス条件記憶部
31,32,33,34 メンテナンス条件生成部
41,43,44 メンテナンス対象選択部
51,52,53,54 メンテナンス判定部
61,63,64 キャッシュメンテナンス部
62 キャッシュ差分メンテナンス部(キャッシュメンテナンス部)
73 統計情報算出部
84 データベース負荷測定部
100,200,300,400 キャッシュメンテナンスシステム
73 Statistical
Claims (9)
前記キャッシュエントリをメンテナンスする条件であるメンテナンス条件を記憶するメンテナンス条件記憶部と、
前記メンテナンス条件記憶部に記憶したメンテナンス条件を参照し、前記メンテナンス条件を満たすときにメンテナンス可能と判定するメンテナンス判定部と、
前記メンテナンス判定部がメンテナンス可能と判定した場合、前記キャッシュエントリをメンテナンスするキャッシュメンテナンス部と、
を備えることを特徴とするキャッシュメンテナンス装置。 In a cache maintenance device for maintaining a cache entry as a unit for storing the data in the cache in a distributed memory cache that stores data from a database in a cache constituted by one or more computer memories,
A maintenance condition storage unit that stores a maintenance condition that is a condition for maintaining the cache entry;
A maintenance determination unit that refers to the maintenance condition stored in the maintenance condition storage unit and determines that maintenance is possible when the maintenance condition is satisfied;
A cache maintenance unit that maintains the cache entry when the maintenance determination unit determines that maintenance is possible;
A cache maintenance device comprising:
予め設定された許容遅延回数及び許容遅延時間の少なくとも一方が入力され、当該入力に基づいて、前記メンテナンス条件を生成して前記メンテナンス条件記憶部に書き込むメンテナンス条件生成部と、をさらに備え、
前記メンテナンス条件生成部は、
前記許容遅延回数のみが入力された場合、前記更新回数が前記許容遅延回数を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、
前記許容遅延時間のみが入力された場合、前回の前記メンテナンス時刻から現在時刻までを示す経過時間が前記許容遅延時間を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、
前記許容遅延回数と前記許容遅延時間とが入力された場合、前記更新回数が前記許容遅延回数を超えたとき又は前記経過時間が前記許容遅延時間を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成することを特徴とする請求項1に記載のキャッシュメンテナンス装置。 An update information storage unit that stores update information including at least one of a previous maintenance time and an update count indicating the number of times the data has been updated since the previous maintenance time;
A maintenance condition generation unit that receives at least one of a preset allowable delay number and an allowable delay time, generates the maintenance condition based on the input, and writes the maintenance condition in the maintenance condition storage unit; and
The maintenance condition generation unit
When only the allowable delay count is input, the maintenance condition that enables the maintenance when the update count exceeds the allowable delay count is generated,
When only the allowable delay time is input, the maintenance condition that enables the maintenance when the elapsed time indicating the previous maintenance time to the current time exceeds the allowable delay time is generated,
When the allowable delay count and the allowable delay time are input, the maintenance condition that enables the maintenance when the update count exceeds the allowable delay count or when the elapsed time exceeds the allowable delay time The cache maintenance device according to claim 1, wherein:
前記メンテナンス条件生成部は、
前記許容遅延回数のみが入力された場合、更新回数が前記許容遅延回数を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、
前記許容遅延時間のみが入力された場合、経過時間が前記許容遅延時間を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、
前記許容遅延回数と前記許容遅延時間とが入力された場合、前記更新回数が前記許容遅延回数を超えたとき又は前記経過時間が前記許容遅延時間を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、
前記メンテナンス判定部は、
前記データベースのテーブルにおける差分データを格納した差分テーブルを参照し、当該差分テーブルのデータ件数を前記更新回数として算出すると共に、当該差分テーブルにおける最も古いデータを格納した時刻から現在時刻までを前記経過時間として算出し、算出した前記更新回数と前記経過時間とを用いて前記メンテナンス条件を満たすか判定し、
前記キャッシュメンテナンス部は、
前記差分テーブルに格納した前記差分データで前記キャッシュエントリを一括して更新すると共に、更新した前記差分データを前記差分テーブルから削除することを特徴とする請求項1に記載のキャッシュメンテナンス装置。 A maintenance condition generation unit that receives at least one of a preset allowable delay number and an allowable delay time, generates the maintenance condition based on the input, and writes the maintenance condition in the maintenance condition storage unit;
The maintenance condition generation unit
When only the allowable delay count is input, the maintenance condition that enables the maintenance when the update count exceeds the allowable delay count is generated,
When only the allowable delay time is input, the maintenance condition that enables the maintenance when an elapsed time exceeds the allowable delay time is generated,
When the allowable delay count and the allowable delay time are input, the maintenance condition that enables the maintenance when the update count exceeds the allowable delay count or when the elapsed time exceeds the allowable delay time Produces
The maintenance determination unit
The difference table storing the difference data in the database table is referred to, the number of data items in the difference table is calculated as the update count, and the elapsed time from the time when the oldest data is stored in the difference table to the current time is calculated. To determine whether the maintenance condition is satisfied using the calculated number of updates and the elapsed time,
The cache maintenance unit
The cache maintenance device according to claim 1, wherein the cache entry is updated collectively with the difference data stored in the difference table, and the updated difference data is deleted from the difference table.
予め設定された許容遅延回数及び許容遅延時間の少なくとも一方と、メンテナンスコストの目標負荷値とが入力され、当該入力に基づいて、前記キャッシュエントリ毎に前記メンテナンス条件を生成して前記メンテナンス条件記憶部に書き込むメンテナンス条件生成部と、
予め設定された統計期間における前記キャッシュエントリをメンテナンスした回数を示すメンテナンス回数の累積値を統計情報として算出する統計情報算出部と、をさらに備え、
前記メンテナンス条件生成部は、
前記メンテナンス回数の累積値に前記目標負荷値を乗じて削減目標値を算出し、
前記許容遅延回数のみが入力された場合、前記更新回数が前記許容遅延回数を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、式(1)で算出した削減値を前記削減目標値から減算し、
前記許容遅延時間のみが入力された場合、前回の前記メンテナンス時刻から現在時刻までを示す経過時間が前記許容遅延時間を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、式(2)で算出した削減値を前記削減目標値から減算し、
前記許容遅延回数と前記許容遅延時間とが入力された場合、前記更新回数が前記許容遅延回数を超えたとき又は前記経過時間が前記許容遅延時間を超えたときに前記メンテナンス可能となる前記メンテナンス条件を生成し、式(3)で算出した削減値を前記削減目標値から減算し、
前記削減目標値から前記削減値を減算した値が0以下になったときは、前記メンテナンス条件の生成を終了することを特徴とする請求項1に記載のキャッシュメンテナンス装置。
A=Mi×(N−1)/N・・・式(1)
A=Mi×(1−T/S)・・・式(2)
A=MIN[{Mi×(N−1)/N},{Mi×(1−T/S)}]・・・式(3)
但し、式(1)〜式(3)において、Aは削減値、Miはメンテナンス回数の累積値、Nは許容遅延回数、Tは許容遅延時間、及び、Sは統計期間である。 An update information storage unit that stores update information including at least one of a previous maintenance time and an update count indicating the number of times the data has been updated since the previous maintenance time;
At least one of an allowable delay number and an allowable delay time set in advance and a target load value of maintenance cost are input, and based on the input, the maintenance condition is generated for each cache entry, and the maintenance condition storage unit A maintenance condition generation unit to write to,
A statistical information calculation unit that calculates, as statistical information, a cumulative value of maintenance counts indicating the number of times that the cache entry has been maintained in a preset statistical period;
The maintenance condition generation unit
Multiplying the cumulative value of the maintenance times by the target load value to calculate a reduction target value,
When only the allowable delay count is input, the maintenance condition that enables the maintenance when the update count exceeds the allowable delay count is generated, and the reduction value calculated by Expression (1) is set as the reduction target value. Subtract from
When only the allowable delay time is input, the maintenance condition that enables the maintenance when the elapsed time from the previous maintenance time to the current time exceeds the allowable delay time is generated, and Expression (2) Subtract the reduction value calculated in step 1 from the reduction target value,
When the allowable delay count and the allowable delay time are input, the maintenance condition that enables the maintenance when the update count exceeds the allowable delay count or when the elapsed time exceeds the allowable delay time And subtracting the reduction value calculated by Equation (3) from the reduction target value,
2. The cache maintenance device according to claim 1, wherein when the value obtained by subtracting the reduction value from the reduction target value becomes 0 or less, the generation of the maintenance condition is terminated.
A = Mi × (N−1) / N (1)
A = Mi × (1−T / S) (2)
A = MIN [{Mi × (N−1) / N}, {Mi × (1-T / S)}] (3)
In Equations (1) to (3), A is a reduction value, Mi is a cumulative value of the number of maintenance times, N is an allowable delay number, T is an allowable delay time, and S is a statistical period.
前記メンテナンス条件生成部は、前記メンテナンス条件を生成しておらず、かつ、前記参照回数の累積値が最小となる前記キャッシュエントリについて、前記メンテナンス条件を生成することを特徴とする請求項4に記載のキャッシュメンテナンス装置。 The statistical information calculation unit calculates, as the statistical information, a cumulative value of the number of times the cache entry is referenced in the statistical period,
5. The maintenance condition generation unit according to claim 4, wherein the maintenance condition generation unit generates the maintenance condition for the cache entry in which the maintenance condition is not generated and the cumulative value of the reference count is minimized. Cash maintenance equipment.
予め設定された許容遅延回数及び許容遅延時間の少なくとも一方が入力され、当該入力に基づいて、前記メンテナンス条件を生成して前記メンテナンス条件記憶部に書き込むメンテナンス条件生成部と、
前記データベースの負荷を示す負荷値を測定するデータベース負荷測定部と、をさらに備え、
前記メンテナンス条件生成部は、
前記許容遅延回数のみが入力された場合、前記更新回数が前記許容遅延回数を超え、かつ、前記負荷値が予め設定された負荷条件を満たすときに前記メンテナンス可能となる前記メンテナンス条件を生成し、
前記許容遅延時間のみが入力された場合、前回の前記メンテナンス時刻から現在時刻までを示す経過時間が前記許容遅延時間を超え、かつ、前記負荷値が前記負荷条件を満たすときに前記メンテナンス可能となる前記メンテナンス条件を生成し、
前記許容遅延回数と前記許容遅延時間とが入力された場合、前記更新回数が前記許容遅延回数を超え又は前記経過時間が前記許容遅延時間を超え、かつ、前記負荷値が前記負荷条件を満たすときに前記メンテナンス可能となる前記メンテナンス条件を生成することを特徴とする請求項1に記載のキャッシュメンテナンス装置。 An update information storage unit that stores update information including at least one of a previous maintenance time and an update count indicating the number of times the data has been updated since the previous maintenance time;
A maintenance condition generation unit that receives at least one of a preset allowable delay number and an allowable delay time, generates the maintenance condition based on the input, and writes the maintenance condition in the maintenance condition storage unit;
A database load measuring unit that measures a load value indicating the load of the database, and
The maintenance condition generation unit
When only the allowable delay number is input, the maintenance condition that enables the maintenance when the update number exceeds the allowable delay number and the load value satisfies a preset load condition is generated,
When only the allowable delay time is input, the maintenance is possible when the elapsed time from the previous maintenance time to the current time exceeds the allowable delay time and the load value satisfies the load condition. Generating the maintenance condition;
When the allowable delay count and the allowable delay time are input, the update count exceeds the allowable delay count or the elapsed time exceeds the allowable delay time, and the load value satisfies the load condition The cache maintenance apparatus according to claim 1, wherein the maintenance condition that enables the maintenance is generated.
前記キャッシュエントリをメンテナンスする条件であるメンテナンス条件を参照し、前記メンテナンス条件を満たすときにメンテナンス可能と判定するメンテナンス判定ステップと、
前記メンテナンス判定ステップでメンテナンス可能と判定した場合、前記キャッシュエントリをメンテナンスするキャッシュメンテナンスステップと、
を備えることを特徴とするキャッシュメンテナンス方法。 In a cache maintenance method for maintaining a cache entry as a unit for storing the data in the cache in a distributed memory cache that stores data from a database in a cache configured by one or more computer memories,
A maintenance determination step that refers to a maintenance condition that is a condition for maintaining the cache entry and determines that maintenance is possible when the maintenance condition is satisfied;
If it is determined that maintenance is possible in the maintenance determination step, a cache maintenance step for maintaining the cache entry;
A cache maintenance method comprising:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009041612A JP2010198258A (en) | 2009-02-25 | 2009-02-25 | Cache maintenance device, method and program thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009041612A JP2010198258A (en) | 2009-02-25 | 2009-02-25 | Cache maintenance device, method and program thereof |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2010198258A true JP2010198258A (en) | 2010-09-09 |
Family
ID=42822931
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2009041612A Pending JP2010198258A (en) | 2009-02-25 | 2009-02-25 | Cache maintenance device, method and program thereof |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2010198258A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2015097774A1 (en) * | 2013-12-25 | 2015-07-02 | 株式会社日立製作所 | Computer system and data management method |
JP2015146201A (en) * | 2010-12-20 | 2015-08-13 | セールスフォース ドット コム インコーポレイティッド | Method and system for performing cross-sectional store joint in multi-tenant store |
JP2017191600A (en) * | 2016-04-11 | 2017-10-19 | レベル スリー コミュニケーションズ,エルエルシー | Invalidation in content delivery network (cdn) |
JP2018133100A (en) * | 2010-12-30 | 2018-08-23 | フェイスブック,インク. | Distributed cache for graph data |
-
2009
- 2009-02-25 JP JP2009041612A patent/JP2010198258A/en active Pending
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2015146201A (en) * | 2010-12-20 | 2015-08-13 | セールスフォース ドット コム インコーポレイティッド | Method and system for performing cross-sectional store joint in multi-tenant store |
JP2018133100A (en) * | 2010-12-30 | 2018-08-23 | フェイスブック,インク. | Distributed cache for graph data |
WO2015097774A1 (en) * | 2013-12-25 | 2015-07-02 | 株式会社日立製作所 | Computer system and data management method |
JP6034512B2 (en) * | 2013-12-25 | 2016-11-30 | 株式会社日立製作所 | Computer system and data management method |
US9934248B2 (en) | 2013-12-25 | 2018-04-03 | Hitachi, Ltd. | Computer system and data management method |
JP2017191600A (en) * | 2016-04-11 | 2017-10-19 | レベル スリー コミュニケーションズ,エルエルシー | Invalidation in content delivery network (cdn) |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11647097B2 (en) | Providing access to managed content | |
US10803047B2 (en) | Accessing data entities | |
AU2016382908B2 (en) | Short link processing method, device and server | |
US9251210B2 (en) | Caching external data sources for SQL processing | |
US9286293B2 (en) | Populating and using caches in client-side caching | |
US10275347B2 (en) | System, method and computer program product for managing caches | |
CN105426321B (en) | Using RDMA close friend's caching method of remote location information | |
CN108055302A (en) | A kind of image cache processing method, system and server | |
US20120166419A1 (en) | Method, system and program for cache control in database | |
US10474185B2 (en) | Timestamp alignment across a plurality of computing devices | |
Ma et al. | An improved web cache replacement algorithm based on weighting and cost | |
CN105159845A (en) | Memory reading method | |
CN101404649B (en) | Data processing system based on CACHE and its method | |
JP2010198258A (en) | Cache maintenance device, method and program thereof | |
US9928174B1 (en) | Consistent caching | |
WO2022127866A1 (en) | Data processing method and apparatus, and electronic device and storage medium | |
EP3507699B1 (en) | Method and systems for master establishment using service-based statistics | |
JP2005063374A (en) | Data management method, data management device, program for the same, and recording medium | |
CN115878677B (en) | Data processing method and device for distributed multi-level cache | |
US11269784B1 (en) | System and methods for efficient caching in a distributed environment | |
CN113490933A (en) | Distributed data processing | |
US10747782B2 (en) | Efficient dual-objective cache | |
US20150100545A1 (en) | Distributed database system and a non-transitory computer readable medium | |
Ryeng et al. | Site-autonomous distributed semantic caching | |
CN113138943A (en) | Method and device for processing request |