JP2011242890A - Request processing method, request processing program and request processing apparatus - Google Patents
Request processing method, request processing program and request processing apparatus Download PDFInfo
- Publication number
- JP2011242890A JP2011242890A JP2010112505A JP2010112505A JP2011242890A JP 2011242890 A JP2011242890 A JP 2011242890A JP 2010112505 A JP2010112505 A JP 2010112505A JP 2010112505 A JP2010112505 A JP 2010112505A JP 2011242890 A JP2011242890 A JP 2011242890A
- Authority
- JP
- Japan
- Prior art keywords
- request
- memory
- maximum
- amount
- memory amount
- 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
- Memory System (AREA)
Abstract
Description
本発明は、リクエスト処理方法、リクエスト処理プログラム、および、リクエスト処理装置の技術に関する。 The present invention relates to a request processing method, a request processing program, and a request processing apparatus.
クライアント装置からネットワークを介して接続されたシステムにおいて、クライアント装置から依頼されたリクエストが、システムが供給するメモリ量の枠内で実行できないときには、そのリクエストを拒否することにより、依頼されたリクエストがシステムに流入する流量を制御する技術が、特許文献1などに開示されている。このリクエスト流量制御システムにより、受け付けたリクエストを処理する計算機のメモリ不足を防止する。
In a system connected from a client device via a network, when a request requested from the client device cannot be executed within the framework of the amount of memory supplied by the system, the requested request is rejected by rejecting the request. A technique for controlling the flow rate flowing into the air is disclosed in
リクエストを処理する計算機として、Java(登録商標)のアプリケ−ションサーバを動作させる場合、主に性能向上の理由により、同一プロセス上で複数の処理が並行して実行される。よって、既に実行中のリクエストが存在している時点で、新たなリクエストの実行が要求されることもある。既に実行中のリクエストと、新たに要求されたリクエストが、同じメモリ資源のメモリ空間を分け合うときには、すべてのリクエストが使用するメモリ空間が、メモリ資源の最大容量以内に収まっている必要がある。 When a Java (registered trademark) application server is operated as a computer for processing a request, a plurality of processes are executed in parallel on the same process mainly for reasons of performance improvement. Therefore, when there is a request that is already being executed, execution of a new request may be requested. When a request that is already being executed and a newly requested request share the memory space of the same memory resource, the memory space used by all the requests needs to be within the maximum capacity of the memory resource.
ここで、リクエストが使用するメモリ量は、時間経過によって変化(増加)することもある。例えば、所定時刻における空きメモリ量が、新たなリクエストの実行に要するメモリ量よりも大きくても、所定時刻以降に、既に実行中のリクエストが使用するメモリ量が増加することによって、新たなリクエストの実行に要するメモリ量が事後的に不足してしまう。 Here, the amount of memory used by the request may change (increase) over time. For example, even if the amount of free memory at a predetermined time is larger than the amount of memory required to execute a new request, the amount of memory used by a request that has already been executed increases after the predetermined time. The amount of memory required for execution will be insufficient afterwards.
しかし、特許文献1などの従来のリクエスト流量制御システムでは、新たなリクエストの実行可否判断が、現在の(所定時刻の)メモリ量だけを参照し、その後の使用量の増加分を考慮しておらず、前記した事後的なメモリ不足を予防することができない。
However, in a conventional request flow rate control system such as
そこで、本発明は、前記した問題を解決し、提供できる計算機資源の範囲内でリクエストを実行することで、計算機資源の不足を将来にわたって予防することを、主な目的とする。 Therefore, the main object of the present invention is to prevent the shortage of computer resources in the future by executing requests within the range of computer resources that can solve and provide the above-mentioned problems.
前記課題を解決するために、本発明は、受け付けたリクエストを実行するリクエスト処理装置であって、
リクエスト処理装置が、Java(登録商標)VM(Virtual Machine)を動作させるJavaアプリケーションサーバであり、
リクエスト処理装置が、ユーザメモリ領域とJavaVM管理領域とを記憶手段内に格納するとともに、メモリ使用量制御部を有しており、
前記ユーザメモリ領域には、リクエストを実行するためのプログラムを具現化したオブジェクトが格納されており、
前記JavaVM管理領域には、前記ユーザメモリ領域に格納される前記オブジェクトの前記オブジェクトIDと、そのオブジェクトが使用するメモリ量と、そのオブジェクトを作成したリクエストのリクエストIDとが対応づけて前記オブジェクト管理用データとして格納されるとともに、リクエストIDごとにそのリクエストを実行するために使用する最大のメモリ量が対応づけて最大サイズ管理用データとして格納されており、
前記メモリ使用量制御部が、新たに受け付けたリクエストを実行するか否かを判定するときに、
前記最大サイズ管理用データを参照して、現在実行中のリクエストの最大のメモリ量を第1メモリ量として取得し、
前記オブジェクト管理用データを参照して、現在実行中のリクエストのリクエストIDに対応する前記オブジェクトが現在使用するメモリ量を第2メモリ量として取得し、前記第2メモリ量から前記第1メモリ量を減算した値を第3メモリ量として計算し、
前記最大サイズ管理用データを参照して、前記新たに受け付けたリクエストの最大のメモリ量を第4メモリ量として取得し、
前記ユーザメモリ領域内の現在の空き容量を前記JavaVMから取得し、取得した現在の空き容量が、前記第3メモリ量と前記第4メモリ量との和よりも大きいときには、前記新たに受け付けたリクエストの実行を許可することを特徴とする。
その他の手段は、後記する。
In order to solve the above-described problem, the present invention provides a request processing device that executes a received request,
The request processing device is a Java application server that operates a Java (registered trademark) VM (Virtual Machine),
The request processing device stores the user memory area and the JavaVM management area in the storage means, and has a memory usage control unit,
The user memory area stores an object embodying a program for executing a request,
In the JavaVM management area, the object ID of the object stored in the user memory area, the amount of memory used by the object, and the request ID of the request that created the object are associated with each other for object management. Is stored as data, and the maximum memory amount used to execute the request for each request ID is stored in association with the maximum size management data,
When the memory usage control unit determines whether to execute a newly received request,
With reference to the maximum size management data, the maximum memory amount of the currently executing request is acquired as the first memory amount,
By referring to the object management data, the memory amount currently used by the object corresponding to the request ID of the currently executing request is acquired as the second memory amount, and the first memory amount is obtained from the second memory amount. Calculate the subtracted value as the third memory amount,
With reference to the maximum size management data, the maximum memory amount of the newly accepted request is acquired as the fourth memory amount,
The current free space in the user memory area is acquired from the JavaVM, and when the acquired current free space is larger than the sum of the third memory amount and the fourth memory amount, the newly accepted request It is characterized by permitting execution of.
Other means will be described later.
本発明によれば、提供できる計算機資源の範囲内でリクエストを実行することで、計算機資源の不足を将来にわたって予防することができる。 According to the present invention, a shortage of computer resources can be prevented in the future by executing a request within the range of computer resources that can be provided.
以下、本発明の一実施形態を、図面を参照して詳細に説明する。 Hereinafter, an embodiment of the present invention will be described in detail with reference to the drawings.
図1は、リクエスト処理システムの装置構成の概要を示す説明図である。リクエスト処理システムは、端末10と計算機30がネットワーク20を介して接続される。
端末10は、計算機30に指定された業務処理の実行を要求するリクエストを送信するクライアント装置である。
FIG. 1 is an explanatory diagram showing an outline of the device configuration of the request processing system. In the request processing system, the
The
計算機30(Javaアプリケーションサーバ)は、通信装置40、CPU50、入力装置60、出力装置70、補助記憶装置80および主記憶装置95を備え、バス90を介して互いに接続される。
通信装置40は、端末10に接続されるネットワーク20に接続する。
CPU50は、主記憶装置95に記憶された各種プログラムを実行することによって各種処理を実行する。
入力装置60は、計算機30に必要な情報および指示の入力に使用する。
出力装置70は、計算機30から出力される情報を表示する。
補助記憶装置80は、プログラムおよびそのプログラムの実行に必要なデータを記憶手段に格納する記憶部として構成される。最大サイズ情報ファイル122(最大サイズ管理用データ)は、補助記憶装置80に含まれる。なお、最大サイズ情報ファイル122は、例えば、手動で既に作成されたCSVファイル122bからコピーされたものである。
The computer 30 (Java application server) includes a
The
The
The
The
The
主記憶装置95は、コンテナ管理領域101、ユーザメモリ領域111、JavaVM(Virtual Machine)管理領域113を含む。
コンテナ管理領域101は、リクエスト受付部102、リクエストID採番部103、リクエスト制御部104、プログラム処理部105、メモリ使用量制御部108、コマンド受付部109、コマンド実行部110を格納する。
ユーザメモリ領域111は、プログラム処理部105を構成するプログラムによって作成されたオブジェクト112を格納する。
JavaVM管理領域113は、オブジェクト管理テーブル114(オブジェクト管理用データ)、オブジェクト管理部115、実行中リクエスト管理テーブル116、最大メモリ使用量計算部117、最大サイズ管理テーブル118、オブジェクトID採番部119、Java API(Application Program Interface)120、GC処理部121を含む。
The
The
The
The Java
リクエスト受付部102は、端末10からのリクエストを受け付け、リクエストID採番部103で一意なリクエストIDを採番し、リクエスト制御部104にリクエストのURLとリクエストIDを通知する。
The
リクエスト制御部104は、リクエスト受付部102から通知されたリクエストURLとリクエストIDを受け取り、メモリ使用量制御部108にリクエストURLを通知して、リクエストが実行可能かどうかの判断を要求する。
The
メモリ使用量制御部108は、リクエスト制御部104から通知されたリクエストの実行可否判断要求に従い、受け付けたリクエストの実行可否を、以下の(1)〜(3)の順に判断する。
(1)図7で後記する判別式(1回目の判定)に従い、受け付けたリクエストの実行可否を判定する。ここで、リクエストの実行可であると判定されたときには、その旨をリクエスト制御部104に返答する。
(2)Java API120に対してGCの実施を要求して空きメモリを増加させる。そのGCの後に、図7で後記する判別式(2回目の判定)に従い、受け付けたリクエストの実行可否を判定する。ここで、リクエストの実行可であると判定されたときには、その旨をリクエスト制御部104に返答する。
(3)空きメモリ量の不足により、受け付けたリクエストが実行不可であると、リクエスト制御部104に返答する。
そして、(1)または(2)で返答を受けたリクエスト制御部104は、コンテナ処理部106を起動させて受け付けたリクエストを実行する。一方、(3)で返答を受けたリクエスト制御部104は、リクエスト受付部102に対してリクエストの実行が許可されなかった旨を通知する。
In accordance with the request execution determination request notified from the
(1) In accordance with a discriminant described later in FIG. 7 (first determination), it is determined whether the accepted request can be executed. Here, when it is determined that the request can be executed, a message to that effect is returned to the
(2) Request the
(3) If the received request cannot be executed due to a lack of free memory, the
The
プログラム処理部105は、コンテナ処理部106とユーザ処理部107とによって構成される。
コンテナ処理部106は、リクエスト制御、トランザクション制御などを行う。コンテナ処理部106はリクエスト制御部から処理の要求を受けたときに実行中リクエスト管理テーブル116に対し、リクエストの情報を格納する。さらに、コンテナ処理部106はユーザ処理部107を実行する。ユーザ処理部107の処理の終了後、コンテナ処理部106は実行中リクエスト管理テーブル116からリクエストの情報を削除する
ユーザ処理部107は、業務処理を実行するためにユーザが作成したプログラムを実行する処理部である。また、ユーザ処理部107はオブジェクトを使用する場合には、オブジェクト管理部115にオブジェクト生成を依頼し、ユーザメモリ領域に生成されたオブジェクト112を使用する。
The
The
オブジェクト管理部115は、ユーザメモリ領域111のオブジェクト112を管理する処理部である。
オブジェクト管理部115は、ユーザ処理部107からの要求を受け付け、オブジェクトID採番部119で一意なオブジェクトIDを採番し、要求されたオブジェクト112を作成し、オブジェクト管理テーブル114にオブジェクトの情報を格納する。
また、オブジェクト管理部115は、メモリ使用量制御部108および最大メモリ使用量計算部117からリクエストIDを受けとり、リクエストが作成したオブジェクトのサイズの一覧を返却する。
さらに、オブジェクト管理部115は、GC処理部121の要求を受け付け、オブジェクト112の情報をオブジェクト管理テーブル114から削除し、オブジェクト112をユーザメモリ領域111から解放する。
The
The
Further, the
Further, the
Java API120は、Javaが提供する既存のインタフェースである。Java API120は、メモリ使用量制御部108から現在の空きメモリ使用量を取得する要求およびGCの発行要求を受ける。
The
GC処理部121は、ユーザメモリ領域111の空きメモリ領域が少なくなった場合またはJava API120からGC発行要求を受けた場合に、ユーザメモリ領域111に格納されているオブジェクト112のうち、破棄可能なオブジェクトを抽出し、オブジェクト管理部115にオブジェクトの解放を依頼する。このGC処理は、Javaに実装されている。
When the free memory area of the
最大サイズ情報ファイル122は、各URLが使用するメモリ使用量の最大サイズを格納する。具体的には、各URLへのリクエストで使用するメモリ使用量の合計、および最もメモリを使用する瞬間のメモリ使用量を、処理の開始前にユーザが格納する。最大サイズ情報ファイル122は、メモリ使用量制御部108がリクエストを受け取るたびに読み込んでも、Javaアプリケーションサーバ起動時にすべて読み込んで主記憶装置95に格納してもよい。
最大サイズ情報ファイル122の作成処理は、以下に示す(1)または(2)の2つのモードのうちのいずれか1つにより実現される。
The maximum size information file 122 stores the maximum size of memory used by each URL. Specifically, the user stores the total memory usage used in requests to each URL and the memory usage at the moment of using the most memory before starting the processing. The maximum size information file 122 may be read every time the memory
The creation processing of the maximum
(1)手動設定モードは、最大サイズ情報ファイル122のデータ内容を、管理者などによる手動設定により、明示的に指定を受けるモードである(詳細は、図7参照)。
そのため、コマンド受付部109は、管理者からのコマンドとして、「最大サイズ情報ファイル122のデータ内容を指定した作成要求」を受け付けると、コマンド実行部110に処理の制御を移す。
または、コマンド受付部109は、管理者からのコマンドとして、手動で既に作成された図1のCSVファイル122bを受け付けると、コマンド実行部110に処理の制御を移す。
コマンド実行部110は、コマンド受付部109から要求を受け取り、コマンドで指定されたデータ内容またはCSVファイル122bのデータ内容を、そのまま最大サイズ情報ファイル122として出力する。
(1) The manual setting mode is a mode in which the data content of the maximum
For this reason, when receiving a “creation request specifying the data content of the maximum size information file 122” as a command from the administrator, the
Alternatively, when the
The
(2)テストモードは、最大サイズ情報ファイル122のデータ内容を、実際にリクエストを動作させた結果の実測値を計測することにより、取得するモードである(詳細は、図8参照)。
そのため、テストモードでは、手動設定モードで必要な構成に加え、さらに、最大メモリ使用量計算部117と最大サイズ管理テーブル118とを用いる。
最大メモリ使用量計算部117は、オブジェクト112のメモリ使用量をリクエストIDごとに集計(合計)し、その結果を最大サイズ管理テーブル118に格納する。
そして、コマンド受付部109は、管理者からコマンドの要求を受け付け、コマンド実行部110に処理の制御を移す。コマンド実行部110は、コマンド受付部109から要求を受け取り、最大サイズ管理テーブル118に格納されている情報を参照し、参照した情報を整形し(表形式からCSV(Comma-Separated Values)形式へのエクスポート処理)、その結果を最大サイズ情報ファイル122に出力する。
(2) The test mode is a mode in which the data content of the maximum
Therefore, in the test mode, in addition to the configuration required in the manual setting mode, the maximum memory
The maximum memory
Then, the
なお、テストモードの動作期間は、長期間であるほど望ましい。テストモードを長期間動作させることで、メモリ使用量の最大値の更新頻度も上がるため、最大サイズ管理テーブル118に格納される最大メモリ使用量の精度も向上する。
さらに、テストモードを使用して作成した最大サイズ情報ファイル122の情報を、新規リクエストの実行可否判定だけでなく、メモリチューニングや、大量にメモリを消費するリクエストの特定などの別の用途に活用してもよい。
Note that the longer the operation period of the test mode, the better. By operating the test mode for a long period of time, the update frequency of the maximum value of the memory usage increases, so the accuracy of the maximum memory usage stored in the maximum size management table 118 is also improved.
Furthermore, the information in the maximum size information file 122 created using the test mode is used not only for determining whether or not a new request can be executed, but also for other purposes such as memory tuning and specifying requests that consume a large amount of memory. May be.
図2は、実行中リクエスト管理テーブル116の一例を示す説明図である。
リクエスト管理テーブル116は、リクエストIDフィールド201およびURLフィールド202を含む。実行中リクエスト管理テーブル116のレコードはリクエストの受付時にコンテナ処理部106によって格納され、リクエストの終了時にコンテナ処理部106に削除される。このため、実行中リクエスト管理テーブル116を参照することで実行中リクエストの一覧を取得することができる。
リクエストIDフィールド201は、端末10から受け付けたリクエストを一意に識別するリクエストIDを格納する。リクエストIDは、リクエスト受付時にリクエストID採番部103に生成される。
URLフィールド202は、端末10から受け付けたリクエストに含まれるURLを格納する。
FIG. 2 is an explanatory diagram illustrating an example of the in-execution request management table 116.
The request management table 116 includes a
The
The
図3は、オブジェクト管理テーブル114の一例を示す説明図である。オブジェクト管理テーブル114は、オブジェクトIDフィールド301、リクエストIDフィールド302、および、オブジェクトサイズフィールド303を含む。
オブジェクト管理テーブル114のレコードはオブジェクト112の作成時にオブジェクト管理部115によって格納され、オブジェクト112の解放時にオブジェクト管理部115によって削除される。オブジェクト管理テーブル114は、リクエストごとのメモリ使用量を計算するためにオブジェクト管理部115から参照される。
FIG. 3 is an explanatory diagram illustrating an example of the object management table 114. The object management table 114 includes an
Records in the object management table 114 are stored by the
オブジェクトIDフィールド301は、オブジェクト管理部115がオブジェクトを一意に識別するオブジェクトIDを格納する。オブジェクトIDは、オブジェクト管理部115の要求を受けて、オブジェクトID採番部119が生成する。
リクエストIDフィールド302は、実行中リクエスト管理テーブル116のリクエストIDフィールド201と同じである。リクエストIDフィールド302には、オブジェクトを作成したリクエストのリクエストIDが格納される
オブジェクトサイズフィールド303は、オブジェクト112が使用しているメモリ量である。オブジェクト管理テーブル114は、オブジェクト112を作成する際に確保したメモリ量を、オブジェクトサイズフィールド303に格納する。
The
The
図4は、最大サイズ管理テーブル118の一例を示す説明図である。最大サイズ管理テーブル118は、URLフィールド401、GC前最大使用量フィールド402、GC後最大使用量フィールド403を含む。
URLフィールド401は、実行中リクエスト管理テーブル116のURLフィールド202と同じである。
GC前最大使用量フィールド402、および、GC後最大使用量フィールド403は、それぞれ、リクエストの生存期間(開始時刻から終了時刻まで)において、そのリクエストが使用するメモリ使用量の最大値を格納する。
GC前最大使用量フィールド402は、GC処理部121によるGC処理が行われる前における、メモリ使用量の最大値を格納する。
GC後最大使用量フィールド403は、GC処理部121によるGC処理が行われた後における、メモリ使用量の最大値を格納する。
FIG. 4 is an explanatory diagram showing an example of the maximum size management table 118. The maximum size management table 118 includes a
The
The pre-GC
The pre-GC
The post-GC maximum
最大メモリ使用量計算部117は、リクエストの生存期間に、そのリクエストのメモリ使用量を監視し、既に最大サイズ管理テーブル118に格納されているメモリ使用量の最大値よりも、現在のメモリ使用量が上回ったときには、その上回った現在のメモリ使用量を、メモリ使用量の最大値として、GC前最大使用量フィールド402(GC処理前の場合)、または、GC後最大使用量フィールド403(GC処理後の場合)に格納する(値を更新する)。
The maximum memory
図5は、最大サイズ情報ファイル122の一例を示す説明図である。最大サイズ情報ファイル122は、URLフィールド501、GC前最大使用量フィールド502、GC後最大使用量フィールド503を含む。最大サイズ情報ファイル122は、最大サイズ管理テーブル118のデータ内容をCSV形式にしたものである。
URLフィールド501は、URLフィールド401と同じ内容である。
GC前最大使用量フィールド502は、GC前最大使用量フィールド402と同じ内容である。
GC後最大使用量フィールド503は、GC後最大使用量フィールド403と同じ内容である。
FIG. 5 is an explanatory diagram showing an example of the maximum
The
The pre-GC
The post-GC maximum
図6は、新規リクエストの実行可否判定のための判別式を示す説明図である。図6(a)および図6(b)は、それぞれ特許文献1などの比較例における判別式での問題点を説明する図であり、図6(c)は本実施形態での判別式が比較例の問題点を解決している旨を説明する図である。
FIG. 6 is an explanatory diagram showing a discriminant for determining whether a new request can be executed. 6 (a) and 6 (b) are diagrams for explaining problems in discriminants in comparative examples such as
図6(a)は、新規リクエストR3が到着した時点での、ユーザメモリ領域111内のメモリ使用状況を示す。
ユーザメモリ領域111内で、既存のリクエスト(R1,R2)が実行中であり、それぞれ現在使用量のメモリを使用している。しかし、ユーザメモリ領域111内の現在の空きメモリ量には、新規リクエストR3の現在の(実行開始時に必要な)メモリ使用量が収まる程度の充分な空きがある。
よって、比較例の以下の判別式を満たすことにより、新規リクエストR3は実行可と判定される。
(現在の空きメモリ量)=(ユーザメモリ領域111のメモリ容量)−(R1の現在使用量)−(R2の現在使用量)とすると、判別式「(R3の現在使用量)<(現在の空きメモリ量)」を満たす。
FIG. 6A shows the memory usage status in the
In the
Therefore, the new request R3 is determined to be executable by satisfying the following discriminant of the comparative example.
When (current free memory amount) = (memory capacity of the user memory area 111) − (current usage amount of R1) − (current usage amount of R2), the discriminant “(current usage amount of R3) <(current The amount of free memory) is satisfied.
図6(b)は、図6(a)の時点から、さらに時間経過したときのユーザメモリ領域111内のメモリ使用状況を示す。
既存のリクエスト(R1,R2)は、それぞれ図6(a)での現在使用量から、さらに増加分だけのメモリを追加的に使用した結果、最大使用量分のメモリを使用する。そのため、図6(b)の時点では、図6(a)の時点よりも、メモリ使用量の増加分だけ現在の空きメモリ量が減少している。その結果、新規リクエストR3の使用可能なメモリ量が減少してしまい、図6(a)で実行可とされたにもかかわらず、事後的にメモリ不足に陥ってしまう。
FIG. 6B shows a memory usage state in the
The existing requests (R1, R2) use the memory corresponding to the maximum usage amount as a result of additionally using the additional amount of memory from the current usage amount in FIG. 6A. Therefore, at the time shown in FIG. 6B, the current free memory amount is reduced by an increase in the memory usage compared to the time shown in FIG. As a result, the amount of memory that can be used for the new request R3 is reduced, and the memory becomes short afterwards even though it can be executed in FIG.
図6(c)は、図6(a)の時点での本実施形態の判別式の処理内容を示す。図6(a)では、既存のリクエスト(R1,R2)の現在使用量を参照していたが、図6(c)では、現在使用量に加えて、既存のリクエスト(R1,R2)の最大使用量を、あらかじめ登録された値として記憶手段から読み取る。そして、以下の判別式を満たすか否かを判定する。
(R3の最大使用量)<(今後も利用可能な空きメモリ量)
この判別式は、(今後も利用可能な空きメモリ量)=(現在の空きメモリ量)−(R1の増加分)−(R2の増加分)であるため、以下の判別式と等価である。
(R1の増加分)+(R2の増加分)+(R3の最大使用量)<(現在の空きメモリ量)
今回の例では、(R1の増加分)+(R2の増加分)が大きいため、(今後も利用可能な空きメモリ量)が少ないので、この判別式を満たさないと判定される。つまり、図6(c)の判別式は、図6(a)の判別式と異なり、現在のメモリ量(現在使用量、空きメモリ量)だけでなく、将来の(最大の)メモリ使用量をも参照することにより、事後的にメモリ不足に陥ってしまうことを抑制できる。
FIG. 6C shows the processing content of the discriminant of the present embodiment at the time of FIG. In FIG. 6A, the current usage of the existing request (R1, R2) was referred to. In FIG. 6C, in addition to the current usage, the maximum of the existing request (R1, R2) The usage amount is read from the storage means as a value registered in advance. Then, it is determined whether or not the following discriminant is satisfied.
(Maximum usage of R3) <(Available free memory in the future)
This discriminant is equivalent to the following discriminant because (the amount of free memory that can be used in the future) = (current amount of free memory) − (increase in R1) − (increase in R2).
(Increase amount of R1) + (Increase amount of R2) + (Maximum usage amount of R3) <(Current free memory amount)
In this example, since (the increase in R1) + (the increase in R2) is large, (the amount of free memory that can be used in the future) is small, so it is determined that this discriminant is not satisfied. That is, the discriminant of FIG. 6C differs from the discriminant of FIG. 6A in that not only the current memory amount (current use amount, free memory amount) but also the future (maximum) memory use amount. By referring to the above, it is possible to suppress a memory shortage afterwards.
以上、図6で示した判別式は、以下に示すように、一般化できる。 As described above, the discriminant shown in FIG. 6 can be generalized as shown below.
図6(a)の判別式は、以下の通りである。
(DRC)+(DNC)<(RS)
ここで、DRC(Demand Running Current)は、実行中(Running)のリクエストR1,R2の現在(Current)のメモリ使用量(Demand)の合計を示す。
DNC(Demand New Current)は、新規の(New)リクエストR3の現在(Current)のメモリ使用量(Demand)を示す。
RS(Resource Supply)は、ユーザメモリ領域111が提供するメモリ資源(Resource)の供給量(Supply)を示す。
The discriminant of FIG. 6A is as follows.
(DRC) + (DNC) <(RS)
Here, DRC (Demand Running Current) indicates the total of the current (Current) memory usage (Demand) of the running requests R1 and R2.
DNC (Demand New Current) indicates the current (Current) memory usage (Demand) of the new (New) request R3.
RS (Resource Supply) indicates the supply amount (Supply) of the memory resource (Resource) provided by the
図6(b)の状況は、以下の式で表現される。
(DRM)+(DNM)>(RS)
ここで、DRM(Demand Running Maximum)は、実行中(Running)のリクエストR1,R2の最大(Maximum)のメモリ使用量(Demand)の合計を示す。
DNM(Demand New Maximum)は、新規の(New)リクエストR3の最大(Maximum)のメモリ使用量(Demand)を示す。
The situation in FIG. 6B is expressed by the following equation.
(DRM) + (DNM)> (RS)
Here, DRM (Demand Running Maximum) indicates the sum of the maximum (Maximum) memory usage (Demand) of the running requests (R1, R2).
DNM (Demand New Maximum) indicates the maximum memory usage (Demand) of the new (New) request R3.
図6(c)の判別式は、以下の通りである。
(DRM)+(DNM)<(RS)
ここで、DRI(Demand Running Increase)は、実行中(Running)のリクエストR1,R2の増加分(Increase)のメモリ使用量(Demand)の合計を示す。(DRM)=(DRC+DRI)により、図6(c)の判別式は、以下のように式変形できる。これらの式変形における各式は内容が等価であるので、式変形における各式のうちのどの式を判別式に用いてもよい。
(DRM)+(DNM)<(RS)
(DRC+DRI)+(DNM)<(RS)
(DRI)+(DNM)<(RS)−(DRC)
(DRI)+(DNM)<(RSC)
ここで、RSC(Resource Supply Current)は、現在(Current)の空きメモリ量(Resource Supply)であり、「(RS)−(DRC)」と等価である。
The discriminant of FIG. 6C is as follows.
(DRM) + (DNM) <(RS)
Here, DRI (Demand Running Increase) indicates the total amount of memory usage (Demand) of the increments (Increase) of the requests R1 and R2 being executed (Running). By (DRM) = (DRC + DRI), the discriminant of FIG. 6C can be transformed as follows. Since the expressions in these expression modifications are equivalent in content, any of the expressions in the expression modification may be used as a discriminant.
(DRM) + (DNM) <(RS)
(DRC + DRI) + (DNM) <(RS)
(DRI) + (DNM) <(RS)-(DRC)
(DRI) + (DNM) <(RSC)
Here, RSC (Resource Supply Current) is the current (Current) free memory amount (Resource Supply) and is equivalent to “(RS) − (DRC)”.
さらに、以下に示すように、判別式に用いられる各パラメータを取得することができる。
DRC(第1メモリ量)は、実行中のリクエストのリクエストIDをリクエストIDフィールド201から取得し、そのリクエストIDをリクエストIDフィールド302から検索し、検索されたレコードのオブジェクトサイズフィールド303をリクエストIDごとに合計することによって、計算できる。
DRM(第2メモリ量)は、実行中のリクエストのURLをURLフィールド202から取得し、そのURLをURLフィールド401(=URLフィールド501)から検索し、検索されたレコードのGC前最大使用量フィールド402(=GC前最大使用量フィールド502)、および、GC後最大使用量フィールド403(=GC後最大使用量フィールド503)の値として、取得できる。
DRI(第3メモリ量)は、「DRM−DRC」で計算できる。
Furthermore, as shown below, each parameter used in the discriminant can be acquired.
The DRC (first memory amount) acquires the request ID of the request being executed from the
The DRM (second memory amount) acquires the URL of the request being executed from the
The DRI (third memory amount) can be calculated by “DRM-DRC”.
DNM(第4メモリ量)は、新規に到着したリクエストのURLをURLフィールド401(=URLフィールド501)から検索し、検索されたレコードのGC前最大使用量フィールド402(=GC前最大使用量フィールド502)、および、GC後最大使用量フィールド403(=GC後最大使用量フィールド503)の値として、取得できる。
RSは、ユーザメモリ領域111として利用可能なメモリ容量の最大値であり、例えば、Java API120を介して取得される。なお、ユーザメモリ領域111は、Javaでそのメモリ容量の上限を設定可能であり、例えば、OS(Operating System)上で利用可能な4GBのメモリの内の0.5GBが、上限として設定される。そのときは、オブジェクト112のデータ量の総和が0.5GB以内の範囲内で、オブジェクト112をユーザメモリ領域111に配置することができる。一方、OS上の利用可能なメモリ容量と、ユーザメモリ領域111の利用可能なメモリ容量とが同じときには、OSのシステムコールを介して取得したOS上の利用可能なメモリ容量を、ユーザメモリ領域111の利用可能なメモリ容量としてもよい。
RSCは、RSのうちの現在の空きメモリであり、Java API120を介して、取得される。
The DNM (fourth memory amount) searches the URL field 401 (= URL field 501) for the URL of the newly arrived request, and the pre-GC maximum usage field 402 (= pre-GC maximum usage field) of the retrieved record. 502) and the post-GC maximum use amount field 403 (= the post-GC maximum use amount field 503).
The RS is a maximum value of the memory capacity that can be used as the
The RSC is the current free memory of the RS, and is acquired via the
図7は、手動設定モードにおける構成要素間のメッセージの流れを示す説明図である。 FIG. 7 is an explanatory diagram showing the flow of messages between components in the manual setting mode.
m1において、リクエスト受付部102は、端末10からの新規リクエストを受け付ける。
m2において、リクエスト受付部102は、リクエストID採番部103に対して、m1で受けた新規リクエストを一意に識別するリクエストIDの生成を要求する。リクエストID採番部103は、一意に識別するIDを生成して、リクエスト受付部102に生成した値を返却する。
m3において、リクエスト受付部102は、m1で受けた新規リクエストについての、リクエストIDとリクエストのURLとを、リクエスト制御部104に通知する。
In m1, the
In m2, the
At m3, the
m4において、リクエスト制御部104は、m3で受信したリクエストのURLを、メモリ使用量制御部108に通知する。
m5において、メモリ使用量制御部108は、実行中リクエスト管理テーブル116を参照して、現在実行されているリクエストの一覧をリクエストIDのリストとして取得する。例えば、図2でいうと、「1」、「2」、「3」、「4」というリクエストIDと、それぞれのURLが取得される。
m6において、メモリ使用量制御部108は、m5で取得したリクエストIDをオブジェクト管理部115に通知する。
At m4, the
In m5, the memory
In m6, the memory
m7において、オブジェクト管理部115は、m6で受信したリクエストIDそれぞれについて、そのリクエストIDが作成したオブジェクトの一覧を、オブジェクト管理テーブル114を参照して取得する。そして、オブジェクト管理部115は、リクエストIDごとに取得したすべてのオブジェクトのメモリ使用量の合計を算出し、その合計をメモリ使用量制御部108に返却する。メモリ使用量制御部108は、現在実行中のすべてのリクエストのメモリ使用量(オブジェクト管理部115から返却されたメモリ使用量)を合計することで、DRCを算出する。
In m7, the
例えば、オブジェクト管理部115は、リクエストID「1」を受け取った場合、オブジェクト管理テーブル114のリクエストIDフィールド302の値が「1」になっているレコード311とレコード312とを取得し、その各レコードのオブジェクトサイズ303の和(9034+883=9917(bytes))を、リクエストID「1」のDRC成分としてメモリ使用量制御部108に返却する。同様に、オブジェクト管理部115は、リクエストID「2」のDRC成分「129(bytes)」と、リクエストID「4」のDRC成分「2009(bytes)」とを求め、メモリ使用量制御部108に返却する。メモリ使用量制御部108は、これらのDRC成分の和(9917+129+2009=12055(bytes))を、DRCとして算出する。
For example, when the
m8において、メモリ使用量制御部108は、m5で取得した現在実行されているリクエストについて、最大サイズ情報ファイル122のGC前最大使用量フィールド502、または、GC後最大使用量フィールド503を参照することにより、参照した最大使用量をDRMとして取得する。これにより、DRI=DRM−DRCが計算できる。
At m8, the memory
例えば、現在実行されているリクエスト「1」のURLフィールド202「/example/index.jsp」と一致するURLフィールド501のレコード511を求め、そのレコード511のGC前最大使用量502「20034(byte)」と、GC後最大使用量503「10028(byte)」とを、リクエスト「1」のDRM成分として取得する。
同様に、他のリクエスト「2,3,4」についても、URLフィールド202からURLフィールド501を検索することにより、対応するGC前最大使用量502とGC後最大使用量503とを、リクエストごとのDRM成分として取得する。
For example, a
Similarly, by searching the
さらに、DRMは、各リクエストのDRM成分の和によって、計算される。
GC前のDRMは、リクエスト「1」のDRM成分(20034)+リクエスト「2」のDRM成分(8099012)+リクエスト「3」のDRM成分(20034)+リクエスト「4」のDRM成分(4098)=8143178(byte)である。
GC後のDRMは、リクエスト「1」のDRM成分(10028)+リクエスト「2」のDRM成分(51582)+リクエスト「3」のDRM成分(10028)+リクエスト「4」のDRM成分(3100)=74738(byte)である。
Furthermore, the DRM is calculated by the sum of the DRM components of each request.
The DRM before GC is: DRM component (20034) of request “1” + DRM component (8099012) of request “2” + DRM component (20034) of request “3” + DRM component (4098) of request “4” = 8143178 (bytes).
The DRM after GC is: DRM component (10028) of request “1” + DRM component (51582) of request “2” + DRM component (10028) of request “3” + DRM component (3100) of request “4” = It is 74738 (byte).
さらに、メモリ使用量制御部108は、m4で通知された新規リクエストのURLをもとに、最大サイズ情報ファイル122のGC前最大使用量フィールド502、または、GC後最大使用量フィールド503を参照することにより、参照した最大使用量をDNMとして取得する。
Further, the memory
m9において、メモリ使用量制御部108は、Java API120を使用して、現在の空きメモリ量をRSCとして取得する。そして、メモリ使用量制御部108は、図6(c)の説明で示した判別式「(DRI)+(DNM)<(RSC)」をもとに、新規リクエストが実行可能かどうか判断する。この判別式の1回目の判定処理では、判別式のDNMとして、GC前最大使用量フィールド502を使用する。
メモリ使用量制御部108は、リクエスト実行可能と判断した場合、リクエスト制御部104にリクエストを実行するよう通知する。
In m9, the memory
When determining that the request can be executed, the memory
一方、メモリ使用量制御部108は、リクエスト実行可能と判断した場合、GC処理によって、RSCを増加させることで、判別式の2回目の判定処理を行う。
m10aにおいて、メモリ使用量制御部108は、空きメモリを増やすために、Java API120にGCの発行を要求する。
m10bにおいて、メモリ使用量制御部108は、オブジェクト管理部115を介して、オブジェクト管理テーブル114から、GC発行後で更新されたDRCを取得する。これにより、DRI=DRM−DRCを更新する。
m10cにおいて、メモリ使用量制御部108は、Java API120を使用して、GC発行後で更新されたRSCを取得する。
そして、メモリ使用量制御部108は、判別式「(DRI)+(DNM)<(RSC)」をもとに、新規リクエストが実行可能かどうか判断する。この判別式の2回目の判定処理では、判別式のDNMとして、GC後最大使用量フィールド503を使用するとともに、m10aで更新されたDRIと、m10cで更新されたRSCとを使用する。
メモリ使用量制御部108は、リクエスト実行可能と判断した場合、リクエスト制御部104にリクエストを実行するよう通知する。2回目の判定処理も満たさなかったときには、リクエスト制御部104は、メモリ使用量制御部108からリクエスト実行不可能という通知が返却され、リクエスト受付部102を介して端末10にリソース不足によるエラーを通知する。
On the other hand, if the memory
In m10a, the memory
In m10b, the memory
In m10c, the memory
Then, the memory
When determining that the request can be executed, the memory
m11において、1回目または2回目の判定処理のいずれかを満たすときには、リクエスト制御部104は、新規リクエストのリクエストIDとリクエストURLとをプログラム処理部105に通知し、コンテナ処理部106に制御を移す。
m12において、コンテナ処理部106は、m11で受け取ったリクエストIDとリクエストURLとを、実行中リクエスト管理テーブル116に格納する。例えば、m1において、リクエスト受付部102が受け付けたリクエストのURLが「/example/index.jsp」、m2で生成されたリクエストIDを「1」とすると、図2のレコード211のように格納する。そして、コンテナ処理部106は、ユーザ処理部107に制御を移す。
When either the first determination process or the second determination process is satisfied at m11, the
In m12, the
m13において、ユーザ処理部107は、オブジェクトを生成する場合、オブジェクト管理部115に対して、新規リクエストのリクエストIDと、そのリクエストが使用するオブジェクトの作成要求を通知する。
m14において、オブジェクト管理部115は、オブジェクトID採番部119で一意なオブジェクトIDを、m13で受信した作成要求のオブジェクト用に採番する。
m15において、オブジェクト管理部115は、ユーザメモリ領域111内に、オブジェクト112を作成する。
m16において、オブジェクト管理部115は、m15のオブジェクトIDのメモリ使用量と、m13のリクエストIDとを対応づけて、オブジェクト管理テーブル114に格納する。例えば、オブジェクト管理部115は、m13のリクエストID「1」と、m15のオブジェクトID「2」、そのオブジェクトID「2」のメモリ使用量「883(bytes)」とを対応づけて、レコード312として格納する。
m17において、オブジェクト管理部115は、作成したオブジェクト112への参照をユーザ処理部107に返却し、ユーザ処理部107がオブジェクト112を使用する。
In m13, when generating the object, the
In m14, the
In m15, the
At m16, the
In m17, the
m18において、ユーザ処理部107によるリクエストの処理が終了したら、コンテナ処理部106は、実行中リクエスト管理テーブル116から終了したリクエストについての情報を削除する。例えば、m12で登録したリクエストIDが「1」である図2のレコード211を、削除する。そして、コンテナ処理部106は、リクエスト受付部102を介して端末10にレスポンスを返却する。
In m18, when the processing of the request by the
さらに、以下に示す処理により、終了したリクエストが使用していたオブジェクトをGC処理により解放することで、新規リクエストを受け付けやすくする。
m19において、オブジェクト管理部115は、GC処理部121からオブジェクト解放要求を受け付ける。
m20において、オブジェクト管理部115は、オブジェクト112をユーザメモリ領域111から解放(削除)する。
m21において、オブジェクト管理部115は、オブジェクト管理テーブル114からm20のオブジェクト112の情報を削除する。
Furthermore, by the process shown below, the object used by the completed request is released by the GC process, thereby making it easy to accept a new request.
In m19, the
At m20, the
In m21, the
図8は、テストモードにおける構成要素間のメッセージの流れを示す説明図である。 FIG. 8 is an explanatory diagram showing a message flow between components in the test mode.
n1において、リクエスト受付部102は、端末10からのリクエストを受け付ける。
n2において、リクエスト受付部102は、n1で受け付けたリクエストを一意に識別するリクエストIDをリクエストID採番部103に生成させる。
n3において、リクエスト受付部102は、n1で受け付けたリクエストのリクエストIDとURLとを引数にして、コンテナ処理部106を呼び出す。ここで、n1で受け付けたリクエストは、テストモードにおける実測用のリクエスト(ベンチマーク)であるため、確実に実行される。つまり、図7のメモリ使用量制御部108が実行していたような、判別式によるリクエストの実行可否判定は、省略される。
In n1, the
At n2, the
In n3, the
n4において、コンテナ処理部106は、n3で受信したリクエストIDとURLとを実行中リクエスト管理テーブル116に格納し、ユーザ処理部107を呼び出す。
以下、図8のn5〜n10の各処理は、図7のm13〜m18の各処理と同じである。例えば、n5の処理は、m13の処理と同じである。
In n4, the
Hereinafter, each process of n5-n10 of FIG. 8 is the same as each process of m13-m18 of FIG. For example, the process of n5 is the same as the process of m13.
以下、テストモードにおける最大サイズ管理テーブル118(GC前最大使用量フィールド402)の更新処理を説明する。
n11において、GC処理部121は、最大メモリ使用量計算部117に対して現在のメモリ使用量の取得を要求する。
n12において、最大メモリ使用量計算部117は、実行中リクエスト管理テーブル116を参照して実行中のリクエストの一覧(例えば、レコード211、レコード212、レコード213、レコード214)を取得する。
n13において、最大メモリ使用量計算部117は、取得したすべてのリクエストについてオブジェクト管理部115にリクエストIDを通知し、各リクエストが使用しているメモリ使用量の取得を行う。
n14において、最大メモリ使用量計算部117は、最大サイズ管理テーブル118を参照してGC前最大使用量フィールド402の情報を取得し、取得した値(リクエストID「1」では、20034bytes)が現在のリクエストのメモリ使用量(リクエストID「1」では、9034+883=9917bytes)よりも小さければ、GC前最大使用量フィールド402の値を、現在のリクエストのメモリ使用量で更新する(リクエストID「1」では、更新せず)。
Hereinafter, the update process of the maximum size management table 118 (the pre-GC maximum usage field 402) in the test mode will be described.
In n11, the
In n12, the maximum memory
In n13, the maximum memory
In n14, the maximum memory
以下、テストモードにおけるGC処理後の最大サイズ管理テーブル118(GC後最大使用量フィールド403)の更新処理を説明する。
n15において、GC処理部121は、既存のGC処理と同様にオブジェクト管理部115に対して不要なオブジェクト112の削除を要求する。
n16において、オブジェクト管理部115では、n15で要求されたオブジェクト112をユーザメモリ領域111から削除する。例えば、オブジェクトIDが「2」のオブジェクトを削除する場合は、図3のレコード312を削除されることになる。
n17において、n16で削除されたオブジェクト112について、オブジェクト管理テーブル114からその情報を削除し、GC処理部121に制御を戻す。そして、GC処理部121は、GC処理(n15〜n17)により不要なオブジェクトを解放したので、ふたたび最大メモリ使用量の取得処理(n11〜n13)を行う。
そして、最大メモリ使用量計算部117は、最大サイズ管理テーブル118を参照してGC後最大使用量フィールド403の情報を取得し、GC後最大使用量フィールド403のメモリ使用量(リクエストID「1」では、10028bytes)が、最大メモリ使用量の取得処理(n11〜n13)によって取得したメモリ使用量(リクエストID「1」では、9034+883=9917bytes)よりも小さければ、GC後最大使用量フィールド403の値を、最大メモリ使用量の取得処理(n11〜n13)によって取得したメモリ使用量で更新する(リクエストID「1」では、更新せず)。
Hereinafter, the update process of the maximum size management table 118 (the maximum use amount field after GC field 403) after the GC process in the test mode will be described.
In n15, the
In n16, the
In n17, the information of the
Then, the maximum memory
そして、以下に、更新された最大サイズ管理テーブル118を、最大サイズ情報ファイル122としてエクスポートする処理を示す。
n18において、コマンド受付部109は、管理者からファイル出力コマンドを受け付けると、コマンド実行部110にファイル出力処理を要求する。
n19において、コマンド実行部110は、最大サイズ管理テーブル118を参照して全リクエストのURL、GC前最大使用量、GC後最大使用量の情報を取得する。
n20において、コマンド実行部110は、n19で取得したデータ内容の形式変換(CSV変換)を行った結果を、最大サイズ情報ファイル122として出力する。
A process for exporting the updated maximum size management table 118 as the maximum
In n18, when the
In n19, the
In n20, the
図9は、手動設定モードにおけるリクエスト処理の概要を示すフローチャートである。 FIG. 9 is a flowchart showing an outline of request processing in the manual setting mode.
S1001として、リクエスト受付部102は、端末10からリクエストを受け付ける。
S1002として、リクエストID採番部103は、リクエスト毎に一意なリクエストIDを採番し、リクエスト制御部104にリクエストURLとリクエストIDとを通知する。
S1003として、リクエスト制御部104は、リクエスト受付部102からリクエストIDとリクエストのURLを受け取り、リクエストが実行可能かどうかを判断するために、メモリ使用量制御部108にリクエストURLを通知して制御を移す。
S1004として、メモリ使用量制御部108は、メモリ使用量制御処理として、新規リクエストの実行可否判定処理(詳細は図10)を行う。
S1005として、リクエスト制御部104は、S1004の判定結果をメモリ使用量制御部108から受信し、その判定結果がリクエスト実行可能なら(S1005,Yes)S1006へ進み、リクエスト実行不可能なら(S1005,No)S1009へ進む。
In step S <b> 1001, the
In S1002, the request
In step S <b> 1003, the
In S1004, the memory
In S1005, the
S1006として、コンテナ処理部106は、リクエストIDとリクエストURLの文字列とをリクエスト制御部104から受信し、それらの情報を実行中リクエスト管理テーブル116に格納する。
S1007として、コンテナ処理部106は、ユーザ処理部107に対して、S1001で受け付けたリクエストの実行を指示する(詳細は図13)。
S1008として、コンテナ処理部106は、S1007の処理を終えた後、実行中リクエスト管理テーブル116からS1007で実行したリクエストの情報を削除する。これにより、実行中リクエスト管理テーブル116には、現在実行しているリクエストの情報だけが格納される。
S1009として、リクエスト受付部102は、端末10に対して、S1001のリクエストに対するレスポンス(応答)を返却する。このレスポンスは、S1005でYesに分岐したときには、コンテナ処理部106から報告を受けたリクエストの正常実行の通知とし、S1005でNoに分岐したときには、エラーとする。
In step S <b> 1006, the
In step S1007, the
In step S <b> 1008, the
In step S <b> 1009, the
図10は、S1004から呼び出される処理であり、メモリ使用量制御処理の詳細を示すフローチャートである。以下の説明では、図10の各処理の動作の主体は、メモリ使用量制御部108である。
FIG. 10 is a flowchart that shows details of the memory usage control process that is called from S1004. In the following description, the main operation of each process in FIG. 10 is the memory
S1101として、リクエスト制御部104から、実行しようとしているリクエストのURL情報を受け取る。
S1102として、実行中リクエスト管理テーブル116を参照し、実行中リクエストIDの一覧を取得する。
S1103として、実行中の全てのリクエストの現時点でのメモリ使用量(DRC)を計算するため、実行中のリクエストID一覧を引数として、図11の処理を呼び出す。
S1104として、最大サイズ情報ファイル122を参照し、S1103で計算した実行中リクエストのURL情報に対応するGC前最大使用量およびGC後最大使用量をDRMとして取得するとともに、S1101で受け取ったリクエストのURL情報に対応するGC前最大使用量およびGC後最大使用量をDNMとして取得する。
S1105として、Java API120を実行して、現在空きメモリ量(RSC)を取得する。
In step S <b> 1101, the URL information of the request to be executed is received from the
In step S1102, the in-execution request management table 116 is referred to, and a list of in-execution request IDs is acquired.
In S1103, in order to calculate the current memory usage (DRC) of all the requests being executed, the process of FIG. 11 is called with the list of request IDs being executed as an argument.
In S1104, the maximum
As S1105, the
S1106として、1回目の判別式「(DRI)+(DNM)<(RSC)」を満たすか否かを判定する。なお、判別式左辺のDRIは、S1104で取得したDRMとしてのGC前最大使用量から、S1103で取得したDRCを減算した結果である。また、判別式左辺のDNMとして、S1104で取得したDNMとしてのGC前最大使用量を使用する。この判別式を満たすときにはS1111へ進み、判別式を満たさないときにはS1107へ進む。 In S1106, it is determined whether or not the first discriminant “(DRI) + (DNM) <(RSC)” is satisfied. The DRI on the left side of the discriminant is the result of subtracting the DRC acquired in S1103 from the maximum pre-GC usage as the DRM acquired in S1104. Further, as the DNM on the left side of the discriminant, the pre-GC maximum use amount as the DNM acquired in S1104 is used. When this discriminant is satisfied, the process proceeds to S1111. When the discriminant is not satisfied, the process proceeds to S1107.
S1107として、空きメモリを増やすために、Java API120にFullGCの実行を要求する。
S1108として、FullGC実行後に、再びS1103の処理を実行する。
S1109として、再びS1105の処理を実行する。
S1110として、2回目の判別式「(DRI)+(DNM)<(RSC)」を満たすか否かを判定する。なお、判別式左辺のDRIは、S1104で取得したDRMとしてのGC後最大使用量から、S1108で取得したDRCを減算した結果である。また、判別式左辺のDNMとして、S1104で取得したDNMとしてのGC後最大使用量を使用する。この判別式を満たすときにはS1111へ進み、判別式を満たさないときにはS1112へ進む。
In S1107, in order to increase the free memory, the
As S1108, after the Full GC is executed, the processing of S1103 is executed again.
As S1109, the process of S1105 is executed again.
In S1110, it is determined whether or not the second discriminant “(DRI) + (DNM) <(RSC)” is satisfied. The DRI on the left side of the discriminant is a result of subtracting the DRC acquired in S1108 from the maximum usage amount after GC as the DRM acquired in S1104. Further, as the DNM on the left side of the discriminant, the post-GC maximum use amount as the DNM acquired in S1104 is used. When this discriminant is satisfied, the process proceeds to S1111. When the discriminant is not satisfied, the process proceeds to S1112.
S1111として、S1101で受け取ったリクエストを実行可能と判断し、リクエスト制御部104にその判断結果を通知する。
S1112として、S1101で受け取ったリクエストをメモリ不足により実行不可能と判断し、リクエスト制御部104にその判断結果を通知する。
In S1111, it is determined that the request received in S1101 can be executed, and the determination result is notified to the
In S1112, it is determined that the request received in S1101 cannot be executed due to a lack of memory, and the determination result is notified to the
図11は、S1103およびS1108から実行中の全リクエストのリクエストIDを引数として呼び出される処理であり、実行中全リクエストのメモリ使用量を計算する処理の詳細を示すフローチャートである。以下の説明では、図11の各処理の動作の主体は、メモリ使用量制御部108である。
S1201として、メモリ使用量制御部108では、引数として受け取った実行中のリクエストIDを順に一つずつ選択するループを開始する。
S1202として、選択されたリクエストIDを引数として図12の処理を呼び出し、そのリクエストIDのメモリ使用量の計算を行う。
S1203として、S1201のループを終了する。
S1204として、S1202でそれぞれ計算したメモリ使用量を合計し、その合計値を実行中全リクエストのメモリ使用量として呼び出し元に返却する。
FIG. 11 is a flowchart showing the details of the processing that is called from S1103 and S1108 with the request IDs of all requests being executed as arguments, and that calculates the memory usage of all requests being executed. In the following description, the main operation of each process in FIG. 11 is the memory
In step S1201, the memory
In S1202, the process shown in FIG. 12 is called with the selected request ID as an argument, and the memory usage of the request ID is calculated.
As S1203, the loop of S1201 is terminated.
In S1204, the memory usage calculated in S1202 is totaled, and the total value is returned to the caller as the memory usage of all requests being executed.
図12は、S1202から実行中のリクエストのリクエストIDを引数として呼び出される処理であり、そのリクエストのメモリ使用量を計算する処理の詳細を示すフローチャートである。以下の説明では、図12の各処理の動作の主体は、オブジェクト管理部115である。
S1301として、引数のリクエストIDをメモリ使用量制御部108から受け取る。
S1302として、オブジェクト管理テーブル114を参照して、S1301のリクエストIDに対応するオブジェクトの一覧を取得する。
S1303として、S1302に取得したすべてのオブジェクトについて、そのオブジェクトのメモリ使用量の合計を算出し、算出結果を要求元に返却する。
FIG. 12 is a flowchart showing details of a process that is called from S1202 with the request ID of the request being executed as an argument, and that calculates the memory usage of the request. In the following description, the subject of the operation of each process in FIG. 12 is the
In step S <b> 1301, an argument request ID is received from the memory
In step S1302, the object management table 114 is referred to, and a list of objects corresponding to the request ID in step S1301 is acquired.
In S1303, for all the objects acquired in S1302, the total memory usage of the objects is calculated, and the calculation result is returned to the request source.
図13は、S1007からリクエストIDを引数として呼び出される処理であり、そのリクエストの実行処理の詳細を示すフローチャートである。以下の説明では、図13の各処理の動作の主体は、S1404以外は、ユーザ処理部107である。
S1401として、引数のリクエストに従って、ユーザの作成したJavaプログラムの処理を順に実行するループを開始する。
S1402として、ループで選択されたプログラムの処理を実行する。
S1403として、S1402の処理がオブジェクトを生成する処理であるか否かを判定する。S1403でYesならS1404へ進み、S1403でNoならS1405へ進む。
S1404として、ユーザ処理部107は、オブジェクト管理部115に対してリクエストIDを通知してオブジェクト112の作成を要求する。要求を受けたオブジェクト管理部115は、オブジェクトID採番部119で一意なオブジェクトIDを採番してそのオブジェクトIDで示されるオブジェクト112を生成する。さらに、オブジェクト管理部115は、採番したオブジェクトIDと、通知されたリクエストIDと、生成したオブジェクト112のメモリ使用量とを対応づけて、オブジェクト管理テーブル114に格納する。
S1405として、S1401のループを終了する。
FIG. 13 is a flowchart showing details of the request execution process, which is a process called from S1007 with the request ID as an argument. In the following description, the subject of the operation of each process in FIG. 13 is the
In S1401, a loop for sequentially executing the processing of the Java program created by the user is started in accordance with the argument request.
In S1402, the program selected in the loop is executed.
In S1403, it is determined whether or not the processing in S1402 is processing for generating an object. If Yes in S1403, the process proceeds to S1404, and if No in S1403, the process proceeds to S1405.
In step S <b> 1404, the
As S1405, the loop of S1401 is terminated.
図14は、テストモードにおけるリクエスト処理の概要を示すフローチャートである。図9の手動設定モードにおける処理と比較すると、メモリ使用量制御部108に関する処理(S1003〜S1005)が不要になる。
FIG. 14 is a flowchart showing an overview of request processing in the test mode. Compared with the process in the manual setting mode of FIG. 9, the process (S1003 to S1005) related to the memory
図15は、GC処理部121が実行するGC処理を示すフローチャートである。このGC処理が実行される契機は、例えば、Javaがメモリ不足状態を検知したときである。
S2001として、不要になったオブジェクトを解放するオブジェクトとして決定する。
S2002として、最大サイズ管理テーブル118内のGC前最大使用量の更新処理(図16)を呼び出す。
S2003として、GC処理として、S2001で解放対象とされたオブジェクト112の解放処理を行う。この解放処理に伴い、解放したオブジェクト112の情報を、オブジェクト管理テーブル114から削除する。
S2004として、最大サイズ管理テーブル118内のGC後最大使用量の更新処理(図17)を呼び出す。
FIG. 15 is a flowchart showing the GC processing executed by the
In S2001, an object that is no longer needed is determined as an object to be released.
In S2002, the update process (FIG. 16) of the maximum pre-GC usage in the maximum size management table 118 is called.
In S2003, as the GC process, the release process of the
In S2004, an update process (FIG. 17) of the maximum use amount after GC in the maximum size management table 118 is called.
図16は、S2002から呼び出されるGC前最大使用量の更新処理の詳細を示すフローチャートである。以下の説明では、図16の各処理の動作の主体は、最大メモリ使用量計算部117である。
S2101として、実行中リクエスト管理テーブル116を参照し、実行中のリクエストの一覧を取得する。
S2102として、S2101で取得した実行中リクエストを一つずつ選択するループを開始する。
S1202として、図12で説明した現在のメモリ使用量の取得処理を呼び出す。
S2103として、S2102で選択した実行中リクエストのURLが最大サイズ管理テーブル118に登録済みであるか否かを判定する。S2103でYesならS2104へ進み、S2103でNoならS2105へ進む。
S2104として、最大サイズ管理テーブル118からGC前最大使用量フィールド402の値を取得し、取得した値がS1202で計算したメモリ使用量よりも小さいか否かを判定する。S2104でYesならS2105へ進み、S2104でNoならS2106へ進む。
S2105として、最大サイズ管理テーブル118のGC前最大使用量フィールド402に、S1202で計算したメモリ使用量を登録(上書き更新)する。
S2106として、S2102からのループを終了する。
FIG. 16 is a flowchart showing details of the pre-GC maximum use amount update process called from S2002. In the following description, the subject of the operation of each process in FIG. 16 is the maximum memory
In S2101, the in-execution request management table 116 is referred to, and a list of requests in execution is acquired.
In S2102, a loop for selecting the executing requests acquired in S2101 one by one is started.
In S1202, the current memory usage acquisition process described in FIG. 12 is called.
In S2103, it is determined whether the URL of the request being executed selected in S2102 has already been registered in the maximum size management table 118. If YES in step S2103, the process advances to step S2104. If NO in step S2103, the process advances to step S2105.
In S2104, the value of the pre-GC
In S2105, the memory usage calculated in S1202 is registered (overwritten update) in the pre-GC
As S2106, the loop from S2102 is terminated.
図17は、S2004から呼び出されるGC後最大使用量の更新処理の詳細を示すフローチャートである。以下の説明では、図17の各処理の動作の主体は、最大メモリ使用量計算部117である。図17の処理は、図16の処理と類似するが、図16のS2103〜S2105の処理が、図17のS2201〜S2202の処理に置き換わっている。
S2201として、最大サイズ管理テーブル118に格納されているGC後最大使用量フィールド403の値が、S1202で計算したメモリ使用量よりも小さいか否かを判定する。S2201でYesならS2202へ進み、S2201でNoならS2106へ進む。
S2202として、最大サイズ管理テーブル118のGC後最大使用量フィールド403に、S1202で計算したメモリ使用量を登録(上書き更新)する。
FIG. 17 is a flowchart showing details of the update processing for the maximum usage amount after GC called from S2004. In the following description, the subject of the operation of each process in FIG. 17 is the maximum memory
In S2201, it is determined whether or not the value in the post-GC
In S2202, the memory usage calculated in S1202 is registered (overwritten update) in the post-GC
以上説明した本実施形態では、メモリ使用量制御部108が図6(c)に示す判別式において、現在実行中のリクエストのメモリ使用量の増加分(DRI)を用いて、新たなリクエストの実行可否を判定することにより、図6(b)に示すような事後的なメモリ不足を防止することができる。
さらに、テストモードにより、DRIを実測値として計測することにより、判別式での判定精度を手動設定モードよりも向上させることができる。
In the present embodiment described above, the memory
Furthermore, by measuring DRI as an actual measurement value in the test mode, the determination accuracy in the discriminant can be improved as compared with the manual setting mode.
10 端末
20 ネットワーク
30 計算機
40 通信装置
50 CPU
60 入力装置
70 出力装置
80 補助記憶装置
90 バス
95 主記憶装置
101 コンテナ管理領域
102 リクエスト受付部
103 リクエストID採番部
104 リクエスト制御部
105 プログラム処理部
106 コンテナ処理部
107 ユーザ処理部
108 メモリ使用量制御部
109 コマンド受付部
110 コマンド実行部
111 ユーザメモリ領域
112 オブジェクト
113 JavaVM管理領域
114 オブジェクト管理テーブル
115 オブジェクト管理部
116 実行中リクエスト管理テーブル
117 最大メモリ使用量計算部
118 最大サイズ管理テーブル
119 オブジェクトID採番部
120 Java API
121 GC処理部
122 最大サイズ情報ファイル
10 terminal 20
121
Claims (6)
リクエスト処理装置は、Java(登録商標)VM(Virtual Machine)を動作させるJavaアプリケーションサーバであり、
リクエスト処理装置は、ユーザメモリ領域とJavaVM管理領域とを記憶手段内に格納する記憶部と、メモリ使用量制御部とを有しており、
前記ユーザメモリ領域には、リクエストを実行するためのプログラムを具現化したオブジェクトが格納されており、
前記JavaVM管理領域には、前記ユーザメモリ領域に格納される前記オブジェクトの前記オブジェクトIDと、そのオブジェクトが使用するメモリ量と、そのオブジェクトを作成したリクエストのリクエストIDとが対応づけて前記オブジェクト管理用データとして格納されるとともに、リクエストIDごとにそのリクエストを実行するために使用する最大のメモリ量が対応づけて最大サイズ管理用データとして格納されており、
前記メモリ使用量制御部は、新たに受け付けたリクエストを実行するか否かを判定するときに、
前記最大サイズ管理用データを参照して、現在実行中のリクエストの最大のメモリ量を第1メモリ量として取得し、
前記オブジェクト管理用データを参照して、現在実行中のリクエストのリクエストIDに対応する前記オブジェクトが現在使用するメモリ量を第2メモリ量として取得し、前記第2メモリ量から前記第1メモリ量を減算した値を第3メモリ量として計算し、
前記最大サイズ管理用データを参照して、前記新たに受け付けたリクエストの最大のメモリ量を第4メモリ量として取得し、
前記ユーザメモリ領域内の現在の空き容量を前記JavaVMから取得し、取得した現在の空き容量が、前記第3メモリ量と前記第4メモリ量との和よりも大きいときには、前記新たに受け付けたリクエストの実行を許可して、そのリクエストの実行を指示することを特徴とする
リクエスト処理方法。 A request processing method by a request processing device that executes a received request,
The request processing device is a Java application server that operates a Java (registered trademark) VM (Virtual Machine).
The request processing apparatus includes a storage unit that stores a user memory area and a JavaVM management area in a storage unit, and a memory usage control unit.
The user memory area stores an object embodying a program for executing a request,
In the JavaVM management area, the object ID of the object stored in the user memory area, the amount of memory used by the object, and the request ID of the request that created the object are associated with each other for object management. Is stored as data, and the maximum memory amount used to execute the request for each request ID is stored in association with the maximum size management data,
When the memory usage control unit determines whether to execute a newly received request,
With reference to the maximum size management data, the maximum memory amount of the currently executing request is acquired as the first memory amount,
By referring to the object management data, the memory amount currently used by the object corresponding to the request ID of the currently executing request is acquired as the second memory amount, and the first memory amount is obtained from the second memory amount. Calculate the subtracted value as the third memory amount,
With reference to the maximum size management data, the maximum memory amount of the newly accepted request is acquired as the fourth memory amount,
The current free space in the user memory area is acquired from the JavaVM, and when the acquired current free space is larger than the sum of the third memory amount and the fourth memory amount, the newly accepted request A request processing method characterized in that execution of the request is permitted and execution of the request is instructed.
請求項1に記載のリクエスト処理方法。 When it is determined that execution of the newly accepted request is not permitted, the memory usage control unit causes the Java VM to execute GC (Garbage Collection) to increase the current free space, and then again. It is determined whether or not the current free space is larger than the sum of the third memory amount and the fourth memory amount. If it is determined that the current free space is larger, the execution of the newly accepted request is permitted. The request processing method according to claim 1, wherein execution of the request is instructed.
請求項1または請求項2に記載のリクエスト処理方法。 The request processing device refers to the object management data, acquires the second memory amount corresponding to the request ID, totals the maximum value of the second memory amount for each request ID, and calculates the total result. The request processing method according to claim 1 or 2, wherein the first memory amount is stored in the maximum size management data.
請求項1ないし請求項3のいずれか1項に記載のリクエスト処理方法。 The request processing device stores a list of currently executing requests in the storage unit, adds the request to the list when the newly accepted request is allowed to be executed, and completes the execution of the request, The request processing method according to any one of claims 1 to 3, wherein the request is deleted from the list.
リクエスト処理装置は、Java(登録商標)VM(Virtual Machine)を動作させるJavaアプリケーションサーバであり、
リクエスト処理装置は、ユーザメモリ領域とJavaVM管理領域とを記憶手段内に格納する記憶部と、メモリ使用量制御部とを有しており、
前記ユーザメモリ領域には、リクエストを実行するためのプログラムを具現化したオブジェクトが格納されており、
前記JavaVM管理領域には、前記ユーザメモリ領域に格納される前記オブジェクトの前記オブジェクトIDと、そのオブジェクトが使用するメモリ量と、そのオブジェクトを作成したリクエストのリクエストIDとが対応づけて前記オブジェクト管理用データとして格納されるとともに、リクエストIDごとにそのリクエストを実行するために使用する最大のメモリ量が対応づけて最大サイズ管理用データとして格納されており、
前記メモリ使用量制御部は、新たに受け付けたリクエストを実行するか否かを判定するときに、
前記最大サイズ管理用データを参照して、現在実行中のリクエストの最大のメモリ量を第1メモリ量として取得し、
前記オブジェクト管理用データを参照して、現在実行中のリクエストのリクエストIDに対応する前記オブジェクトが現在使用するメモリ量を第2メモリ量として取得し、前記第2メモリ量から前記第1メモリ量を減算した値を第3メモリ量として計算し、
前記最大サイズ管理用データを参照して、前記新たに受け付けたリクエストの最大のメモリ量を第4メモリ量として取得し、
前記ユーザメモリ領域内の現在の空き容量を前記JavaVMから取得し、取得した現在の空き容量が、前記第3メモリ量と前記第4メモリ量との和よりも大きいときには、前記新たに受け付けたリクエストの実行を許可して、そのリクエストの実行を指示することを特徴とする
リクエスト処理装置。 A request processing device that executes a received request,
The request processing device is a Java application server that operates a Java (registered trademark) VM (Virtual Machine).
The request processing apparatus includes a storage unit that stores a user memory area and a JavaVM management area in a storage unit, and a memory usage control unit.
The user memory area stores an object embodying a program for executing a request,
In the JavaVM management area, the object ID of the object stored in the user memory area, the amount of memory used by the object, and the request ID of the request that created the object are associated with each other for object management. Is stored as data, and the maximum memory amount used to execute the request for each request ID is stored in association with the maximum size management data,
When the memory usage control unit determines whether to execute a newly received request,
With reference to the maximum size management data, the maximum memory amount of the currently executing request is acquired as the first memory amount,
By referring to the object management data, the memory amount currently used by the object corresponding to the request ID of the currently executing request is acquired as the second memory amount, and the first memory amount is obtained from the second memory amount. Calculate the subtracted value as the third memory amount,
With reference to the maximum size management data, the maximum memory amount of the newly accepted request is acquired as the fourth memory amount,
The current free space in the user memory area is acquired from the JavaVM, and when the acquired current free space is larger than the sum of the third memory amount and the fourth memory amount, the newly accepted request A request processing device characterized in that execution of the request is permitted and execution of the request is instructed.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2010112505A JP2011242890A (en) | 2010-05-14 | 2010-05-14 | Request processing method, request processing program and request processing apparatus |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2010112505A JP2011242890A (en) | 2010-05-14 | 2010-05-14 | Request processing method, request processing program and request processing apparatus |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JP2011242890A true JP2011242890A (en) | 2011-12-01 |
Family
ID=45409493
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2010112505A Pending JP2011242890A (en) | 2010-05-14 | 2010-05-14 | Request processing method, request processing program and request processing apparatus |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2011242890A (en) |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2014171002A1 (en) * | 2013-04-19 | 2014-10-23 | 株式会社日立製作所 | Memory management method, computer, and recording medium |
| JP2014239302A (en) * | 2013-06-06 | 2014-12-18 | キヤノン株式会社 | Image processing apparatus, control method thereof, and program |
| JP2019204477A (en) * | 2018-05-17 | 2019-11-28 | キヤノン株式会社 | Image processing device, control method therefor, and program |
-
2010
- 2010-05-14 JP JP2010112505A patent/JP2011242890A/en active Pending
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2014171002A1 (en) * | 2013-04-19 | 2014-10-23 | 株式会社日立製作所 | Memory management method, computer, and recording medium |
| JP2014239302A (en) * | 2013-06-06 | 2014-12-18 | キヤノン株式会社 | Image processing apparatus, control method thereof, and program |
| JP2019204477A (en) * | 2018-05-17 | 2019-11-28 | キヤノン株式会社 | Image processing device, control method therefor, and program |
| JP7186541B2 (en) | 2018-05-17 | 2022-12-09 | キヤノン株式会社 | IMAGE PROCESSING DEVICE, CONTROL METHOD THEREOF, AND PROGRAM |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP5971420B2 (en) | State restoration program, apparatus, and support method | |
| JP5334226B2 (en) | Schedule management method and schedule management server | |
| US11256541B2 (en) | Rescheduling of virtual machine migrations with less impact on an existing migration schedule | |
| US20210263892A1 (en) | Method and apparatus for managing storage space on storage device in an electronic apparatus by using context data and user profile data | |
| JP6501694B2 (en) | Computer system and task execution method of computer system | |
| CN101361056A (en) | Coordinates and selects computer protocols for obtaining resources from multiple resource managers | |
| JP2011118587A (en) | System for executing cooperative service by plurality of servers | |
| JP2012118922A (en) | Printing system, transmission control device, and program | |
| CN111884949A (en) | Method, device and system for determining and realizing shunting scheme of AB experiment | |
| JP2011242890A (en) | Request processing method, request processing program and request processing apparatus | |
| KR101661789B1 (en) | Synchronizing self-referencing fields during two-way synchronization | |
| US20190220205A1 (en) | Job Manager For Deploying A Bundled Application | |
| JP2002049637A (en) | Database management method and apparatus, and recording medium | |
| CN110503297B (en) | Service scene acquisition method, device, electronic equipment and medium | |
| EP2325791A1 (en) | Business flow distributed processing system and method | |
| JP4249605B2 (en) | Client server system, cache control method, and computer program | |
| JP7162556B2 (en) | A system and method for supporting configuration for operation of a service system containing one or more application services | |
| JP2013191003A (en) | Branch repository management system | |
| CN112486953A (en) | Data migration method and device, computer equipment and storage medium | |
| JPWO2018135008A1 (en) | Impact analysis system, measurement item optimization method, and measurement item optimization program | |
| JP5509164B2 (en) | Computer, management method and program | |
| JP7010632B2 (en) | Intermediate data management system and intermediate data management method | |
| CN112905541A (en) | Mirror image warehouse garbage cleaning method and device | |
| JP2012221147A (en) | Computer and resource management method | |
| US9678815B2 (en) | Information processing system, information processing apparatus, and method of controlling them |