CN112131287A - Method and device for reading data - Google Patents

Method and device for reading data Download PDF

Info

Publication number
CN112131287A
CN112131287A CN201910551474.8A CN201910551474A CN112131287A CN 112131287 A CN112131287 A CN 112131287A CN 201910551474 A CN201910551474 A CN 201910551474A CN 112131287 A CN112131287 A CN 112131287A
Authority
CN
China
Prior art keywords
character string
floor
data
string data
array
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910551474.8A
Other languages
Chinese (zh)
Inventor
唐超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201910551474.8A priority Critical patent/CN112131287A/en
Publication of CN112131287A publication Critical patent/CN112131287A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database

Abstract

The invention discloses a method and a device for reading data, and relates to the technical field of computers. One embodiment of the method comprises: reading target character string data from a data source; separating the target character string data, and adding the floor character string data of each floor into the same array, thereby generating a character string array; wherein the target string data comprises floor string data; and filtering the floor character string data in the character string array, and deserializing the filtered floor character string data into object data. The implementation mode can solve the technical problem that the bearing capacity of the server is reduced due to intensive deserialization operation.

Description

Method and device for reading data
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for reading data.
Background
In order to meet the requirements of cross-platform (needing to be conveniently read by a webpage end, an APP end, various APP embedded applets and the like), contents such as sales promotion activities, shops and the like are generally organized by using the shops as dimensions and adopting a JSON data format, so that after a JSON object is serialized into a character string, the character string is stored into a cache or a field of a database as a section of character string content, and the character string content is organized by using a character string with the floors as dimensions.
When each mobile terminal reads a character string of JSON data from a data source, it is necessary to deserialize the whole segment of character string data into an object format (e.g., nodejs' JSON.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the deserialization belongs to intensive operation of a Central Processing Unit (CPU), and intensive deserialization operation of large JSON data brings large performance pressure to the CPU of the server, so that the bearing capacity of the server is reduced, and key system indexes such as CPU occupancy rate, transaction per second (number of transactions processed by the server per second), and Transport Protocol (TP) 99 (minimum time consumption required for meeting nineteen network requests) are deteriorated.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for reading data to solve the technical problem that the load capacity of a server is reduced due to intensive deserialization operations.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of reading data, including:
reading target character string data from a data source;
separating the target character string data, and adding the floor character string data of each floor into the same array, thereby generating a character string array; wherein the target string data comprises floor string data;
and filtering the floor character string data in the character string array, and deserializing the filtered floor character string data into object data.
Optionally, reading the target string data from the data source includes:
reading storage character string data from a data source;
intercepting target character string data from the stored character string data through a starting character string index and an ending character string index of the target character string data;
wherein the storage string data includes the target string data and the attached information.
Optionally, the dividing the target character string data, and adding the floor character string data of each floor to the same array, thereby generating a character string array, including:
taking the first attribute name in each floor character string as a separation identifier, and separating the target character string data to obtain the floor character string data of each floor;
adding the floor character string data of each floor into the same array in sequence, thereby generating a character string array;
wherein an array element in the string array represents a floor string data.
Optionally, filtering the floor character string data in the character string array includes:
and filtering the floor character string data in the character string array based on the preset maximum floor number and/or at least one floor identification.
Optionally, after deserializing the filtered floor character string data into object data, the method further includes:
screening the object data based on business requirements;
and serializing the screened object data into issued character string data, and issuing the issued character string data to the client.
In addition, according to another aspect of an embodiment of the present invention, there is provided an apparatus for reading data, including:
the intercepting module is used for reading target character string data from a data source;
the partitioning module is used for partitioning the target character string data and adding the floor character string data of each floor into the same array so as to generate a character string array; wherein the target string data comprises floor string data;
and the deserializing module is used for filtering the floor character string data in the character string array and deserializing the filtered floor character string data into object data.
Optionally, the intercept module is further configured to:
reading storage character string data from a data source;
intercepting target character string data from the stored character string data through a starting character string index and an ending character string index of the target character string data;
wherein the storage string data includes the target string data and the attached information.
Optionally, the partitioning module is further configured to:
taking the first attribute name in each floor character string as a separation identifier, and separating the target character string data to obtain the floor character string data of each floor;
adding the floor character string data of each floor into the same array in sequence, thereby generating a character string array;
wherein an array element in the string array represents a floor string data.
Optionally, filtering the floor character string data in the character string array includes:
and filtering the floor character string data in the character string array based on the preset maximum floor number and/or at least one floor identification.
Optionally, the system further comprises a serialization module, configured to, after deserializing the screened floor character string data into object data, screen the object data based on service requirements, serialize the screened object data into delivered character string data, and deliver the delivered character string data to the client.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any of the embodiments described above.
According to another aspect of the embodiments of the present invention, there is also provided a computer readable medium, on which a computer program is stored, which when executed by a processor implements the method of any of the above embodiments.
One embodiment of the above invention has the following advantages or benefits: because the technical means that the target character string data is read from the data source, then the target character string data is separated and filtered, and finally the filtered character string data is in reverse sequence as the object data is adopted, the technical problem that the bearing capacity of the server is reduced due to intensive deserialization operation is solved. The embodiment of the invention firstly filters and then carries out deserialization operation, thereby reducing the density of deserialization operation, reducing the occupancy rate of the CPU, reducing the performance pressure on the CPU and improving the bearing capacity of the server; moreover, for existing systems, the upstream data storage logic and the downstream client display logic do not need to be modified, so that the read optimization can be performed by using the method and the system at lower cost; in addition, the realization of the invention is not limited by programming languages, and the existing languages such as java, javascript, php and the like can use the invention.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a main flow of a method of reading data according to an embodiment of the invention;
FIG. 2 is a schematic illustration of JSON data for a store according to an embodiment of the present invention;
FIG. 3 is a flow chart illustrating a process of reading target string data according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of target string data according to an embodiment of the present invention;
FIG. 5 is a flow chart illustrating the separation of target string data according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of an array of strings according to an embodiment of the invention;
FIG. 7 is a schematic flow diagram of filtering and deserialization according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of object data according to an embodiment of the invention;
FIG. 9 is a schematic view of a main flow of a method of reading data according to a referential embodiment of the present invention;
FIG. 10 is a schematic diagram of the main blocks of an apparatus for reading data according to an embodiment of the present invention;
FIG. 11 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 12 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a main flow of a method of reading data according to an embodiment of the present invention. As an embodiment of the present invention, as shown in fig. 1, the method for reading data may include:
step 101, reading target character string data from a data source.
First, target string data is read from a data source (e.g., a cache or a database). Since contents such as sales promotion and stores are generally organized in a data format of JSON with the store as a dimension, a JSON object is serialized into a character string, and the character string is stored as a piece of character string contents in a field of a cache or a database, and the character string contents are organized as character strings with the floor as a dimension. Alternatively, the target character string data may be character string data of one shop. As shown in fig. 2, JSON data of the store includes JSON data of a head information floor, a carousel floor, a commodity floor, and the like, and the target character string data includes JSON character string data of a head information floor, a carousel floor, a commodity floor, and the like. Therefore, in step 101, character string data of the head information floor, carousel floor, commodity floor, and the like, that is, character string data of the entire store is read. Further, the JSON data of each store may include JSON data of a plurality of floors, and JSON data of other floors, and is not limited to the floors shown in fig. 2. Among other things, the JSON data format is a lightweight data exchange format that stores and represents data in a text format that is completely independent of the programming language based on a subset of ECMAScript (the js specification set by the european computer association).
In general, the data source also includes ancillary information such as store information, and therefore, it is necessary to filter out the ancillary information. Optionally, step 101 comprises: reading storage character string data from a data source; intercepting and taking out target character string data from the stored character string data through a starting character string index and an ending character string index of the target character string data; wherein the storage string data includes the target string data and the attached information. In this embodiment, first, stored character string data (including character string data of the entire store and the affiliated information of the store) is read from a data source (e.g., redis or mysql, etc.), as shown in fig. 3, and then the start character string position and the end character string position are acquired by the start character string index and the end character string index, thereby intercepting target character string data (i.e., character string data of the entire store) from the stored character string data.
In a typical system, store data in a data source often includes other contents in addition to JSON string data of the store, and needs to be filtered out through this step. Since the start character string index and the end character string index of the shop data are set when the shop is finished, the character string data of the whole shop can be easily extracted by the start character string index and the end character string index, as shown in fig. 4.
And 102, separating the target character string data, and adding the floor character string data of each floor into the same array, thereby generating a character string array.
After the target character string data is obtained, the target character string data is partitioned, and the floor character string data of each floor is added to the same array, so that a character string array is generated. In an embodiment of the present invention, the target character string data includes floor character string data corresponding to each floor.
Optionally, step 102 may specifically include: taking the first attribute name in each floor character string as a separation identifier, and separating the target character string data to obtain the floor character string data of each floor; and adding the floor character string data of each floor into the same array in sequence, thereby generating a character string array. In embodiments of the invention, an array element in the array of character strings represents a floor character string data. The floor character strings of all floors can be conveniently cut by separating fields, the character strings are organized in an array mode, subsequent filtering steps are facilitated, convenience and compatibility are good, and CPU loss is low.
Specifically, as shown in fig. 5, it is first necessary to obtain the split fields (split keys), for example, the floor strings are { "a": "xxx" … }, { "a": "xxx" … }, and { "a": "xxx" … }, because a is the first field, then { "a is the split key that can be used as the split identifier for locating the strings that separate different floors. Then, separating the target character string data by using the split Key to obtain the floor character string data corresponding to each floor; and finally, adding the floor character string data of each floor to the same array according to the storage sequence, thereby obtaining a character string array. And taking the first field as a separation identifier, separating the target character string data shown in fig. 4 to obtain the floor character string data of three floors, and sequentially adding the floor character string data of the three floors into the same array to obtain the character string array shown in fig. 6.
Optionally, the partition identifier is used as a first attribute name of JSON data of each floor, and may be a floor name, a floor identifier, or the like, and the first attribute name may be obtained by means of character string search: the character between the first { "and the first subsequent" of the current json is the first attribute name. Wherein each floor identification can be distinguished by an ID, which can be a non-repeating character string or a unique identifier (GUID).
And 103, filtering the floor character string data in the character string array, and deserializing the filtered floor character string data into object data.
In step 103, the floor character string data in the character string array obtained in step 102 may be filtered based on a preset filtering condition, and then the filtered floor character string data is deserialized into object data. In the present invention, deserialization refers to converting the string format of JSON into an object format. Optionally, the floor string data in the string array may be filtered based on a preset maximum number of floors and/or at least one floor identification. By adopting a mode of filtering first and then deserializing, the density of deserializing operation can be reduced, so that the CPU occupancy rate is reduced.
Specifically, two ways of filtering may be used, one being the maximum number of floors, and the other being the floor identification: 1. the maximum floor number limit is entered by defining max, and is filtered by defining the maximum value condition through for circulation; 2. a filtered single or multiple floor ID is defined, traversed by for, and matched by IndexOf to filter the value of the floor ID, such as the field name of the ID uniqueId. indexOf is a method in javascript, which can return the first appearing position of a certain specified string value in a string, and has the same implementation in other languages. In the for statement, once the condition is hit, calling an deserialization interface, and deserializing the filtered floor character strings in the character string array into a JSON object; if the client does not hit the target object, no operation is performed, and the target object is discarded, which indicates that the service scene of the current client is not needed.
As shown in fig. 7, taking the floor character string data of a certain store as an example, the floor character string data (for example, the floor character string data of a head information floor, a carousel floor, a commodity floor, and the like) in the character string array may be filtered based on a preset filtering condition (for example, the number of floors, an ID, and the like), and then the filtered floor character string data (for example, the character string data of three floors, that is, the head information floor, the carousel floor, and the commodity floor) may be deserialized into object data (that is, a head information floor JSON object, a carousel floor JSON object, and a commodity floor JSON object). For example, fig. 8 is a JSON object after deserializing the floor string data in fig. 6.
Taking a 10-floor store as an example, if the prior art is adopted to read data, the character strings of 10 floors need to be deserialized into a JSON object, and if the method provided by the embodiment of the invention is adopted to read data (assuming that the filtering condition is that the maximum number of floors is 5), the character string data of the first 5 floors are screened out, and then the character string data of the 5 floors are deserialized into the JSON object. Therefore, compared with the prior art, the method provided by the embodiment of the invention can improve the CPU performance of the server by 30%, and particularly can reduce the CPU occupancy rate by 9% under the condition of large-flow access of E-commerce webpage application, thereby avoiding the deterioration of key system indexes such as the CPU occupancy rate, TPS, TP99 and the like.
According to the various embodiments described above, it can be seen that the present invention solves the problem of reduced bearing capacity of the server due to intensive deserialization operations by a technical means of reading the target string data from the data source, then separating and filtering the target string data, and finally deserializing the filtered string data into object data. The embodiment of the invention firstly filters and then carries out deserialization operation, thereby reducing the density of deserialization operation, reducing the occupancy rate of the CPU, reducing the performance pressure on the CPU and improving the bearing capacity of the server; moreover, for existing systems, the upstream data storage logic and the downstream client display logic do not need to be modified, so that the read optimization can be performed by using the method and the system at lower cost; in addition, the realization of the invention is not limited by programming languages, and the existing languages such as java, javascript, php and the like can use the invention.
Fig. 9 is a schematic diagram of a main flow of a method for reading data according to a reference embodiment of the present invention, where the method for reading data may specifically include:
step 901, reading storage character string data from a data source.
Firstly, reading storage character string data from data sources such as redis or mysql, wherein the storage character string data comprises JSON character string data of stores and accessory information of the stores.
And step 902, intercepting the target character string data from the stored character string data through the start character string index and the end character string index of the target character string data.
Since the start character string index and the end character string index of the shop data are set at the time of shop decoration, the JSON character string data (i.e., target character string data) of the whole shop can be easily intercepted by the start character string index and the end character string index.
And 903, taking the first attribute name in each floor character string as a separation identifier, and separating the target character string data to obtain the floor character string data of each floor.
And taking the first field as a separation mark to separate the JSON character string data of the stores to obtain the floor character string data corresponding to each floor in the stores.
And 904, adding the floor character string data of each floor into the same array in sequence, thereby generating a character string array.
And adding the floor character string data of each floor to the same array according to the storage sequence, thereby obtaining a character string array. Wherein an array element in the string array represents a floor string data.
And step 905, filtering the floor character string data in the character string array.
And filtering the floor character string data in the character string array based on preset filtering conditions (such as the maximum floor number and/or floor identification).
And 906, deserializing the filtered floor character string data into object data, so that the density of deserializing operation is reduced.
Step 907, screening the object data based on the business requirements.
In order to ensure the system carrying capacity, the client performance and the like, the delivered floor data can be subjected to screening operations such as paging, judging whether the floor data is expired, effectiveness and the like.
And 908, serializing the screened object data into issued character string data so as to enable the issued character string data to meet the cross-platform requirement and be conveniently read by a webpage end, an APP end, various APP embedded applets and the like. In the embodiment of the invention, serialization refers to converting the object format of JSON into a character string format.
And step 909, issuing the issued character string data to the client.
In addition, in a reference embodiment of the present invention, the detailed implementation of the method for reading data is described in detail above, so that the repeated description is not repeated here.
Fig. 10 is a schematic diagram of main blocks of an apparatus for reading data according to an embodiment of the present invention, and as shown in fig. 10, the apparatus for reading data 1000 includes a truncating module 1001, a separating module 1002, and a deserializing module 1003. The intercepting module 1001 is configured to read target string data from a data source; the partitioning module 1002 is configured to partition the target character string data, and add the floor character string data of each floor to the same array, thereby generating a character string array; the deserializing module 1003 is configured to filter the floor character string data in the character string array, and deserialize the filtered floor character string data into object data. Wherein the target string data includes floor string data.
Optionally, the intercept module 1001 is further configured to:
reading storage character string data from a data source;
intercepting target character string data from the stored character string data through a starting character string index and an ending character string index of the target character string data;
wherein the storage string data includes the target string data and the attached information.
Optionally, the separation module 1002 is further configured to:
taking the first attribute name in each floor character string as a separation identifier, and separating the target character string data to obtain the floor character string data of each floor;
adding the floor character string data of each floor into the same array in sequence, thereby generating a character string array;
wherein an array element in the string array represents a floor string data.
Optionally, filtering the floor character string data in the character string array includes:
and filtering the floor character string data in the character string array based on the preset maximum floor number and/or at least one floor identification.
Optionally, the device further includes a serialization module, configured to, after deserializing the filtered floor character string data into object data, filter the object data based on service requirements, serialize the filtered object data into delivered character string data, and deliver the delivered character string data to a client.
According to the various embodiments described above, it can be seen that the present invention solves the problem of reduced bearing capacity of the server due to intensive deserialization operations by a technical means of reading the target string data from the data source, then separating and filtering the target string data, and finally deserializing the filtered string data into object data. The embodiment of the invention firstly filters and then carries out deserialization operation, thereby reducing the density of deserialization operation, reducing the occupancy rate of the CPU, reducing the performance pressure on the CPU and improving the bearing capacity of the server; moreover, for existing systems, the upstream data storage logic and the downstream client display logic do not need to be modified, so that the read optimization can be performed by using the method and the system at lower cost; in addition, the realization of the invention is not limited by programming languages, and the existing languages such as java, javascript, php and the like can use the invention.
It should be noted that, in the implementation of the apparatus for reading data according to the present invention, the above method for reading data has been described in detail, and therefore, the repeated content herein will not be described again.
Fig. 11 shows an exemplary system architecture 1100 of a method of reading data or an apparatus for reading data to which embodiments of the present invention may be applied.
As shown in fig. 11, the system architecture 1100 may include terminal devices 1101, 1102, 1103, a network 1104, and a server 1105. The network 1104 is a medium to provide communication links between the terminal devices 1101, 1102, 1103 and the server 1105. Network 1104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 1101, 1102, 1103 to interact with a server 1104 over a network 1104 to receive or send messages or the like. Various messaging client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, etc. (examples only) may be installed on the terminal devices 1101, 1102, 1103.
The terminal devices 1101, 1102, 1103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 1105 may be a server that provides various services, such as a backend management server (for example only) that provides support for shopping-like websites browsed by users using the terminal devices 1101, 1102, 1103. The background management server may analyze and process the received data such as the product information query request, and feed back a processing result (for example, target push information and product information — only an example) to the terminal device.
It should be noted that the method for reading data provided by the embodiment of the present invention is generally executed on the terminal devices 1101, 1102, 1103 in the public place, and may also be executed by the server 1105, and accordingly, the apparatus for reading data is generally installed on the terminal devices 1101, 1102, 1103 in the public place, and may also be installed in the server 1105.
It should be understood that the number of terminal devices, networks, and servers in fig. 11 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 12, shown is a block diagram of a computer system 1200 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 12 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 12, the computer system 1200 includes a Central Processing Unit (CPU)1201, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)1202 or a program loaded from a storage section 1208 into a Random Access Memory (RAM) 1203. In the RAM1203, various programs and data necessary for the operation of the system 1200 are also stored. The CPU 1201, ROM 1202, and RAM1203 are connected to each other by a bus 1204. An input/output (I/O) interface 1205 is also connected to bus 1204.
The following components are connected to the I/O interface 1205: an input section 1206 including a keyboard, a mouse, and the like; an output portion 1207 including a display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 1208 including a hard disk and the like; and a communication section 1209 including a network interface card such as a LAN card, a modem, or the like. The communication section 1209 performs communication processing via a network such as the internet. A driver 1210 is also connected to the I/O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is mounted on the drive 1210 as necessary, so that a computer program read out therefrom is mounted into the storage section 1208 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 1209, and/or installed from the removable medium 1211. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 1201.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes an intercept module, a partition module, and an deserialization module, where the names of the modules do not in some cases constitute a limitation on the module itself.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: reading target character string data from a data source; separating the target character string data, and adding the floor character string data of each floor into the same array, thereby generating a character string array; wherein the target string data comprises floor string data; and filtering the floor character string data in the character string array, and deserializing the filtered floor character string data into object data.
According to the technical scheme of the embodiment of the invention, the technical means that the target character string data is read from the data source, then the target character string data is separated and filtered, and finally the filtered character string data is in reverse sequence as the object data is adopted, so that the technical problem that the bearing capacity of the server is reduced due to intensive deserialization operation is solved. The embodiment of the invention firstly filters and then carries out deserialization operation, thereby reducing the density of deserialization operation, reducing the occupancy rate of the CPU, reducing the performance pressure on the CPU and improving the bearing capacity of the server; moreover, for existing systems, the upstream data storage logic and the downstream client display logic do not need to be modified, so that the read optimization can be performed by using the method and the system at lower cost; in addition, the realization of the invention is not limited by programming languages, and the existing languages such as java, javascript, php and the like can use the invention.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. A method of reading data, comprising:
reading target character string data from a data source;
separating the target character string data, and adding the floor character string data of each floor into the same array, thereby generating a character string array; wherein the target string data comprises floor string data;
and filtering the floor character string data in the character string array, and deserializing the filtered floor character string data into object data.
2. The method of claim 1, wherein reading the target string data from the data source comprises:
reading storage character string data from a data source;
intercepting target character string data from the stored character string data through a starting character string index and an ending character string index of the target character string data;
wherein the storage string data includes the target string data and the attached information.
3. The method of claim 1, wherein separating the target string data and adding the floor string data for each floor to the same array to generate an array of strings comprises:
taking the first attribute name in each floor character string as a separation identifier, and separating the target character string data to obtain the floor character string data of each floor;
adding the floor character string data of each floor into the same array in sequence, thereby generating a character string array;
wherein an array element in the string array represents a floor string data.
4. The method of claim 1, wherein filtering the floor string data in the string array comprises:
and filtering the floor character string data in the character string array based on the preset maximum floor number and/or at least one floor identification.
5. The method of claim 1, wherein after deserializing the filtered floor string data into object data, further comprising:
screening the object data based on business requirements;
and serializing the screened object data into issued character string data, and issuing the issued character string data to the client.
6. An apparatus for reading data, comprising:
the intercepting module is used for reading target character string data from a data source;
the partitioning module is used for partitioning the target character string data and adding the floor character string data of each floor into the same array so as to generate a character string array; wherein the target string data comprises floor string data;
and the deserializing module is used for filtering the floor character string data in the character string array and deserializing the filtered floor character string data into object data.
7. The apparatus of claim 6, wherein the intercept module is further configured to:
reading storage character string data from a data source;
intercepting target character string data from the stored character string data through a starting character string index and an ending character string index of the target character string data;
wherein the storage string data includes the target string data and the attached information.
8. The apparatus of claim 6, wherein the separation module is further configured to:
taking the first attribute name in each floor character string as a separation identifier, and separating the target character string data to obtain the floor character string data of each floor;
adding the floor character string data of each floor into the same array in sequence, thereby generating a character string array;
wherein an array element in the string array represents a floor string data.
9. The apparatus of claim 6, wherein filtering the floor string data in the array of strings comprises:
and filtering the floor character string data in the character string array based on the preset maximum floor number and/or at least one floor identification.
10. The apparatus of claim 6, further comprising:
and the serialization module is used for screening the object data based on service requirements after deserializing the screened floor character string data into the object data, serializing the screened object data into issued character string data, and issuing the issued character string data to a client.
11. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-5.
12. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-5.
CN201910551474.8A 2019-06-24 2019-06-24 Method and device for reading data Pending CN112131287A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910551474.8A CN112131287A (en) 2019-06-24 2019-06-24 Method and device for reading data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910551474.8A CN112131287A (en) 2019-06-24 2019-06-24 Method and device for reading data

Publications (1)

Publication Number Publication Date
CN112131287A true CN112131287A (en) 2020-12-25

Family

ID=73849355

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910551474.8A Pending CN112131287A (en) 2019-06-24 2019-06-24 Method and device for reading data

Country Status (1)

Country Link
CN (1) CN112131287A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113626103A (en) * 2021-08-09 2021-11-09 平安医疗健康管理股份有限公司 Method, device and equipment for processing service data of Web page and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113626103A (en) * 2021-08-09 2021-11-09 平安医疗健康管理股份有限公司 Method, device and equipment for processing service data of Web page and storage medium

Similar Documents

Publication Publication Date Title
CN109683998B (en) Internationalization realization method, device and system
CN107480205B (en) Method and device for partitioning data
CN107491382B (en) Log output method and device
CN110795315A (en) Method and device for monitoring service
CN112835904A (en) Data processing method and data processing device
CN109753424B (en) AB test method and device
CN112817562A (en) Service processing method and device
CN110928594A (en) Service development method and platform
CN112818026A (en) Data integration method and device
CN112131287A (en) Method and device for reading data
CN110705271A (en) System and method for providing natural language processing service
CN112100168A (en) Method and device for determining data association relationship
CN111723063A (en) Method and device for processing offline log data
CN111127077A (en) Recommendation method and device based on stream computing
CN113704222A (en) Method and device for processing service request
CN110928850A (en) Traffic statistic method and device
CN112784187A (en) Page display method and device
CN110647327A (en) Method and device for dynamic control of user interface based on card
CN110888939A (en) Data management method and device
CN110858240A (en) Front-end module loading method and device
CN111414566A (en) Method and device for pushing information
CN111460273B (en) Information pushing method and device
CN112667627B (en) Data processing method and device
CN113779448A (en) Page processing method and device
CN113065920A (en) Data processing method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination