Method for rapidly loading large data group based on DSS data system
Technical Field
The invention relates to a method for quickly loading a large data group based on a DSS data system.
Background
The Darwin Streaming Server is called DSS for short. The DSS is an open source real-time streaming media playing server program provided by Apple company, the whole program is written by pure C + +, the design follows the program design principles of high performance, simplicity, modularization and the like, the program is required to be efficient, the expandability is good, and therefore, the DSS server system is quite ideal in cross-platform support, can run on Windows NT, Windows 2000 and above Windows kernel versions, and can also run on NIX versions well, including Mac OS X, Linux, FreeBSD and Solaris, and the DSS is developed based on standard streaming media protocols RTSP and RTP/RTCP, so that the application has extremely high universality and universality.
The prior DSS-based server data system has the following defects:
firstly, a chimney-type architecture on the traditional IT service deployment leads to high allocation and low usage of equipment hardware, in order to meet the performance and capacity bearing requirements of application programs by considering future application system service development and service burst requirements, a user often selects a certain proportion of allowance to be left when configuring hardware equipment such as computation, storage and network, but after hardware resources are on line, the load of the application system in a certain time is not too high, so that the utilization rate of the higher configured hardware equipment is not high.
Secondly, the existing DSS server data system stores data and exchanges data with a heap as a main means, in this case, if the data volume is small, the influence is not great under the condition of infrequent data use, however, for an enterprise business-class server, it is often necessary to load large-batch data and frequently operate large-scale data groups, if an original heap operation mode is used, space is opened and released each time, and the opened space is very large, and a large amount of memory fragments are generated in the operation process, so that the space and time efficiency in memory use are very low, and the program will deteriorate after running for a period of time.
Thirdly, the existing DSS server does not lock a memory page, the server often has a very large memory capacity and is exclusively used, the actual physical memory usage in the actual operation process is very low, page-missing interrupts are frequently generated when a large data cluster is operated, the generation of the page-missing interrupts seriously affects the response speed of the server and further accumulates data access, and finally even causes the server to be down, which is often difficult to solve.
The existing DSS-based framework is usually used for reading and writing a large amount of data from a database in a small batch and in a loading mode when needed, the use limitation of the mode is very large, and the frequent I/O operation is unacceptable consumption in the use of a server.
In view of the above, the present invention provides a method for fast loading a large data group based on a DSS data system.
Disclosure of Invention
The invention aims to provide a method for quickly loading a large data group based on a DSS data system, which is used for fully utilizing physical memory resources of a server, realizing quick loading and high efficiency and practicability of the large data group and improving the efficiency of the DSS frame data system.
In order to achieve the purpose, the technical scheme of the invention is as follows:
a method for rapidly loading large data groups based on a DSS data system comprises the following steps:
step 1, designing a special virtual memory class QTSSVMarray, wherein the virtual memory class is a template class and comprises a construction function for reserving a preset amount of space in initialization, and the space is not in a physical memory;
step 2, taking a QTSSVMArray of a virtual memory template as a static member variable of a QTSSDictionary in the DSS original data system, and designing the type of a structural body to be stored in a storage space according to the requirement of an application program;
step 3, initializing a static member variable QTSSVMArray in QTSSDictionary, reserving 10MB address space, and restarting the DSS data server if the DSS server fails to reserve the space at the stage;
step 4, adding a function SetBigValue and a qtssAttrDataTypeBigData mark in the QTSSDictionary, wherein the function SetBigValue is used for setting and storing a large-scale data structure, the qtssAttrDataTypeBigData mark is used for setting and storing a large-scale structure data type in the system data type, actually submitting the function SetBigValue to a physical memory when the function SetBigValue is called for the first time, and submitting 1MB of an actual physical memory to a previously reserved address space according to the requirement; the SetBliguValue function uses pointers to store data, wherein the length of fAllocatedLen in a qtssAttrDataTypeBigData mark is set as the length of a pointer array in the function, fAttributeData.Ptr is the address of the pointer array, and fAttributeData.Len is the value of a pointer sizeof;
and 5, the server starts a process, a huge data group loaded in a database by a database plug-in enters a server process memory space, a SetBigValue function is designed in the database plug-in and called once for each row of data, each row of data is stored in each structural body in the virtual memory, at the moment, the SetBigValue function corresponds to an actual physical memory structure according to the array subscript in the developed pointer array, and each pointer in the pointer array is respectively and correspondingly submitted to a memory area in the virtual memory physical space for data storage.
Step 6, adding a condition for acquiring the attribute value of the newly added qtssAttrDataTypeBigData in a GetValuePtr function of the DSS data system, wherein the acquisition mode of the address of the newly added virtual memory physical space is the same as the acquisition mode of the physical space using the heap space;
and 7, locking the submitted physical memory in the using process of the server.
Step 8, adding a QTSS _ SetBugValue interface for providing an external plug-in for a server to use;
and 9, fictitious functions in the QTSSVMArray class so as to release the virtual memory life cycle at the end.
The step 1 further comprises: setting MEM _ TOP _ DOWN flag to virtual function VirtualAlloc to make the operating system reserve space from the high memory address.
In step 2, the structure type stored in the storage space may be designed as a structure type with a size of 1024Bytes per structure according to actual needs, and the structure type is designed as a multiple of the size of the target system paging file, which is 4KB on X86 and X64 and 8KB on IA 64.
After adopting the scheme, compared with the prior art, the invention has the beneficial effects that:
(1) by opening up large virtual memory and submitting a large amount of physical memory to the server for use, the hardware resources of the server are fully utilized, and the existing method is idle in a large amount on the use of the server resources.
(2) Through the use of virtual memory, the characteristics of the virtual memory can be fully used:
1) loading of large data clusters becomes possible;
2) the memory is developed at one time, and compared with the existing system which needs to be developed each time, the efficiency is obviously improved;
3) through the characteristic of continuous virtual memory space, the data access is convenient and fast, the address is discontinuous in the physical memory space in the stack-up mode of the existing scheme, the linked list type access is inefficient, and a large amount of memory fragments are easily caused.
(3) The method has the advantages that the physical memory is locked to prevent the memory page exchange of the server process space in the operation period to the maximum extent, so that the performance loss of the server is greatly reduced, and the existing method frequently carries out page swap-in and swap-out scheduling by the memory manager of the operating system in the use process of a large data group, so that the performance of the server is greatly influenced;
(4) the large data cluster is loaded at one time through the use of the virtual memory, the condition that reloading is needed in the existing scheme is avoided, and particularly the data loading condition needing the I/O process is the behavior of downtime on a server.
The invention is further described with reference to the following figures and detailed description.
Drawings
FIG. 1: the invention relates to a flow chart of a design method of a DSS efficient data system.
Detailed Description
As shown in fig. 1, a method for fast loading a large data group based on a DSS data system disclosed in the present invention includes the following steps:
step 1, designing a special virtual memory class QTSSVMarray, wherein the virtual memory class is a template class and comprises a construction function for reserving a set amount of space in advance during initialization, and the space is not in a physical memory; setting an MEM _ TOP _ DOWN mark in a virtual function VirtualAlloc to enable an operating system to reserve a space from a high-order memory address;
step 2, taking a QTSSVMArray of a virtual memory template as a static member variable of a QTSSDictionary in the DSS original data system, and designing the type of a structural body to be stored in a storage space according to the requirement of an application program; the structure type stored in the storage space can be designed into a structure type with the size of 1024Bytes in each structure according to actual needs, and the structure type is designed into a multiple of the size of a target system paging file, and the value is 4KB on X86 and X64 and 8KB on IA 64;
step 3, initializing a static member variable QTSSVMArray in QTSSDictionary, reserving 10MB address space, and restarting the DSS data server if the DSS server fails to reserve the space at the stage;
step 4, adding a function SetBigValue and a qtssAttrDataTypeBigData mark in the QTSSDictionary, wherein the function SetBigValue is used for setting and storing a large-scale data structure, the qtssAttrDataTypeBigData mark is used for setting and storing a large-scale structure data type in the system data type, actually submitting the function SetBigValue to a physical storage when the function SetBigValue is called for the first time, and submitting 1MB of actual physical memory to a previously reserved address space according to the requirement in the text; the SetBliguValue function uses pointers to store data, wherein the length of fAllocatedLen in a qtssAttrDataTypeBigData mark is set as the length of a pointer array in the function, fAttributeData.Ptr is the address of the pointer array, and fAttributeData.Len is the value of a pointer sizeof;
step 5, the server starts the process and enters the memory space of the server process by loading the huge data group in the database through the database plug-in, calling a SetBigValue function once for each row of data in the database plug-in, storing each row of data in each structural body in the virtual memory, wherein the SetBigValue function corresponds to an actual physical memory structure according to the array subscript in the developed pointer array, and each pointer in the pointer array is respectively and correspondingly submitted to a memory area in the physical space of the virtual memory for data storage; in this step, allocation is performed according to the size and scale of the data in the database read by the actual program.
Step 6, adding a condition for acquiring the attribute value of the newly added qtssAttrDataTypeBigData in a GetValuePtr function of the DSS data system, wherein the acquisition mode of the address of the newly added virtual memory physical space is the same as the acquisition mode of the heap space;
and 7, locking the submitted physical memory in the using process of the server to prevent paging exchange.
Step 8, adding a QTSS _ SetBugValue interface for providing an external plug-in for a server to use;
and 9, fictitious functions in the QTSSVMArray class so as to release the virtual memory life cycle at the end.
The above are merely specific examples of the present invention, and do not limit the scope of the present invention. All equivalent changes made according to the design idea of the present application fall within the protection scope of the present application.