The present invention relates to a method of managing a memory, a computer, and a recording medium.
Ina society in which IT has been introduced into business of companies as a business system, an application server that is a constituent element of a system is an essential element. The application server is generally realized by an execution environment such as Java (registered trademark) or .NET (registered trademark). In a case where the application server is operated, a memory use amount in the execution environment is an important item to be monitored. Therefore, a person in charge of operation of the system always monitors a memory use amount of an object and takes, as part of an operational service, measures against reduction in performance of the system, a system crash, and the like caused by memory tuning and the memory use amount.
PTL 1 discloses a method of classifying generated objects by application and calculating a memory use amount for each application by specifying to which application a shared object referred to by a plurality of applications belongs.
PTL 1: JP-A-2012-221147
However, the method described in PTL 1 is not suitable in a case where a plurality of users execute an application or for calculating, in a system in which many applications are executed in a single virtual machine, a memory use amount for each application or for each piece of information related to a generator of an object (hereinafter, referred to as “generator property information”) such as user information. In the method described in PTL 1, because data is stored in a header area having a fixed size depending on an execution environment, the number of manageable applications or the number of pieces of manageable generator property information is limited.
A representative embodiment of the invention is such that a computer for executing a program to generate data executes a step of specifying, from a storage device in which a plurality of pieces of generator property information on the data and identification information that the data has are associated and held, data corresponding to each piece of the generator property information and calculating a memory use amount of the specified data, and a step of outputting the calculated memory use amount to an interface.
According to an aspect of the invention, it is possible to calculate a memory use amount used for each of a plurality of pieces of generator property information on data.
[
[
[
[
[
[
[
[
[
[
[
[
[
[
[
[
[
[
[
[
[
[
In this embodiment, as illustrated in a display screen 1, for example, a memory use amount of an object generated for each used application can be grasped with the use of an application ID that is a piece of generator property information. This is realized by storing, in a Java object, the generator property information related to generation of the object such as request-related information, user-related information, and generator information.
The Java object has a mark area 2, a klass area 3, and a data area 4. Generally, a header area means the mark area 2 and the klass area 3. A data area means the data area 4.
Embodiment 1 of a computer 101 to which the invention is applied will be described with reference to drawings. In this embodiment, identification information used for managing a plurality of pieces of generator property information is inserted into an object generated at the time of operation of a program 113 operated in a Java virtual machine 104. Thus, a memory use amount used by each object is calculated for each piece of the generator property information.
The computer 101 includes a CPU 102 and a memory 103. In the CPU 102, a Java virtual machine (Java VM) 104 is executed. By executing the program (application) 113 in the memory, the Java virtual machine 104 realizes a program reading unit 105, a program execution unit 106, an object generation unit 107, a generator property information ID generation unit 108, a generator property information ID insertion unit 109, generator property information recording unit 110, a generator property information analysis unit 111, and a generator property information output unit 112.
The memory 103 has the program 113 stored in the memory 103, a buffer 114, and a heap 118.
The program reading unit 105 reads the program 113 stored in the memory 103.
The program execution unit 106 executes the read program 113.
The object generation unit 107 generates, in the heap 118, an object needed to execute the program 113.
The generator property information ID generation unit 108 manages, with the use of a unique ID, the generator property information acquired during execution of the program 113, such as the request-related information, the user-related information, and program-related information, and registers the generator property information in a generator property information ID list 115.
The generator property information ID insertion unit 109 inserts a generator property information ID into the object.
The generator property information recording unit 110 acquires the generator property information ID from the object, records, in generator property information aggregate data 116, the generator property information ID together with information at the time of occurrence of an event such as an event occurrence time and the number of users simultaneously performing connection, and arranges the generator property information ID and the information at the time of occurrence of the event in the buffer 114.
The generator property information analysis unit 111 performs analysis processing on the generator property information aggregate data.
The generator property information output unit 112 outputs the generator property information aggregate data 116 and generator property information analysis data 117.
The buffer 114 is a storage area for storing the generator property information ID list 115, the generator property information aggregate data 116, and the generator property information analysis data 117.
The generator property information ID list 115 is a table in which the generator property information for each object is managed.
The request ID 302 is a unique ID applied to a request requested for the Java virtual machine 104 by a user.
The user ID 303 is a unique ID assigned to a user who uses the program 113 operated in the Java virtual machine 104.
The service ID 304 is an ID uniquely assigned to a service operated in the Java virtual machine 104. The service means an application group for achieving a purpose that has been determined in advance.
The application ID 305 is an ID uniquely assigned to the program 113 operated in the Java virtual machine 104.
The generator class name 306 is a class name corresponding to a generator of a generated object.
Note that session information, company (organization) information, generator method information of the object, source code information, generation path information of the object, and the like, which are not written in the generator property information ID list 115, may be also managed.
The generator property information aggregate data 116 is a table in which the generator property information is stored.
The event occurrence time 401 means a time at which an event occurs. The event means, for example, occurrence of GC, excessive user accesses, and mass consumption of a memory.
The event ID 402 is an ID of the event, which is generated in accordance with the kind of occurred event.
The thread ID 403 is a thread ID of a thread in which an object to be recorded is generated.
The number of users simultaneously performing execution 404 is the number of accesses to the Java virtual machine 104 at the time of occurrence of the event.
The object class name 405 is a class name of the object to be recorded.
The data size 411 indicates a size of each object.
The generator property information ID 400, the request ID 406, the user ID 407, the service ID 408, the application ID 409, and the generator class name 410 are similar to contents recorded in the generator property information ID list 115.
The generator property information analysis data 117 is a table showing analyzed data of the generator property information. Details thereof will be described below with reference to
The heap 118 is an area for storing arbitrary data that is dynamically secured at the time of execution of the program 113. A Java heap used at the time of execution of the Java virtual machine 104 is included in the heap 118 used in this embodiment. In this embodiment, the Java virtual machine 104 that incorporates generational garbage collection will be described. However, the Java virtual machine 104 in which another memory management method such as Garbage-First (G1) garbage collection is incorporated can be also applied to.
In a case where the Java virtual machine 104 incorporates the generational garbage collection, the Java heap 118 is managed by dividing the Java heap 118 into three areas, i.e., a New generation area (New area), an Old generation area (Old area), and a Permanent area (Perm area). The New area is managed by dividing the New area into two areas, i.e., an Eden area and a Survivor area. By dividing inside the Java heap 118 as described above, the garbage collection can be executed without influencing responsiveness.
Note that the program 113, the generator property information ID list 115, the generator property information aggregate data 116, and the generator property information analysis data 117 may be stored in an external storage device 119 such as a hard disk and a storage, instead of the memory 103. The computer 101 is connected to an external input/output device 120. The external input/output device 120 means a mouse and a keyboard for receiving input from a user, a display to which an analyzed result is outputted, and the like.
With reference to
In S501, the program reading unit 105 reads the program 113 stored in the memory 103.
In S502, the program execution unit 106 executes the read program 113.
In S503, the object generation unit 107 generates, in the heap 118, an object needed to execute the program 113.
In S504, the generator property information ID generation unit 108 generates an ID of generator property information acquired during execution of the program 113, such as request-related information, user-related information, program-related information, and generator information, and registers the ID in the generator property information ID list 115.
In S505, the generator property information ID insertion unit 109 inserts the generated generator property information ID into the object.
In S506, the generator property information recording unit 110 acquires the generator property information ID from the object at the time of occurrence of an event such as a time of occurrence of promotion processing of the object, and acquires corresponding generator property information from the generator property information ID list 115 by using the acquired ID as a key. At this time, the information at the time of occurrence of the event, such as the event occurrence time and the number of users simultaneously performing connection, is added as additional information, and the corresponding generator property information and the additional information are stored in the generator property information aggregate data 116. Then, the stored information is arranged in the buffer 114.
In S507, the generator property information analysis unit 111 determines whether to implement analysis processing in order to decide whether to analyze the generator property information aggregate data 116 generated in generator property information recording processing (S506) by using statistical processing or a mathematical optimization technique. In a case where the analysis processing is performed (S507: Yes), in generator property information analysis processing (S508), the statistical processing or the mathematical optimization processing suitable for a purpose of the analysis is implemented by using the generator property information aggregate data 116 as original data, and a result of the analysis is stored as the generator property information analysis data 117 in the buffer 114. In a case where the analysis processing is not performed (S507: No), the processing proceeds to generator property information output processing (S509).
Finally, in S509, the generator property information output unit 112 outputs the generator property information aggregate data 116 and the generator property information analysis data 117.
Hereinafter, each processing shown in
With reference to
Firstly, in S601, the generator property information ID generation unit 108 acquires, from the computer 101, the generator property information acquired by executing the program 113.
Subsequently, in S602, a unique generator property information ID is applied to the acquired generator property information.
Subsequently, in S603, the generator property information acquired in S601 and the generator property information ID applied in S602 are associated with each other and are stored as the generator property information ID list 115 in the buffer 114.
With reference to
Firstly, in S701, the generator property information ID insertion unit 109 checks a size of a free space of a target object.
Subsequently, in S702, the generator property information ID insertion unit 109 determines whether or not a free space exists in a data area of the target object. In a case where the free space does not exist (S702: No), a generator property information ID storage area is added to the target object in S703. In a case where the free space exists in the data area (S702: Yes), the processing proceeds to S704.
Finally, in S704, the generator property information ID insertion unit 109 inserts the generator property information ID into the free space. Note that an upper limit value of a size of the generator property information ID to be inserted may be determined based on the size of the free space of the object.
In this embodiment, a unit of alignment is set to 8 bytes, and variables are arranged from the top of the data area at a memory address on a byte basis. Generally, the memory has a boundary for each predetermined bytes depending on physical specification such as a processor and a cache line, and it is necessary to arrange data along the boundary. Arranging the data along the boundary is referred to as “alignment”. In a case where the data is arranged against the alignment, the program is adversely affected. For example, the program cannot be executed, or execution efficiency of the program is remarkably reduced.
A class of the program 113 in
The free spaces of the data area may be discrete in the memory 103 as in
Note that, in a case of Java, a location of the free space of the data area is determined depending on the arrangement order of the data stored in the class object serving as a model of the object. Therefore, as to information on which location in the object the generator property information is arranged, a free space can be calculated when the class object is loaded in program execution processing (S502). The information on such an arrangement location can be held in the class object or in another data structure.
With reference to
In this embodiment, the size of the free space of the object is checked in the program execution processing (S502). Alternatively, a largest free space size can be grasped by checking information on the class object for use in the application in advance. By checking the information in advance, the generator property information ID can be inserted without increasing a size of the object. Further, by calculating a largest value of the generator property information ID, which can be assigned based on the largest free space size, the generator property information ID can be assigned without increasing the size of the object.
With reference to
In S1001, the generator property information recording unit 110 determines whether or not there is an occurrence timing of the recording processing to ascertain whether or not the generator property information needs to be recorded. As the occurrence timing of the recording processing, a time of occurrence of an event is considered, such as a time of occurrence of promotion processing of the object, a time of occurrence of garbage collection (GC), and a time when a memory use amount exceeds a threshold that has been set in advance. In a case where there is the occurrence timing of the recording processing (S1001: Yes), the generator property information ID is acquired from the object to be recorded in S1002. In a case where there is no occurrence timing (S1001: No), the processing is terminated.
In S1003, the generator property information recording unit 110 acquires information from the generator property information ID list with the use of the acquired generator property information ID.
In S1004, the generator property information recording unit 110 acquires the information at the time of occurrence of the event related to the generator property information of an object to be recorded. The information at the time of occurrence of the event herein indicates information such as an occurrence time of the event to be recorded, the number of users simultaneously performing connection, and the number of threads at the time of occurrence of the event to be recorded. Herein, whether or not an object is the object to be recorded can be determined by using a reference flag that the object has, but another method may be used.
In S1005, the acquired generator property information and the information at the time of occurrence of the event are aggregated and are stored as the generator property information aggregate data 116 in the buffer 114.
Note that, at the time of such aggregate processing of the generator property information, information on a state of an inflow rate of the object and an existing amount of the object in the areas (Survivor area, Old area, and the like) configuring the heap 118 may be aggregated.
With reference to
In S1101, the generator property information analysis unit 111 acquires the generator property information aggregate. data 116 from the buffer 114.
In S1102, the generator property information analysis unit 111 implements the analysis processing such as the statistical processing and the mathematical optimization processing with respect to the acquired generator property information aggregate data 116. As specific examples of the analysis processing, there are various analysis methods such as prediction of a memory use amount after a predetermine time elapses using probabilistic analysis theory, abnormal use pattern analysis of a program-specific memory use amount with a discriminant analysis method, and operation tendency analysis of users with cluster analysis.
In S1103, the generated data is stored as the generator property information analysis data 117 in the buffer 114.
Herein, as a kind of the analysis processing, a sizing method of a memory will be exemplified.
The application ID, the request ID, and a memory use amount for each request corresponding to the request ID are extracted from the generator property information aggregate data 116 acquired in S1101.
With reference to
In S1401, the generator property information output unit acquires the generator property information aggregate data 116 and the generator property information analysis data 117 from the buffer 114.
In S1402, whether to process the acquired data is determined. In a case where the acquired data is processed (S1402: Yes), the processing proceeds to S1403, and in a case where the acquired data is not processed (S1402: No), the processing proceeds to S1404.
In S1403, outputting data is generated from the generator property information aggregate data 116 and the generator property information analysis data 117. Note that data process in this processing is mainly format conversion for a time when the data is outputted to a screen or outputted to a file. Note that the analysis processing (S1102) of
In S1404, the outputting data is outputted to the external input/output device 120.
In S1405, whether to output the outputting data to a file in the external storage device 119 is determined. In a case where the outputting data is outputted to a file (S1405: Yes), the data is outputted to the external storage device 119 in S1406. In a case where the outputting data is not outputted (S1405: No), the processing is terminated.
The outputting data 1502 displays the number of users simultaneously performing execution 1504 with respect to the Java virtual machine 104 and the memory use amount 1505 in each execution of GC. As the memory use amount 1505, any use amount may be displayed, such as the inflow rate of the object to the Old area of the heap 118, the existing amount of the object in the Old area of the heap 118, and a generation amount of the object in the New area of the heap 118. A memory use state may be outputted in a form of a CSV file (Comma-Separated Values file) or the like to the external storage device 119.
As described above, by applying the invention, it is possible to grasp a use state of an application server with the use of various analysis conditions.
Embodiment 2 of a computer 1701 to which the invention is applied will be described. Embodiment 2 is an embodiment in which control such as closing of a server and migration of a request are executed based on acquired generator property information in an environment of the plurality of computers 1701.
In this embodiment, a system control processing unit 121 and a load management unit 122 are provided in the Java virtual machine 104 and a system control data 123 is provided in the buffer 114.
In this embodiment, a system configuration in which the plurality of computers 1701 are connected and each of the computers 1701 includes the load management unit 122 is illustrated. However, any one of the computers 1701 configuring the system may include the load management unit 122, or a load management computer that is communicable to the computers 1701 may be newly provided.
In system control processing in S1801 that is a new processing step, closing processing of a computer 1701 in which a problem has occurred and request resumption processing are implemented.
With reference to
In S1901, in order to minimize a range of influence of the problem, there is performed system closing processing in which stop processing of a request and closing processing of the computer 1701 in which the problem has occurred are performed.
In S1902, in order to normally process the request migrated from the computer 1701 in which the problem has occurred, the request stopped in the system closing processing (S1901) is re-executed and the processing is terminated.
With reference to
In S2001, the system control processing unit 121 ascertains whether or not there is an occurrence timing of the control processing. In a case where there is the occurrence timing of the control processing (S2001: Yes), the processing proceeds to S2002, and program execution processing corresponding to the request that has caused the occurrence timing is stopped. In a case where there is no occurrence timing of the control processing (S2001: No), the processing is terminated. The occurrence timing of the control processing means, for example, a time of occurrence of Full GC, a time when the memory use amount of the request exceeds a threshold that has been set in advance, and a time when a use amount of the heap 118 exceeds a threshold that has been set in advance.
In S2003, the system control processing unit 121 ascertains whether or not the memory use amount of the program processing corresponding to the request exceeds the threshold that has been set in advance. This is performed to ascertain whether or not the memory use amount of the request corresponding to the stopped program execution processing has an abnormal value. In a case where the memory use amount does not exceed the threshold (S2003: No), in order to perform a re-execution request with respect to another computer 1701 in the system, session information of the stopped request is sent to the load management unit 122 in S2004. In a case where the memory use amount exceeds the threshold (S2003: Yes), the request is considered as an abnormal request, and the processing proceeds to S2005. A closing request of the computer 1701 in which the problem has occurred is sent to the load management unit 122.
In S2006, the system control processing unit 121 acquires information at the time of occurrence of the problem in order to record an occurrence status of the problem.
In S2007, in order to record the information at the time of occurrence of the problem, the system control processing unit 121 puts together the acquired information at the time of occurrence of the problem and a handling history and records the acquired information and the handling history as the system control data 123.
In S2008, the system control processing unit 121 implements recovery processing such as rebooting and garbage collection processing with respect to the computer 1701 in which the problem has occurred.
With reference to
In S2201, the system control processing unit 121 ascertains whether or not a resumption request of a stopped session is received from the load management unit 122. In a case where the resumption request is received (S2201: Yes), the session information is acquired from the load management unit 122 in S2202. Note that the session information may be acquired directly from the computer 1701 in which the problem has occurred, instead of the load management unit 122. In a case where the resumption request is not received (S2201: No), the processing is terminated.
In S2203, in order to return a result in response to the request, the system control processing unit 121 re-executes the program processing corresponding to the stopped request, and the processing is terminated.
Note that, in this embodiment, the session and the request are migrated to another computer 1701 that is normally operated. However, scale-out processing may be performed on another computer 1701 in a hot standby state, and the session and the request may be migrated to the computer 1701 that has been subjected to the scale-out processing.
By implementing the above processing, even in a case where abnormality occurs in the memory use amount of the computer 1701, it is possible to return the result in response to the request without shutting down the system.
Hereinabove, the embodiments for implementing the invention have been described. However, the invention is not limited to those examples, and various configurations and operations are applicable within the scope of the invention.
An example where function units in the embodiments are realized by cooperating a program and a CPU has been described above, but a part or all thereof can be also realized as hardware.
The information managed while being shown in various table forms in the embodiments is not limited to the table forms. Various kinds of information may be displayed on an operation screen of a client.
Note that a program for realizing the function units in the embodiments can be stored in an electrical.electronic and/or magnetic non-transitory recording medium.
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/JP2013/061567 | 4/19/2013 | WO | 00 |