Data processing method and apparatus, and computing device, cloud platform and readable storage medium
By rearranging functions in program files based on function call popularity and using larger logical pages to reduce cross-page access, the problem of performance degradation caused by frequent cross-page access in paging storage management is solved and program execution performance is improved.
Patent Information
- Application Number
- PCT/CN2024/080543
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-07-31
- Filing Date
- 2024-03-07
- Publication Date
- 2024-10-31
AI Technical Summary
In the paging storage management mode, the program frequently performs cross-page access, resulting in performance degradation. It is difficult for existing technology to effectively solve this problem.
The cloud server rearranges the functions in the program file according to the popularity of function calls, uses larger logical pages to load high-heat functions, reduces cross-page access, and improves page access density and translation back buffer hit rate.
It effectively reduces cross-page access during program execution, improves program performance and translation backup buffer hit rate, and improves overall performance.
Smart Images

Figure CN2024080543_31102024_PF_FP_ABST
Abstract
Description
Data processing method, device, computing device, cloud platform and readable storage medium
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on April 28, 2023, with application number 202310483962.6, and invention name “A program optimization method and cloud management platform based on cloud computing technology”, and the Chinese patent application filed with the State Intellectual Property Office on July 31, 2023, with application number 202310952523.5, and invention name “Data processing method, device, computing device, cloud platform and readable storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of cloud computing, and in particular to a data processing method, apparatus, computing device, cloud platform, and readable storage medium. Background Art
[0003] In paging memory management, a program's logical address space is divided into several equal-sized regions, each called a page, logical page, or page. Currently, operating systems use a standard 4KB page size, but can also support a variety of larger page sizes. By enabling large page memory, the operating system reduces the number of page mapping tables it must handle.
[0004] However, when the operating system uses all large pages or all small pages to load program functions, different functions may frequently perform cross-page accesses to make function calls. Frequent cross-page accesses may cause program performance to degrade.
[0005] Summary of the Invention
[0006] The embodiments of the present application provide a data processing method, apparatus, computing device, cloud platform and readable storage medium, which can solve the problem of frequent cross-page access during program execution, thereby improving program performance.
[0007] In a first aspect, a data processing method is provided. The data processing method includes: first, a cloud server obtains a first program file requested for execution by a client. Then, the cloud server determines the function call heat of at least one function contained in the first program file during execution, and loads the at least one function into logical pages of different paging sizes of the program file according to the function call heat of different functions, thereby obtaining a second program file, wherein the paging size of the logical page corresponding to the function with higher function call heat is larger than the paging size of the logical page corresponding to the function with lower function call heat. Finally, the cloud server sends the execution result of the second program file to the client.
[0008] Based on this data processing method, the cloud server uses functions as the granularity and rearranges the functions according to the function call heat of the first program file to be executed by the client. In the rearranged second program file, the cloud server uses a larger logical page to load functions with high function call heat, so that the second program file can call functions with high function call heat more continuously from the same logical page during operation. Therefore, the page access density of the function is improved, the cross-page access of the function during the program execution process is reduced, and the program execution performance is improved. At the same time, loading more functions with high function call heat with larger logical pages can reduce the miss of the translation lookaside buffer (TLB), improve the hit rate of the translation lookaside buffer, and further improve the program execution performance.
[0009] As a possible implementation method, logical pages with different paging sizes include at least one large page and at least one small page, and the paging size of at least one large page is larger than the paging size of at least one small page. The cloud server preferentially loads high-heat functions into at least one large page and loads low-heat functions into at least one small page to obtain a second program file. Among them, the high-heat function is a function block whose function call heat is greater than or equal to a first preset value, and the low-heat function is a function block whose function call heat is less than the first preset value. The function block includes a calling function and a called function, and the calling function calls the called function during the execution of the program.
[0010] Based on the above implementation method, high-heat functions are loaded into large pages first. If at least one large page cannot load all high-heat functions, small pages are used to load the remaining high-heat functions and low-heat functions, ensuring the integrity of function loading.
[0011] As a possible implementation manner, the cloud server determines the number of huge pages of the at least one huge page according to the size of the first program file and the paging size of each huge page in the at least one huge page.
[0012] This application does not limit the specific number of huge pages. For example, at least one huge page can load a preset proportion of high-heat functions. For another example, at least one huge page can load all high-heat functions.
[0013] Based on the above implementation, the cloud server determines the total number of huge pages based on the size of the first program file and the size of the huge pages. This ensures that the number of huge pages is sufficient to load high-performance functions, while simultaneously loading low-performance functions other than high-performance functions into small pages, effectively avoiding excessive memory fragmentation caused by an excessive number of huge pages. Furthermore, the cloud server uses both huge and small pages to arrange functions. Compared to using only huge pages, this reduces the computing resources consumed by the extensive splitting and merging of memory areas, as well as the performance jitter caused by frequent memory reclaims.
[0014] In some possible embodiments, at least one large page cannot load all high-heat functions. When loading high-heat functions into large pages, the cloud server can determine the loading location of the function based on the remaining space size of the large page and the function call heat of the function.
[0015] Optionally, if there are currently remaining blank huge pages, the high-heat function with the highest call heat among the unloaded functions is loaded into the blank huge page.
[0016] Optionally, if there are no remaining blank huge pages, the hottest function with the highest call popularity among the unloaded functions is loaded into a loaded huge page with a remaining space larger than that of the hottest function. The loaded huge page is a non-blank huge page.
[0017] Optionally, if there are currently no remaining blank large pages, and the size of the high-heat function that calls the highest heat among the unloaded functions is larger than the remaining space size of all loaded large pages, the unloaded high-heat function and low-heat function are loaded into at least one small page.
[0018] As a second implementation method, at least one huge page can load all high-heat functions, and the cloud server loads the high-heat functions into at least one huge page in sequence according to the order of their function call heat from high to low.
[0019] Based on the above implementation method, blank huge pages are preferentially used to load the currently most popular functions, ensuring that the probability of functions with higher call popularity being loaded into huge pages is higher than the probability of functions with lower call popularity being loaded into huge pages, so that functions with high call popularity can be called continuously in huge pages, thereby further reducing the situation of cross-page access of functions.
[0020] As one possible implementation, at least one large page and at least one small page belong to different segments. This allows functions loaded in large pages and small pages to be placed in different segments. This allows the cloud server's operating system to continuously call popular functions in large pages based on the large page's segment table when running the second program file, rather than frequently querying segment tables in different segments for cross-page access, thereby improving program execution efficiency.
[0021] As a possible implementation method, function call heat is the function call frequency.
[0022] As a possible implementation method, the cloud server determines the function call frequency of at least one function by: performing static analysis on the first program file to obtain a static control flow graph of at least one function, and then determining the function call frequency of at least one function based on the static control flow graph when executing the first program file.
[0023] Optionally, when the first program file is executed, the cloud server determines at least one execution path of the first program file in the static control flow graph based on the function jump information, determines the number of executions of each execution path in the at least one execution path based on the function jump information within a sampling period, and then determines the function call frequency of at least one function for each function in each execution path based on the sampling period and the number of executions of the execution path to which each function belongs.
[0024] The function jump information may be obtained by the cloud server from a last branch recording (LBR) register corresponding to the first program file, and the function jump information includes a jump address-destination address pair.
[0025] Based on the above implementation method, the cloud server counts the number of function executions based on the function jump information during the execution of the first program file at the granularity of the execution path, so that the function call frequency can be determined based on the popularity of the execution path, which is conducive to the subsequent arrangement of multiple functions on the execution path with higher popularity to the same large page.
[0026] As a possible implementation manner, the cloud server may execute the above-mentioned data processing method provided in this application when the frequency of translation lookaside buffer misses during the execution of the first program file is greater than a second preset value.
[0027] As a possible implementation method, the cloud server can execute the above-mentioned data processing method provided in this application when the average value of the function call heat of at least one function during the execution of the first program file is less than a third preset value.
[0028] Based on the above implementation method, the cloud server monitors the running status of the first program file, and executes the data processing method when the translation backup buffer miss frequency is high or the average function call heat is small, that is, when the program runs stably, to optimize the first program file, thereby enabling the data processing method of the present application when the running efficiency of the first program file is low, to ensure that the performance of the program can be improved.
[0029] In a possible implementation, the cloud server pushes optimization information to the client, where the optimization information is used to inform the user of the optimization service of the data processing method for the first program file, thereby executing the data processing method after obtaining user permission information sent by the client.
[0030] Optionally, after executing the data processing method to obtain the second program file, the cloud server updates the first program file requested to be executed by the client, replaces the first program file with the second program file, and saves the first program file.
[0031] In a second aspect, a data processing device is provided, which includes various modules for executing the data processing method in the first aspect or any possible implementation of the first aspect. The data processing device in the present application may include a transceiver module and a processing module. The transceiver module is used to obtain a first program file requested to be executed by a client. The processing module is used to determine the function call heat of at least one function called during the execution of the first program file, and to load at least one function into logical pages with different paging sizes according to the function call heat, to obtain a second program file, wherein the paging size of the logical page corresponding to the function with high function call heat is larger than the paging size of the logical page corresponding to the function with low function call heat. The transceiver module is also used to send the execution result of the second program file to the client.
[0032] As a possible implementation method, logical pages with different paging sizes include at least one large page and at least one small page, and the paging size of at least one large page is larger than the paging size of at least one small page. The processing module is specifically used to: preferentially load high-heat functions into at least one large page, where the high-heat function is a function block whose function call heat is greater than or equal to a first preset value, where the function block includes a calling function and a called function, and during the execution of the program file, the calling function calls the called function; and load low-heat functions into at least one small page to obtain a second program file, where the low-heat function is a function block whose function call heat is less than the first preset value.
[0033] As a possible implementation manner, the processing module is further configured to determine the number of huge pages in the at least one huge page according to the size of the first program file and the paging size of each huge page in the at least one huge page.
[0034] As a possible implementation method, the processing module is specifically used to: when the number of loaded huge pages is less than the number of huge pages, load the highest-heat function called by the unloaded function into a blank huge page; when the number of loaded huge pages is equal to the number of huge pages, determine a loaded huge page with a remaining space greater than or equal to the size of the highest-heat function called by the unloaded function, and load the highest-heat function called by the unloaded function into the loaded huge page.
[0035] As a possible implementation method, the processing module is specifically used to: when the number of loaded large pages is equal to the number of large pages, and the size of the high-heat function that calls the highest heat among the unloaded functions is greater than the remaining space size of each large page in at least one large page, the unloaded high-heat function and the low-heat function are loaded into at least one small page to obtain a second program file.
[0036] As a possible implementation method, the processing module is specifically used to: determine the number of huge pages of at least one huge page based on the number of high-heat functions and the paging size of each huge page in at least one huge page, so that at least one huge page can load all high-heat functions.
[0037] As a possible implementation manner, the processing module is specifically configured to load high-heat functions into at least one large page in sequence according to the order of their function call heat from high to low.
[0038] As a possible implementation manner, at least one large page and at least one small page belong to different segments respectively.
[0039] As a possible implementation method, function call heat is the function call frequency.
[0040] As a possible implementation method, the processing module is specifically used to: perform static analysis on the first program file to obtain a static control flow graph of at least one function; when the first program file is executed, determine the function call frequency of at least one function according to the static control flow graph.
[0041] As a possible implementation method, the processing module is specifically used to: when the first program file is executed, determine at least one execution path of the first program file in the static control flow graph according to the function jump information; determine the number of executions of each execution path in at least one execution path according to the function jump information within a sampling period; for each function in each execution path, determine the function call frequency of at least one function according to the sampling period and the number of executions of the execution path to which each function belongs.
[0042] As a possible implementation manner, the transceiver module is further configured to: obtain function jump information from a latest branch record LBR register corresponding to the first program file, where the function jump information includes a jump address-destination address pair.
[0043] As a possible implementation method, the processing module is also used to: during the execution of the first program file, if the frequency of translation backup buffer misses is greater than a second preset value, execute the operating steps of the data processing method in the first aspect or any possible implementation method of the first aspect.
[0044] As a possible implementation method, the processing module is also used to: determine the average value of the function call heat of at least one function during the execution of the first program file; if the average value is less than a third preset value, execute the operating steps of the data processing method in the first aspect or any possible implementation method of the first aspect.
[0045] In a third aspect, a computing device is provided, comprising a memory and a processor, wherein the memory is used to store a set of computer instructions, and when the processor executes the set of computer instructions, it is used to execute the operating steps of the data processing method in the first aspect or any possible implementation of the first aspect.
[0046] In a fourth aspect, a cloud computing platform is provided. The cloud computing platform includes a cloud server and a client, wherein the client is configured to send a request to the cloud server, and the cloud server is configured to execute the operation steps of the data processing method in the first aspect or any possible implementation of the first aspect according to the request, and the client is further configured to receive the execution result of the second program file.
[0047] In addition, the technical effects of the data processing device described in the second aspect, the technical effects of the computing equipment described in the third aspect, and the technical effects of the cloud platform described in the fourth aspect can refer to the technical effects of the data processing method described in the first aspect and will not be repeated here.
[0048] In a fifth aspect, a readable storage medium is provided. The readable storage medium includes a computer program or instructions that, when executed on a computer, causes the computer to execute the data processing method described in any possible implementation of the first aspect.
[0049] In a sixth aspect, a computer program product is provided, which includes a computer program or instructions, and when the computer program or instructions are executed on a computer, causes the computer to execute the data processing method described in any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] FIG1 is a schematic diagram of the architecture of a data processing system provided by the present application;
[0051] FIG2 is a schematic diagram of the hierarchical structure of a cloud platform of a data processing system provided by the present application;
[0052] FIG3 is a flow chart of a data processing method provided by the present application;
[0053] FIG4 is a schematic diagram of a logic page of a second program file provided by the present application;
[0054] FIG5 is a schematic diagram comparing a logical page of a first program file and a logical page of a second program file provided by the present application;
[0055] FIG6 is a flow chart of a function call frequency counting step provided by the present application;
[0056] FIG7 is a schematic diagram of a static control flow graph provided by the present application;
[0057] FIG8 is a schematic diagram of an execution path recording method provided by the present application;
[0058] FIG9 is a schematic diagram of a method for recording execution times provided by the present application;
[0059] FIG10 is a flow chart of a function loading step provided by the present application;
[0060] FIG11 is a second flow chart of a data processing method provided by the present application;
[0061] FIG12 is a schematic structural diagram of a data processing device provided by the present application;
[0062] FIG13 is a schematic structural diagram of a system including a computing device provided in the present application. DETAILED DESCRIPTION
[0063] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. In the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships. For example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b and c can be single or multiple.
[0064] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" or "for example" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0065] The data transmission method provided in the embodiment of the present application can be applied in cloud platform scenarios in the field of cloud computing. The following is a brief introduction to the technologies that may be involved in this application.
[0066] (1) Paging storage management
[0067] In paging memory management, a program's logical address space is divided into several equal-sized regions, each called a page. All pages in the program's address space are numbered sequentially starting at 0. Correspondingly, the physical address space of memory is similarly divided into regions of the same page size, each called a physical block or page frame. Like logical pages, all physical blocks in memory are numbered sequentially starting at 0. When allocating memory for a program, program pages can be loaded into adjacent or non-adjacent physical blocks in memory on a page-by-page basis. In paging memory management, logical addresses in a program are converted to page numbers and addresses within the page. This conversion is performed automatically by the system hardware during program execution, and the entire process is transparent to the user. Therefore, when programming, users do not need to know the correspondence between logical addresses, page numbers, and addresses within the page; they only need to use one-dimensional logical addresses.
[0068] Page selection in a paging system significantly impacts system performance. While page sizes that are too small can effectively reduce page fragmentation and improve memory utilization, they also result in each process requiring more pages. This increases the size of the page table used for page management, occupying more memory space. Page sizes that are too large can reduce page table size and increase page replacement speed, but they also increase page fragmentation.
[0069] (2) Page Table
[0070] Data is stored in memory (e.g., RAM, hard disk) in bytes. To correctly store or retrieve data, each byte is assigned a unique memory address, called a physical address. In virtual memory technology, physical addresses are used for data access. A logical address, also called a relative address, is the address given by memory access instructions (also known as internal access instructions) in computer systems with address translation capabilities. This address is used to specify an operand or instruction in machine language instructions. A logical address can be composed of a segment selector plus an offset address that specifies a relative address within a segment. The logical address undergoes addressing mode calculation or conversion to obtain the actual effective address in memory, the physical address. A linear address is the intermediate layer between logical and physical addresses. Program code generates a logical address, or an offset within a segment, which is added to the base address of the corresponding segment to form a linear address. A virtual address is the segment offset within the logical address.
[0071] The virtual address space is divided into fixed-size pages. Pages correspond to page frames in physical memory, which are blocks of physical memory. Pages and page frames are generally the same size, such as 4 kilobytes (KB), 8KB, 16KB, or even larger. In practice, computer systems typically range from 512 bytes to 1 gigabyte (GB). This is the paging technique used in virtual memory.
[0072] Virtual addresses and physical addresses must be mapped for the central processing unit (CPU) to function properly. This mapping requires the storage of a mapping table. In modern CPU architectures, this mapping is typically stored in a page mapping table in physical memory, such as a page table.
[0073] A page table is a table that shows a one-to-one correspondence between pages and page frames, serving as an index when searching for the page frame corresponding to a page. The correspondence between a page table entry and a page frame in the page table is called a page table entry. A page table consists of multiple page table entries. The structure of a page table entry depends on the machine architecture, but is generally similar. For example, a page table entry contains an identifier and auxiliary data information. The identifier is a virtual address, and the data is the physical address mapped to the virtual address. The auxiliary information includes a valid bit, a modification bit, an access bit, and a reserved bit. The valid bit indicates whether the page currently exists in memory. When a thread executed by a processor or processor core attempts to access a page that does not exist in memory, a page fault interrupt is generated. The protection bit indicates the type of access allowed to the page, such as read-write or read-only. The modification bit and access bit were introduced to record page usage and are used during page replacement. For example, when a memory page is modified by a program, the hardware will automatically set the modification bit. If the program encounters a page fault interrupt next time and needs to run the page replacement algorithm to call out the page to make room for the page to be called in, it will first access the modification bit to know that the page has been modified, that is, a dirty page. The latest page content needs to be written back to the hard disk for storage. Otherwise, it means that the copy content on the memory and hard disk is synchronized and does not need to be written back to the hard disk. The access bit is also automatically set by the system when the program accesses the page. It is also a value used by the page replacement algorithm. The operating system will determine whether to eliminate the page based on whether the page is being accessed. Generally speaking, pages that are no longer used are more suitable for elimination.
[0074] To further optimize performance, modern CPU architectures introduce TLBs to cache a portion of frequently accessed page table contents.
[0075] (3) Large page memory
[0076] Huge pages, in simple terms, reduce page table size by increasing the operating system page size, thereby avoiding cache misses. Currently, operating systems use a standard 4KB page size, but can also support a variety of larger page sizes. For example, Linux supports 1GB and 2MB huge pages based on a special file system, providing greater application flexibility and performance optimization.
[0077] Currently, many methods use large page technology to solve the instruction address translation problem of cloud programs. By enabling large page memory, the system only needs to process fewer page mapping tables, thereby reducing access / maintenance overhead and significantly reducing CPU instruction TLB misses.
[0078] (4) Control Flow Graph
[0079] A control flow graph (CFG), also known as a control flow diagram, is an abstract representation of a process or program. It is an abstract data structure used by compilers and maintained internally. It represents all the paths traversed during program execution. It graphically represents the possible execution flows of all basic blocks within a process and can also reflect the real-time execution of a process.
[0080] (5) Cloud Platform
[0081] A cloud platform, also known as a cloud computing platform, refers to a service based on hardware and software resources that provides computing, networking, and storage capabilities. That is, the platform provider combines the cloud (remote hardware resources) and computing (remote software resources) to form a platform that provides various services to users.
[0082] Services provided by cloud platforms can include software as a service (SaaS), platform as a service (PaaS), and infrastructure as a service (IaaS). SaaS involves a service provider deploying application software on the cloud platform's servers, and users subscribe to the application software services from the service provider over the internet based on their needs. PaaS offers a development environment as a service, meaning the service provider provides users with services such as a development environment, server platforms, and hardware resources. Users develop applications within the cloud platform's development environment and share them with other users via the cloud platform and the internet. IaaS involves a service provider providing a cloud infrastructure consisting of multiple servers as a service to users. This integrates memory, input / output devices, storage, and computing resources into a virtual resource pool, providing users with storage resources and virtualized servers.
[0083] The rise of cloud computing has led to an increasing number of large-scale programs being placed in data centers for computing. These programs are referred to as cloud programs. In recent years, cloud programs have developed rapidly, and their instructions have shown the following two characteristics: (1) The number of instructions has increased: Cloud programs are not only increasing in the scale of data processing, but also in the scale of their own instructions, resulting in an extremely large instruction scale. (2) Complex calls between instructions: Due to the need for flexibility and rapid changes in the architecture of cloud programs, most of them are composed of multiple modules, and the modules are relatively dispersed. This results in complex function call relationships in the function call stack of cloud programs, and the software call stack has also become deeper.
[0084] The large instruction size and complex instruction call relationships of cloud programs result in significant TLB misses for instructions of limited size during instruction address translation. Once a TLB miss occurs, a multi-level page table access (page walk) through the memory management unit (MMU) is required, resulting in significant latency. In modern CPUs, the high number of steps required to access multi-level page tables makes address translation expensive. Furthermore, when virtualization is used in cloud scenarios, two layers of address translation are required, resulting in significantly higher memory address translation overhead than local execution. Therefore, instruction address translation has become a major performance bottleneck for cloud programs. In data centers, optimizing the instruction layout of large-scale cloud programs, increasing instruction locality, reducing cross-page accesses during function calls, and thus reducing instruction address translation overhead to improve performance have become crucial.
[0085] There are currently three main approaches to reducing instruction translation overhead in cloud programs. The first is to use large pages in the operating system. The second is to use dedicated hardware within the CPU to predict instruction addresses in advance, known as hardware (e.g., TLB) prefetching. The third is compiler optimization, where the compiler uses information collected during the cloud program's runtime to generate higher-quality code, thereby improving cloud program performance.
[0086] Fully using large pages on the operating system can reduce the size of the page table and increase the page replacement speed, but it will lead to memory leaks, increased page fragmentation, and performance jitter during frequent memory recycling, affecting the overall performance of the program.
[0087] Hardware prefetching is generally designed for a certain fixed access pattern. Cloud programs have too many access patterns, and hardware prefetching is not applicable to cloud program scenarios. When prefetching is ineffective, it will increase bandwidth overhead.
[0088] Compiler optimizations don't reduce address translation overhead and require binary code instrumentation for cloud programs, introducing additional performance overhead. Furthermore, cloud programs typically have a rapid product iteration rate. Instrumentation-based compilation feedback optimizations cannot use runtime data collected from older versions to compile new versions. Frequent performance data collection using the latest instrumented versions is required, making them less adaptable to cloud programs.
[0089] The present application provides a data processing method, in particular, a data processing method of "rearranging functions using logical pages of different sizes according to function call heat". First, the cloud server obtains the first program file requested to be executed by the client, and determines the function call heat of at least one function that needs to be called during the execution of the first program file. Then, the cloud server reloads at least one function to a logical page of different paging size according to the function call heat to obtain a second program file; wherein, the paging size of the logical page to which the function with high function call heat is loaded is larger than the paging size of the logical page to which the function with low function call heat is loaded. Finally, the cloud server executes the second program file and returns the execution result of the second program file to the client.
[0090] Based on this data processing method, the cloud server uses functions as the granularity and rearranges the functions of the first program file according to the function call heat of the first program file to be executed by the client, so as to preferentially load functions with higher function call heat into logical pages with larger paging sizes. When the cloud server runs the program after the function rearrangement, that is, the second program file, it continuously calls functions with higher function call heat from logical pages with larger paging sizes, thereby improving the page access density of the functions, reducing cross-page access of functions during program execution, and improving program execution performance. At the same time, since logical pages with larger paging sizes can load more functions in one logical page than logical pages with smaller paging sizes, the program has a greater chance of hitting when using the translation backup buffer to obtain functions, which can reduce translation backup buffer misses and further improve program execution performance.
[0091] The implementation of the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0092] FIG1 is a schematic diagram of the architecture of a data processing system provided by the present application. As shown in FIG1 , the data processing system 100 includes a server and a client 140. The server is used to provide services to the client 140 via a network. The number and type of servers are related to the services that the client 140 needs to provide, such as data read / write services, computing services, image recognition services, etc. Taking the data processing system 100 including a cloud platform as an example, the server in the data processing system 100, i.e., the cloud platform, includes a computing server cluster 110, a storage server cluster 120, and a network device cluster 130. Among them, the computing server cluster 110 and the storage server cluster 120 respectively communicate with the client 140 through the network device cluster 130.
[0093] The computing server cluster 110 includes one or more computing servers (two computing servers, namely, computing server 111 and computing server 112 , are shown in FIG1 , but are not limited to two computing servers).
[0094] Computing servers, such as servers and desktop computers, are computing resources in data processing system 100 and are used to generate and allocate computing resources based on user needs based on virtualization technology. Computing servers are used to execute cloud programs to implement functions requested by client 140.
[0095] For example, the computing server is used to determine the function call heat of at least one function called during the execution of the first program file requested by the user, and load the at least one function into logical pages of different paging sizes according to the function call heat to obtain a second program file.
[0096] For another example, the computing server is used to execute the second program file and send the execution result of the second program file to the client.
[0097] When executing the second program file, the computing server may read functions from its own memory or a logical page stored in the storage server cluster 120 to execute the second program file.
[0098] In a possible embodiment, the computing server interacts with the storage server for data via Remote Direct Memory Access (RDMA), Remote Procedure Call (RPC), or the like.
[0099] At the hardware level, the computing server is provided with a processor and memory (not shown in FIG1 ), and the computing function of the computing server is realized by the processor running the program in the memory.
[0100] The storage server cluster 120 includes one or more storage servers (two storage servers, storage server 121 and storage server 122 , are shown in FIG1 , but the present invention is not limited to two storage servers).
[0101] The storage server serves as a storage resource in the data processing system 100, such as a server, desktop computer, or storage array controller, hard disk frame, etc., and is used to provide logical disk storage, unstructured data storage, and integrated backup services for the cloud virtual machines in the data processing system 100.
[0102] From a hardware perspective, a storage server includes a processor, a network card, and memory. The processor in the storage server is used to process data from outside the storage server. The network card is used to control the access process to the memory, such as the control of address signals, data signals, and various command signals, so that the storage server can provide the memory as a storage resource to users. The memory is used to store data and can include internal memory and / or hard disk. Memory refers to internal storage that directly exchanges data with the processor. Memory can read and write data quickly at any time and serves as a temporary data storage for the operating system or other running programs. Unlike memory, the hard disk reads and writes data more slowly than memory and is usually used to store data persistently.
[0103] In one embodiment of the present application, a storage server stores a logic page containing multiple functions, and the storage server sends the logic page requested by the computing server to the computing server, so that the computing server calls the function according to the logic page to execute the program.
[0104] In addition to the computing server cluster 110 and the storage server cluster 120, the data processing system 100 may also include a management server cluster (not shown in Figure 1). The management server cluster includes one or more management servers. The management server is used to manage all computing services, shared storage, and networks of the entire computer system 100, and provide users or administrators with an application program interface (API) for managing the entire node.
[0105] Network device cluster 130 includes one or more switches and routers. As shown in Figure 1 , in this embodiment, network device cluster 130 includes router 131, switch 132, switch 133, and switch 134. Client 140 is connected to router 131 via the Internet. Router 131 is connected to switch 133 via switch 132. Switch 133 is connected to each computing server in computing server cluster 110. Switch 134 is connected to each computing server in computing server cluster 110 and each storage server in storage server cluster 120.
[0106] Optionally, the number and type of switches included in network device cluster 130 can be adjusted based on the needs of data processing system 100. Switches 132, 133, and 134 can be switches with different functions. For example, switch 132 can be a core switch, while switches 133 and 134 can be switches for managing specific network segments. For example, switch 132 can be a core switch, switch 133 can be a switch for internal and external switching segments, and switch 134 can be a switch for storage segments.
[0107] Client 140 includes one or more clients ( FIG. 1 shows two clients, namely client 141 and client 142 , but the present invention is not limited to two clients). The client includes an interface and application required for accessing data processing system 100 .
[0108] Client 140 is used to send a request to compute server cluster 110, causing a compute server in compute server cluster 110 to execute a first program file based on the user's request, or to load the functions of the first program file into logical pages of different paging sizes based on function call popularity, and then run a second program file with the functions rearranged. Optionally, client 140 can send a request to a compute server in compute server cluster 110 based on geographic proximity. The compute server that receives the request is called the client's coordinator, coordinating and scheduling one or more tasks of the transaction.
[0109] It is worth noting that FIG1 is merely a schematic diagram and should not be construed as limiting the present application. The data processing system 100 may also include other devices not shown in FIG1. Furthermore, the storage server and computing server in the data processing system 100 may be the same device or different devices. For example, computing server 111 and storage server 121 may be provided on the same server device, with computing resources provided to computing server 111 and storage resources provided to storage server 121.
[0110] The computing servers, storage servers, etc. in the above-mentioned data processing system 100 provided in this application can be nodes in a cloud platform. Based on the equipment of the data processing system 100 as shown in Figure 1, the data processing system 100 implements the functions of nodes such as computing nodes and storage nodes based on infrastructure as a service, platform as a service, and software as a service, and provides services (such as computing services, storage services, and network services) to the client 140 through the node. The node can be a service node (such as computing nodes and storage nodes, etc.) in the cloud obtained by virtualizing the resources (such as computing resources and storage resources, etc.) of the data processing system 100. For example, the computing servers in the data processing system 100 are virtualized as computing nodes in the cloud platform, and the storage nodes are virtualized as storage nodes in the cloud platform. In this case, the nodes and servers can be regarded as equivalent in this application.
[0111] For another example, the computing server and storage server in the data processing system 100 are virtualized into a service node in the cloud platform, and the service node has the functions of a computing node and a storage node. For example, the cloud server that provides services to the user terminal 140 in the cloud platform of the present application can be a computing server, or a computing server can be virtualized into a service node.
[0112] Next, the layered structure of the data processing system 100 as a cloud platform will be described with reference to FIG. 2 .
[0113] As shown in Figure 2, IaaS platform 210 is used to virtualize all infrastructure resources in data processing system 100, providing users with virtual resources (e.g., computing resources, network resources, and storage resources) in a software-defined manner. Infrastructure resources refer to resources provided by computing server cluster 110, storage server cluster 120, and / or network device cluster 130 in data processing system 100.
[0114] PaaS platform 220 implements the runtime environment and application support functions of data processing system 100. Users can apply for computing units within quotas rather than virtual resources to run their own services. Alternatively, computing units can be containers, and data processing system 100 deploys and runs user code by scheduling containers. It should be noted that the number of containers in PaaS platform 220 can be one or more; Figure 2 shows only one container as an example.
[0115] As a possible implementation, data processing system 100 can inject one or more components into a container to deploy and run the code. Optionally, the resources (computing resources or storage resources) used by multiple components in the same container can belong to the same hardware device (e.g., a computing server or storage server) in data processing system 100, or they can belong to different hardware devices.
[0116] The SaaS application 230 is used to provide services to users by composing user-deployed applications in the form of API responses based on the IaaS platform 210 and the PaaS platform 220. The application and container of the SaaS application 230 can communicate through a web server.
[0117] It is worth noting that FIG2 is only a schematic diagram and should not be understood as a limitation on the present application. The hierarchical structure of the data processing system 100 may also include other modules that are not shown in FIG2 .
[0118] Next, the data processing method provided by this embodiment will be described in detail with reference to the accompanying drawings.
[0119] The steps of the data processing method provided in this embodiment are performed by a service node virtualized from a computing server (such as computing server 111 and / or computing server 112) in computing node cluster 110 in data processing system 100. This service node is hereinafter referred to as a cloud server. Next, the data processing method provided in this embodiment of the application will be described with reference to FIG3 .
[0120] Step 310: The client 140 sends a request to the cloud server.
[0121] As one possible example, the request of client 140 may be a software access request.
[0122] In other possible embodiments, the client 140 may also make any type of request such as data writing, data reading, etc. The above software access request is only an example listed in this application.
[0123] Step 320: The cloud server obtains the first program file that needs to be executed.
[0124] As a possible example, the cloud server reads the first program file requested to be executed from its own memory or the storage server cluster 120 .
[0125] As a possible implementation method, when the first program file is a program being executed by the cloud server, or when the first program file is a frequently executed program stored in the cloud server's own memory, the cloud server reads the first program file requested to be executed from its own memory.
[0126] As another possible implementation, when the first program file requested to be executed is not stored in its own memory, the cloud server reads the first program file requested to be executed from the storage server cluster 120 .
[0127] Step 330: The cloud server determines the function call heat of at least one function called during the execution of the first program file.
[0128] As a possible example, the cloud server performs static analysis and function call heat statistics on the first program file in sequence to obtain the function call heat of each function in at least one function during the execution of the first program file.
[0129] In a possible embodiment of the present application, the function call heat may be the function call frequency, where a high function call frequency indicates a high function call heat, and a low function call frequency indicates a low function call heat.
[0130] The above function call frequency is only an example. This application does not limit the specific indicator of function call heat. Function call heat can also be any indicator value that can represent the frequency of function calls. For example, function call heat can also be function call frequency, function call count, etc.
[0131] As a possible implementation manner, the cloud server sequentially performs static analysis and function call frequency statistics on the first program file, as described in detail in steps 331 to 332 in FIG6 , which will not be described in detail here.
[0132] Step 340: The cloud server loads at least one function into logical pages of different paging sizes based on the function call popularity, thereby obtaining a second program file. The paging size of the logical page corresponding to the function with higher call popularity is larger than the paging size of the logical page corresponding to the function with lower call popularity.
[0133] As a possible example, the cloud server preferentially loads high-heat functions into at least one large page and low-heat functions into at least one small page according to the function call heat of each function in at least one function to obtain a second program file.
[0134] As a possible implementation manner, the total number of huge pages is determined by the cloud server according to the size of the first program file and the paging size of the huge pages.
[0135] Optionally, the cloud server divides a preset ratio of the total size of all functions included in the first program file by the paging size of the huge page to obtain the total number of huge pages. The preset ratio can be flexibly set according to demand, such as 20%, 25%, 31%, 60%, 85%, etc.
[0136] This application does not limit the specific page sizes of large pages and small pages. For example, the page size of a large page can be 2 mebibyte (MB), 4MB, 10MB, 512MB, 1GB, 2.4GB, 4GB, etc. For another example, the page size of a small page can be 2KB, 4KB, 8KB, 32KB, etc.
[0137] If all huge pages cannot load all the hot functions:
[0138] First, considering that the high-heat functions with the highest call popularity among the unloaded functions need to be loaded into the huge pages first, when the number of loaded huge pages is less than the total number of huge pages, the cloud server can load the high-heat functions with the highest call popularity among the unloaded functions into blank huge pages.
[0139] Optionally, the high-heat function is a function block whose function call heat is greater than or equal to a first preset value, and the low-heat function is a function block whose function call heat is less than the first preset value. The function block includes a calling function and a called function, which can be regarded as a function. During the execution of the first program file, the calling function calls the called function. The called function corresponding to the calling function can be one or more called functions. For example, if function 1 calls function 2, and function 2 calls function 3, then function 2 and function 3 can both be called called functions of function 1.
[0140] Secondly, considering the need to reduce intra-page fragmentation of logical pages, the cloud server can load the hottest function that calls the highest popularity among the unloaded functions into a loaded huge page with remaining space greater than the size of the hottest function when the number of loaded huge pages is equal to the total number of huge pages.
[0141] Thirdly, considering the need to ensure that all functions contained in the first program file are loaded, the cloud server can load the unloaded high-heat functions and low-heat functions into at least one small page when the number of loaded large pages is equal to the total number of large pages and the size of the highest-heat function called among the unloaded functions is greater than the remaining space size of each loaded large page.
[0142] For a specific example of the above function loading, please refer to steps 341 to 345 in FIG10 , which will not be described in detail here.
[0143] If all large pages can load all the hot functions:
[0144] First, considering that loading all high-heat functions into large pages can further reduce the probability of cross-page access, the cloud server can load high-heat functions into at least one large page in sequence according to the order of their function call heat from high to low.
[0145] Secondly, considering that the more functions with higher function call heat in a large page, the lower the probability of cross-page access, the cloud server can load low-heat functions into at least one large page in sequence according to the order of their function call heat from high to low.
[0146] Thirdly, when the remaining space of each large page in at least one large page is smaller than any low-heat function, the cloud server may load the remaining low-heat functions into at least one small page.
[0147] As a possible implementation method, the large pages and small pages in this application belong to different segments respectively, so that when the operating system of the cloud server calls functions according to the rearranged logical pages, it can continuously call high-temperature functions in the large page according to the segment table of the large page, instead of frequently querying the segment tables of different segments for cross-page access, thereby improving the program running efficiency.
[0148] In this application, after the cloud server loads at least one function into a large page and a small page respectively according to the function call popularity, the schematic diagram of the resulting logical page can be referred to in Figure 4. Different shapes such as squares, rectangles, circles, and hexagons in Figure 4 are used to represent different functions (for example, A(), B(), C(), etc.), and connecting lines with arrows are used to indicate that the function without the arrow end is calling the function connected to the arrow end.
[0149] Figure 4 is a graphical diagram of functions rearranged between large and small pages. A comparison of the logical pages (including large and small pages) contained in the second program file and the logical pages (including only small pages) contained in the first program file after the functions are rearranged between large and small pages can be seen in Figure 5. A(), B(), C(), etc. in Figure 5 represent different functions. Arrowheads indicate that a function without an arrowhead calls a function connected to an arrowhead. Large Page 1, Small Page 1, Small Page 2, and Small Page 3 in the figure are merely illustrative designations.
[0150] Step 350: The cloud server executes the second program file to obtain an execution result of the second program file.
[0151] As one possible example, the cloud server calls a high-popularity function loaded using a large page during execution of the second program file, and continuously obtains the calling function and the called function of the high-popularity function based on the large page. The cloud server will not further describe the calling method of low-popularity functions loaded using large pages and high-popularity functions loaded using small pages during execution of the second program file.
[0152] Step 360 : The cloud server returns a response to the client 140 .
[0153] As a possible example, the cloud server returns a response including the execution result of the second program file to the client 140 .
[0154] In other possible embodiments of the present application, the response returned by the cloud server to the client 140 may not include the execution result of the second program file. For example, when the request is a data write request, the response is used to indicate that the cloud server has written the data required by the data write request to the storage server cluster 120 into the storage server cluster 120.
[0155] Based on steps 310 to 360 of the above-mentioned data processing method, the cloud server uses functions as granularity and rearranges the functions contained in the first program file according to the function call heat of the first program file to be executed by the client. In the rearranged second program file, the cloud server preferentially loads functions with high function call heat using larger logical pages to increase the probability that the second program file will continuously call functions with higher function call heat from the same logical page more frequently during operation. Therefore, when the cloud server executes the second program file, compared with executing the first program file that loads functions randomly or in a logical order into the logical page, the page access density of the function is improved, the probability of cross-page access is smaller, and the program execution performance is improved. At the same time, loading more functions with higher function call heat into larger logical pages can reduce the miss of the translation backup buffer, improve the hit rate of the translation backup buffer, and further improve the program execution performance.
[0156] The above describes the overall process of the data processing method provided by this application in conjunction with Figures 3 to 5. Next, in conjunction with Figures 6 to 9, taking the function call popularity as the function call frequency as an example, the specific steps of the cloud server performing static analysis and function call frequency statistics on the first program file are described in detail. As shown in Figure 6, step 330 in Figure 3 can include the following steps 331-332.
[0157] Step 331: The cloud server performs static analysis on the first program file to obtain a static control flow graph of at least one function.
[0158] As a possible example, the cloud server performs static code analysis on the first program file to determine a static control flow graph of at least one function.
[0159] The static control flow graph may include the start address, end address, function size, and inter-function call information of each function in at least one function.
[0160] This application does not limit the storage or representation of static control flow graphs. For example, as shown in Figure 7, A(), B(), C(), H(), V(), etc. represent functions, and arrowed lines are used to represent call information between functions, that is, the function without an arrow end calls the function connected by the arrow end.
[0161] Step 332: When the first program file is executed, the cloud server determines the function call frequency of at least one function according to the static control flow graph.
[0162] As a possible example, when executing the first program file, the cloud server samples the execution path of the first program file in the static control flow graph, and records the number of executions of each execution path to obtain the function call frequency of at least one function.
[0163] As one possible implementation, a recent branch record register records function jump information between functions in a static control flow graph when the cloud server executes the first program file. The cloud server samples the recent branch record register to determine a portion of the execution path of the first program file based on the function jump information, and annotates the execution count, function call type, and other information for this portion of the execution path.
[0164] In this way, the cloud server periodically performs sampling to determine part of the execution path of the first program file, counts the function call frequency of some functions, and then loads them into large pages or small pages. It can also reduce the probability of cross-page access during program execution to improve program performance. At the same time, there is no need to continuously monitor all functions for a long time, which reduces the time and computing and communication volume of subsequent function loading, and improves the overall generation efficiency of the second program file.
[0165] Optionally, the function call frequency of each function may be the number of times the execution path to which the function belongs is executed within a sampling period. The sampling period can be flexibly adjusted according to the sampling accuracy requirements, such as 1 millisecond, 0.5 seconds, 1 second, 2 seconds, 18 seconds, 60 seconds, 5 minutes, etc.
[0166] For example, the partial execution path shown by the thick arrow connecting line in Figure 8, the cloud server periodically samples the function jump information in the most recent branch record register with a period of 0.1 seconds, and collects the function jump information of function P() calling function A(), the function jump information of function B() calling function C(), the function jump information of function C() calling function G(), and the function jump information of function G() calling function H(), and records each function jump information in the static control flow graph to obtain a partial execution path.
[0167] For example, the execution times of the execution paths shown by the numbers corresponding to the arrowed lines in FIG9 , the cloud server counts the function jump information collected in one or more cycles, and obtains that the execution times of the execution path from function P() to function A() is 1300, the execution times of the execution path from function A() to function S() is 213, the execution times of the execution path from function S() to function B() is 550, the execution times of the execution path from function B() to function C() is 611, the execution times of the execution path from function C() to function G() is 54, and the execution times of the execution path from function F() to function G() is 1300. 10, the execution number of the execution path from function G() to function H() is 6, the execution number of the execution path from function H() to function Q() is 39, the execution number of the execution path from function P() to function Q() is 100, the execution number of the execution path from function K() to function P() is 1120, the execution number of the execution path from function D() to function K() is 170, the execution number of the execution path from function D() to function E() is 160, the execution number of the execution path from function K() to function V() is 820, and the execution number of the execution path from function V() to function E() is 443.
[0168] After completing the function call frequency statistics based on the steps shown in FIG6 , the data processing method of the present application executes step 340 in FIG3 to load at least one function into logical pages of different paging sizes. The function loading step is exemplarily described below with reference to FIG10 . As shown in FIG10 , the function loading step may include steps 341 to 345 .
[0169] Step 341: The cloud server constructs a dynamic control flow graph based on the static control flow graph and the function call frequency of at least one function.
[0170] In the example shown in Figure 10, the dynamic control flow graph includes functions A(), function B(), function C(), function D(), function E(), function F(), function G(), and function H() represented by shapes such as circles, squares, triangles, and pentagons, and the numbers on the connecting lines represent the function call frequency between each function.
[0171] Step 342: The cloud server determines the total number of huge pages based on the size of the first program file and the paging size of the huge pages.
[0172] As a possible example, the total number of huge pages can be such that the total capacity of all huge pages can accommodate a preset proportion of high-heat functions, wherein the preset proportion can be flexibly set according to demand, such as 25%, 31%, 45%, 60%, 85%, etc.
[0173] Step 343: When there is currently an unloaded huge page, the cloud server loads the function with the highest function call frequency among the unloaded functions into the unloaded huge page.
[0174] Based on the example shown in FIG10 , there are currently unloaded huge pages and all functions are unloaded. Functions C() to D() are the function blocks with the highest function call frequency among the unloaded functions. This function block is loaded as a function into an unloaded huge page, such as Huge Page 1. After functions C() to D() are loaded, functions A() to B() are the function blocks with the highest function call frequency among the unloaded functions. This function block is loaded as a function into an unloaded huge page, such as Huge Page 2.
[0175] Step 344: When there is no unloaded huge page, the cloud server loads the function with the highest function call frequency among the unloaded functions into a loaded huge page with a remaining space greater than or equal to the function size.
[0176] Based on the example shown in FIG10 , there is currently no unloaded huge page, and functions A() to F() are function blocks with the highest function call frequency among the unloaded functions. The function is loaded as a function into the loaded huge page 2.
[0177] Optionally, the loaded huge page used to load the function with the highest function call frequency among the unloaded functions may be the huge page with the highest function call frequency among all huge pages whose remaining space is greater than or equal to the function size. The function call frequency of a huge page is the sum of the function call frequencies of all functions loaded in the huge page.
[0178] Step 345: When there is no loaded large page with a remaining space greater than or equal to the function size of the function with the highest function call frequency among the unloaded functions, the cloud server loads the function with the highest function call frequency among the unloaded functions into a small page.
[0179] Based on the example shown in FIG10 , the remaining space of the currently largest large page 2 is smaller than that of the functions with the highest function call frequency, such as functions E() to H(), loaded into small page 1 .
[0180] In a possible embodiment of the present application, the principle of function loading in a small page can be the same as the principle of function loading in the above-mentioned large page. For example, the small page used to load the function with the highest function call frequency can be the large page with the highest call frequency among all small pages. No further details will be given here.
[0181] In this application, the cloud server can use tools such as testing scripts to obtain the static control flow graph and / or dynamic control flow graph of the first program file. The testing script can be a linear script, a structured script, a shared script, a data-driven script, a keyword-driven script, etc.
[0182] Based on steps 341 to 345 above, functions with the highest call frequency are preferentially loaded into large pages (e.g., if no large pages are loaded or the large pages with the highest call frequency), thereby increasing the probability of continuously calling functions from large pages during program execution and reducing the number of cross-page accesses during program execution, thereby improving program performance. At the same time, functions with lower call frequencies are loaded into small pages to avoid the problem of excessive page fragmentation caused by all logical pages being large pages. Compared to using only large pages, this can reduce the computing resources occupied by the large amount of work involved in splitting / merging memory areas, as well as the performance jitter caused by frequent memory recycling, further improving program performance.
[0183] The above text, in combination with Figures 3 to 10, provides an overall and detailed description of the data processing method provided in the present application. Since the application scenario of the data processing method can be a cloud platform, the cloud server in the cloud platform also pushes a program optimization service to the client 140 before converting the first program file requested to be executed by the client 140 into a second program file, so as to determine whether to execute steps 320 to 350 as shown in Figure 3 according to the user's instructions.
[0184] As shown in FIG. 11 , the data processing method including the cloud platform pushing a program optimization service to the client 140 includes steps 1110 to 1180 .
[0185] Step 1110: Client 140 sends a request to the cloud server.
[0186] Step 1120: The cloud server obtains the first program file requested to be executed.
[0187] For the specific contents of the above steps 1110 and 1120, please refer to steps 310 and 320 in FIG. 3 , which will not be described in detail here.
[0188] Step 1130 : The cloud server pushes a program optimization service request to the client 140 .
[0189] As a possible example, the program optimization service request is used to indicate that the cloud server requests to convert a first program file into a second program file.
[0190] Optionally, the triggering condition for the cloud server to push the program optimization service request to the client 140 may be: the frequency of translation backup buffer misses is greater than a second preset value, and / or the average function call heat of at least one function during the execution of the first program file is less than a third preset value.
[0191] Step 1140 : The cloud server receives the program optimization service response from the client 140 .
[0192] As a possible example, the program optimization service response is used to indicate that the user determines to convert the first program file into the second program file, or does not convert the first program file into the second program file. This application uses the example of the user determining to convert the first program file into the second program file for subsequent explanation.
[0193] In this embodiment, the time when the cloud server and the client 140 perform the program optimization service request and the program optimization service response is not limited. For example, it can be before step 1110, between step 1110 and step 1120, or after step 1120.
[0194] Step 1150: The cloud server determines the function call heat of at least one function called during the execution of the first program file.
[0195] Step 1160: The cloud server loads at least one function into logical pages of different paging sizes according to the function call heat to obtain a second program file.
[0196] As a possible example, after obtaining the second program file, the cloud server may also store the first program file in the cloud server or the storage server cluster 120 .
[0197] Step 1170: The cloud server executes the second program file and obtains an execution result of the second program file.
[0198] Step 1180 : The cloud server returns a response to the client 140 .
[0199] For the specific contents of the above steps 1150 and 1180, please refer to steps 330 to 360 in FIG3 , which will not be repeated here.
[0200] Based on the above steps 1110 to 1180, the cloud server monitors the running status of the first program file, and executes the data processing method when the translation backup buffer miss frequency is high or the average function call heat is small, that is, when the program runs stably, thereby being able to push program optimization services to users when the running efficiency of the first program file is low, enabling users to determine whether to convert the first program file into the second program file when the performance of the first program file has a large room for improvement, thereby improving user experience.
[0201] Figure 12 is a schematic diagram of the structure of a possible data processing device provided in this embodiment. This data processing device can be used to implement the functions of the cloud server in the above method embodiment, and thus also has the beneficial effects of the above method embodiment. In this embodiment, the data processing device can be a node composed of computing server 111, computing server 112, storage server 121, storage server 122 and / or other servers as shown in Figure 1, or a module (such as a chip) applied to the server.
[0202] As shown in FIG. 12 , the data processing device 1200 includes a transceiver module 1210 and a processing module 1220 .
[0203] The data processing device 1200 can be used to implement the functions of the cloud server in the method embodiment shown in Figure 3 above, and the various modules included in the data processing device 1200 are specifically used to implement the following functions.
[0204] The transceiver module 1210 is used to obtain the first program file requested to be executed by the client. For example, the transceiver module 1210 is used to execute step 320 shown in FIG3 .
[0205] The processing module 1220 is configured to determine the function call heat of at least one function called during the execution of the first program file. For example, the processing module 1220 is configured to execute step 330 shown in FIG3 .
[0206] Processing module 1220 is further configured to load the at least one function into logical pages of different paging sizes based on the function call heat, thereby obtaining a second program file, wherein the paging size of the logical page corresponding to the function with higher function call heat is larger than the paging size of the logical page corresponding to the function with lower function call heat. For example, processing module 1220 is configured to execute step 340 shown in FIG. 3 .
[0207] The transceiver module 1210 is further configured to send the execution result of the second program file to the client. For example, the processing module 1220 is configured to execute step 350 shown in FIG3 .
[0208] As a possible implementation method, logical pages with different paging sizes include at least one large page and at least one small page, and the paging size of at least one large page is larger than the paging size of at least one small page. The processing module is specifically used to: preferentially load high-heat functions into at least one large page, where the high-heat function is a function block whose function call heat is greater than or equal to a first preset value, where the function block includes a calling function and a called function, and during the execution of the program file, the calling function calls the called function; and load low-heat functions into at least one small page to obtain a second program file, where the low-heat function is a function block whose function call heat is less than the first preset value.
[0209] As a possible implementation manner, the processing module is further configured to determine the number of huge pages in the at least one huge page according to the size of the first program file and the paging size of each huge page in the at least one huge page.
[0210] As a possible implementation method, the processing module is specifically used to: when the number of loaded huge pages is less than the number of huge pages, load the highest-heat function called by the unloaded function into a blank huge page; when the number of loaded huge pages is equal to the number of huge pages, determine a loaded huge page with a remaining space greater than or equal to the size of the highest-heat function called by the unloaded function, and load the highest-heat function called by the unloaded function into the loaded huge page.
[0211] As a possible implementation method, the processing module is specifically used to: when the number of loaded large pages is equal to the number of large pages, and the size of the high-heat function that calls the highest heat among the unloaded functions is greater than the remaining space size of each large page in at least one large page, the unloaded high-heat function and the low-heat function are loaded into at least one small page to obtain a second program file.
[0212] As a possible implementation method, the processing module is specifically used to: determine the number of huge pages of at least one huge page based on the number of high-heat functions and the paging size of each huge page in at least one huge page, so that at least one huge page can load all high-heat functions.
[0213] As a possible implementation manner, the processing module is specifically configured to load high-heat functions into at least one large page in sequence according to the order of their function call heat from high to low.
[0214] As a possible implementation manner, at least one large page and at least one small page belong to different segments respectively.
[0215] As a possible implementation method, function call heat is the function call frequency.
[0216] As a possible implementation method, the processing module is specifically used to: perform static analysis on the first program file to obtain a static control flow graph of at least one function; when the first program file is executed, determine the function call frequency of at least one function according to the static control flow graph.
[0217] As a possible implementation method, the processing module is specifically used to: when the first program file is executed, determine at least one execution path of the first program file in the static control flow graph according to the function jump information; determine the number of executions of each execution path in at least one execution path according to the function jump information within a sampling period; for each function in each execution path, determine the function call frequency of at least one function according to the sampling period and the number of executions of the execution path to which each function belongs.
[0218] As a possible implementation manner, the transceiver module is further configured to: obtain function jump information from a latest branch record LBR register corresponding to the first program file, where the function jump information includes a jump address-destination address pair.
[0219] As a possible implementation, the processing module is further configured to: during the execution of the first program file, if the frequency of translation lookaside buffer misses is greater than a second preset value, execute the operation steps of the data processing method shown in FIG3 .
[0220] As a possible implementation method, the processing module is also used to: determine the average value of the function call heat of at least one function during the execution of the first program file; if the average value is less than a third preset value, execute the operating steps of the data processing method shown in Figure 3.
[0221] It should be understood that the data processing device 1200 of the embodiment of the present invention can be implemented by a CPU, an ASIC, or a programmable logic device (PLD). The PLD can be a complex programmable logical device (CPLD), an FPGA, a generic array logic (GAL), or any combination thereof. When the data processing device 1200 implements the data processing method shown in FIG. 3 via software, the data processing device 1200 and its various modules can also be software modules.
[0222] It should be understood that the computing nodes, storage nodes and other nodes in the embodiments of the present application may correspond to the data processing device 1200 in the embodiments of the application, and may correspond to the corresponding subjects in executing the method according to the embodiments of the present application, and the above-mentioned and other operations and / or functions of each module in the data processing device 1200 are respectively for realizing the corresponding processes of the method in Figure 3. For the sake of brevity, they will not be repeated here.
[0223] The present application also provides a system as shown in FIG13 , which includes multiple computing devices 1300, each of which includes a memory 1301, a processor 1302, a communication interface 1303, and a bus 1304. The memory 1301, the processor 1302, and the communication interface 1303 are communicatively connected to each other via the bus 1304. The computing device 1300 may be a server such as a computing server or a storage server in FIG1 , or may be a service node provided by a computing server and / or a storage server in FIG2 .
[0224] The memory 1301 may be a read-only memory, a static storage device, a dynamic storage device, or a random access memory. The memory 1301 may store computer instructions and a set of data required to execute the computer instructions. When the computer instructions stored in the memory 1301 are executed by the processor 1302, the processor 1302 and the communication interface 1303 are used to perform the data processing method.
[0225] The processor 1302 may be a general-purpose central processing unit (CPU), an application-specific integrated circuit (ASIC), a graphics processing unit (GPU), or any combination thereof. The processor 1302 may include one or more chips. The processor 1302 may include an AI accelerator, for example, a neural processing unit (NPU). In addition, FIG13 is illustrated by taking the example of each computing device 1300 including one processor 1302. During specific implementation, the number and type of processors 1302 in each computing device 1300 may be set according to business requirements. The same computing device 1300 may include one or more processors. When the same computing device 1300 includes multiple processors, this application does not limit the type of processor.
[0226] The communication interface 1303 uses a transceiver module such as, but not limited to, a transceiver to implement communication between the computing device 1300 and other devices or a communication network. For example, a user operation request can be received or sent through the communication interface 1303.
[0227] The bus 1304 may include a path for transmitting information between various components of the computing device 1300 (eg, the memory 1301 , the processor 1302 , and the communication interface 1303 ).
[0228] A communication path is established between each of the computing devices 1300 via a communication network. Any computing device 1300 may be a computer (eg, a server) in a distributed storage system, a computer in an edge data center, or a terminal computing device.
[0229] The functions of service nodes such as computing nodes and / or storage nodes can be deployed on each computing device 1300, for example, executing any step 310-step 360 shown in Figure 3, or executing the functions of the transceiver module 1210 and / or processing module 1220 in the data processing device 1200.
[0230] The method steps in this embodiment can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and storage medium can be located in an ASIC. In addition, the ASIC can be located in a terminal device. Of course, the processor and storage medium can also exist as discrete components in a network device or a terminal device.
[0231] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the process or function described in the embodiments of the present application is performed in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device. The computer program or instruction can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer program or instruction can be transmitted from one website, computer, server or data center to another website, computer, server or data center via wired or wireless means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, a hard disk, or a tape; it can also be an optical medium, such as a digital video disc (DVD); it can also be a semiconductor medium, such as a solid state drive (SSD). The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present application, and such modifications or substitutions should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A data processing method, characterized in that: Applied to cloud servers, including: Obtain a first program file requested to be executed by the client; Determining a function call heat of at least one function called during execution of the first program file; According to the function call heat, the at least one function is loaded into logical pages with different paging sizes respectively to obtain a second program file, wherein the paging size of the logical page corresponding to the function with high function call heat is larger than the paging size of the logical page corresponding to the function with low function call heat; Sending the execution result of the second program file to the client.
2. The method according to claim 1, characterized in that The logical pages with different paging sizes include at least one large page and at least one small page, the paging size of the at least one large page is larger than the paging size of the at least one small page, and the at least one function is loaded into the logical pages with different paging sizes according to the function call heat to obtain the second program file, including: Prioritize loading high-heat functions to the at least one large page, the high-heat function being a function block whose function call heat is greater than or equal to a first preset value, the function block including a calling function and a called function, and the calling function calls the called function during the execution of the program file; A low-heat function is loaded into the at least one small page to obtain the second program file, wherein the low-heat function is a function block whose function call heat is less than the first preset value.
3. The method according to claim 2, characterized in that The method further comprises: The number of huge pages of the at least one huge page is determined according to the size of the first program file and the paging size of each huge page in the at least one huge page.
4. The method according to claim 3, characterized in that: The step of preferentially loading the high-heat function to the at least one large page includes: When the number of loaded huge pages is less than the number of huge pages, the high-heat function with the highest call heat among the unloaded functions is loaded into the blank huge page; When the number of loaded large pages is equal to the number of large pages, determine a loaded large page whose remaining space is greater than or equal to the size of the highest-heat function called by the unloaded function, and load the highest-heat function called by the unloaded function into the loaded large page.
5. The method according to claim 4, characterized in that The step of loading the low-heat function into the at least one small page to obtain the second program file includes: When the number of loaded large pages is equal to the number of large pages, and the size of the high-heat function with the highest heat among the unloaded functions is larger than the remaining space size of each large page in the at least one large page, the unloaded high-heat function and the low-heat function are loaded into the at least one small page to obtain the second program file.
6. The method according to claim 2, characterized in that The method further comprises: According to the number of the high-heat functions and the paging size of each large page in the at least one large page, the number of large pages of the at least one large page is determined so that the at least one large page can load all the high-heat functions.
7. The method according to claim 5, characterized in that The step of preferentially loading the high-heat function to the at least one large page includes: The high-heat functions are loaded into the at least one large page in sequence according to the order of function call heat of the high-heat functions from high to low.
8. The method according to any one of claims 2 to 7, characterized in that: The at least one large page and the at least one small page belong to different segments respectively.
9. The method according to any one of claims 1 to 8, characterized in that The function call heat is the function call frequency.
10. The method according to claim 9, characterized in that The determining of the function call heat of at least one function called by the first program file during execution includes: Performing static analysis on the first program file to obtain a static control flow graph of the at least one function; When the first program file is executed, the function call frequency of the at least one function is determined according to the static control flow graph.
11. The method according to claim 10, characterized in that The step of determining the function call frequency of the at least one function according to the static control flow graph when the first program is executed includes: When the first program file is executed, determining at least one execution path of the first program file in the static control flow graph according to the function jump information; Determining the execution times of each execution path in the at least one execution path according to the function jump information within a sampling period; For each function in each execution path, the function call frequency of the at least one function is determined according to the sampling period and the number of executions of the execution path to which each function belongs.
12. The method according to claim 11, characterized in that The method further comprises: The function jump information is obtained from a most recent branch record LBR register corresponding to the first program file, wherein the function jump information includes a jump address-destination address pair.
13. The method according to any one of claims 1 to 12, characterized in that Before determining the function call heat of at least one function called by the first program file during execution, the method further includes: During the execution of the first program file, if the frequency of translation lookaside buffer misses is greater than a second preset value, the step of determining the function call heat of at least one function called during the execution of the first program file is performed.
14. The method according to any one of claims 1 to 13, characterized in that Before loading the at least one function into logical pages with different paging sizes according to the function call heat, the method further includes: determining an average value of function call heat of the at least one function during execution of the first program file; If the average value is less than a third preset value, the step of loading the at least one function into logical pages with different paging sizes according to the function call heat is performed.
15. A data processing device, characterized in that: include: A transceiver module, used for obtaining a first program file requested to be executed by a client; a processing module, configured to determine a function call heat of at least one function called during execution of the first program file; The processing module is further used to load the at least one function into logical pages of different paging sizes according to the function call heat, to obtain a second program file, wherein the paging size of the logical page corresponding to the function with high function call heat is larger than the paging size of the logical page corresponding to the function with low function call heat; The transceiver module is further used to send the execution result of the second program file to the client.
16. A computing device, characterized in that: The computing device includes a memory and a processor, wherein the memory is used to store a set of computer instructions; when the processor executes the set of computer instructions, the operation steps of any one of the methods described in claims 1-14 are performed.
17. A cloud platform, characterized in that: The cloud platform includes a cloud server and a client, the client is used to send a request to the cloud server, the cloud server is used to execute the operation steps of any of the methods described in claims 1-14 according to the request, and the client is also used to receive the execution result of the second program file.
18. A readable storage medium, characterized in that: The readable storage medium includes a computer program or instructions, and when the computer program or instructions are executed on a computer, the computer is caused to execute the operation steps of any one of the methods described in claims 1 to 14.
Citation Information
Patent Citations
Method for realizing godson blade file system based on hugetlbfs technique
CN102339302A
Large memory page integration method based on memory access heat
CN105022696A
Program running method and device and computer readable storage medium
CN113360215A
Method for managing dynamic library and corresponding device
CN115729859A
Enhancing memory safe programming using a page frame tag mechanism
US20210141899A1
Cited By
Memory resource scheduling method and electronic equipment
CN121433922A
