JP2021071929A - Api call handling system and api call handling program - Google Patents
Api call handling system and api call handling program Download PDFInfo
- Publication number
- JP2021071929A JP2021071929A JP2019198265A JP2019198265A JP2021071929A JP 2021071929 A JP2021071929 A JP 2021071929A JP 2019198265 A JP2019198265 A JP 2019198265A JP 2019198265 A JP2019198265 A JP 2019198265A JP 2021071929 A JP2021071929 A JP 2021071929A
- Authority
- JP
- Japan
- Prior art keywords
- throttling
- message
- api call
- api
- queue
- 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
Abstract
Description
本発明は、API(Application Program Interface)の呼び出しに対する処理を実行するAPI呼び出し処理システムおよびAPI呼び出し処理プログラムに関する。 The present invention relates to an API call processing system and an API call processing program that execute processing for an API (Application Program Interface) call.
従来のAPI呼び出し処理システムとして、短時間に多数のAPIの呼び出しが生じることによってAPI呼び出し処理システム自体の動作に支障が生じることを防止するために、過去のAPIの利用の回数に応じて新たなAPIの利用を制限するものが知られている(例えば、特許文献1、2参照。)。
As a conventional API call processing system, in order to prevent the operation of the API call processing system itself from being hindered by a large number of API calls occurring in a short period of time, new API calls are made according to the number of times the API has been used in the past. Some are known to limit the use of APIs (see, for example,
しかしながら、従来のAPI呼び出し処理システムにおいては、新たなAPIの利用を制限するために、過去のAPIの利用の回数や履歴を管理するテーブルやデータベースにアクセスする必要があるので、これらのテーブルやデータベースに対する負荷が上がり、その結果、API呼び出し処理システム自体の動作に支障が生じるという問題がある。 However, in the conventional API call processing system, in order to limit the use of a new API, it is necessary to access a table or database that manages the number of times and history of past API use. Therefore, these tables and databases As a result, there is a problem that the operation of the API call processing system itself is hindered.
そこで、本発明は、APIの利用を制限する場合にAPI呼び出し処理システム自体の動作に支障が生じる可能性を低減することができるAPI呼び出し処理システムおよびAPI呼び出し処理プログラムを提供することを目的とする。 Therefore, an object of the present invention is to provide an API call processing system and an API call processing program that can reduce the possibility that the operation of the API call processing system itself is hindered when the use of API is restricted. ..
本発明のAPI呼び出し処理システムは、APIの呼び出しに応じたデータに基づいた応答を返す呼び出し応答部と、前記APIの利用の制限であるスロットリングの内容を示すスロットリング情報に基づいて前記スロットリングを実行するスロットリング実行部と、前記APIの呼び出し毎のメッセージであるAPI呼び出しメッセージを保持するためのAPI呼び出しキューと、前記APIが呼び出された場合に前記API呼び出しメッセージを前記API呼び出しキューにエンキューするAPI呼び出しメッセージエンキュー部と、前記API呼び出しキューに保持された前記API呼び出しメッセージに直接または間接的に基づいて前記スロットリング情報を更新するスロットリング情報更新部とを備えることを特徴とする。 The API call processing system of the present invention has a call response unit that returns a response based on data in response to an API call, and the throttling based on throttling information indicating the content of throttling that is a restriction on the use of the API. The throttling execution unit that executes the above, the API call queue for holding the API call message that is the message for each API call, and the API call message are enqueued to the API call queue when the API is called. It is characterized by including an API call message enqueue unit to be used, and a throttling information update unit that updates the throttling information directly or indirectly based on the API call message held in the API call queue.
この構成により、本発明のAPI呼び出し処理システムは、APIが呼び出された場合にAPI呼び出しメッセージをAPI呼び出しキューにエンキューし、API呼び出しキューに保持されたAPI呼び出しメッセージに直接または間接的に基づいてスロットリング情報を更新するので、過去のAPIの利用の回数や履歴を管理するテーブルやデータベースを備える必要がなく、APIの利用を制限する場合にAPI呼び出し処理システム自体の動作に支障が生じる可能性を低減することができる。 With this configuration, the API call processing system of the present invention enqueues an API call message into the API call queue when the API is called, and the slot is directly or indirectly based on the API call message held in the API call queue. Since the ring information is updated, it is not necessary to have a table or database that manages the number of times and history of API usage in the past, and if the API usage is restricted, the operation of the API call processing system itself may be hindered. It can be reduced.
本発明のAPI呼び出し処理システムは、前記スロットリングを指示するメッセージであるスロットリング指示メッセージを保持するためのスロットリング指示キューと、前記スロットリング指示メッセージを前記スロットリング指示キューにエンキューするスロットリング指示メッセージエンキュー部とを備え、前記呼び出し応答部、前記スロットリング実行部、前記API呼び出しメッセージエンキュー部および前記スロットリング情報更新部は、フロントエンドサーバーによって実現され、前記スロットリング指示メッセージエンキュー部は、バックエンドサーバーによって実現され、前記スロットリング指示メッセージエンキュー部は、前記API呼び出しキューに保持された前記API呼び出しメッセージに直接または間接的に基づいて前記スロットリング指示メッセージを生成し、生成した前記スロットリング指示メッセージを前記スロットリング指示キューにエンキューし、前記スロットリング情報更新部は、前記スロットリング指示キューに保持された前記スロットリング指示メッセージに基づいて前記スロットリング情報を更新しても良い。 The API call processing system of the present invention includes a throttling instruction queue for holding a throttling instruction message, which is a message instructing the throttling, and a throttling instruction for encuing the throttling instruction message into the throttling instruction queue. The call response unit, the throttling execution unit, the API call message enqueue unit, and the throttling information update unit are realized by a front-end server, and the throttling instruction message enqueue unit is backed up. The throttling instruction message enqueue unit realized by the end server generates the throttling instruction message directly or indirectly based on the API call message held in the API call queue, and the generated throttling instruction. The message may be enqueued to the throttling instruction queue, and the throttling information update unit may update the throttling information based on the throttling instruction message held in the throttling instruction queue.
この構成により、本発明のAPI呼び出し処理システムは、API呼び出しキューに保持されたAPI呼び出しメッセージに直接または間接的に基づいてバックエンドサーバーがスロットリング指示メッセージを生成し、スロットリング指示メッセージに基づいてフロントエンドサーバーがスロットリング情報を更新するので、API呼び出しキューに保持されたAPI呼び出しメッセージに直接基づいてフロントエンドサーバーがスロットリング情報を更新する場合と比較して、APIの利用を制限するフロントエンドサーバーの負担を軽減することができ、その結果、APIの利用を制限する場合にAPI呼び出し処理システム自体の動作に支障が生じる可能性を低減することができる。 With this configuration, the API call processing system of the present invention allows the backend server to generate a throttling instruction message based directly or indirectly on the API call message held in the API call queue, based on the throttling instruction message. Because the front-end server updates the throttling information, it limits the use of the API compared to when the front-end server updates the throttling information directly based on the API call messages held in the API call queue. The load on the server can be reduced, and as a result, the possibility that the operation of the API call processing system itself is hindered when the use of the API is restricted can be reduced.
本発明のAPI呼び出し処理システムは、前記APIの呼び出しの回数の集計結果を示すメッセージである集計結果メッセージを保持するための集計結果キューと、前記集計結果メッセージを前記集計結果キューにエンキューする集計結果メッセージエンキュー部とを備え、前記集計結果メッセージエンキュー部は、前記バックエンドサーバーによって実現され、前記集計結果メッセージエンキュー部は、前記API呼び出しキューに保持された前記API呼び出しメッセージに基づいて前記集計結果メッセージを生成し、生成した前記集計結果メッセージを前記集計結果キューにエンキューし、前記スロットリング指示メッセージエンキュー部は、前記集計結果キューに保持された前記集計結果メッセージに基づいて前記スロットリング指示メッセージを生成し、生成した前記スロットリング指示メッセージを前記スロットリング指示キューにエンキューし、前記スロットリング指示メッセージエンキュー部が前記スロットリング指示メッセージを生成する間隔は、前記集計結果メッセージエンキュー部が前記集計結果メッセージを生成する間隔より長くても良い。 The API call processing system of the present invention includes an aggregation result queue for holding an aggregation result message, which is a message indicating the aggregation result of the number of times the API is called, and an aggregation result that enqueues the aggregation result message into the aggregation result queue. The aggregation result message enqueue unit is realized by the back-end server, and the aggregation result message enqueue unit includes the aggregation result message based on the API call message held in the API call queue. Is generated, the generated aggregation result message is enqueued to the aggregation result queue, and the throttling instruction message enqueue unit generates the throttling instruction message based on the aggregation result message held in the aggregation result queue. Then, the generated throttling instruction message is enqueued to the throttling instruction queue, and the aggregation result message enqueue unit sets the aggregation result message at intervals at which the throttling instruction message enqueue unit generates the throttling instruction message. It may be longer than the generation interval.
この構成により、本発明のAPI呼び出し処理システムは、API呼び出しキューに保持されたAPI呼び出しメッセージに基づいてバックエンドサーバーが集計結果メッセージを生成し、集計結果メッセージを生成する間隔より長い間隔で、集計結果メッセージに基づいてバックエンドサーバーがスロットリング指示メッセージを生成するので、API呼び出しキューに保持されたAPI呼び出しメッセージに直接基づいてバックエンドサーバーがスロットリング指示メッセージを生成する場合と比較して、バックエンドサーバーに一時的に大きな負荷がかかる可能性を低減することができ、その結果、APIの利用を制限する場合にAPI呼び出し処理システム自体の動作に支障が生じる可能性を低減することができる。 With this configuration, the API call processing system of the present invention aggregates at intervals longer than the interval at which the back-end server generates the aggregation result message based on the API call message held in the API call queue and generates the aggregation result message. The back-end server generates a throttling instruction message based on the result message, so it is back compared to when the back-end server generates a throttling instruction message based directly on the API call message held in the API call queue. It is possible to reduce the possibility that a large load is temporarily applied to the end server, and as a result, it is possible to reduce the possibility that the operation of the API call processing system itself is hindered when the use of API is restricted.
本発明のAPI呼び出し処理プログラムは、APIの呼び出しに応じたデータに基づいた応答を返す呼び出し応答部と、前記APIの利用の制限であるスロットリングの内容を示すスロットリング情報に基づいて前記スロットリングを実行するスロットリング実行部と、前記APIの呼び出し毎のメッセージであるAPI呼び出しメッセージを保持するためのAPI呼び出しキューに、前記API呼び出しメッセージを、前記APIが呼び出された場合にエンキューするAPI呼び出しメッセージエンキュー部と、前記API呼び出しキューに保持された前記API呼び出しメッセージに直接または間接的に基づいて前記スロットリング情報を更新するスロットリング情報更新部とをコンピューターに実現させることを特徴とする。 The API call processing program of the present invention has a call response unit that returns a response based on data in response to an API call, and the throttling information that indicates the content of throttling that is a restriction on the use of the API. API call message that enqueues the API call message when the API is called in the throttling execution unit that executes the API and the API call queue for holding the API call message that is the message for each API call. It is characterized in that a computer realizes an enqueue unit and a throttling information update unit that updates the throttling information directly or indirectly based on the API call message held in the API call queue.
この構成により、本発明のAPI呼び出し処理プログラムを実行するコンピューターは、APIが呼び出された場合にAPI呼び出しメッセージをAPI呼び出しキューにエンキューし、API呼び出しキューに保持されたAPI呼び出しメッセージに直接または間接的に基づいてスロットリング情報を更新するので、過去のAPIの利用の回数や履歴を管理するテーブルやデータベースを備える必要がなく、APIの利用を制限する場合にAPI呼び出し処理システム自体の動作に支障が生じる可能性を低減することができる。 With this configuration, the computer executing the API call processing program of the present invention enqueues the API call message into the API call queue when the API is called, and directly or indirectly to the API call message held in the API call queue. Since the throttling information is updated based on, it is not necessary to have a table or database that manages the number of times and history of API usage in the past, and when restricting API usage, the operation of the API call processing system itself is hindered. The possibility of occurrence can be reduced.
本発明のAPI呼び出し処理システムおよびAPI呼び出し処理プログラムは、APIの利用を制限する場合にAPI呼び出し処理システム自体の動作に支障が生じる可能性を低減することができる。 The API call processing system and the API call processing program of the present invention can reduce the possibility that the operation of the API call processing system itself will be hindered when the use of the API is restricted.
以下、本発明の実施の形態について、図面を用いて説明する。 Hereinafter, embodiments of the present invention will be described with reference to the drawings.
まず、本発明の一実施の形態に係るAPI呼び出し処理システムの構成について説明する。 First, the configuration of the API call processing system according to the embodiment of the present invention will be described.
図1は、本実施の形態に係るAPI呼び出し処理システム10のブロック図である。 FIG. 1 is a block diagram of the API call processing system 10 according to the present embodiment.
図1に示すように、API呼び出し処理システム10は、データベース20と、外部からのAPIの呼び出しに応じてデータベース20からデータを収集し、収集したデータに基づいた応答を外部に返すフロントエンドサーバー30と、API呼び出し処理システム10の内部で処理を実行するバックエンドサーバー40と、APIの呼び出し毎のメッセージ(以下「API呼び出しメッセージ」という。)を保持するためのAPI呼び出しキュー51と、1分間などの特定の時間の間のAPIの呼び出しの回数の集計結果を示すメッセージ(以下「集計結果メッセージ」という。)を保持するための集計結果キュー52と、APIの利用の制限であるスロットリングを指示するメッセージ(以下「スロットリング指示メッセージ」という。)を保持するためのスロットリング指示キュー53とを備えている。API呼び出し処理システム10は、1台のコンピューターによって構成されても良いし、複数台のコンピューターによって構成されても良い。
As shown in FIG. 1, the API call processing system 10 collects data from the
API呼び出し処理システム10は、外部から利用されるためのAPIを公開している。API呼び出し処理システム10は、例えば、遠隔地に存在するMFP(Multifunction Peripheral)、プリンター専用機などの画像形成装置から累計印刷枚数、トナーの残量、エラーの発生状況などの各種の情報を取得して、データベース20に記憶するものである。API呼び出し処理システム10は、例えば、画像形成装置の印刷枚数に応じた金額の請求書を作成する外部のシステムからのAPIの呼び出しに応じて画像形成装置の印刷枚数を返したり、画像形成装置のトナーの残量に応じてトナーを発注する外部のシステムからのAPIの呼び出しに応じて画像形成装置のトナーの残量を返したりするものである。
The API call processing system 10 discloses an API to be used from the outside. The API call processing system 10 acquires various information such as the cumulative number of prints, the remaining amount of toner, and the error occurrence status from an image forming apparatus such as an MFP (Multifunction Peripheral) or a dedicated printer that exists in a remote location. It is stored in the
図2は、1台のコンピューターによって構成される場合のフロントエンドサーバー30のブロック図である。
FIG. 2 is a block diagram of the front-
図2に示すように、フロントエンドサーバー30は、種々の操作が入力される例えばキーボード、マウスなどの操作デバイスである操作部31と、種々の情報を表示する例えばLCD(Liquid Crystal Display)などの表示デバイスである表示部32と、LAN、インターネットなどのネットワーク経由で、または、ネットワークを介さずに有線または無線によって直接に、外部の装置と通信を行う通信デバイスである通信部33と、各種の情報を記憶する例えば半導体メモリー、HDD(Hard Disk Drive)などの不揮発性の記憶デバイスである記憶部34と、フロントエンドサーバー30全体を制御する制御部35とを備えている。
As shown in FIG. 2, the front-
記憶部34は、フロントエンドサーバー30用のプログラムであるフロントエンドサーバー用プログラム34aを記憶している。フロントエンドサーバー用プログラム34aは、例えば、フロントエンドサーバー30の製造段階でフロントエンドサーバー30にインストールされていても良いし、CD(Compact Disk)、DVD(Digital Versatile Disk)、USB(Universal Serial Bus)メモリーなどの外部の記憶媒体からフロントエンドサーバー30に追加でインストールされても良いし、ネットワーク上からフロントエンドサーバー30に追加でインストールされても良い。フロントエンドサーバー用プログラム34aは、本発明のAPI呼び出し処理プログラムの一部を構成している。
The storage unit 34 stores the front-
記憶部34は、スロットリングの内容を示すスロットリング情報34bを記憶している。
The storage unit 34
図3は、スロットリング情報34bの一例を示す図である。
FIG. 3 is a diagram showing an example of throttling
図3に示すように、スロットリング情報34bは、スロットリングの対象であるAPIの呼び出し元の識別情報としてのユーザー名と、スロットリングの対象であるAPIの識別情報としてのAPI名と、スロットリングの実行の期限とを、ユーザー名およびAPI名の組み合わせ毎に示している。
As shown in FIG. 3, the throttling
図2に示す制御部35は、例えば、CPU(Central Processing Unit)と、プログラムおよび各種のデータを記憶しているROM(Read Only Memory)と、制御部35のCPUの作業領域として用いられるメモリーとしてのRAM(Random Access Memory)とを備えている。制御部35のCPUは、記憶部34または制御部35のROMに記憶されているプログラムを実行する。 The control unit 35 shown in FIG. 2 includes, for example, a CPU (Central Processing Unit), a ROM (Read Only Memory) that stores programs and various data, and a memory used as a work area of the CPU of the control unit 35. RAM (Random Access Memory) is provided. The CPU of the control unit 35 executes the program stored in the storage unit 34 or the ROM of the control unit 35.
制御部35は、フロントエンドサーバー用プログラム34aを実行することによって、APIの呼び出しに応じたデータに基づいた応答を返す呼び出し応答部35aと、スロットリングを実行するスロットリング実行部35bと、API呼び出しメッセージをエンキューするAPI呼び出しメッセージエンキュー部35cと、スロットリング情報34bを更新するスロットリング情報更新部35dとを実現する。
The control unit 35 executes the front-
図4は、1台のコンピューターによって構成される場合のバックエンドサーバー40のブロック図である。
FIG. 4 is a block diagram of the back-
図4に示すように、バックエンドサーバー40は、種々の操作が入力される例えばキーボード、マウスなどの操作デバイスである操作部41と、種々の情報を表示する例えばLCDなどの表示デバイスである表示部42と、LAN、インターネットなどのネットワーク経由で、または、ネットワークを介さずに有線または無線によって直接に、外部の装置と通信を行う通信デバイスである通信部43と、各種の情報を記憶する例えば半導体メモリー、HDDなどの不揮発性の記憶デバイスである記憶部44と、バックエンドサーバー40全体を制御する制御部45とを備えている。
As shown in FIG. 4, the back-
記憶部44は、バックエンドサーバー40用のプログラムであるバックエンドサーバー用プログラム44aを記憶している。バックエンドサーバー用プログラム44aは、例えば、バックエンドサーバー40の製造段階でバックエンドサーバー40にインストールされていても良いし、CD、DVD、USBメモリーなどの外部の記憶媒体からバックエンドサーバー40に追加でインストールされても良いし、ネットワーク上からバックエンドサーバー40に追加でインストールされても良い。バックエンドサーバー用プログラム44aは、本発明のAPI呼び出し処理プログラムの一部を構成している。
The storage unit 44 stores the back-
記憶部44は、スロットリングの実行の条件を示す実行条件情報44bを記憶している。
The storage unit 44 stores the
図5は、実行条件情報44bの一例を示す図である。
FIG. 5 is a diagram showing an example of
図5に示すように、実行条件情報44bは、スロットリングの対象であるAPIの呼び出し元のユーザー名と、スロットリングの対象であるAPIのAPI名と、スロットリングの実行の条件と、スロットリングの実行の期間とを、ユーザー名およびAPI名の組み合わせ毎に示している。スロットリングの実行の条件は、例えば、「呼び出しの回数が5分間で50回を超える」、「呼び出しの回数が10分間で100回を超える」などである。
As shown in FIG. 5, the
図4に示す制御部45は、例えば、CPUと、プログラムおよび各種のデータを記憶しているROMと、制御部45のCPUの作業領域として用いられるメモリーとしてのRAMとを備えている。制御部45のCPUは、記憶部44または制御部45のROMに記憶されているプログラムを実行する。 The control unit 45 shown in FIG. 4 includes, for example, a CPU, a ROM for storing programs and various data, and a RAM as a memory used as a work area of the CPU of the control unit 45. The CPU of the control unit 45 executes a program stored in the storage unit 44 or the ROM of the control unit 45.
制御部45は、バックエンドサーバー用プログラム44aを実行することによって、集計結果メッセージをエンキューする集計結果メッセージエンキュー部45aと、スロットリング指示メッセージをエンキューするスロットリング指示メッセージエンキュー部45bとを実現する。
By executing the back-
次に、API呼び出し処理システム10の動作について説明する。 Next, the operation of the API call processing system 10 will be described.
まず、外部からAPIが呼び出された場合のフロントエンドサーバー30の動作について説明する。
First, the operation of the front-
図6は、外部からAPIが呼び出された場合のフロントエンドサーバー30の動作のフローチャートである。
FIG. 6 is a flowchart of the operation of the front-
フロントエンドサーバー30の制御部35は、外部からAPIが呼び出される度に、図6に示す動作を実行する。
The control unit 35 of the front-
図6に示すように、制御部35のスロットリング実行部35bは、対象のAPIの呼び出し元が、このAPIに対して、現時点で、スロットリングの対象であるか否かをスロットリング情報34bに基づいて判断する(S101)。
As shown in FIG. 6, the throttling
スロットリング実行部35bは、対象のAPIの呼び出し元が、このAPIに対して、現時点で、スロットリングの対象であるとS101において判断すると、例えば503エラーを返すなど、スロットリングを実行して(S102)、図6に示す動作を終了する。
When the caller of the target API determines in S101 that the target API is currently the target of throttling, the throttling
制御部35のAPI呼び出しメッセージエンキュー部35cは、対象のAPIの呼び出し元が、このAPIに対して、現時点で、スロットリングの対象ではないとS101において判断されると、今回のAPIの呼び出しに関するAPI呼び出しメッセージを生成する(S103)。
When the API call
図7は、図6に示す動作において生成されるAPI呼び出しメッセージの一例を示す図である。 FIG. 7 is a diagram showing an example of an API call message generated in the operation shown in FIG.
図7に示すように、API呼び出しメッセージは、対象のAPIの呼び出しの時刻を示す「timeStamp」と、対象のAPIの呼び出し元のユーザー名を示す「userName」と、対象のAPIのAPI名を示す「apiName」とを含んでいる。図7に示す例では、「timeStamp」、「userName」、「apiName」のそれぞれの値は、「2019/09/10 20:00:10」、「User 1」、「API A」である。
As shown in FIG. 7, the API call message indicates "timeStamp" indicating the time when the target API is called, "userName" indicating the user name of the caller of the target API, and the API name of the target API. Includes "apiName". In the example shown in FIG. 7, the respective values of "timeStamp", "userName", and "apiName" are "2019/09/10 20:00:10", "
図6に示すように、制御部35のAPI呼び出しメッセージエンキュー部35cは、S103の処理の後、S103において生成したAPI呼び出しメッセージをAPI呼び出しキュー51にエンキューする(S104)。
As shown in FIG. 6, the API call
次いで、制御部35の呼び出し応答部35aは、今回のAPIの呼び出しに応じてデータベース20からデータを収集する(S105)。
Next, the
次いで、呼び出し応答部35aは、S105において収集したデータに基づいた応答を、今回のAPIの呼び出し元に返して(S106)、図6に示す動作を終了する。
Next, the
次に、特定の時間の間のAPIの呼び出しの回数を集計する場合のバックエンドサーバー40の動作について説明する。
Next, the operation of the back-
図8は、特定の時間の間のAPIの呼び出しの回数を集計する場合のバックエンドサーバー40の動作のフローチャートである。
FIG. 8 is a flowchart of the operation of the back-
バックエンドサーバー40の制御部45は、例えば1分毎など、特定の時間毎に図8に示す動作を実行する。
The control unit 45 of the back-
図8に示すように、制御部45の集計結果メッセージエンキュー部45aは、API呼び出しキュー51からのAPI呼び出しメッセージのデキューを試みる(S121)。
As shown in FIG. 8, the aggregation result
次いで、集計結果メッセージエンキュー部45aは、S121における試みの結果、API呼び出しキュー51からAPI呼び出しメッセージをデキューしたか否かを判断する(S122)。
Next, the aggregation result
集計結果メッセージエンキュー部45aは、API呼び出しキュー51からAPI呼び出しメッセージをデキューしたとS122において判断すると、S121においてデキューしたAPI呼び出しメッセージに基づいて、APIの呼び出しの回数を、ユーザー名およびAPI名の組み合わせ毎に集計する(S123)。
When the aggregation result
次いで、集計結果メッセージエンキュー部45aは、S123における集計の結果を示す集計結果メッセージを、ユーザー名およびAPI名の組み合わせ毎に生成する(S124)。
Next, the aggregation result
図9は、図8に示す動作において生成される集計結果メッセージの一例を示す図である。 FIG. 9 is a diagram showing an example of an aggregation result message generated in the operation shown in FIG.
図9に示すように、集計結果メッセージは、対象のAPIの呼び出しの回数の集計の開始時刻を示す「timeStamp」と、対象のAPIの呼び出し元のユーザー名を示す「userName」と、対象のAPIのAPI名を示す「apiName」と、対象のAPIの呼び出しの回数を示す「count」とを含んでいる。図9に示す例では、「timeStamp」、「userName」、「apiName」、「count」のそれぞれの値は、「2019/09/10 20:00」、「User 1」、「API A」、「80」である。すなわち、図9に示す例では、「2019/09/10 20:00」以降の1分間の間に、API名「API A」のAPIがユーザー名「User 1」の読み出し元から「80」回呼び出されたことを示している。
As shown in FIG. 9, the aggregation result message includes "timeStamp" indicating the aggregation start time of the number of calls of the target API, "userName" indicating the user name of the caller of the target API, and the target API. It includes "apiName" indicating the API name of the target API and "count" indicating the number of calls of the target API. In the example shown in FIG. 9, the respective values of "timeStamp", "userName", "apiName", and "count" are "2019/09/10 20:00", "
図8に示すように、集計結果メッセージエンキュー部45aは、S124の処理の後、S124において生成した集計結果メッセージを集計結果キュー52にエンキューする(S125)。
As shown in FIG. 8, the aggregation result
集計結果メッセージエンキュー部45aは、API呼び出しキュー51からAPI呼び出しメッセージをデキューしなかったとS122において判断するか、S125の処理を実行すると、図8に示す動作を終了する。
When the aggregation result
次に、スロットリング指示メッセージを生成する場合のバックエンドサーバー40の動作について説明する。
Next, the operation of the back-
図10は、スロットリング指示メッセージを生成する場合のバックエンドサーバー40の動作のフローチャートである。
FIG. 10 is a flowchart of the operation of the back-
バックエンドサーバー40の制御部45は、例えば5分毎など、特定の時間毎に図10に示す動作を実行する。なお、図10に示す動作の実行の間隔は、図8に示す動作の実行の間隔より長い。
The control unit 45 of the back-
図10に示すように、制御部45のスロットリング指示メッセージエンキュー部45bは、集計結果キュー52からの集計結果メッセージのデキューを試みる(S141)。
As shown in FIG. 10, the throttling instruction
次いで、スロットリング指示メッセージエンキュー部45bは、S141における試みの結果、集計結果キュー52から集計結果メッセージをデキューしたか否かを判断する(S142)。
Next, the throttling instruction
スロットリング指示メッセージエンキュー部45bは、集計結果キュー52から集計結果メッセージをデキューしたとS142において判断すると、S141においてデキューした集計結果メッセージに基づいて、APIの呼び出しの回数を、ユーザー名およびAPI名の組み合わせ毎に集計する(S143)。
When the throttling instruction
次いで、スロットリング指示メッセージエンキュー部45bは、今回の図10に示す動作において未だ対象にしていない、ユーザー名およびAPI名の組み合わせの1つのみを対象にする(S144)。
Next, the throttling instruction
次いで、スロットリング指示メッセージエンキュー部45bは、S143において集計した回数が実行条件情報44bに示される、スロットリングの実行の条件を満たすか否かを、現在の対象の組み合わせに関して判断する(S145)。
Next, the throttling instruction
スロットリング指示メッセージエンキュー部45bは、スロットリングの実行の条件を満たすとS145において判断すると、現在の対象の組み合わせに対するスロットリング指示メッセージを生成する(S146)。
When the throttling instruction
図11は、図10に示す動作において生成されるスロットリング指示メッセージの一例を示す図である。 FIG. 11 is a diagram showing an example of a throttling instruction message generated in the operation shown in FIG.
図11に示すように、スロットリング指示メッセージは、対象のAPIの呼び出し元のユーザー名を示す「userName」と、対象のAPIのAPI名を示す「apiName」と、スロットリングの実行の期限を示す「timeStamp」とを含んでいる。図11に示す例では、「userName」、「apiName」、「timeStamp」のそれぞれの値は、「User 1」、「API A」、「2019/09/10 21:05:00」である。すなわち、図11に示す例では、「2019/09/10 21:05:00」まで、ユーザー名「User 1」の読み出し元からのAPI名「API A」のAPIの呼び出しをスロットリングする指示を示している。ここで、スロットリング指示メッセージエンキュー部45bは、現在の対象の組み合わせに関して実行条件情報44bに示される、スロットリングの実行の期間を、現在の日時に加算することによって、スロットリングの実行の期限を算出する。
As shown in FIG. 11, the throttling instruction message indicates "userName" indicating the user name of the caller of the target API, "apiName" indicating the API name of the target API, and the deadline for executing throttling. Includes "timeStamp". In the example shown in FIG. 11, the respective values of "userName", "apiName", and "timeStamp" are "
図10に示すように、スロットリング指示メッセージエンキュー部45bは、S146の処理の後、S146において生成したスロットリング指示メッセージをスロットリング指示キュー53にエンキューする(S147)。
As shown in FIG. 10, the throttling instruction
制御部45の集計結果メッセージエンキュー部45aは、スロットリングの実行の条件を満たさないとS145において判断されるか、S147の処理が終了すると、S141において集計結果キュー52からデキューした、現在の対象の組み合わせの集計結果メッセージのうち、集計結果キュー52に再度エンキューする必要がある集計結果メッセージが存在するか否かを、現在の対象の組み合わせに関して実行条件情報44bに示される、スロットリングの実行の条件に基づいて判断する(S148)。具体的には、集計結果メッセージエンキュー部45aは、図10に示す動作の実行の間隔が、現在の対象の組み合わせに関して実行条件情報44bに示される、スロットリングの実行の条件における対象の期間(以下「実行条件期間」という。)より短い場合、次回の図10に示す動作の実行の予定時刻から実行条件期間前までの「timeStamp」を含む集計結果メッセージを、集計結果キュー52に再度エンキューする必要があると判断する。例えば、図10に示す動作の実行の間隔が5分であり、実行条件期間が10分である場合、集計結果メッセージエンキュー部45aは、次回の図10に示す動作の実行の予定時刻から10分前までの「timeStamp」を含む集計結果メッセージを、集計結果キュー52に再度エンキューする必要があると判断する。
The aggregation result
集計結果メッセージエンキュー部45aは、S141において集計結果キュー52からデキューした、現在の対象の組み合わせの集計結果メッセージのうち、集計結果キュー52に再度エンキューする必要がある集計結果メッセージが存在するとS148において判断すると、S141において集計結果キュー52からデキューした、現在の対象の組み合わせの集計結果メッセージのうち、集計結果キュー52に再度エンキューする必要がある集計結果メッセージを、集計結果キュー52に再度エンキューする(S149)。
The aggregation result
制御部45のスロットリング指示メッセージエンキュー部45bは、S141において集計結果キュー52からデキューした、現在の対象の組み合わせの集計結果メッセージのうち、集計結果キュー52に再度エンキューする必要がある集計結果メッセージが存在しないとS148において判断するか、S149の処理が終了すると、今回の図10に示す動作において未だ対象にしていない、ユーザー名およびAPI名の組み合わせが存在するか否かを判断する(S150)。
The throttling instruction
スロットリング指示メッセージエンキュー部45bは、今回の図10に示す動作において未だ対象にしていない、ユーザー名およびAPI名の組み合わせが存在するとS150において判断すると、S144の処理を実行する。
When the throttling instruction
スロットリング指示メッセージエンキュー部45bは、集計結果キュー52から集計結果メッセージをデキューしなかったとS142において判断するか、今回の図10に示す動作において未だ対象にしていない、ユーザー名およびAPI名の組み合わせが存在しないとS150において判断すると、図10に示す動作を終了する。
The throttling instruction
次に、スロットリング情報34bを更新する場合のフロントエンドサーバー30の動作について説明する。
Next, the operation of the front-
図12は、スロットリング情報34bを更新する場合のフロントエンドサーバー30の動作のフローチャートである。
FIG. 12 is a flowchart of the operation of the front-
フロントエンドサーバー30の制御部35は、例えば5分毎など、特定の時間毎に図12に示す動作を実行する。
The control unit 35 of the front-
図12に示すように、制御部35のスロットリング情報更新部35dは、スロットリング指示キュー53からのスロットリング指示メッセージのデキューを試みる(S161)。
As shown in FIG. 12, the throttling
次いで、スロットリング情報更新部35dは、S161における試みの結果、スロットリング指示キュー53からスロットリング指示メッセージをデキューしたか否かを判断する(S162)。
Next, the throttling
スロットリング情報更新部35dは、スロットリング指示キュー53からスロットリング指示メッセージをデキューしたとS162において判断すると、S161においてデキューしたスロットリング指示メッセージに基づいてスロットリング情報34bを更新する(S163)。
When the throttling
スロットリング情報更新部35dは、スロットリング指示キュー53からスロットリング指示メッセージをデキューしなかったとS162において判断するか、S163の処理を終了すると、図12に示す動作を終了する。
When the throttling
以上に説明したように、API呼び出し処理システム10は、APIが呼び出された場合にAPI呼び出しメッセージをAPI呼び出しキュー51にエンキューし(S104)、API呼び出しキュー51に保持されたAPI呼び出しメッセージに間接的に基づいてスロットリング情報34bを更新する(S163)ので、過去のAPIの利用の回数や履歴を管理するテーブルやデータベースを備える必要がなく、APIの利用を制限する場合にAPI呼び出し処理システム10自体の動作に支障が生じる可能性を低減することができる。
As described above, the API call processing system 10 enqueues the API call message into the API call queue 51 (S104) when the API is called, and indirectly to the API call message held in the
API呼び出し処理システム10は、API呼び出しキュー51に保持されたAPI呼び出しメッセージに間接的に基づいてバックエンドサーバー40がスロットリング指示メッセージを生成し(S146)、スロットリング指示メッセージに基づいてフロントエンドサーバー30がスロットリング情報34bを更新する(S163)ので、API呼び出しキュー51に保持されたAPI呼び出しメッセージに直接基づいてフロントエンドサーバー30がスロットリング情報34bを更新する場合と比較して、APIの利用を制限するフロントエンドサーバー30の負担を軽減することができ、その結果、APIの利用を制限する場合にAPI呼び出し処理システム10自体の動作に支障が生じる可能性を低減することができる。
In the API call processing system 10, the back-
API呼び出し処理システム10は、API呼び出しキュー51に保持されたAPI呼び出しメッセージに基づいてバックエンドサーバー40が集計結果メッセージを生成し(S124)、集計結果メッセージを生成する間隔より長い間隔で、集計結果メッセージに基づいてバックエンドサーバー40がスロットリング指示メッセージを生成する(S146)ので、API呼び出しキュー51に保持されたAPI呼び出しメッセージに直接基づいてバックエンドサーバー40がスロットリング指示メッセージを生成する場合と比較して、バックエンドサーバー40に一時的に大きな負荷がかかる可能性を低減することができ、その結果、APIの利用を制限する場合にAPI呼び出し処理システム10自体の動作に支障が生じる可能性を低減することができる。
In the API call processing system 10, the back-
バックエンドサーバー40は、本実施の形態において、API呼び出しキュー51に保持されたAPI呼び出しメッセージに基づいて集計結果メッセージを生成し(S124)、集計結果キュー52に保持された集計結果メッセージに基づいてスロットリング指示メッセージを生成する(S146)。すなわち、バックエンドサーバー40は、本実施の形態において、API呼び出しキュー51に保持されたAPI呼び出しメッセージに間接的に基づいてスロットリング指示メッセージを生成する。しかしながら、バックエンドサーバー40は、API呼び出しキュー51に保持されたAPI呼び出しメッセージに直接基づいてスロットリング指示メッセージを生成しても良い。
In the present embodiment, the back-
API呼び出し処理システム10は、本実施の形態において、API呼び出しキュー51に保持されたAPI呼び出しメッセージに基づいてバックエンドサーバー40が集計結果メッセージを生成し(S124)、集計結果キュー52に保持された集計結果メッセージに基づいてバックエンドサーバー40がスロットリング指示メッセージを生成し(S146)、スロットリング指示キュー53に保持されたスロットリング指示メッセージに基づいてフロントエンドサーバー30がスロットリング情報34bを更新する(S163)。すなわち、API呼び出し処理システム10は、本実施の形態において、API呼び出しキュー51に保持されたAPI呼び出しメッセージに間接的に基づいてスロットリング情報34bを更新する。しかしながら、API呼び出し処理システム10は、API呼び出しキュー51に保持されたAPI呼び出しメッセージに直接基づいてスロットリング情報34bを更新しても良い。すなわち、API呼び出し処理システム10は、API呼び出しキュー51に保持されたAPI呼び出しメッセージと、実行条件情報とに基づいてフロントエンドサーバー30がスロットリング情報34bを更新しても良い。
In the API call processing system 10, in the present embodiment, the back-
APIの呼び出し元の識別情報は、本実施の形態において、ユーザー名であるが、例えばIP(Internet Protocol)アドレスなど、ユーザー名以外の識別情報でも良い。 In the present embodiment, the identification information of the caller of the API is a user name, but identification information other than the user name such as an IP (Internet Protocol) address may be used.
10 API呼び出し処理システム
30 フロントエンドサーバー
34a フロントエンドサーバー用プログラム(API呼び出し処理プログラムの一部)
34b スロットリング情報
35a 呼び出し応答部
35b スロットリング実行部
35c API呼び出しメッセージエンキュー部
35d スロットリング情報更新部
40 バックエンドサーバー
44a バックエンドサーバー用プログラム(API呼び出し処理プログラムの一部)
45a 集計結果メッセージエンキュー部
45b スロットリング指示メッセージエンキュー部
51 API呼び出しキュー
52 集計結果キュー
53 スロットリング指示キュー
10 API
45a Aggregation result
Claims (4)
前記APIの利用の制限であるスロットリングの内容を示すスロットリング情報に基づいて前記スロットリングを実行するスロットリング実行部と、
前記APIの呼び出し毎のメッセージであるAPI呼び出しメッセージを保持するためのAPI呼び出しキューと、
前記APIが呼び出された場合に前記API呼び出しメッセージを前記API呼び出しキューにエンキューするAPI呼び出しメッセージエンキュー部と、
前記API呼び出しキューに保持された前記API呼び出しメッセージに直接または間接的に基づいて前記スロットリング情報を更新するスロットリング情報更新部と
を備えることを特徴とするAPI呼び出し処理システム。 A call response unit that returns a response based on the data corresponding to the API call, and
A throttling execution unit that executes the throttling based on the throttling information indicating the contents of the throttling that is a restriction on the use of the API, and
An API call queue for holding an API call message, which is a message for each API call, and
An API call message enqueue unit that enqueues the API call message to the API call queue when the API is called, and
An API call processing system including a throttling information update unit that updates the throttling information directly or indirectly based on the API call message held in the API call queue.
前記スロットリング指示メッセージを前記スロットリング指示キューにエンキューするスロットリング指示メッセージエンキュー部と
を備え、
前記呼び出し応答部、前記スロットリング実行部、前記API呼び出しメッセージエンキュー部および前記スロットリング情報更新部は、フロントエンドサーバーによって実現され、
前記スロットリング指示メッセージエンキュー部は、バックエンドサーバーによって実現され、
前記スロットリング指示メッセージエンキュー部は、前記API呼び出しキューに保持された前記API呼び出しメッセージに直接または間接的に基づいて前記スロットリング指示メッセージを生成し、生成した前記スロットリング指示メッセージを前記スロットリング指示キューにエンキューし、
前記スロットリング情報更新部は、前記スロットリング指示キューに保持された前記スロットリング指示メッセージに基づいて前記スロットリング情報を更新することを特徴とする請求項1に記載のAPI呼び出し処理システム。 A throttling instruction queue for holding the throttling instruction message, which is a message instructing throttling, and
It is provided with a throttling instruction message enqueue unit that enqueues the throttling instruction message into the throttling instruction queue.
The call response unit, the throttling execution unit, the API call message enqueue unit, and the throttling information update unit are realized by a front-end server.
The throttling instruction message enqueue unit is realized by the back-end server.
The throttling instruction message enqueue unit generates the throttling instruction message directly or indirectly based on the API call message held in the API call queue, and the generated throttling instruction message is used as the throttling instruction. Enqueue to the queue,
The API call processing system according to claim 1, wherein the throttling information updating unit updates the throttling information based on the throttling instruction message held in the throttling instruction queue.
前記集計結果メッセージを前記集計結果キューにエンキューする集計結果メッセージエンキュー部と
を備え、
前記集計結果メッセージエンキュー部は、前記バックエンドサーバーによって実現され、
前記集計結果メッセージエンキュー部は、前記API呼び出しキューに保持された前記API呼び出しメッセージに基づいて前記集計結果メッセージを生成し、生成した前記集計結果メッセージを前記集計結果キューにエンキューし、
前記スロットリング指示メッセージエンキュー部は、前記集計結果キューに保持された前記集計結果メッセージに基づいて前記スロットリング指示メッセージを生成し、生成した前記スロットリング指示メッセージを前記スロットリング指示キューにエンキューし、
前記スロットリング指示メッセージエンキュー部が前記スロットリング指示メッセージを生成する間隔は、前記集計結果メッセージエンキュー部が前記集計結果メッセージを生成する間隔より長いことを特徴とする請求項2に記載のAPI呼び出し処理システム。 An aggregation result queue for holding an aggregation result message, which is a message indicating the aggregation result of the number of API calls, and
It is provided with an aggregation result message enqueue unit that enqueues the aggregation result message into the aggregation result queue.
The aggregation result message enqueue unit is realized by the back-end server.
The aggregation result message enqueue unit generates the aggregation result message based on the API call message held in the API call queue, and enqueues the generated aggregation result message into the aggregation result queue.
The throttling instruction message enqueue unit generates the throttling instruction message based on the aggregation result message held in the aggregation result queue, enqueues the generated throttling instruction message to the throttling instruction queue, and then enqueues the generated throttling instruction message into the throttling instruction queue.
The API call process according to claim 2, wherein the interval at which the throttling instruction message enqueue unit generates the throttling instruction message is longer than the interval at which the aggregation result message enqueue unit generates the aggregation result message. system.
前記APIの利用の制限であるスロットリングの内容を示すスロットリング情報に基づいて前記スロットリングを実行するスロットリング実行部と、
前記APIの呼び出し毎のメッセージであるAPI呼び出しメッセージを保持するためのAPI呼び出しキューに、前記API呼び出しメッセージを、前記APIが呼び出された場合にエンキューするAPI呼び出しメッセージエンキュー部と、
前記API呼び出しキューに保持された前記API呼び出しメッセージに直接または間接的に基づいて前記スロットリング情報を更新するスロットリング情報更新部と
をコンピューターに実現させることを特徴とするAPI呼び出し処理プログラム。 A call response unit that returns a response based on the data corresponding to the API call, and
A throttling execution unit that executes the throttling based on the throttling information indicating the throttling content that is a restriction on the use of the API, and a throttling execution unit.
In the API call queue for holding the API call message, which is a message for each API call, the API call message enqueue unit that enqueues the API call message when the API is called, and an API call message enqueue unit.
An API call processing program, characterized in that a computer realizes a throttling information update unit that updates the throttling information directly or indirectly based on the API call message held in the API call queue.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019198265A JP2021071929A (en) | 2019-10-31 | 2019-10-31 | Api call handling system and api call handling program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019198265A JP2021071929A (en) | 2019-10-31 | 2019-10-31 | Api call handling system and api call handling program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2021071929A true JP2021071929A (en) | 2021-05-06 |
Family
ID=75713993
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2019198265A Pending JP2021071929A (en) | 2019-10-31 | 2019-10-31 | Api call handling system and api call handling program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2021071929A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113885902A (en) * | 2021-08-23 | 2022-01-04 | 北京房江湖科技有限公司 | Application program interface updating method |
CN115296942A (en) * | 2022-07-22 | 2022-11-04 | 中电信数智科技有限公司 | Combined API (application program interface) counting charging device based on weighted response |
-
2019
- 2019-10-31 JP JP2019198265A patent/JP2021071929A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113885902A (en) * | 2021-08-23 | 2022-01-04 | 北京房江湖科技有限公司 | Application program interface updating method |
CN113885902B (en) * | 2021-08-23 | 2022-10-11 | 贝壳找房(北京)科技有限公司 | Application program interface updating method |
CN115296942A (en) * | 2022-07-22 | 2022-11-04 | 中电信数智科技有限公司 | Combined API (application program interface) counting charging device based on weighted response |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11651312B2 (en) | Combining batch and queueable technologies in a platform for large volume parallel processing | |
US20170054808A1 (en) | Rapid client-side component processing based on component relationships | |
JP6532385B2 (en) | INFORMATION PROCESSING SYSTEM, CONTROL METHOD THEREOF, AND PROGRAM | |
JPWO2006100752A1 (en) | Distributed processing management apparatus, distributed processing management method, distributed processing management program | |
JP2021071929A (en) | Api call handling system and api call handling program | |
JP4555145B2 (en) | Batch scheduling program, batch scheduling method, and batch scheduling apparatus | |
EP3816906A2 (en) | Method and device for processing transaction request in blockchain, electronic apparatus and storage medium | |
US9049164B2 (en) | Dynamic message retrieval by subdividing a message queue into sub-queues | |
US7523361B2 (en) | Error condition handling | |
Miyamae et al. | Performance improvement of the consortium blockchain for financial business applications | |
JP2008090798A (en) | Backup-control device of data-processing system, and system therefor | |
CN110381150B (en) | Data processing method and device on block chain, electronic equipment and storage medium | |
JP5870642B2 (en) | Information processing apparatus, management method, and management program | |
JP6179200B2 (en) | Information processing apparatus, device, information processing system, information processing method, and information processing program | |
JP2013066123A (en) | Image forming apparatus and job control program | |
JP5884566B2 (en) | Batch processing system, progress confirmation device, progress confirmation method, and program | |
US20210149726A1 (en) | Scheduling device, scheduling system, scheduling method, and non-transitory computer-readable medium | |
JP2015094976A (en) | Information processing apparatus, information processing method, and program | |
JP2017037469A (en) | Information processing system, priority processing method, information processor and program | |
US20200136802A1 (en) | QoS Assisted AES Engine for SSD Controller | |
JP6226666B2 (en) | Batch processing control program, batch processing system | |
US20240045633A1 (en) | Image forming apparatus, information processing method, and storage medium | |
JP2015109049A (en) | Electronic device and workflow generation program | |
JP2012185610A (en) | Information processor, work significance calculation method and work significance calculation program | |
JP2009129376A (en) | Request control method in client server system, request control program, and server device |