Dynamic memory occupancy test method and device, equipment, medium and program product
By importing the application database object into the test database, constructing the test environment and executing the test SQL statement, the problem of excessive dynamic memory share in domestic databases is solved, and low-cost dynamic memory usage testing is realized to help discover and solve performance problems.
Patent Information
- Application Number
- CN202510049348.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-04-22
AI Technical Summary
During the migration of traditional databases to domestic databases, it is easy to have a problem of excessive increase in dynamic memory, especially session-level stored procedure compilation products occupy a large amount of dynamic memory, resulting in performance degradation.
By importing the application database objects in the application database to the test database, constructing the test environment, and obtaining the system view of the test database, constructing the test SQL statements associated with each test object in the test database based on the system view, passing in incoming parameters into each test SQL statement, forming a test SQL statement collection, and finally executing at least one test SQL statement in the test SQL statement collection with the global cache turned on, and obtaining dynamic memory usage during the execution.
It realizes low-cost dynamic memory usage testing, which can effectively evaluate the dynamic memory usage of stored procedure compilation products, helps applications discover problems during the test phase, and reduces post-production risks.
Smart Images

Figure CN119862131A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial technology, and in particular to a dynamic memory occupancy testing method, device, equipment, medium and program product. Background Art
[0002] At present, the application of domestic database products in the financial industry is generally in the early stages of promotion, and the need to migrate from original databases to domestic databases is extremely urgent.
[0003] During the migration of traditional databases to domestic databases, the problem of excessively high dynamic memory usage occurs. For example, the compiled products of session-level stored procedures occupy a large amount of dynamic memory. Therefore, it is necessary to reduce the usage of dynamic memory by globally caching the compiled products of stored procedures.
[0004] Domestic database products are in a period of rapid development and cannot maintain long-term version stability. Frequent upgrades of databases as basic software will have a certain impact on application development and production operations and maintenance. Therefore, it is necessary to improve the dynamic memory usage test and verification solution. Summary of the invention
[0005] The present invention provides a dynamic memory occupancy observation method, device, equipment, medium and program product, which can perform acceptance testing on the dynamic memory occupancy of stored procedure compilation products.
[0006] According to one aspect of the present invention, a dynamic memory usage testing method is provided, comprising:
[0007] Importing an application database object in an application database into a test database; the application database object includes at least one test object; the test object includes a stored procedure and a stored function;
[0008] Acquire a system view of the test database, and construct a test structured query language SQL statement associated with each test object in the test database based on the system view;
[0009] Pass input parameters to each test SQL statement to form a test SQL statement set;
[0010] In a state where the global cache is turned on, at least one test SQL statement in the test SQL statement set is executed, and the dynamic memory usage is obtained during the execution of the test SQL statement.
[0011] According to another aspect of the present invention, a dynamic memory usage testing device is provided, comprising:
[0012] An object import module, used for importing an application database object from an application database into a test database; the application database object includes at least one test object; the test object includes a stored procedure and a stored function;
[0013] A statement construction module, used for obtaining a system view of the test database, and constructing a test structured query language SQL statement associated with each test object in the test database based on the system view;
[0014] The parameter input module is used to input parameters to each test SQL statement to form a test SQL statement set;
[0015] The memory testing module is used to execute at least one test SQL statement in the test SQL statement set when the global cache is turned on, and obtain the dynamic memory usage during the execution of the test SQL statement.
[0016] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0017] at least one processor; and
[0018] a memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the dynamic memory occupancy testing method described in any embodiment of the present invention.
[0020] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the dynamic memory occupancy test method described in any embodiment of the present invention when executed.
[0021] According to another aspect of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the computer program implements the dynamic memory occupancy testing method of any embodiment of the present disclosure.
[0022] The technical solution of the embodiment of the present invention is to construct a test environment by importing application database objects in an application database into a test database, and then obtain a system view of the test database, and based on the system view, construct a test SQL statement associated with each test object in the test database, and pass input parameters into each test SQL statement to form a test SQL statement set, and finally execute at least one test SQL statement in the test SQL statement set in a state where the global cache is turned on, and obtain the dynamic memory usage during the execution of the test SQL statement. It only needs to import the application database objects in the application database to achieve a low-cost dynamic memory usage test.
[0023] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 is a flow chart of a dynamic memory usage testing method provided according to Embodiment 1 of the present invention;
[0026] Figure 2 is a flow chart of a dynamic memory usage testing method provided according to Embodiment 2 of the present invention;
[0027] Figure 3 is a structural schematic diagram of a dynamic memory occupancy testing device provided according to Embodiment 3 of the present invention;
[0028] Figure 4 It is a structural schematic diagram of an electronic device for implementing the dynamic memory occupancy testing method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] Embodiment 1
[0032] Figure 1 A flowchart of a dynamic memory occupancy test method is provided for the first embodiment of the present invention. This embodiment is applicable to the case of verifying and evaluating the dynamic memory usage in a test environment. The method can be executed by a dynamic memory occupancy test device. The dynamic memory occupancy test device can be implemented in the form of hardware and / or software. The dynamic memory occupancy test device can be configured in various general-purpose computing devices. Figure 1 As shown, the method includes:
[0033] S110, importing the application database object in the application database into the test database; the application database object includes at least one test object; the test object includes a stored procedure and a stored function;.
[0034] When migrating from a traditional database to a domestic database, the dynamic memory usage is prone to increase too high, including the problem that the session-level stored procedure compilation products occupy a large proportion. Therefore, it is necessary to globally cache the compiled products of the stored procedures to reduce the usage of dynamic memory. In order to complete the dynamic memory usage evaluation based on the global cache of the stored procedure compilation products before production, it is necessary to establish a test environment.
[0035] The application database is the database environment where the application actually runs. The application database includes application database objects and application data. The application database objects include database tables, indexes, stored procedures, stored functions, and packages.
[0036] The test object is a set of Structured Query Language (SQL) statements stored in the database server, and these SQL statements can be executed later by calling the name of the test object. Test objects include two types: stored procedures and stored functions. In the embodiment of the present invention, they specifically include stored procedures and stored functions in a package, as well as stored procedures and stored functions outside a package.
[0037] In the embodiment of the present invention, in order to build a test environment, firstly, all application database objects in the application database are imported into a pre-built test database to form a test environment, so as to facilitate the subsequent dynamic memory occupancy test in the test environment. Specifically, the application-related data definition language (Data Definition Language, DDL for short) is imported into the test database, which includes statements associated with application database objects such as database tables, indexes, stored procedures, stored functions, and packages. In the process of importing DDL, invalid application database objects can also be deleted.
[0038] S120: Obtain a system view of the test database, and construct a test SQL statement associated with each test object in the test database based on the system view.
[0039] The test SQL statement is an SQL statement used to call and execute the test object, wherein the test object includes a stored procedure and a stored function.
[0040] In the embodiment of the present invention, after the application database objects in the application database are imported into the test database and the test environment is constructed, the system view of the test database is obtained. For example, the system view includes a stored procedure view storing stored procedure information and stored function information, a package view containing package information, and a parameter view containing parameter quantity information.
[0041] Furthermore, through the system view, the SQL statements for calling each test object are spliced as the test SQL statements. Specifically, by associating and querying multiple system views, the object information of the entire test object can be obtained, including the stored procedures and stored functions in the package, as well as the stored procedures and stored functions outside the package. Specifically, the information in multiple views can be associatively queried through SQL statements to obtain information such as the test object's associated user, the package to which it belongs, the object name (stored procedure name or stored function name), and the number of object parameters.
[0042] Finally, by splicing the above information, a test SQL statement for calling the test object is generated. For example, selectowner.package_name.funcname(parameter 1, parameter 2). The above test SQL statement is used to call the stored function funcname in the package package_name associated with the user owner. The test SQL statement needs to provide two parameters.
[0043] S130. Pass input parameters into each test SQL statement to form a test SQL statement set.
[0044] In an embodiment of the present invention, when calling each test object, input parameters need to be given. On the basis of constructing the test SQL statement associated with each test object in S120, input parameters need to be passed into each test SQL statement to execute the test SQL statement. The test SQL statement set is composed of all the test SQL statements with passed input parameters.
[0045] Specifically, if you need to test the initialization memory usage, you do not need to import data. You can pass all the input parameters of each test SQL statement as NULL values to obtain a complete test SQL statement.
[0046] Specifically, if you need to simulate the actual application scenario to test the memory usage, you can first import a set amount of application data from the application database into the test database. Then, based on the application data, perform data expansion, and input the imported application data and the expanded data as input parameters into each test SQL statement to obtain a complete test SQL statement.
[0047] S140. With the global cache enabled, execute at least one test SQL statement in the test SQL statement set, and obtain dynamic memory usage during the execution of the test SQL statement.
[0048] In the embodiment of the present invention, in order to prevent the stored procedure compilation product from occupying a large amount of dynamic memory, it is generally necessary to enable the global cache of the stored procedure compilation product. In order to test the dynamic memory usage when the global cache is enabled, it is necessary to execute at least one test SQL statement in the test SQL statement set when the global cache is enabled, and obtain the dynamic memory usage during the execution of the test SQL statement.
[0049] Specifically, a set number of test SQL statements can be selected in the test SQL statement set according to a ratio, and then the selected test SQL statements are executed, and during the execution process, each time the set number of collection items is executed, the dynamic memory usage is printed once to implement dynamic memory testing.
[0050] The technical solution of the embodiment of the present invention is to construct a test environment by importing application database objects in an application database into a test database, and then obtain a system view of the test database, and based on the system view, construct a test SQL statement associated with each test object in the test database, and pass input parameters into each test SQL statement to form a test SQL statement set, and finally execute at least one test SQL statement in the test SQL statement set in a state where the global cache is turned on, and obtain the dynamic memory usage during the execution of the test SQL statement. It only needs to import the application database objects in the application database to achieve a low-cost dynamic memory usage test.
[0051] Embodiment 2
[0052] Figure 2 A flowchart of a dynamic memory usage test method provided in the second embodiment of the present invention. This embodiment further refines the above embodiment and provides specific steps for constructing a test SQL statement associated with each test object in the test database based on the system view, as well as specific steps for passing input parameters to each test SQL statement to form a test SQL statement set, and specific steps for executing at least one test SQL statement in the test SQL statement set and obtaining the dynamic memory usage during the execution of the test SQL statement. Figure 2 As shown, the method includes:
[0053] S210, importing an application database object in an application database into a test database; the application database object includes at least one test object; the test object includes a stored procedure and a stored function.
[0054] S220: Obtain a system view of the test database, and obtain object information of the test object in the test database by querying at least one system view.
[0055] In the embodiment of the present invention, after obtaining the system view of the test database, the object information of the full amount of the test object can be obtained by associating and querying multiple system views, including the stored procedures and stored functions in the package, as well as the stored procedures and stored functions outside the package. Specifically, the information of the test object associated user, the package to which it belongs, the object name (stored procedure name or stored function name), and the number of object parameters can be obtained by associating and querying the information in multiple views through SQL statements.
[0056] Optionally, the object information includes at least one of the user to which the test object belongs, the package to which it belongs, the object name, and the number of object parameters.
[0057] In this optional embodiment, the object information is limited to at least one of the user to which the test object belongs, the package to which it belongs, the object name, and the number of object parameters. By associating and querying multiple system views, the object information of all measured test objects can be quickly obtained to prepare data for subsequent calls to the test objects, thereby improving test efficiency.
[0058] S230. Based on the object information, concatenate the test SQL statements of the test object to which the object information belongs.
[0059] In the embodiment of the present invention, the queried object information is spliced according to the grammatical rules of the SQL language to generate a test SQL statement for calling the test object. For example, select owner.package_name.funcname (parameter 1, parameter 2). The above test SQL statement is used to call the stored function funcname in the package package_name associated with the user owner. The test SQL statement needs to provide two parameters.
[0060] By associating and querying the system view, the object information of all test objects is obtained, and then the object information is assembled to obtain the test SQL statement, which can realize the rapid generation of the test SQL statement and provide sufficient test samples for the dynamic memory usage test.
[0061] S240. Pass input parameters into each test SQL statement to form a test SQL statement set.
[0062] Optionally, input parameters are passed to each test SQL statement to form a test SQL statement set, including:
[0063] Pass the missing value NULL as an input parameter to each test SQL statement to form a test SQL statement set; or
[0064] A set amount of application data is exported from the application database, the application data is expanded to obtain expanded data, and the application data and the expanded data are used as input parameters and passed into each test SQL statement to form a test SQL statement set.
[0065] In this optional embodiment, two methods are provided for passing input parameters into each test SQL statement to form a test SQL statement set: first, when it is necessary to test memory initialization occupancy, there is no need to import data, and all input parameters of each test SQL statement can be passed as NULL values to obtain a complete test SQL statement.
[0066] Second, if you need to simulate the actual application scenario to test the memory usage, you can first import a set amount of application data from the application database into the test database. Then, based on the application data, perform data expansion, and input the imported application data and the expanded data as input parameters into each test SQL statement to obtain a complete test SQL statement. By importing application data and performing data expansion, you can quickly obtain application data that matches the actual application scenario, simulate the real application scenario, and improve the reliability of the test results.
[0067] Through simulation testing without importing data and simulating real business parameter testing with imported data, the dynamic memory usage of stored procedure compilation products is observed. The test environment is verified through various testing methods to observe the memory usage of stored procedure compilation products, helping the application to find as many problems as possible during the testing phase and reduce risks after production.
[0068] S250. With the global cache enabled, execute at least one test SQL statement in the test SQL statement set, and obtain dynamic memory usage during the execution of the test SQL statement.
[0069] S260. In a state where the global cache is closed, execute at least one test SQL statement in the test SQL statement set, and obtain the dynamic memory usage during the execution of the test SQL statement.
[0070] In the embodiment of the present invention, in order to test the effect of enabling the global cache on the dynamic memory usage, at least one test SQL statement in the test SQL statement set can be executed when the global cache is disabled, and the dynamic memory usage is obtained during the execution of the test SQL statement. The test result is used as a reference to the test result when the global cache is enabled, and the dynamic memory usage is observed when the global cache is enabled and when the global cache is disabled, respectively, to provide a more intuitive dynamic memory test result.
[0071] Optionally, at least one test SQL statement in the test SQL statement set is executed, and the dynamic memory usage is obtained during the execution of the test SQL statement, including
[0072] Filter multiple groups of test SQL statements in the test SQL statement set according to the identification serial number of each test SQL statement;
[0073] Each time a set of test SQL statements is executed, the dynamic memory usage is printed once.
[0074] In this optional embodiment, there is provided a specific method for executing at least one test SQL statement in a test SQL statement set and obtaining the dynamic memory usage during the execution of the test SQL statement: first, multiple groups of test SQL statements are screened in the test SQL statement set according to the identification number of each test SQL statement. For example, two test SQL statements are screened out in each package, and each 100 test SQL statements are exported to a file as a group for subsequent dynamic memory testing. Furthermore, the dynamic memory usage is printed once each time a group of test SQL statements is executed. Since the total number of test SQL statements is huge, the test efficiency can be improved by screening a set number of statements for dynamic memory testing by identification numbers.
[0075] It is worth noting that the test environment in this solution can be flexibly changed according to the database environment in which the application actually runs. It has no tight coupling with the specific database and can be applied to various types of database testing and verification.
[0076] The technical solution of the embodiment of the present invention observes the dynamic memory occupied by the compiled products of the stored procedures through simulation testing without importing data and simulating real business parameter input testing with imported data. The test environment is verified through various testing methods to observe the memory occupied by the compiled products of the stored procedures, thereby helping the application to discover as many problems as possible during the testing phase and reduce the risks after production.
[0077] Embodiment 3
[0078] Figure 3 This is a schematic diagram of the structure of a dynamic memory usage test device provided in Embodiment 3 of the present invention. Figure 3 As shown, the device comprises:
[0079] An object import module 310 is used to import an application database object in an application database into a test database; the application database object includes at least one test object; the test object includes a stored procedure and a stored function;
[0080] A statement construction module 320 is used to obtain a system view of the test database, and construct a test structured query language SQL statement associated with each test object in the test database based on the system view;
[0081] The parameter input module 330 is used to input parameters into each test SQL statement to form a test SQL statement set;
[0082] The memory test module 340 is used to execute at least one test SQL statement in the test SQL statement set when the global cache is turned on, and obtain the dynamic memory usage during the execution of the test SQL statement.
[0083] The technical solution of the embodiment of the present invention is to construct a test environment by importing application database objects in an application database into a test database, and then obtain a system view of the test database, and based on the system view, construct a test SQL statement associated with each test object in the test database, and pass input parameters into each test SQL statement to form a test SQL statement set, and finally execute at least one test SQL statement in the test SQL statement set in a state where the global cache is turned on, and obtain the dynamic memory usage during the execution of the test SQL statement. It only needs to import the application database objects in the application database to achieve a low-cost dynamic memory usage test.
[0084] Optionally, the statement construction module 320 is specifically used to:
[0085] Obtaining object information of a test object in the test database by querying at least one system view;
[0086] Based on the object information, a test SQL statement of the test object to which the object information belongs is concatenated.
[0087] Optionally, the parameter input module 330 is specifically used for:
[0088] Pass the missing value NULL as an input parameter to each test SQL statement to form a test SQL statement set; or
[0089] A set amount of application data is exported from the application database, data expansion is performed on the application data to obtain expanded data, and the application data and the expanded data are used as input parameters and passed into each test SQL statement to form a test SQL statement set.
[0090] Optionally, the dynamic memory usage test device also includes:
[0091] The occupancy acquisition module is used to execute at least one test SQL statement in the test SQL statement set when the global cache is closed, and obtain the dynamic memory occupancy during the execution of the test SQL statement.
[0092] Optionally, the memory test module 340 is specifically used for:
[0093] Filtering multiple groups of test SQL statements from the test SQL statement set according to the identification serial number of each test SQL statement;
[0094] Each time a set of test SQL statements is executed, the dynamic memory usage is printed once.
[0095] Optionally, the object information includes at least one of the user to which the test object belongs, the package to which it belongs, the object name, and the number of object parameters.
[0096] The dynamic memory occupancy testing device provided in the embodiment of the present invention can execute the dynamic memory occupancy testing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0097] In the technical solution of the present invention, the collected information is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data comply with the relevant laws, regulations and standards of relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0098] Embodiment 4
[0099] According to an embodiment of the present invention, the present invention also provides an electronic device, a readable storage medium and a computer program product.
[0100] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, applicators, blade applicators, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0101] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0102] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0103] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a dynamic memory occupancy test method.
[0104] In some embodiments, the dynamic memory occupancy test method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the dynamic memory occupancy test method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the dynamic memory occupancy test method in any other appropriate manner (e.g., by means of firmware).
[0105] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0106] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or application.
[0107] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0108] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0109] The systems and techniques described herein may be implemented in a computing system that includes a backend component (e.g., as a data applier), or a computing system that includes a middleware component (e.g., an application applier), or a computing system that includes a frontend component (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0110] A computing system may include a client and an application server. The client and the application server are generally remote from each other and usually interact through a communication network. The relationship between the client and the application server is generated by computer programs running on corresponding computers and having a client-application server relationship with each other. The application server may be a cloud application server, also known as a cloud computing application server or a cloud host, which is a host product in a cloud computing application system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS applications.
[0111] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0112] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A dynamic memory usage test method, characterized in that: include: Importing application database objects from the application database into the test database; The application database object includes at least one test object; the test object includes a stored procedure and a stored function; Acquire a system view of the test database, and construct a test structured query language SQL statement associated with each test object in the test database based on the system view; Pass input parameters to each test SQL statement to form a test SQL statement set; In a state where the global cache is turned on, at least one test SQL statement in the test SQL statement set is executed, and the dynamic memory usage is obtained during the execution of the test SQL statement.
2. The method according to claim 1, characterized in that Based on the system view, constructing a test structured query language SQL statement associated with each test object in the test database, including: Obtaining object information of a test object in the test database by querying at least one system view; Based on the object information, a test SQL statement of the test object to which the object information belongs is concatenated.
3. The method according to claim 1, characterized in that Pass input parameters to each test SQL statement to form a test SQL statement set, including: Pass the missing value NULL as an input parameter to each test SQL statement to form a test SQL statement set; or A set amount of application data is exported from the application database, data expansion is performed on the application data to obtain expanded data, and the application data and the expanded data are used as input parameters and passed into each test SQL statement to form a test SQL statement set.
4. The method according to claim 1, characterized in that Also includes: In a state where the global cache is closed, at least one test SQL statement in the test SQL statement set is executed, and the dynamic memory usage is obtained during the execution of the test SQL statement.
5. The method according to claim 1 or 4, characterized in that: Execute at least one test SQL statement in the test SQL statement set, and obtain dynamic memory usage during the execution of the test SQL statement, including Filtering multiple groups of test SQL statements from the test SQL statement set according to the identification serial number of each test SQL statement; Each time a set of test SQL statements is executed, the dynamic memory usage is printed once.
6. The method according to claim 2, characterized in that The object information includes at least one of the user to which the test object belongs, the package to which it belongs, the object name, and the number of object parameters.
7. A dynamic memory usage test device, characterized in that: include: An object import module, used for importing application database objects in the application database into the test database; The application database object includes at least one test object; the test object includes a stored procedure and a stored function; A statement construction module, used for obtaining a system view of the test database, and constructing a test structured query language SQL statement associated with each test object in the test database based on the system view; The parameter input module is used to input parameters to each test SQL statement to form a test SQL statement set; The memory testing module is used to execute at least one test SQL statement in the test SQL statement set when the global cache is turned on, and obtain the dynamic memory usage during the execution of the test SQL statement.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the dynamic memory occupancy testing method described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the dynamic memory occupancy test method according to any one of claims 1 to 6 when executed.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the dynamic memory occupancy testing method according to any one of claims 1 to 6.