Program, method for processing information, and information processor
By identifying and utilizing only necessary packages based on meta information in the source code, the device accelerates the construction and startup of function execution environments in cloud services, addressing the inefficiencies of traditional package integration methods.
Patent Information
- Application Number
- JP2023034045
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-03-06
- Publication Date
- 2024-09-19
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The challenge of building a function execution environment in a cloud service environment is the time-consuming process of acquiring and integrating numerous packages, which can lead to delays in startup and function execution.
An information processing device identifies first and second packages based on meta information in the source code, constructing the execution environment using only the necessary packages, thereby reducing the time required to build and start the function execution environment.
This approach speeds up the startup process by minimizing the acquisition of unnecessary packages, reducing cold start delays, and optimizing resource usage in cloud service environments.
Smart Images

Figure 2024125912000001
Abstract
Description
[Technical field]
[0001] The present invention relates to a program, an information processing method, and an information processing device. [Background technology]
[0002] Nowadays, instead of owning an information processing environment for executing application software, it is becoming more common to use an information processing environment owned by a service provider via a network. A service that allows users to use an information processing environment via a network is sometimes called a cloud service. For example, a cloud service is a service that deploys a lightweight program created by a user called a serverless function and executes the serverless function for a short period of time when a specific event occurs. For example, a virtualization technology such as container-based virtualization is used to execute the serverless function. In container-based virtualization, a container that collects resources such as libraries used to execute a specific program is defined as the execution environment for the program.
[0003] Meanwhile, various methods have been considered for improving the execution performance of programs. For example, in database management systems, a technique has been proposed that applies a method called micro-specialization to eliminate unnecessary code from an original program, such as branch statements that refer to local invariants in branch condition evaluation. In this proposal, DBMS (DataBase Management System) code identified as unnecessary due to locally invariant variables is replaced with micro-specialized DBMS code that performs the same function as the DBMS code with fewer instructions.
[0004] In addition, a method has been proposed that determines program blocks whose source code should be improved based on the execution status recorded by executing an execution module, thereby making it possible to allocate limited developer resources to optimization work on program blocks that will produce significant performance improvements.
[0005] A code detection method has been proposed that reduces the processing load of dynamic analysis by detecting target code to be subjected to dynamic analysis within a portion of program code based on the results of static analysis of the program code. [Prior art documents] [Patent documents]
[0006] [Patent Document 1] JP 2018-14142 A [Patent Document 2] JP 2009-211424 A [Patent Document 3] JP 2008-217751 A Summary of the Invention [Problem to be solved by the invention]
[0007] Here, various packages that provide modules for executing the function written by the user are referenced in the source code. In addition, other packages may be used to execute processes in a certain package. For this reason, when constructing an execution environment for a function, a predetermined set of packages that may be used in the user's function may be acquired by the device that constructs the execution environment for the function. However, this method may require a large number of packages to be acquired, and may take a long time to construct the execution environment for the function.
[0008] In one aspect, the present invention aims to speed up the startup of an execution environment for a function. [Means for solving the problem]
[0009] In one embodiment, a program is provided that causes a computer to execute the following process: identify a first package used to execute a function described in a source code based on the source code, identify a second package based on meta-information included in the first package and indicating a second package referenced by the first package, and construct an execution environment for the function using the source code, the first package, and the second package.
[0010] In one embodiment, there is provided an information processing method executed by a computer, and an information processing device having a storage unit and a processing unit. Effect of the Invention
[0011] On the one hand, it can speed up the startup of the function execution environment. [Brief description of the drawings]
[0012] [Figure 1] FIG. 1 is a diagram illustrating an information processing apparatus according to a first embodiment. [Diagram 2] FIG. 11 illustrates an example of an information processing system according to a second embodiment. [Diagram 3] FIG. 2 illustrates an example of hardware of a relay server. [Figure 4] FIG. 2 is a diagram illustrating an example of functions of the information processing system. [Diagram 5] FIG. 13 is a diagram illustrating an example of a flow of execution of a function. [Figure 6] FIG. 13 illustrates an example of processing when a function is started. [Figure 7] FIG. 13 illustrates an example of importing a package. [Figure 8] FIG. 13 is a diagram illustrating an example of optimization of a function execution environment. [Figure 9] FIG. 13 is a diagram illustrating an example of specifying a package to be incorporated into source code. [Figure 10] FIG. 4 is a diagram illustrating an example of dictionary data. [Figure 11]FIG. 13 is a diagram illustrating an example of a package group that cannot be identified from a function of the source code. [Figure 12] FIG. 13 is a diagram showing an example of a package used in another package. [Figure 13] FIG. 13 is a diagram showing an example of identifying another package based on meta-information. [Figure 14] FIG. 13 illustrates an example of a package correspondence table. [Figure 15] FIG. 13 illustrates an example of a function management table. [Figure 16] FIG. 2 is a diagram illustrating examples of static and dynamic references. [Figure 17] FIG. 13 is a diagram illustrating an example of a discrepancy between the relationship between related packages and actual processing. [Figure 18] FIG. 13 illustrates an example of a stack trace. [Figure 19] FIG. 13 illustrates an example of deleting unused classes; [Figure 20] FIG. 13 illustrates an example of deleting unnecessary packages by replacing a package. [Figure 21] FIG. 13 illustrates an example of replacing a method in a package. [Figure 22] 11 is a flowchart illustrating an example of service construction. [Diagram 23] 13 is a flowchart illustrating an example of function execution control. [Figure 24] 13 is a flowchart illustrating an example of function registration. [Diagram 25] 13 is a flowchart showing an example of function processing (1). [Figure 26] 13 is a flowchart illustrating an example of updating an analysis result. [Figure 27] 13 is a flowchart showing an example of function processing (2). DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0013] The present embodiment will be described below with reference to the drawings. [First embodiment] A first embodiment will be described.
[0014] FIG. 1 is a diagram illustrating an information processing apparatus according to a first embodiment. The information processing device 10 constructs an execution environment for a function defined by a user. The execution environment for the function is realized by, for example, a container. For example, the information processing device 10 is connected to an execution node 20 via a network, and constructs a function execution environment 21 using hardware resources such as a CPU (Central Processing Unit) and a RAM (Random Access Memory) of the execution node 20. The function execution environment 21 is an execution environment for a function defined by a user.
[0015] The execution node 20 may be a physical computer (physical machine) or a virtual computer (virtual machine) that operates using the hardware resources of a physical machine. The function executed by the function execution environment 21 may be a so-called serverless function. The information processing device 10 may be referred to as a computer. The function execution environment 21 may be constructed on the information processing device 10.
[0016] The information processing device 10 has a storage unit 11 and a processing unit 12. The storage unit 11 may be a volatile semiconductor memory such as a RAM, or a non-volatile storage such as a hard disk drive (HDD) or a flash memory. The storage unit 11 stores source code 30 created by a user. The source code 30 shows an example of a description of a function "function()". The description of the specific processing content of the function "function()" is abbreviated as "<logic>".
[0017] The processing unit 12 is, for example, a processor such as a CPU, a GPU (Graphics Processing Unit), or a DSP (Digital Signal Processor). However, the processing unit 12 may include an electronic circuit for a specific purpose such as an ASIC (Application Specific Integrated Circuit) or an FPGA (Field Programmable Gate Array). The processor executes a program stored in a memory such as a RAM (which may be the storage unit 11). A set of multiple processors may be called a "multiprocessor" or simply a "processor."
[0018] The processing unit 12 identifies a first package used to execute a function included in the source code 30, based on the source code 30. A package is a collection of prepared program parts, and is made public so that it can be incorporated into a user's source code for use. Note that a class in Java (registered trademark) or C++, or a function in the C language, is an example of a program part.
[0019] The processing unit 12 detects reserved words such as "import" prepared in the programming language used to write the source code 30 from the source code 30, and can identify the first package from the class name specified by the reserved word. For example, the class name includes information capable of identifying a package (e.g., PKG_A), such as "PKG_A.Data operation." "PKG" is an abbreviation for package.
[0020] However, there is a possibility that a class name written together with a reserved word such as "import" and a package file name including that package do not match. Therefore, the processing unit 12 may analyze all packages in advance to create dictionary data indicating the correspondence between class names and packages, store the data in the storage unit 11, and identify a package corresponding to a class name in an import statement or the like based on the dictionary data. Note that in an import statement or the like, not only the fully qualified name of a class but also its prefix may be specified. For this reason, it is preferable that the processing unit 12 also registers the correspondence between prefixes and packages in the dictionary data.
[0021] For example, the processing unit 12 identifies a package 40 (PKG_A) and a package 50 (PKG_B) as the first package from the import statements included in the source code 30.
[0022] The processing unit 12 identifies the second package based on meta-information included in the first package and indicating the second package referenced by the first package. For example, the package 40 includes meta-information 40a. The meta-information 40a includes information on the package 61 ("PKG_C") and the package 63 ("PKG_E") referenced by the package 40. Furthermore, the package 50 includes meta-information 50a. The meta-information 50a includes information on the package 65 ("PKG_G") referenced by the package 50. Therefore, the processing unit 12 identifies the packages 61 and 63 referenced by the package 40 and the package 65 referenced by the package 50 based on the meta-information 40a and 50a. The packages 61, 63, and 65 are examples of the second package.
[0023] The processing unit 12 may identify the second package based on the meta-information included in the first package before identifying the first package from the source code 30. For example, the processing unit 12 may create correspondence information between the first package and the second package in advance and store it in the storage unit 11, and identify the second package using the correspondence information when constructing the function execution environment 21 by the source code 30.
[0024] The processing unit 12 constructs an execution environment for the function using the source code 30, the first package, and the second package. For example, the processing unit 12 downloads packages 61, 63, and 65 as the identified second package from a predetermined device via a network. At this time, the processing unit 12 also downloads packages 40 and 50 if they have not been acquired yet. Then, the processing unit 12 constructs a function execution environment 21 on the execution node 20 using the source code 30, the packages 40 and 50, and the packages 61, 63, and 65. After the function execution environment 21 is constructed, the function corresponding to the source code 30 is executed on the execution node 20.
[0025] In this way, according to the information processing device 10, a first package used to execute a function described in the source code 30 is identified based on the source code 30. A second package is identified based on meta-information included in the first package, the meta-information indicating a second package referenced by the first package. An execution environment for the function is constructed using the source code 30, the first package, and the second package. This enables the information processing device 10 to speed up the startup of the execution environment for the function.
[0026] Here, in the example of the first embodiment, the packages 61, 63, and 65 are included in the package group 60. The package group 60 is a collection of packages 61, 62, 63, 64, and 65. The packages 40 and 50 and each package in the package group 60 are prepared in advance as a collection of packages to be provided to the user. As a comparative example, when constructing an execution environment for a function in the source code 30, the information processing device 10 may acquire the packages 40 and 50 and all the packages in the package group 60 and use them in the construction. However, if all of these packages are acquired randomly to construct an execution environment, an extra package that is not used by the function in the source code 30 may be included, and it takes time to construct the execution environment to acquire the extra package. In addition, if all of the package group 60 that may be used by the user's function is acquired, the package group 60 will become bloated as new packages are added, and the time required to construct the execution environment will also increase.
[0027] Therefore, the information processing device 10 can identify a second package referenced by a first package identified from the source code 30, based on meta information included in the first package, and extract only the second package from the package group 60. In the above example, the processing unit 12 acquires packages 61, 63, and 65 from the package group 60 and uses them to build the function execution environment 21, but does not acquire packages 62 and 64. In this way, since unnecessary packages are not acquired in the construction of the function execution environment 21, the time required to build the function execution environment 21 is shortened, and the time to start up the function execution environment is shortened.
[0028] Also, as described above, after the function execution environment 21 is constructed, if the function is executed continuously within a predetermined time, the function is executed by the already constructed function execution environment 21 without performing construction processing of a new execution environment. If the function is not executed for a predetermined time, the resources reserved for the function execution environment 21 are released, and when the function is executed again, the function is executed from construction processing of a new execution environment. In this way, starting a function from construction processing of an execution environment is sometimes called a cold start. In contrast, starting a function in an already constructed execution environment after a cold start is sometimes called a warm start. According to the information processing device 10, in such a function execution method, it is possible to speed up the cold start. As a result, it is also possible to reduce the function processing delay caused by the cold start.
[0029] [Second embodiment] Next, a second embodiment will be described. FIG. 2 illustrates an example of an information processing system according to the second embodiment.
[0030] The information processing system 1 provides a cloud service. The information processing system 1 has multiple server computers. The information processing system 1 is connected to a network 70. The network 70 may be a local area network (LAN), a wide area network (WAN), or the Internet. The information processing system 1 lends out hardware resources of the multiple server computers to users via the network 70, making them available for use by the users. Services provided by the information processing system 1 include the execution of serverless functions. The information processing system 1 charges users according to the services they use.
[0031] Here, "serverless" means building and operating a system without being aware of servers. In "serverless," resources such as CPU, memory, and storage are allocated from the system when certain conditions are met, triggered by a trigger called a function, a pre-set program is executed, and the resources are released after the program has finished. Because a program is run in response to a function, systems that employ serverless are sometimes called FaaS (Function as a Service). Also, a serverless function is a program executed by a serverless system, and hereinafter will be referred to simply as a function.
[0032] A terminal device 80 is connected to the network 70. The terminal device 80 is a client computer operated by a user. The user can operate the terminal device 80 to use the services of the information processing system 1.
[0033] The multiple server computers included in the information processing system 1 include a relay server 100, an execution server 200, . . . The relay server 100 is a server computer that accepts a function call from the terminal device 80. In response to the function call, the relay server 100 causes the execution server 200 to execute the function. The relay server 100 obtains the processing result of the function from the execution server 200 and responds to the terminal device 80. The relay server 100 is an example of the information processing device 10 of the first embodiment.
[0034] The execution server 200 is a server computer that executes a user's function. The user's function is executed using a function execution environment, such as a container, in the execution server 200. The first execution of the function is a cold start. The cold start includes downloading a package used to execute the function. The execution server 200 is an example of the execution node 20 of the first embodiment.
[0035] The relay server 100 and the execution server 200 may be realized by a virtual machine that operates using the CPU and memory of a physical machine in the information processing system 1. If a function is executed consecutively in a relatively short time after a cold start, it is called a warm start. In a warm start, a function can be executed in a shorter time than in a cold start because an already constructed function execution environment can be used.
[0036] FIG. 3 is a diagram illustrating an example of hardware of the relay server. The relay server 100 has a processor 101, a RAM 102, a HDD 103, a GPU 104, an input interface 105, a medium reader 106, and a communication interface 107. These units that the relay server 100 has are connected to a bus inside the relay server 100. The processor 101 corresponds to the processing unit 12 in the first embodiment. The RAM 102 or the HDD 103 corresponds to the storage unit 11 in the first embodiment.
[0037] The processor 101 is an arithmetic device that executes program instructions. The processor 101 is, for example, a CPU. The processor 101 loads at least a part of the programs and data stored in the HDD 103 into the RAM 102 and executes the programs. The processor 101 may include multiple processor cores. The relay server 100 may also have multiple processors. The processing described below may be executed in parallel using multiple processors or processor cores. A set of multiple processors may also be called a "multiprocessor" or simply a "processor."
[0038] The RAM 102 is a volatile semiconductor memory that temporarily stores programs executed by the processor 101 and data used in calculations by the processor 101. Note that the relay server 100 may include a type of memory other than a RAM, and may include multiple memories.
[0039] The HDD 103 is a non-volatile storage device that stores software programs such as an OS (Operating System), middleware, and application software, as well as data. Note that the relay server 100 may include other types of storage devices, such as a flash memory or an SSD (Solid State Drive), or may include multiple non-volatile storage devices.
[0040] The GPU 104 outputs an image to a display 111 connected to the relay server 100 in accordance with an instruction from the processor 101. As the display 111, any type of display can be used, such as a CRT (Cathode Ray Tube) display, a liquid crystal display (LCD: Liquid Crystal Display), a plasma display, or an organic EL (OEL: Organic Electro-Luminescence) display.
[0041] The input interface 105 acquires an input signal from an input device 112 connected to the relay server 100, and outputs the input signal to the processor 101. The input device 112 may be a pointing device such as a mouse, a touch panel, a touch pad, or a trackball, a keyboard, a remote controller, a button switch, or the like. In addition, a plurality of types of input devices may be connected to the relay server 100.
[0042] The medium reader 106 is a reading device that reads programs and data recorded on a recording medium 113. For example, a magnetic disk, an optical disk, a magneto-optical disk (MO: Magneto-Optical disk), a semiconductor memory, etc. can be used as the recording medium 113. Magnetic disks include flexible disks (FD: Flexible Disks) and HDDs. Optical disks include compact discs (CDs) and digital versatile discs (DVDs).
[0043] The medium reader 106 copies, for example, the program or data read from the recording medium 113 to another recording medium such as the RAM 102 or the HDD 103. The read program is executed, for example, by the processor 101. Note that the recording medium 113 may be a portable recording medium, and may be used for distributing the program or data. Also, the recording medium 113 and the HDD 103 may be referred to as computer-readable recording media.
[0044] The communication interface 107 is connected to a network 114 and communicates with other information processing devices via the network 114. The network 114 is an internal network of the information processing system 1. The communication interface 107 may be a wired communication interface connected to a wired communication device such as a switch or a router, or a wireless communication interface connected to a wireless communication device such as a base station or an access point.
[0045] The execution server 200 and the terminal device 80 are also realized using the same hardware as the relay server 100 . FIG. 4 is a diagram illustrating an example of functions of the information processing system.
[0046] The relay server 100 includes a storage unit 120 and a proxy 130. The storage unit 120 uses storage areas such as a RAM 102 and a HDD 103. The proxy 130 is realized by the processor 101 executing a program stored in the RAM 102.
[0047] The storage unit 120 stores data used in the processing of the proxy 130. The data stored in the storage unit 120 includes source code of a function written by a user. In the second embodiment, Java is given as an example of a programming language used to write the source code. The data stored in the storage unit 120 also includes information indicating a correspondence between a class and a package including the class. The data stored in the storage unit 120 further includes information indicating a correspondence between a user's function and a package used in the function.
[0048] The proxy 130 relays a function call from the terminal device 80 to the execution server 200. The proxy 130 may obtain a result of the function execution by the execution server 200 and transmit it to the terminal device 80. The proxy 130 has an execution environment creation unit 131, an optimization unit 132, a function execution instruction unit 133, and an execution environment deletion unit 134.
[0049] The execution environment creation unit 131 creates a function execution environment 210 on the execution server 200. The function execution environment 210 is an execution environment for a function defined by a user, and is realized by a container or the like as described above. In addition to the user's function body, various packages are incorporated into the container.
[0050] The optimization unit 132 optimizes packages included in the function execution environment 210. Specifically, the optimization unit 132 aims to speed up the cold start of the function execution environment 210 by excluding packages that are not used for executing the user's functions from the function execution environment 210.
[0051] The function execution instruction unit 133 instructs the execution server 200 to execute a function in response to a function call received from the terminal device 80. The function execution instruction unit 133 obtains the execution result of the function from the execution server 200 and responds to the terminal device 80. Here, when function calls are received consecutively in a relatively short period of time after a cold start, creation of the function execution environment 210 is omitted and the execution server 200 is instructed to execute the function. In this case, a warm start is performed and the function is executed by the constructed function execution environment 210.
[0052] If the function is not called even after a predetermined time has elapsed after a cold start, the execution environment deletion unit 134 deletes the function execution environment 210 of the function from the execution server 200. The execution server 200 has a function execution environment 210. For example, when the function execution environment 210 is created, resources of the execution server 200 such as a processor and RAM are allocated to the function execution environment 210 such as a container. When the function execution environment 210 is deleted, the resources of the execution server 200 that were allocated to the function execution environment 210 are released.
[0053] Next, the flow of function execution by the function execution environment 210 will be described. FIG. 5 is a diagram illustrating an example of the flow of execution of a function. First, the proxy 130 accepts a function call from the terminal device 80 (step ST1). At this stage, the function execution environment 210 for the corresponding function has not yet been created in the execution server 200. Therefore, the proxy 130 creates the function execution environment 210 on the execution server 200 (step ST2). As described above, the function execution environment 210 is, for example, a container. Then, the proxy 130 instructs the execution server 200 to execute the function using the function execution environment 210 (step ST3). The period from step ST2 to step ST3 corresponds to the period during which a cold start is performed.
[0054] Before a predetermined time has elapsed since the function execution in step ST3, the proxy 130 receives a function call for the same function from the terminal device 80 (step ST4). Then, the proxy 130 instructs the execution server 200 to execute the function using the function execution environment 210 (step ST5). Since the created function execution environment 210 can be used for the function call in step ST4, a warm start is performed.
[0055] After that, the proxy 130 detects that a predetermined time has elapsed without the function being executed. Then, the proxy 130 deletes the function execution environment 210 from the execution server 200 (step ST6). The predetermined time in steps ST4 and ST6 is, for example, about 5 minutes.
[0056] FIG. 6 is a diagram illustrating an example of processing when a function is started. The time chart c1 illustrates the process performed when a function is started. The direction from the left to the right in FIG. 6 is the positive direction of time. For example, when a function is started in a cloud service, first, a code download is performed, and then the execution environment is started. In the code download, a package file used by the function is downloaded from a specified server. In the execution environment start, a function execution environment 210 is created and started based on the specified memory, runtime, and various settings. The period of the code download and the execution environment start is called a cold start duration.
[0057] Then, when the function execution environment 210 is started, the initialization code and the handler code are executed in sequence. The period during which the initialization code and the handler code are executed is called the invocation duration.
[0058] The time it takes for a function to prepare during a cold start is not charged, but a cold start will slow down the overall execution time of your function. Here, packages loaded by functions etc. will be described.
[0059] FIG. 7 is a diagram illustrating an example of importing a package. Packages are used to classify and manage multiple classes in program code. Developers can specify and use classes in external packages, such as packages published on the Web, as well as classes within the project they are developing.
[0060] In the example of Figure 7, a developer creates a package group P1 in a project under development. The package group P1 includes packages A and B. Meanwhile, the developer can load and use a package group P2a from outside of an existing package group P2 that is publicly available on the Web, etc., in the project. The existing package group P2 includes packages C, D, E, .... The package group P2a includes packages C and E.
[0061] In this way, by using existing external packages, the amount of source code to be developed can be reduced and development efficiency can be improved. In Java, packages are published with the file name "~.jar".
[0062] Next, an example of optimization of the function execution environment 210 by the optimization unit 132 will be described. FIG. 8 is a diagram illustrating an example of optimization of a function execution environment. First, the optimization unit 132 prepares an environment including all the packages as the function execution environment 210a (step ST11). For the sake of simplicity, it is assumed here that an environment including all four packages, namely, a DB access PKG, a storage PKG, a mail transmission PKG, and a session PKG, is prepared.
[0063] Next, the optimization unit 132 identifies, from among all these packages, packages that are not used in the user's functions, that is, unnecessary packages (step ST12). For example, from among the above four packages, the optimization unit 132 identifies the storage PKG, the mail transmission PKG, and the session PKG as unnecessary packages.
[0064] Then, the optimization unit 132 optimizes the function execution environment 210a into the function execution environment 210 by deleting unnecessary packages from among all the prepared packages (step ST13). For example, the optimization unit 132 creates the function execution environment 210 without using the unnecessary packages, that is, the storage PKG, the mail transmission PKG, and the session PKG.
[0065] The following describes in more detail the optimization process by the optimization unit 132, including the optimization illustrated in Fig. 8. First, an example of optimization by the optimization unit 132 through static analysis of source code will be described.
[0066] FIG. 9 is a diagram showing an example of specifying a package to be incorporated into source code. When writing source code that uses a class included in a package, information indicating which class of the package is to be used is written, for example, at the beginning of the source code. Therefore, when accepting a function registration by a user, the optimization unit 132 can identify the related package based on the corresponding description.
[0067] For example, source code 500 is a description of a function "function()," and shows an example in which an external class is imported by the reserved word "import" at the beginning. Specifically, source code 500 describes "import DB access PKG.data operation.registration." From this description, optimization unit 132 identifies "DB access PKG" as a related package. Also, source code 500 describes "import storage PKG.search." From this description, optimization unit 132 identifies "storage PKG" as a related package.
[0068] However, there is a possibility that a class name written using an import statement does not include a name that exactly matches the package file name of the package that includes the class. Therefore, the optimization unit 132 creates dictionary data indicating which class is included in which package by analyzing the inside of the package in advance, and stores the dictionary data in the storage unit 120. Next, an example of the dictionary data will be described.
[0069] FIG. 10 is a diagram illustrating an example of dictionary data. Dictionary data 121 is created by optimization unit 132 and stored in storage unit 120. Dictionary data 121 includes items for class name or prefix and package file name. In the item for class name or prefix, a class name or prefix that exists in a package is registered. A prefix is the portion written to the left of any comma in a class name written with commas between them, and the description to the right of the comma is a wildcard. A wildcard is represented by an asterisk symbol "*". In the item for package file name, a file name of a package corresponding to a class name or prefix is registered.
[0070] For example, the dictionary data 121 has a record with a class name or prefix “org.xxxxx.api.admin.progress.StatusMirroringImpl” and a package file name “xxxxx-api.jar.” This record indicates that the class with the class name “org.xxxxx.api.admin.progress.StatusMirroringImpl” is included in the package with the package file name “xxxxx-api.jar.”
[0071] Furthermore, the dictionary data 121 has a record of a class name or prefix "org.xxxxx.internal.api.*" and a package file name "internal-api.jar." This record indicates that the class indicated by the prefix "org.xxxxx.internal.api.*" is included in the package with the package file name "internal-api.jar."
[0072] Furthermore, the dictionary data 121 has records of class names or prefixes "org.xxxxx.*", package file names "xxxxx-api.jar", and "internal-api.jar". The records indicate that the class indicated by the prefix "org.xxxxx.*" is included in the package with the package file name "xxxxx-api.jar" and the package with the package file name "internal-api.jar".
[0073] Records indicating the correspondence between other class names or prefixes and package file names are also registered in the dictionary data 121. The dictionary data 121 may be created, for example, by a data structure of a dictionary type list.
[0074] FIG. 11 is a diagram showing an example of a package group that cannot be identified from a function in the source code. Here, it is possible to identify the package used by the function from the source code by referencing the import statement, etc., as shown in the example of Figure 9. On the other hand, if the package in question further uses another package, it is not possible to identify the other package only from the information written in the source code of the function.
[0075] For example, tree t1 indicates a relationship in which a function defined by a user uses two packages, a DB access PKG and a storage PKG, and the DB access PKG and the storage PKG each use two other packages. In this case, the package group used by the DB access PKG and the storage PKG cannot be identified from the source code. Furthermore, even if each package included in the package group used by the DB access PKG and the storage PKG further uses another package, the other package cannot be identified from the source code.
[0076] Therefore, the optimization unit 132 obtains the relationship in which a package uses another package by analyzing each package. FIG. 12 is a diagram showing an example of a package used in another package.
[0077] Tree t2 shows a relationship in which package PKG_A uses packages PKG_C and PKG_D. Tree t3 shows a relationship in which package PKG_B uses packages PKG_E and PKG_F.
[0078] The optimization unit 132 acquires in advance the relationship between packages prepared by the provider by analyzing the package. The optimization unit 132 can acquire the relationship between packages based on meta information included in each package.
[0079] FIG. 13 is a diagram showing an example of identifying another package based on meta-information. Package p1 includes meta information m1. The meta information m1 includes a list of other packages referenced by package p1. For example, a file built from a Maven project requires pom.xml during build, so the package file also includes pom.xml. pom.xml describes information indicating other packages used by the package. For this reason, pom.xml is an example of meta information m1.
[0080] The optimization unit 132 unpacks, for example, a jar file in a package and analyzes the meta information m1. Code m1a is an example of a description of pom.xml, which is an example of the meta information m1. In the code m1a, an artifactId tag in a dependency tag describes information about other packages referenced by the package p1.
[0081] In the example of code m1a, the optimization unit 132 identifies "hk2.jar," "jakarta.xml.bind-api.jar," and "jaxb-osgi.jar" as file names of other packages referenced by package p1. The optimization unit 132 registers the relationships between the identified packages in the package correspondence table.
[0082] FIG. 14 is a diagram illustrating an example of a package correspondence table. The package correspondence table 122 is stored in the storage unit 120. The package correspondence table 122 is information indicating the correspondence between a certain package and other packages referenced by the package. The package correspondence table 122 includes items for a package and a related package. In the package item, the file name of the package is registered. In the related package item, the file name of another package referenced by the package registered in the package item, i.e., the related package, is registered.
[0083] For example, package correspondence table 122 has a record of a package "PKG_XXX.jar" and related packages "hk2.jar", "jakarta.xml.bind-api.jar", and "jaxb-osgi.jar". This record indicates that the package with the file name "PKG_XXX.jar" uses three packages with the file names "hk2.jar", "jakarta.xml.bind-api.jar", and "jaxb-osgi.jar".
[0084] Based on the package correspondence table 122, the optimization unit 132 identifies a package used by a function defined by the user and other packages used by that package, and registers them in the function management table.
[0085] FIG. 15 illustrates an example of a function management table. The function management table 123 is stored in the storage unit 120. The function management table 123 is information for managing user functions. The function management table 123 is created, for example, for each user. The function management table 123 includes items of user function name and related package. The name of a function defined by a user is registered in the user function name item. The related package item is registered with the file name of a related package related to the function. The related package item is registered with the file name of a package directly identified from the function, as well as the file names of other packages identified in a chain reaction from meta information of the package.
[0086] For example, the function management table 123 has a record of a user function name "function F1", related packages "xxxxx-api.jar", "internal-api.jar", .... The record indicates the relationship in which the function with the user function name "function F1" uses packages with file names "xxxxx-api.jar", "internal-api.jar".
[0087] In this way, the optimization unit 132 can create the function management table 123 by statically analyzing the source code and packages written by the user. The execution environment creation unit 131 can avoid acquiring unnecessary packages by creating the function execution environment 210 based on the function management table 123.
[0088] On the other hand, there may be cases where a dynamic class reference exists in the execution of a function, or where there is a discrepancy between the relationship between the related packages extracted by static analysis and the actual processing. Therefore, the optimization unit 132 performs optimization by dynamic analysis in addition to optimization by static analysis.
[0089] FIG. 16 is a diagram showing examples of static and dynamic references. There are two ways to refer to a class: static reference and dynamic reference. Figure 16(A) shows an example of static reference (static class reference). Figure 16(B) shows an example of dynamic reference (dynamic class reference).
[0090] For example, a class that is statically referenced in an executable file e1 of a certain program is always loaded from package p11 that contains that class and expanded into memory at run time, whereas a class that is dynamically referenced in executable file e1 is loaded from package p12 that contains that class and expanded into memory depending on the process at run time.
[0091] Static references are determined at compile time and can be identified by static analysis, but dynamic references can only be determined at run time and cannot be detected by static analysis. FIG. 17 is a diagram showing an example of a deviation in the relationship between related packages and actual processing.
[0092] List L1 shows the following relationships among six packages PKG_A to PKG_F identified by static analysis: Method A1 of package A references package PKG_B. Method A2 of package A references package PKG_C. In addition, the packages referenced by package PKG_C are packages PKG_D, PKG_E, and PKG_F.
[0093] Consider a case where only method A1 is used in package PKG_A in actual processing. In this case, method A2 is not executed, so package PKG_C is unnecessary. Not only that, but packages PKG_D, PKG_E, and PKG_F linked to package PKG_C are also unnecessary. List L2 shows that the four packages, PKG_C to PKG_F, are unnecessary for the actual processing of package PKG_A.
[0094] In order to remove such unnecessary packages, the optimization unit 132 performs optimization by dynamic analysis as follows. FIG. 18 illustrates an example of a stack trace.
[0095] Optimizer 132 measures which method was actually used when executing a function. The use of a method indicates that the method is called and executed. The use of a method means that the class corresponding to the method is used, and also means that the package including the class is used (the package including the class is used).
[0096] For example, in a JVM (Java Virtual Machine), it is possible to acquire a stack trace 124 as standard. The stack trace 124 is information indicating a processing history such as other functions and methods called during the execution process of a user's function. For example, the stack trace 124 records information such as which method of which class in which package was used in the order of processing. The optimization unit 132 acquires the stack trace 124 from the execution server 200 and stores it in the storage unit 120.
[0097] The optimization unit 132 obtains a list 125 of methods used when executing a function from the contents of the stack trace 124. The list 125 also includes information on the class corresponding to the method. For example, the optimization unit 132 obtains a list 125 including the used methods "org.xxxxx.grizzly...", "zzz.nio.ch.SelectorImpl...", etc. based on the stack trace 124.
[0098] FIG. 19 illustrates an example of deleting unused classes. The optimization unit 132 extracts classes used in the user's functions by static analysis, and records information about the extracted classes in list 126. List 126 is stored in the storage unit 120. The class information includes information about the package that includes the class. The function management table 123 described above may be created based on list 126. Furthermore, the optimization unit 132 extracts classes that were actually used based on list 125 obtained by dynamic analysis, and records information about the extracted classes in list 127. List 127 is stored in the storage unit 120.
[0099] The optimization unit 132 creates list 128 by deleting from list 126 classes that are not in list 127, i.e., classes that have not been used, from the classes in list 126. Then, the optimization unit 132 narrows down the packages based on list 128. Specifically, the optimization unit 132 deletes packages that are not included in list 128 from the related packages in the function management table 123 for the corresponding function.
[0100] Here, when deleting a package, the optimization unit 132 replaces the contents of the package so that only the packages that are actually used remain. FIG. 20 illustrates an example of deleting unnecessary packages by replacing a package.
[0101] Tree t4 shows an example of inter-package relationships for a user's function extracted by static analysis. For example, the function uses packages PKG_A and PKG_B. Package PKG_A uses packages PKG_C and PKG_D. Package PKG_C uses packages PKG_E and PKG_F. Package PKG_D uses packages PKG_F and PKG_G. Package PKG_E uses packages PKG_H and PKG_I. Package PKG_F uses packages PKG_I and PKG_J. Package PKG_G uses packages PKG_J and PKG_K.
[0102] On the other hand, it is assumed that it is confirmed by dynamic analysis that packages PKG_D, PKG_F, PKG_G, PKG_J, and PKG_K are not used during actual execution. In this case, the optimization unit 132 replaces unused methods in the packages PKG_A and PKG_C with packages PKG_A' and PKG_C', respectively. In this way, the optimization unit 132 prevents failures during execution due to the absence of the packages PKG_D, PKG_F, PKG_G, PKG_J, and PKG_K. Tree t5 shows the relationship between packages when the packages PKG_A and PKG_C are replaced with the packages PKG_A' and PKG_C', respectively, and the packages PKG_D, PKG_F, PKG_G, PKG_J, and PKG_K are deleted.
[0103] FIG. 21 illustrates an example of replacing a method within a package. As shown in Fig. 20, when deleting unnecessary packages, the optimization unit 132 maintains the consistency of dependencies between packages to be left. Therefore, the optimization unit 132 focuses on methods implemented in classes. Since no processing is performed for unused methods, their contents become unnecessary. The optimization unit 132 can eliminate references to unused classes by making the processing contents of unused methods empty. This eliminates calls to the class, making it possible to eliminate unnecessary parts while maintaining consistency.
[0104] Code 501 shows an example of the description of methods "function_A" and "function_B" of class "A" in a package. Of these, method "function_B" is a method that has a link to another class and is not actually used. For this reason, optimization unit 132 creates code 502 by making method "function_B" in code 501 empty. Code 502 is used in place of code 501. In this way, the reference code indicating the link to the other class is removed from code 502, making it possible to delete the package that includes the other class.
[0105] For example, the optimization unit 132 accumulates information for a certain period of time through dynamic analysis, and performs optimization by deleting processes that have not been used for the certain period of time. If the process is used after optimization, the package reference will fail, and the function execution will fail. In this case, the execution environment creation unit 131 will initialize the package and recreate the function execution environment 210. The optimization unit 132 will then accumulate information again through dynamic analysis. However, during actual service operation, tests will be performed before operation and one function will only have one role, so there is an extremely small possibility that the process deleted by optimization will be used.
[0106] Next, the process performed by the relay server 100 will be described. FIG. 22 is a flow chart illustrating an example of service construction. The service construction process is executed in advance by the optimization unit 132 before accepting a function registration by a user.
[0107] (S10) The optimization unit 132 acquires packages that the user can use. (S11) The optimization unit 132 unpacks and analyzes each acquired package to identify packages corresponding to the class or prefix and other packages used by each package. The optimization unit 132 registers the packages corresponding to the class or prefix in the dictionary data 121. The optimization unit 132 also registers dependencies between packages in the package correspondence table 122. Then, the service construction is completed.
[0108] FIG. 23 is a flowchart showing an example of function execution control. (S20) Proxy 130 performs function registration. Function registration is a process for registering a function input by a user. In function registration, list 126 of classes to be used for the user's functions and records in function management table 123 are created. Details of function registration will be described later.
[0109] (S21) The proxy 130 repeatedly obtains the results of dynamic analysis for a certain period of time for the function process (1) in step S22 described below. (S22) The proxy 130 performs function processing (1). Through function processing (1), a function execution environment 210 is constructed based on the list 126 and the function management table 123. Then, the user's function is executed using the function execution environment 210. Details of the function processing (1) will be described later.
[0110] (S23) After a certain period of time has elapsed, the proxy 130 ends the repeated acquisition of the dynamic analysis results. Note that the acquisition of the dynamic analysis results in steps S21 and S23 is performed by the optimization unit 132.
[0111] (S24) Proxy 130 updates the analysis result based on the stack trace obtained as a result of the dynamic analysis. In updating the analysis result, list 126 is updated to list 128 based on the result of the dynamic analysis, and function management table 123 is updated. Details of updating the analysis result will be described later.
[0112] (S25) The proxy 130 performs function processing (2). Through function processing (2), the function execution environment 210 is reconstructed based on the list 128 and the updated function management table 123. Then, the user's function is executed using the reconstructed function execution environment 210. Details of the function processing (2) will be described later.
[0113] (S26) The proxy 130 judges whether the processing of the user's function in step S25 ended normally. If it ended normally, the function execution control ends, and thereafter, the function execution environment 210 reconstructed in step S25 is used. If it did not end normally, the process proceeds to step S21. If the process proceeds to step S21, the proxy 130 will reconstruct the function execution environment 210 again using the package before the reconstruction in step S25. The judgment in step S26 is made by the optimization unit 132.
[0114] FIG. 24 is a flowchart showing an example of function registration. Function registration corresponds to step S20. (S30) The optimization unit 132 receives implementation of function logic by the user.
[0115] (S31) The optimization unit 132 performs a static analysis on the code implemented in step S30 to analyze the packages referenced by the code based on the dictionary data 121 and the package correspondence table 122, and creates a list 126.
[0116] (S32) Based on the analysis result of step S31, the optimization unit 132 registers the package used for the environment startup and build of the user's function in the function management table 123. Then, the function registration ends.
[0117] FIG. 25 is a flowchart showing an example of the function process (1). The function process (1) corresponds to step S22. (S40) When the function execution instruction unit 133 receives a function call from the user from the terminal device 80, it determines whether or not a function execution environment 210 for executing the called function exists. If the function execution environment 210 does not exist, the process proceeds to step S41. If the function execution environment 210 exists, the process proceeds to step S42. If the process proceeds to step S41, a cold start is performed. If the process proceeds to step S42, a warm start is performed.
[0118] (S41) The execution environment creation unit 131 creates the function execution environment 210 based on the list 126 of classes extracted by static analysis. Since a cold start is performed here, the execution environment creation unit 131 downloads a package file used to create the function execution environment 210 from a predetermined server based on the function management table 123.
[0119] (S42) The function execution instruction unit 133 instructs the function execution environment 210 to execute processing based on the implemented code, and causes the function execution environment 210 to execute the processing. (S43) The function execution instruction unit 133 acquires the execution result of the function in step S42 from the function execution environment 210, and responds to the terminal device 80 that made the call.
[0120] (S44) The optimization unit 132 acquires from the execution server 200 a stack trace created in response to function execution in the function execution environment 210, and analyzes the method that was actually used from the stack trace.
[0121] (S45) The optimization unit 132 accumulates the analyzed information by recording information on the actually used method identified in step S44 in the list 125. Then, the function process (1) ends.
[0122] FIG. 26 is a flowchart showing an example of updating the analysis result. Updating the analysis results corresponds to step S24. (S50) Optimization unit 132 extracts classes actually used in the corresponding function from the accumulated data, that is, list 125, and creates list 127.
[0123] (S51) The optimization unit 132 extracts a package corresponding to the extracted class. For example, the optimization unit 132 can extract information about the package based on the class name recorded in the list 127 and the dictionary data 121.
[0124] (S52) The optimization unit 132 updates the environment information so as to leave the extracted packages. For example, the optimization unit 132 updates the list 126 to the list 128 by deleting information of classes that are not used from the list 126 based on the list 127. The optimization unit 132 also deletes packages that do not remain in the list 128 from the related packages of the corresponding function in the function management table 123. Then, the analysis result update ends.
[0125] FIG. 27 is a flowchart showing an example of the function process (2). The function process (2) corresponds to step S25. (S60) When the function execution instruction unit 133 receives a function call from the user from the terminal device 80, it determines whether or not a function execution environment 210 for executing the function to be called exists. If the function execution environment 210 does not exist, the process proceeds to step S61. If the function execution environment 210 exists, the process proceeds to step S62. If the process proceeds to step S61, a cold start is performed. If the process proceeds to step S62, a warm start is performed.
[0126] (S61) The execution environment creation unit 131 creates the function execution environment 210 based on the list of classes 128 updated by dynamic analysis. In step S61, since a cold start is performed, the execution environment creation unit 131 downloads a package file used to create the function execution environment 210 from a predetermined server based on the function management table 123 updated by dynamic analysis. In this case, the optimization unit 132 replaces the methods in the package to maintain consistency of the relationships between the packages, as illustrated in FIG. 20.
[0127] (S62) The function execution instruction unit 133 instructs the function execution environment 210 to execute processing based on the implemented code, and causes the function execution environment 210 to execute the processing. (S63) The function execution instruction unit 133 acquires the execution result of the function in step S62 from the function execution environment 210, and responds to the caller terminal device 80. Then, the function process (2) ends.
[0128] In step S61, the related packages are further narrowed down by dynamic analysis, which reduces the time required to create the function execution environment 210 compared to step S41. Also, in the function process (2), the determination in step S60 may not be performed, and the execution environment creating unit 131 may execute step S61, so that the function execution environment 210 is always reconstructed based on the result of the dynamic analysis.
[0129] Furthermore, after step S26 (YES), the proxy 130 performs normal operation using the function execution environment 210 updated in step S25. As described above, the relay server 100 identifies the second package referenced by the first package based on the meta-information included in the first package identified from the source code of the function, and can extract only the second package from the group of packages provided. Therefore, the relay server 100 narrows down the packages to be acquired when constructing the function execution environment 210, and can avoid acquiring unnecessary packages. This reduces the time required to construct the function execution environment 210 and speeds up the startup (cold start) of the function execution environment 210. As a result, function processing delays are reduced.
[0130] In addition, the relay server 100 can further narrow down the packages required for executing the function by dynamic analysis, by leaving the packages actually used when executing the function and deleting the packages not used. This further shortens the time required to build the function execution environment 210, and further speeds up the startup of the function execution environment 210. As a result, the function processing delay is further reduced.
[0131] Here, as a comparative example, a method for reducing the number of packages that can be used by limiting the packages that can be used in a function in advance can be considered to deal with the delay in starting the function execution environment 210 during a cold start. However, in the comparative example method, functions implemented in existing applications cannot be used in a serverless manner as is, and the implementation of the function must be changed to fit within the range of packages that can be used in a serverless manner. For example, in the comparative example method, if a package for sending email is included in the packages to be restricted, functions with a function for sending email cannot be used.
[0132] On the other hand, according to the Relay Server 100, instead of restricting the packages that the user can use within a function, the Relay Server 100 identifies the packages required for each function implemented by the user and performs optimization. Therefore, compared to the method of the comparative example, the Relay Server 100 does not need to restrict the packages that the user can use.
[0133] In addition, the relay server 100 optimizes the function execution environment 210 by combining static analysis and dynamic analysis. This allows the relay server 100 to perform optimization efficiently. For example, dynamic analysis is performed during operation, and the packages required at the very beginning of operation cannot be identified by dynamic analysis alone, but by using static analysis, the packages to be used can be narrowed down to a certain extent. In addition, if all the packages provided were to be incorporated into the function execution environment 210, the resource consumption of the function execution environment 210 would increase, making practical operation difficult. Therefore, by using static analysis and dynamic analysis, the relay server 100 can gradually narrow down the packages to be incorporated into the function execution environment 210 so that the number of packages to be incorporated into the function execution environment 210 does not become excessive.
[0134] As described above, the relay server 100 executes the following process. The processor 101 identifies a first package used to execute a function described in the source code based on the source code. The processor 101 identifies a second package based on meta-information included in the first package, the meta-information indicating a second package referenced by the first package. The processor 101 constructs an execution environment for the function using the source code, the first package, and the second package.
[0135] This allows the relay server 100 to narrow down the packages used to construct the execution environment for the function, thereby speeding up the startup of the execution environment for the function. For example, a package identified by an import statement at the beginning of source code is an example of a first package. Also, the above-mentioned pom.xml is an example of meta information. Furthermore, the function execution environment 210 corresponds to the "function execution environment."
[0136] Furthermore, the processor 101 may create in advance a package correspondence table 122 indicating the correspondence between a package and other packages referenced by the package, based on the meta-information of each of a plurality of packages including a first package and a second package. When the processor 101 accepts the registration of a function by a user, the processor 101 registers information on the package used for the function in the function management table 123, based on the information indicating the correspondence. Then, when the processor 101 accepts a call of the function, for example, the processor 101 can obtain the package used for the function based on the function management table 123 and construct an execution environment for the function. This allows the relay server 100 to speed up the startup of the execution environment for the function.
[0137] The processor 101 may determine whether or not the second package was used to execute the function based on a stack trace when the function was executed by the execution environment. If the second package was not used to execute the function, the processor 101 may reconstruct the execution environment without using the second package.
[0138] This allows the relay server 100 to further narrow down the packages used to construct the execution environment for the function, and further speeds up the startup of the execution environment for the function. During the reconstruction, the processor 101 deletes, from the code included in the first package, a reference code that references a program part belonging to the second package, as exemplified in FIG.
[0139] This allows the relay server 100 to prevent a failure in executing a function due to the absence of a program component belonging to the second package. For example, a class of a package published in a jar file is an example of a program component.
[0140] The processor 101 may determine whether the first package was used to execute the function based on the stack trace. If the first package was not used to execute the function, the processor 101 may reconstruct the execution environment without using the first package.
[0141] The processor 101 may identify a third package referenced from the first package via the second package based on other meta information included in each of a plurality of packages including the second package and indicating other packages referenced by the second package. The processor 101 may then further use the third package to construct an execution environment for the function.
[0142] This allows the relay server 100 to narrow down the packages used to construct the execution environment for the function, thereby speeding up the startup of the execution environment for the function. The processor 101 may determine whether or not the third package was used to execute the function based on a stack trace at the time of execution of the function by the execution environment. If the third package was not used to execute the function, the processor 101 may reconstruct the execution environment without using the third package.
[0143] This allows the relay server 100 to further narrow down the packages used to construct the execution environment for the function, and further speeds up the startup of the execution environment for the function. During the reconstruction, as illustrated in FIG. 21, the processor 101 deletes reference code that references a program part belonging to the third package from the code contained in the second package or the fourth package that is the reference source of the third package.
[0144] This allows the relay server 100 to prevent failure in executing the function due to the absence of a program part that belongs to the third package. For example, when processor 101 accepts the registration of a function, it identifies a first package and a second package corresponding to the function. Then, when processor 101 accepts a call of the function, it constructs an execution environment for the function. Every time processor 101 accepts a call of the function at a time interval shorter than a predetermined time, processor 101 instructs execution of the function by the execution environment. The instruction to execute the function may be given to, for example, a node (e.g., execution server 200) that runs the execution environment. Then, when the time during which no call of the function is accepted reaches a predetermined time, processor 101 deletes the execution environment.
[0145] In this way, the processor 101 identifies the first package and the second package corresponding to the function in advance when the processor 101 accepts the registration of the function by the user. Then, the processor 101 does not need to identify the first package and the second package when the function is called, and can obtain the identified first package and the second package to construct the execution environment of the function. In this way, the relay server 100 can reduce the startup time of the execution environment by cold start for functions such as serverless functions executed using cold start and warm start. As a result, the function processing delay at the time of cold start is reduced.
[0146] Furthermore, the execution environment constructed by the processor 101 may be a container that operates using resources such as a processor and memory of a computer corresponding to the relay server 100 or another computer corresponding to the execution server 200. That is, the process of constructing an execution environment for a function or the process of creating an execution environment for a function may be the process of creating a container that executes the function. For example, in the information processing system 1 that provides an execution service for a serverless function, the startup of a container due to a cold start may be performed frequently. For this reason, the execution environment by the relay server 100, i.e., the shortening of the startup time of the container, is particularly useful for the operation of the execution service for a serverless function provided using the container.
[0147] The information processing of the first embodiment can be realized by causing the processing unit 12 to execute a program. The information processing of the second embodiment can be realized by causing the processor 101 to execute a program. The program can be recorded in a computer-readable recording medium 113.
[0148] For example, the program can be distributed by distributing recording medium 113 on which the program is recorded. Alternatively, the program may be stored in another computer and distributed via a network. The computer may store (install) the program recorded in recording medium 113 or a program received from another computer in a storage device such as RAM 102 or HDD 103, and read and execute the program from the storage device. [Explanation of symbols]
[0149] 10. Information processing device 11 Storage section 12 Processing section 20 Execution Node 21 Function Execution Environment 30 Source Code 40,50,61,62,63,64,65 Package 40a,50a Meta information 60 packages
Claims
1. On the computer, Identifying a first package used to execute a function described in a source code based on the source code, and identifying a second package based on meta-information included in the first package, the meta-information indicating a second package referenced by the first package; constructing an execution environment for the function using the source code, the first package, and the second package; A program that executes a process.
2. determining whether the second package was used to execute the function based on a stack trace obtained when the function was executed by the execution environment; if the second package was not used to execute the function, reconstructing the execution environment without using the second package; The program according to claim 1, which causes the computer to execute a process.
3. In the reconstruction, a reference code that refers to a program part belonging to the second package is deleted from the code included in the first package. The program according to claim 2, which causes the computer to execute a process.
4. identifying a third package referenced via the second package starting from the first package based on other meta information included in each of a plurality of packages including the second package, the other meta information indicating other packages referenced by the second package, and constructing the execution environment by further using the third package; The program according to claim 1, which causes the computer to execute a process.
5. determining whether the third package was used to execute the function based on a stack trace obtained when the function was executed by the execution environment; if the third package was not used to execute the function, reconstructing the execution environment without using the third package; 5. The program according to claim 4, which causes the computer to execute a process.
6. In the reconstruction, a reference code that references a program part belonging to the third package is deleted from a code included in the second package or the fourth package that is a reference source of the third package.
6. The program according to claim 5, which causes the computer to execute a process.
7. When the registration of the function is accepted, the first package and the second package corresponding to the function are identified; When a call to the function is received, the execution environment is constructed; instructing the execution environment to execute the function each time a call to the function is received at a time interval shorter than a predetermined time; When the time during which the function call is not accepted reaches the predetermined time, the execution environment is deleted. The program according to claim 1, which causes the computer to execute a process.
8. The execution environment is a container that operates using resources of the computer or another computer. The program according to claim 1.
9. The computer Identifying a first package used to execute a function described in a source code based on the source code, and identifying a second package based on meta-information included in the first package, the meta-information indicating a second package referenced by the first package; constructing an execution environment for the function using the source code, the first package, and the second package; Information processing methods.
10. A storage unit that stores source code; a processing unit that identifies a first package used to execute a function described in the source code based on the source code, identifies the second package based on meta-information included in the first package, the meta-information indicating a second package referenced by the first package, and constructs an execution environment for the function using the source code, the first package, and the second package; An information processing device having the above configuration.
Citation Information
Patent Citations
Device and method for detecting code
JP2008217751A
Optimization point determining device, optimization point determination system, computer program, and optimization point determination method
JP2009211424A
Method of micro-specialization in database management system
JP2018014142A
