Data processing method and device and storage medium
By generating configuration information for target data during data processing and using this configuration information to mark the transmission location of target data, the problem of large memory overhead during data processing is solved, and more efficient data processing is achieved.
Patent Information
- Application Number
- CN202311585052.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-24
- Publication Date
- 2025-05-27
AI Technical Summary
In the process of data processing, especially in cross-platform or network transmission, there is a problem of large memory overhead, especially because memory needs to be frequently allocated and freed during serialization and deserialization.
When the message object contains target data that does not need to be encoded or not before and after encoding, the serialization method is used to indirectly package the target data, and the configuration information is generated for the target data as part of the serialized data of the message object and written into the second memory space, and the configuration information is used to mark the transmission position of the target data in the serialized data, thereby reducing the need to write target data from the first memory space to the second memory space.
This method effectively reduces the memory overhead in the data processing process, while improving the data processing efficiency, and avoids unnecessary memory copy during the serialization process.
Smart Images

Figure CN120045246A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a data processing method, device, and storage medium. Background Art
[0002] In cross-platform or network transmission, various processes are often required for the message objects to be transmitted, such as serialization / deserialization. Among them, serialization processing refers to the process of converting a message object (such as various messages or data to be transmitted) into byte information suitable for transmission, and deserialization is the process of restoring the byte information to a message object.
[0003] In the process of data processing, it is necessary to allocate memory to store the message object and the data processing result of the message object, resulting in a relatively large memory overhead. Summary of the Invention
[0004] Multiple aspects of this application provide a data processing method, device, and storage medium to reduce the memory overhead during the data processing of message objects.
[0005] An embodiment of this application provides a data processing method, including: loading a target message object into a first memory space, where the target message object at least includes a value domain, and the value domain at least includes target type data; generating first configuration information for the target type data, and writing the first configuration information as partial serialized data of the target message object into a second memory space; the serialized data of the target message object further includes the target type data located in the first memory space, and the first configuration information is used to mark the transmission position of the target type data in the serialized data; sending the serialized data of the target message object to the peer, and when sending the first configuration information, reading the target type data from the first memory space and sending it to the peer together.
[0006] An embodiment of this application further provides a data processing method, including: receiving the serialized data of the target message object sent by the peer, where the target message object at least includes a value domain, and the value domain at least includes target type data; parsing the serialized data to obtain at least the first configuration information of the target type data, where the first configuration information is used to mark the transmission position of the target type data in the serialized data; identifying the target type data included in the serialized data according to the first configuration information, and obtaining the target message object according to the target type data.
[0007] The embodiment of the present application further provides a data processing method, including: loading a target message object into a first memory space, where the target message object at least includes a value range, and the value range includes target-type data and non-target-type data; generating serialized data of the target message object according to the marking information of the non-target-type data and the target-type data, and writing it into a second memory space; taking the target-type data as an independent message object and generating configuration information for it, where the configuration information includes the marking information of the target-type data and a first pointer field for carrying the memory address information of the independent message object at the peer end; writing the configuration information as part of the serialized data of the independent message object into the second memory space; the serialized data of the independent message object further includes the target-type data located in the first memory space; sending the serialized data of the target message object and the serialized data of the independent message object to the peer end, and when sending the configuration information, reading the target-type data from the first memory space and sending it to the peer end together.
[0008] The embodiment of the present application further provides a data processing method, including: receiving serialized data of multiple message objects, where the multiple message objects include a target message object and an independent message object, and the independent message object is the target-type data in the target message object; parsing the non-target-type data and the marking information of the target-type data of the target message object from the serialized data of the target message object; parsing the configuration information and the target-type data of the independent message object from the serialized data of the independent message object, where the configuration information includes the marking information of the target-type data and a first pointer field; configuring pointer information pointing to the target-type data in the first pointer field according to the memory address information of the target-type data at the local end; associating the non-target-type data, the first pointer field, and the target-type data of the target message object according to the marking information of the target-type data to obtain the target message object.
[0009] The embodiment of the present application further provides an electronic device, including: a memory and a processor; the memory is used for storing a computer program; the processor is coupled with the memory and is used for executing the computer program to implement the steps in any one of the data processing methods provided by the embodiment of the present application.
[0010] The embodiment of the present application further provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, it causes the processor to implement the steps in any one of the data processing methods provided by the embodiment of the present application.
[0011] In the embodiments of the present application, when the message object includes target data that does not need to be encoded or remains unchanged before and after encoding, a serialization method of indirectly packing the target data can be adopted. Configuration information is generated for the target data as part of the serialized data of the message object and written into the second memory space. The configuration information is used to mark the transmission position of the target data in the serialized data. In this way, during the process of sending the serialized data of the message object to the peer, when sending the configuration information of the target data, the target data is directly read from the first memory space and sent to the peer together. During the data processing process, there is no need to write the target data from the first memory space into the second memory space, reducing the memory overhead and improving the data processing efficiency at the same time. Description of the Drawings
[0012] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation of the present application. In the drawings:
[0013] Figure 1a Schematic diagram of a message object provided by an exemplary embodiment of the present application;
[0014] Figure 1b Schematic diagram of a serialized data provided by an exemplary embodiment of the present application;
[0015] Figure 1c Schematic diagram of another serialized data provided by an exemplary embodiment of the present application;
[0016] Figure 1d Schematic diagram of yet another serialized data provided by an exemplary embodiment of the present application;
[0017] Figure 1e Schematic diagram of another message object provided by an exemplary embodiment of the present application;
[0018] Figure 1f Schematic diagram of a serialized data provided by an exemplary embodiment of the present application;
[0019] Figure 1g Schematic diagram of a deserialized data provided by an exemplary embodiment of the present application;
[0020] Figure 1h Schematic diagram of the serialization / deserialization process of a serial structure provided by an exemplary embodiment of the present application;
[0021] Figure 2a Schematic diagram of the flowchart of a data processing method provided by an exemplary embodiment of the present application;
[0022] Figure 2bA schematic diagram for serializing a target message object provided by an exemplary embodiment of the present application;
[0023] Figure 2c A schematic diagram for data processing provided by an exemplary embodiment of the present application;
[0024] Figure 3 A flowchart of a data processing method provided by an exemplary embodiment of the present application;
[0025] Figure 4a A flowchart of another data processing method provided by an exemplary embodiment of the present application;
[0026] Figure 4b Another schematic diagram for serializing a target message object provided by an exemplary embodiment of the present application;
[0027] Figure 5 A flowchart of another data processing method provided by an exemplary embodiment of the present application;
[0028] Figure 6a A flowchart of yet another object processing method provided by an exemplary embodiment of the present application;
[0029] Figure 6b A schematic diagram for performing serialization on an object graph provided by an exemplary embodiment of the present application;
[0030] Figure 7a A flowchart of an object processing method provided by an exemplary embodiment of the present application;
[0031] Figure 7b A schematic diagram for serialization and deserialization provided by an exemplary embodiment of the present application;
[0032] Figure 8a A schematic diagram of the structure of a data processing device provided by an exemplary embodiment of the present application;
[0033] Figure 8b A schematic diagram of the structure of a data processing device provided by an exemplary embodiment of the present application;
[0034] Figure 9 A schematic diagram of the structure of an electronic device provided by an exemplary embodiment of the present application. Detailed implementation manners
[0035] To make the objectives, technical solutions and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments of this application and the corresponding drawings. Obviously, the described embodiments are only a part rather than all of the embodiments of this application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts shall fall within the scope of protection of this application.
[0036] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.
[0037] Before introducing the embodiments of this application, first introduce the layout of the object diagram and the encoding formats of different serializers / deserializers.
[0038] As Figure 1a shown, each message object includes: a header, a value field, and a reference field. The value field is the object data, and the reference field points to other objects referenced by this object. For example, message object A references message object B. The value field of message object A is represented by V1, and the value field of message object B is represented by V2. The reference field of message object A is implemented as the address information of message object B in memory.
[0039] The following introduces the encoding formats of several serializers / deserializers.
[0040] 1) The built-in serializer / deserializer in Java (Serializer / Deserializer), simply referred to as JavaS / D. Serialize the metadata of the class used by each message object and the value field of this message object. In the case where this message object references other message objects, serialize the metadata of the class used by the other message objects referenced and their value fields. Among them, the metadata is serialized using a character type (string), with a relatively long serialization length and large memory overhead. As Figure 1b shown, the serialized data of message object A contains the serialized data of message object B.
[0041] 2) Kryo is the most representative third-party serialization library that supports Java serialization. Compared with the built-in serialization method in Java, Kryo uses a class identifier (class_ID) to map the classes used, reducing the size of the metadata. As Figure 1cAs shown, the serialized data of message object A contains the serialized data of message object B.
[0042] 3) Skyway uses a class identification mechanism similar to Kryo to reduce the length of metadata, and during serialization, it converts the absolute address pointed to by the pointer field into a relative offset address. As Figure 1d shown, the serialized data of message object A contains the serialized data of message object B.
[0043] Figure 1e The encoding format adopted by the Cereal serializer is introduced. Among them, Cereal is a serialization tool library implemented based on c++. In Figure 1e it is illustrated with an object graph including: message object A, message object B, message object C, and message object D. Message object A references message object B and message object C, message object B references message object D, and message object D references message object A. Among them, H represents the header of each message object, and V represents the value field of each message object; in memory, the starting address of message object A is 1000, the offset address is 72, and the ending address is 1072. The starting address of message object B is 2000, the offset address is 48, and the ending address is 2048. The starting address of message object C is 3000, the offset address is 40, and the ending address is 3040. The starting address of message object D is 4000, the offset address is 40, and the ending address is 4040. Figure 1f Exemplarily shows the serialization result of the object graph and the relative offset addresses between each message object. For example, the relative offset address of message object A is 0, the relative offset address of message object B is 0 + 72 = 72, the relative offset address of message object C is 72 + 48 = 120, and the relative offset address of message object D is 120 + 40 = 160. Figure 1g Exemplarily shows the deserialization result of the message object graph, and illustrates the restored message object graph with the starting address being 8000 as an example.
[0044] Analyze the above serializer. Figure 1b As shown in the Java built-in serializer, all message objects are embedded in the serialization stream. The message objects are strongly correlated. Serialization is a serial process and does not support serializing / deserializing a message object graph with circular references. Figure 1c - 1gThe serializer shown needs to perform serialization processing on the value fields of all message objects, store the serialization result in memory, and encode the pointer field of the message object as the relative offset address of the message object relative to the object it references in memory. Therefore, after performing serialization processing on all message objects in the object graph, the pointer field can be encoded. During deserialization, after receiving all serialized data, the relative offset can be modified to a pointer, as Figure 1h shown. The above serializer is completely serial in the entire process of "serialization -> network transmission -> deserialization". Therefore, the overall end-to-end latency is very large. In addition, during the above serialization process, the message object is first copied from the hard disk to the first memory space for serialization processing, and a second memory space is allocated to store the serialization result. During this process, some data does not need to be encoded or remains unchanged before and after encoding, and these data are also copied from the first memory space to the second memory space, resulting in a large amount of memory space consumption in the entire serialization process. In the following embodiments of the present application, the problem of memory consumption during serialization is first addressed, and further, the problem of large end-to-end latency can be solved.
[0045] First, in the embodiments of the present application, for message objects containing pointer fields and value fields, a method of separately encoding (or serializing) the value fields and pointer fields of the message objects is proposed to ensure data integrity and accuracy. Value field encoding (or serialization of the value field) refers to the process of converting the value of the message object into binary or other formats. In value field encoding, the range, precision, and representation of the data type need to be considered. For example, for integer types, a fixed-size byte may be used to represent its value; for floating-point types, floating-point notation may be used. Pointer encoding (or serialization of the pointer field) refers to the process of converting the pointer reflecting the reference relationship of the message object into a storable or transmissible format. In pointer encoding, the value of the pointer and the data type it points to need to be considered. Usually, pointer encoding needs to include the value of the pointer itself and the offset or address of the message object it points to. Separating value field encoding and pointer encoding can ensure data integrity and accuracy. Encoding the pointer and value field together may result in inaccurate or corrupted decoded data. Therefore, during serialization, value field encoding and pointer encoding can be processed separately to ensure correct decoding and integrity of the data.
[0046] Secondly, in the embodiments of the present application, an improvement is proposed for the serialization method of the value range. That is, when the message object includes target type data that does not need to be encoded or remains unchanged before and after encoding, an indirect packaging serialization method for the target type data can be adopted. Configuration information is generated for the target type data and written into the second memory space as part of the serialized data of the message object, and the transmission position of the target type data in the serialized data is marked with this configuration information. In this way, during the process of sending the serialized data of the message object to the peer, when sending the configuration information of the target type data, the target type data is directly read from the first memory space and sent to the peer together. During serialization, it is not necessary to write the target type data from the first memory space into the second memory space, which can reduce memory overhead and improve serialization efficiency at the same time.
[0047] Furthermore, the serialization method for the value range provided by the embodiments of the present application is applicable to both a single message object and a message object in an object graph that has a reference relationship with other message objects. For the message objects in the object graph, their value ranges and pointer fields can be serialized independently. The following will combine the accompanying drawings to elaborate on the solutions provided by the embodiments of the present application from the aspects of the value range serialization method and the pointer field serialization dimension respectively. In addition, the present application provides two implementation manners for the serialization method of the value range. Both implementation manners belong to the category of indirect packaging of the value range, but they are different in specific implementation. For the two serialization methods of the value range, reference can be made to the descriptions in the embodiments shown in Figure 2a and Figure 4a ; for the deserialization processing method of the value range, reference can be made to the descriptions in the embodiments shown in Figure 3 and Figure 5 ; for the serialization method of the pointer field, reference can be made to the description in the embodiment shown in Figure 6a ; for the deserialization method of the pointer field, reference can be made to the description in the embodiment shown in Figure 7a .
[0048] Embodiments for serializing and deserializing a value range:
[0049] Figure 2a is a schematic flowchart of a data processing method provided by an exemplary embodiment of the present application. This data processing method is used for serializing a message object. As shown in Figure 2a , the method includes:
[0050] 201. Load the target message object into the first memory space. The target message object includes at least a value range, and the value range includes at least target type data;
[0051] 202. Generate first configuration information for the target type of data, and write the first configuration information as part of the serialized data of the target message object into the second memory space; the serialized data of the target message object further includes the target type of data located in the first memory space, and the first configuration information is used to mark the transmission position of the target type of data in the serialized data.
[0052] 203. Send the serialized data of the target message object to the peer, and when sending the first configuration information, read the target type of data from the first memory space and send it to the peer together.
[0053] In this embodiment, serialization processing can be performed on any message object. For the sake of convenience of description, the serialization processing of the target message object is taken as an example for subsequent description. For the explanation and examples of the message object, reference can be made to the description in the embodiments shown in Figure 6a In the embodiments of the present application, the target message object at least includes a value domain. Optionally, when the target message object is implemented as a message object in an object graph, the target message object may further include a pointer domain. In the embodiments shown in Figure 2a The focus is on the way of serializing the value domain. When the target message object includes a pointer domain, for the way of serializing the pointer domain, reference can be made to the embodiments shown in Figure 6a which will not be elaborated here; of course, other ways can also be adopted for the way of serializing the pointer domain, and this embodiment does not limit this. The value domain of the target message object at least includes: the target type of data. The target type of data belongs to a data type that does not need to be encoded or remains unchanged before and after encoding. For example, byte data or char data or string data. The number of the target type of data included in the target message object can be one segment or multiple segments, and each segment contains one or more target type of data.
[0054] In this embodiment, when serializing the target message object, the first memory space and the second memory space can be allocated for the target message object. The first memory space is used to store the target message object, and the second memory space is used to store the serialized data of the target message object. The sizes of the first memory space and the second memory space can be the same or different. Preferably, the first memory space and the second memory space can be allocated as needed according to the size of the target message object and the size of the serialized data of the target message object. In this embodiment, the target message object can be loaded into the first memory space. For example, the target message object can be loaded from the hard disk into the first memory space, or the first message object can be received through the network card and loaded into the first memory space.
[0055] In this embodiment, serialized data can be generated for a target message object, and the generated serialized data can be written into a second memory space. Among them, since the target type of data belongs to a data type that does not require encoding or remains unchanged before and after encoding, during the serialization of the target type of data, the serialized data after encoding the target type of data is the target type of data itself. Therefore, writing the target type of data from the first memory space into the second memory space will incur additional memory overhead. Based on this, in the embodiment of the present application, first configuration information is generated for the target type of data in the value range. The first configuration information is used to mark the transmission position of the target type of data in the serialized data of the target message object. This transmission position indicates that when sending the serialized data of the target message object to the peer, when the first configuration information is transmitted, the target type of data starts to be read from the first memory space and sent together.
[0056] In this embodiment, the first configuration information can be written into the second memory space as part of the serialized data of the target message object. Instead of writing the target type of data from the first memory space into the second memory space, the target type of data located in the first memory space is directly used as part of the serialized data of the target message object, and the transmission position of the target type of data during the transmission of the serialized data of the target message object to the peer is marked through the first configuration information, so as to reduce the memory overhead during the serialization process. Generally speaking, the memory space occupied by the first configuration information is smaller than the memory space occupied by the target type of data. That is to say, in this embodiment, the serialized data of the target message object includes not only the first configuration information but also the target type of data located in the first memory space. Correspondingly, when sending the serialized data of the target message object to the peer, each part of the serialized data is read from the second memory space and sent to the peer. When the first configuration information in the second memory space is sent, the target type of data is read from the first memory space and sent to the peer together, so as to assist in completing the serialization process through the first configuration information, saving memory space while improving the serialization efficiency.
[0057] In an optional embodiment, the value range of the target message object further includes: non-target data. Non-target data belongs to a data type that changes before and after encoding. For example, integer (int) data. The following will explain the changes that occur to non-target data before and after encoding in combination with the encoding method. Among them, the encoding method for non-target data is not limited. Different encoding methods have different encoding rules. For example, when using the Varint encoding method to encode non-target data, Varint is a method for encoding numbers, and the binary data after encoding is of variable length. For example, if the non-target data is implemented as the number 1 and the Varint encoding method is used to encode the number 1, the result represented in binary is 0000 0001, occupying 1 byte. The integer data 1 before encoding is 1, and after encoding is 0000 0001. Thus, the integer data changes before and after encoding. Another example is that the ZigZag encoding method can be used. ZigZag is a coding scheme that maps signed integers to unsigned integers. For example, the signed integers 0, -1, 1, -2 are encoded as unsigned integers 0, 1, 2, 3. Similarly, the above-mentioned signed integers change before and after encoding.
[0058] Among them, the number of non-target data can be one or more. The serialization processing methods for each non-target data are the same or similar. The following will take the serialization processing of one non-target data as an example for explanation. Encode the non-target data to obtain encoded data, and write the encoded data as part of the serialized data of the target message object into the second memory space. Among them, the target data and the non-target data have an order in the target message object. The first configuration information and the encoded data can be stored in the second memory space in the order of the target data and the non-target data in the target message object. For example, each data is sequentially represented in the target message object as: non-target data F1 -> target data F2 -> non-target data F3. Correspondingly, in the second memory space, they are sequentially stored in order: the encoded data of non-target data F1 -> the first configuration information of target data F2 -> the encoded data of non-target data F3.
[0059] Optionally, the implementation of writing the encoded data as part of the serialized data of the target message object into the second memory space includes: encapsulating the encoded data into a first data segment. The first data segment includes: a tag field, a length field, and a data field. The tag field is used to store a first tag, the length field is used to store the length information of the encoded data, and the data field is used to store the encoded data. In other words, the first data segment includes the first tag, the length information of the encoded data, and the encoded data; the first tag indicates that the first data segment corresponds to non-target data; according to the order in which the non-target data appears in the target message object, the first data segment is written into the data segment area in the second memory space. Among them, the first tag can be represented by numbers, boolean values, strings, or other types of data. For example, in the data segment, 1 bit is used to represent the tag. If the bit is 0, it represents the first tag, or if the bit is 1, it represents the first tag. Of course, the first tag can be represented by multiple bits, and no limitation is made in this regard.
[0060] In Figure 2b , taking the target message object as a single message object without reference relationships as an example for illustration. In addition, in Figure 2b taking the target message object including non-target data J1, target data J2, and target data J3 as an example for illustration. As Figure 2b shown, the first data segment corresponding to the non-target data J1 (i.e., the data segment of J1) includes the first tag (tag1), the length information (len1) of the encoded data, and the encoded data (data). The first data segment is stored in the second memory space as part of the serialized data of the target message object.
[0061] In an optional embodiment, the first configuration information includes: marking information and pointer information. The marking information is used to identify the target data. The marking information can be a number. In the following introduction, the marking information is simply referred to as NUM. Optionally, the order in which the target data appears in the target message object can be used as the specific implementation of NUM. The pointer information is the memory address information of the target data at the peer end. In this way, when the peer end receives the target data, based on this pointer information, the target data can be stored in the corresponding memory space at the peer end.
[0062] In this embodiment, there is no limitation on the implementation of generating the first configuration information for the target data and writing the first configuration information as part of the serialized data of the target message object into the second memory space. The following is an exemplary description.
[0063] Example G1: To be compatible with the data structure corresponding to the serialized data of non-target data, the first configuration information is reflected by means of a data segment plus an additional segment, reducing the damage to the data structure of the value domain serialized data.
[0064] Generate a second data segment for the target-type data. The second data segment includes a tag field, a length field, and a data field. The tag field is used to store the second tag, the length information field is used to store the length information of NUM, and the data field is used to store NUM. In other words, the second data segment includes the second tag, the length information of NUM, and NUM. The second tag indicates that the second data segment corresponds to the target-type data. Among them, the second tag can be represented by a number, a boolean value, a string, or other types of data. For example, the second tag can be represented by 1 bit (0 or 1) in the second data segment. Of course, the second tag can be represented by multiple bits, and no limitation is made in this regard.
[0065] Among them, for any data segment, the tag field can use 1 bit to represent the first tag and the second tag. For example, if the bit in the tag field is "1", it means that the data segment contains the first tag, and this data segment is the first data segment generated for non-target-type data. If the bit in the tag field is "0", it means that the data segment contains the second tag, and this data segment is the second data segment generated for target-type data.
[0066] In this embodiment, an additional segment can also be generated for the target-type data. The additional segment includes: a data field and a pointer field. The data field is used to store NUM, and the pointer field is used to store pointer information. That is to say, the additional segment includes at least NUM and pointer information. Write the second data segment into the data segment area in the second memory space and write the additional segment into the additional segment area in the second memory space according to the order in which the target-type data appears in the target message object; among them, the additional segment area is located after the data segment area. There may be multiple target-type data, and multiple additional segments will also be arranged in order. As Figure 2b shown, the target message object includes two target-type data J2 and target-type data J3. Correspondingly, the additional segment area in the second memory space contains two additional segments and the two additional segments are arranged in order. Optionally, the additional segment also includes: a length field, and the length field is used to store the size information (size) of the target-type data.
[0067] In Figure 2b take the serialized data of the target message object including a data segment and an additional segment as an example for illustration. The data segment includes a tag field, a length field, and a data field. Depending on the situation, the data carried by each field is different. In Figure 2bIn the following, taking the target message object including the target type data J2 and the target type data J3 as an example for illustration. Among them, the second data segment of the target type data J2 includes: the second tag (tag2), the length information (len2) of NUM, and NUM2. The additional segment of the target type data J2 includes the third tag (sub tag1), NUM2, sub tag1, the size information (size2) of the target type data, sub tag1, and the pointer information (ptr1); the second data segment of the target type data J3 includes: tag2, the length information (len3) of NUM, and NUM3. The additional segment of the target type data J3 includes sub tag1, NUM3, sub tag1, the size information (size3) of the target type data, sub tag1, and the pointer information (ptr2). For a detailed introduction to the third tag, please refer to the subsequent embodiments, which will not be elaborated here for the time being.
[0068] Example G2: Instead of using the form of a data segment plus an additional segment, the first configuration information is reflected through the data segment.
[0069] Generate a third data segment for the target type data. The third data segment includes the second tag, the length information of the target data, and the target data. The target data includes the marking information and the pointer information. The second tag indicates that the third data segment corresponds to the target type data; the third data segment may include a tag field, a length field, and a data field. The tag field is used to store the second tag, the length field is used to store the length information of the target data, and the data field is used to store the marking information and the pointer information; write the third data segment to the corresponding position in the second memory space in the order in which the target type data appears in the target message object.
[0070] In an alternative embodiment, the additional segment of the above Example G1 further includes: a third tag. The third tag is used to identify the selection of the first serialization method for the target type data; the first serialization method refers to the method of serializing the target type data as a part of the serialized data of the target message object based on the first configuration information, that is Figure 2a the serialization method provided by the illustrated embodiment.
[0071] Among them, the additional segment includes a tag field. The tag field is used to store the third tag. The tag field can be added at the starting position of the additional segment corresponding to each target type data, or the tag field can be added before each field in the additional segment. In Figure 2b the following, taking the addition of the tag field before each field in the additional segment and the tag field storing the third tag as an example for illustration, but it is not limited to this. Among them, the tag field can be represented by 1 bit. For example, the third tag is 0 or 1. Of course, the third tag can also be represented by multiple bits.
[0072] Furthermore, asFigure 2b As shown, when obtaining the serialization results of the non-target data J1, target data J2, and target data J3 of the target message object respectively, that is, obtaining the serialized data of the target message object. This serialized data includes not only part of the serialized data in the second memory space, but also the target data J2 and target data J3 located in the first memory space. During the process of transmitting the serialized data of the target message object to the peer, the data segments of the non-target data J1, the data segments of the target data J2, the additional segments of the target data J2, the data segments of the target data J3, and the additional segments of the target data J3 can be sequentially read from the second memory space in order and transmitted to the peer via the network; among them, when reading the additional segment of the target data J2, it is necessary to read the target data J2 from the first memory space and transmit it to the peer via the network; similarly, when reading the additional segment of the target data J3, it is necessary to read the target data J3 from the first memory space and transmit it to the peer via the network.
[0073] Further optionally, the embodiments of the present application provide multiple serialization methods, including Figure 2a The first serialization method provided by the embodiment shown, further including: The second serialization method refers to the method of serializing the target data as an independent message object having a reference relationship with the target message object, that is, Figure 4a The serialization method provided by the embodiment shown, for details, please refer to Figure 4a The description of the embodiment shown; and the third serialization method refers to the method of directly copying the target data as part of the serialized data of the target message object from the first memory space to the second memory space, that is, the traditional serialization method. Based on this, in an optional embodiment, as Figure 2c shown, the total data volume of the target data included in the target message object can be obtained, and it is determined whether the total data volume is within the set data volume range. When the total data volume is within the set data volume range, the first serialization method is selected from multiple serialization methods for the target data.
[0074] Further optionally, as Figure 2cAs shown, when the total data volume is not within the set data volume range, it is also possible to determine whether the total data volume is greater than the upper limit value of the set data volume. When the total data volume is greater than the upper limit value of the set data volume range, from multiple serialization methods, the second serialization method is selected. This can not only save memory resources, but also serialize the target type of data as an independent message object, decouple the target type of data from the target message object, facilitate deserializing the two in a parallel manner, improve the deserialization efficiency, and shorten the end-to-end latency. Further, when the total data volume is less than or equal to the upper limit value of the set data volume range, it is determined whether the total data volume is less than the lower limit value of the set data volume range. When the total data volume is less than the lower limit value of the set data volume range, from multiple serialization methods, the third serialization method is selected, which can simplify the serialization method and the memory resource consumption will not be too large.
[0075] It should be noted that the corresponding relationship between different serialization methods and the tag values in the tag fields in the additional segment can be preset. For example, the tag values in the tag fields are represented by two bits. 00 indicates that the first serialization method is used for the target type of data, that is, the third tag is implemented as 00, 01 indicates that the second serialization method is used for the target type of data, and 11 indicates that the third serialization method is used for the target type of data. After determining which serialization method to use according to the total data volume of the target type of data, the corresponding tag value can be set in the tag field in the additional segment.
[0076] In an alternative embodiment, in the case where the local end and the peer end communicate using Remote Direct Memory Access (RDMA), an RDMA connection is established with the peer end in advance. Through this RDMA connection, the local end and the peer end can negotiate the memory space for storing the target message object. Correspondingly, the peer end returns the start address information of the memory space reserved for the target message object to the local end; the local end receives the start address information of the memory space reserved for the target message object sent by the peer end; according to the start address information of the reserved memory space and the address offset of the target type of data in the target message object, the memory address information of the target type of data at the peer end is determined, and this memory address information is written as part of the information in the first configuration information into the second memory space. Further, in Figure 2b In the shown embodiment, this memory address information can be set as the value of the pointer information (ptr) in the additional segment.
[0077] Further optionally, according to the start address information of the reserved memory space, the serialized data is copied from the second memory space to the reserved memory space at the peer end in an RDMA manner; and when copying to the first configuration information, the target type of data is copied from the first memory space to the position corresponding to the memory address information in the reserved memory space.
[0078] In an alternative embodiment, the target message object belongs to an object graph, and there is a reference relationship between the target message object and other message objects in the object graph. In this case, the target message object further includes: a pointer field representing the aforementioned reference relationship; the serialized data of the target message object further includes: the serialized result of the pointer field. Figure 2a The data processing method provided by the illustrated embodiment further includes: a step of serializing the pointer field of the target message object. In the embodiments of the present application, the implementation manner of serializing the pointer field of the target message object is not limited, and any manner that can separately serialize the pointer field and the value field is applicable to the embodiments of the present application.
[0079] In an alternative embodiment of the present application, a manner of serializing the pointer field of a target message object is provided, including: respectively allocating identification information for the target message object and other message objects; using the identification information of the target message object and the identification information of other message objects to participate in the serialization process instead of the pointer field in the target message object, so as to obtain the serialized result of the pointer field. It should be noted that the serialized result of this pointer field will also be used as part of the serialized data of the target message object. Optionally, the serialized result of this pointer field can also be stored in a second memory space.
[0080] Optionally, an implementation manner of using the identification information of the target message object and the identification information of other message objects to participate in the serialization process instead of the pointer field in the target message object to obtain the serialized result of the pointer field includes: generating header information for the target message object as the serialized result of the pointer field, and invalidating the pointer field of the target message object; the header information of the target message object includes at least the identification information of the target message object and the identification information of other message objects pointed to by the pointer field of the target message object when the pointer field is non-empty.
[0081] Among them, if the target message object is referenced by other message objects and does not reference other message objects, the pointer field of the target message object is empty; conversely, when the target message object references other message objects, the pointer field of the target message object is non-empty. As Figure 6b shown, the message objects m10 and m12 do not reference other message objects, and the pointer fields of the message objects m10 and m12 are empty. The message object m0 references the message objects m1, m2, and m3, and the pointer field of the message object m0 is non-empty.
[0082] Further optionally, generate header information for the target message object, including: generating an empty header in a set format for the target message object, where the empty header includes at least a sequence number field, a reference field, and a second pointer field; configuring information for each field in the empty header to obtain the header information of the target message object; where the information configuration includes: adding the identification information of the target message object to the sequence number field; adding pointer information pointing to the target message object to the second pointer field, and the pointer information is the address information of the serialized data of the target message object in the second memory space; adding the identification information of other message objects pointed to by the pointer field in the target message object when the pointer field is not empty to the reference field.
[0083] It should be noted that in the above embodiments, the process of serializing the pointer field of the target message object is described from the perspective of the target message object. Figure 6a Describing the process of serializing the pointer fields of each message object from the perspective of the entire object graph, the target message object in the above embodiments can be implemented as Figure 6a Any message object in the object graph shown in the embodiments, therefore, for a detailed introduction to the process of serializing the pointer field of the target message object, reference can be made to Figure 6a the embodiments shown, which will not be elaborated here.
[0084] Figure 3 The flowchart of a data processing method provided by an exemplary embodiment of the present application is used to perform deserialization processing on a target message object, as Figure 3 shown, the method includes:
[0085] 301. Receive the serialized data of the target message object sent by the peer end. The target message object includes at least a value domain, and the value domain includes at least target type data, and the target type data belongs to a data type that does not require encoding or remains unchanged before and after encoding;
[0086] 302. Parse the serialized data to obtain at least the first configuration information of the target type data, where the first configuration information is used to mark the transmission position of the target type data in the serialized data;
[0087] 303. Identify the target type data included in the serialized data according to the first configuration information, and obtain the target message object according to the target type data.
[0088] In this embodiment, for a detailed introduction to the target type data and the first configuration information, reference can be made to the foregoing embodiments, which will not be elaborated here.
[0089] In this embodiment, the implementation manners of storing the serialized data and the deserialized data by the local end in the memory space include the following two:
[0090] The first method: The network card at the local end receives the serialized data sent by the peer end and stores the data received by the network card in the first memory space. Deserialization processing is performed on the serialized data to obtain a deserialization result, and the deserialization result is stored in the second memory space. The first memory space and the second memory space can be socket buffers, or, when the local end adopts the RDMA technology, the first memory space and the second memory space can be implemented as the memory spaces corresponding to RDMA. Optionally, when the target message object belongs to an object graph and there is a reference relationship between the target message object and other message objects in the object graph, the deserialized data of the message object may not be continuously stored in the second memory space, and only the pointing relationship between the deserialized data needs to be configured.
[0091] The second method: The serialized data received by the network card is stored in the first memory space. Deserialization processing is performed on the serialized data in the first memory space to obtain deserialized data. When using a user-mode network driver (such as DPDK or RDMA), the memory pool technology is adopted to retain the first memory space, and the deserialized data directly replaces the serialized data in the first memory space without additional allocation of a second memory space. Among them, DPDK is short for Data Plane Development Kit.
[0092] In the embodiments of the present application, when the received target type data in the message object does not need to be encoded or remains unchanged before and after encoding, instead of performing deserialization processing on the target type data, the first configuration information of the target type data is obtained by parsing the serialized data, and the target type data in the serialized data is identified according to the first configuration information; the message object is obtained according to the target type data. Throughout the process, identifying the target type data in the serialized data according to the first configuration information does not require writing the target type data from the first memory space to the second memory space, saving memory overhead and improving data processing efficiency.
[0093] In an optional embodiment, the value range of the target message object further includes: non-target type data, and the data processing method further includes: parsing the non-target type data from the serialized data; correspondingly, obtaining the target message object according to the target type data includes: obtaining the target message object according to the target type data and the non-target type data.
[0094] Optionally, the order information of the non-target type data and the target type data in the target message object can also be parsed from the serialized data. Correspondingly, the target message object can be obtained according to the target type data, the non-target type data, and the order information.
[0095] Optionally, non-target data is parsed from the serialized data, including: parsing each data segment in the serialized data one by one; when the first data segment containing the first tag is parsed, extracting the encoded data from the first data segment according to the length information of the encoded data contained in the first data segment; decoding the encoded data to obtain the non-target data. For example, if the length information of the encoded data contained in the first data segment indicates that the offset address of the encoded data is 2, and the address information of the length information is 2000, then 2001 can be used as the starting address, and the data at addresses 2001 - 2002 is read as the encoded data. Among them, the method of decoding the encoded data is not limited, and the encoding method corresponds to the decoding method. For example, if the encoding method is Varint, the decoding method is also Varint; if the encoding method is ZigZag, the decoding method is also ZigZag.
[0096] In an alternative embodiment, the serialized data is parsed to obtain at least the first configuration information of the target data, including: parsing each data segment in the serialized data one by one; when the second data segment containing the second tag is parsed, extracting the marker information from the second data segment according to the length information of the marker information contained in the second data segment, where the marker information represents the order in which the target data appears in the target message object; when the additional segment containing the marker information in the serialized data is parsed, obtaining the pointer information from the additional segment, where the pointer information is the memory address information of the target data at the local end; correspondingly, according to the first configuration information, identifying the target data contained in the serialized data includes: identifying the target data contained in the serialized data according to the memory address information.
[0097] In an alternative embodiment, the target message object belongs to an object graph, and there is a reference relationship between the target message object and other message objects in the object graph. The target message object further includes: a pointer field representing the reference relationship. The data processing method further includes: parsing the serialized result of the pointer field from the serialized data, and completing the deserialization process of the pointer field according to the serialized result of the pointer field. Further optionally, the identification information of the target message object and the identification information of other message objects having a reference relationship with the target message object can be parsed from the serialized data; according to the identification information of the target message object and the identification information of other message objects, the pointer field in the target message object is restored.
[0098] Optionally, parsing the identification information of the target message object and the identification information of other message objects having a reference relationship with the target message object from the serialized data includes: parsing the header information of the target message object and the pointer field that is made invalid from the serialized data; where the header information includes at least the identification information of the target message object and the identification information of other message objects pointed to by the pointer field before it is made invalid when it is not empty.
[0099] Further optionally, the packet header information includes a sequence number field, a reference field, and a second pointer field. The sequence number field carries the identification information of the target message object, and the reference field carries the identification information of other message objects pointed to by the pointer field before invalidation when it is non-empty. The data processing method further includes: when obtaining the value domain of the target message object, configuring pointer information pointing to the target message object in the second pointer field according to the memory address of the value domain of the target message object; and restoring the pointer field in the target message object according to the identification information of the target message object and the identification information of other message objects, including: when obtaining the value domains of all message objects in the object graph, for the target message object, if the identification information of other message objects it references is obtained from the reference field in its packet header information, configuring the pointer information in the second pointer field of the packet header information of other message objects into the invalidated pointer field of the target message object to obtain the reference relationship between the target message object and other message objects.
[0100] It should be noted that in the above embodiments, the process of deserializing the pointer field of the target message object is described from the perspective of the target message object. Figure 7a Describing the process of deserializing the pointer fields of all message objects from the perspective of the entire object graph, the target message object in the above embodiments can be implemented as Figure 7a any message object in the object graph shown in the embodiments. Therefore, for a detailed introduction to the serialization process of the pointer field of the target message object, reference can be made to Figure 7a the embodiments shown, which will not be elaborated here.
[0101] Another data processing method is provided in the embodiments of the present application. This data processing method is used to serialize the target message object, as Figure 4a shown, and the method includes:
[0102] 401. Load the target message object into the first memory space. The target message object at least includes a value domain, and the value domain includes target type data and non-target type data. The target type data belongs to a data type that does not require encoding or whose encoding remains unchanged before and after encoding.
[0103] 402. Generate serialized data of the target message object according to the marking information of the non-target type data and the target type data, and write it into the second memory space.
[0104] 403. Generate configuration information for the target type data as an independent message object. The configuration information includes the marking information of the target type data and a first pointer field for carrying the memory address information of the independent message object at the peer end.
[0105] 404. Write the configuration information as part of the serialized data of an independent message object into the second memory space; the serialized data of the independent message object also includes the target-type data located in the first memory space;
[0106] 405. Send the serialized data of the target message object and the serialized data of the independent message object to the peer, and when sending the configuration information, read the target-type data from the first memory space and send it to the peer together.
[0107] In this embodiment, for a detailed introduction to the first memory space, the second memory space, the target-type data, and the non-target-type data, please refer to the foregoing Figure 2a illustrated embodiment and will not be elaborated here.
[0108] In this embodiment, the target-type data in the target message object can be used as an independent message object. The independent message object refers to using the target-type data as the data in the dimension of the message object. Specifically, configuration information can be generated for the target-type data used as the independent message object. To distinguish it from the first configuration information in the foregoing embodiment, the configuration information in this embodiment can be referred to as the second configuration information. The second configuration information includes the marking information of the target-type data and the first pointer field. For an introduction to the marking information of the target-type data, please refer to the foregoing and will not be elaborated here. The subsequent marking information is represented by NUM. The first pointer field is used to carry the memory address information of the independent message object at the peer end. This first pointer field is mainly used to configure the pointer information pointing to the target-type data during deserialization. At the local end (i.e., the end where the serialization operation is performed), the memory address information of the target-type data in the first memory space can be configured, or it can be empty, without limitation. As long as the second configuration information contains this first pointer field.
[0109] Since the target-type data belongs to a data type that does not require encoding or whose data remains unchanged before and after encoding, and the target-type data is stored in the first memory space, if the encoded target-type data is stored in the second memory space, the data stored in the first memory space and the second memory space for the target-type data is the same, increasing the memory overhead. In this embodiment, the second configuration information is written as part of the serialized data of the independent message object into the second memory space, and the target-type data is no longer written from the first memory space into the second memory space to reduce the memory overhead during the serialization process. The serialized data of the independent message object includes, in addition to the second configuration information of the target-type data, the target-type data located in the first memory space. Correspondingly, sending the serialized data of the target message object and the serialized data of the independent message object to the peer, and when sending the second configuration information, reading the target-type data from the first memory space and sending it to the peer together can not only save memory overhead but also improve the efficiency of data processing.
[0110] In an optional embodiment, serialization data of a target message object is generated according to tag information of non-target data and target data, including: encoding the non-target data to obtain encoded data, encapsulating the encoded data into a first data segment, where the first data segment includes a first tag, length information of the encoded data, and the encoded data; the first tag indicates that the first data segment corresponds to the non-target data; generating a second data segment according to the tag information of the target data, where the second data segment includes a second tag, length information of the tag information, and the tag information, and the second tag indicates that the second data segment points to an independent message object.
[0111] Optionally, the first / second data segment includes: a tag field, a length field, and a data field. For the first data segment, the tag field is used to store the first tag, the length field is used to store the length information of the encoded data, and the data field is used to store the encoded data. For the second data segment, the tag field is used to store the second tag, the length field is used to store the length information of the tag information, and the data field is used to store the tag information. For a detailed introduction to each field and each piece of information in the data segment, reference can be made to the foregoing.
[0112] Optionally, the implementation manner of writing the serialization data of the target message object into a second memory space includes: writing the first data segment and the second data segment into the second memory space in the order in which the non-target data and the target data appear in the target message object to obtain the serialization data of the target message object.
[0113] In Figure 4b taking the message object including non-target data J1, target data J2, and target data J3 as an example for illustration. The encoded data of the non-target data J1 is encapsulated into a first data segment, and the first data segment includes: a first tag (tag1), length information of the encoded data (len1), and the encoded data (data). The tag information of the target data J2 is NUM2, and the tag information of the target data J3 is NUM3. The second data segment of the target data J2 includes: a second tag (tag2), length information of the tag information (len2), and the tag information (NUM2). The second data segment of the target data J3 includes: a second tag (tag2), length information of the tag information (len3), and the tag information (NUM3).
[0114] Optionally, the configuration information includes a data field and a first pointer field. The data field stores the tag information of the target data. In addition, it further includes: a length field, which is used to store the size information (size) of the target data.
[0115] In Figure 4bAmong them, the configuration information of the target-type data J2 includes: tag3, NUM2, tag3, size2, tag3, and the first pointer field (U64_ptr1) and the target-type data J2. The configuration information of the target-type data J3 includes: the third tag (tag3), NUM3, tag3, size3, tag3, and the first pointer field (U64_ptr2) and the target-type data J3. For a detailed introduction to the third tag, reference can be made to the subsequent or foregoing embodiments.
[0116] In an alternative embodiment, the second configuration information further includes: a third tag; the third tag is used to identify the second serialization method selected for the target-type data; the second serialization method refers to a method of serializing the target-type data as an independent message object having a reference relationship with the target message object. Among them, the second configuration information includes a tag field for storing the third tag. The tag field can be added at the start position of each configuration information, or can be added before each field in the configuration information. In Figure 4b the following, taking adding the tag field before each field in the second configuration information as an example for illustration, but not limited thereto. Among them, for a detailed introduction to the third tag, reference can be made to Figure 2b the detailed introduction in the foregoing embodiment, which will not be elaborated here.
[0117] Optionally, before generating the configuration information for the target-type data as an independent message object, it further includes: obtaining the total data volume of the target-type data included in the target message object, and when the total data volume is greater than the upper limit value of the set data volume range, selecting the second serialization method from multiple serialization methods for the target-type data.
[0118] Further optionally, when the total data volume is within the set data volume range, select the first serialization method from multiple serialization methods; when the total data volume is less than the lower limit value of the set data volume range, select the third serialization method from multiple serialization methods; among them, the first serialization method refers to a method of serializing the target-type data as a part of the serialized data of the target message object based on the configuration information; the third serialization method refers to a method of directly copying the target-type data as part of the serialized data of the target message object from the first memory space to the second memory space.
[0119] In an alternative embodiment, in order to establish a reference relationship between an independent message object and a target message object, the independent message object may include a pointer field that stores the reference relationship of the independent message object to the target message object. Based on this, the method of this embodiment further includes: serializing the pointer field of the independent message object. In an alternative embodiment of the present application, a method for serializing the pointer field of a target message object is provided, including: allocating identification information for the target message object and the independent message object. The identification information is not limited and can be any single or combination of letters, numbers, or symbols. Subsequently, the identification information can be represented by an id; generating header information for the independent message object and writing the header information of the independent message object as part of the serialized data of the independent message object into the second memory space; wherein, the header information of the independent message object at least includes the identification information of the target message object, the identification information of the independent message object, and pointer information pointing to the independent message object, and the pointer information is the address information of the independent message object in the second memory space.
[0120] Optionally, generating header information for the independent message object includes: generating an empty header in a set format for the independent message object, where the empty header at least includes a sequence number field, a reference field, and a second pointer field; configuring information for each field in the empty header to obtain the header information of the independent message object; wherein, the information configuration includes: adding the identification information of the independent message object to the sequence number field; adding pointer information pointing to the independent message object to the second pointer field; adding the identification information of the target message object to the reference field.
[0121] In Figure 4b it, the identification information of the target message object K1 is id1, the identification information of the independent message object K2 corresponding to the target type data J2 is id2, and the identification information of the independent message object K3 corresponding to the target type data J3 is id3. The header information of the independent message object K2 includes: the identification information of the target message object K1 (id1), the identification information of the independent message object K2 (id2), and pointer information pointing to the independent message object K2 (msg_ptr2). The header information of the independent message object K3 includes: the identification information of the target message object K1 (id1), the identification information of the independent message object K3 (id3), and pointer information pointing to the independent message object K3 (msg_ptr3). The header information of the target message object K1 includes: the identification information of the message object referenced by the target message object K1 (id0), the identification information of the target message object K1 (id1), and pointer information pointing to the target message object K1 (msg_ptr1). In Figure 4b it is also shown the message type (type), and the message type is used to determine the encoding method of the value domain in the target message object.
[0122] In an alternative embodiment, the target message object belongs to an object graph, and there is a reference relationship between the target message object and other message objects in the object graph; in this case, the target message object further includes: a pointer field representing the aforementioned reference relationship; the serialized data of the target message object further includes: the serialized result of the pointer field. Correspondingly, the method of this embodiment further includes: a step of serializing the pointer field of the target message object. In the embodiments of the present application, the implementation manner of serializing the pointer field of the target message object is not limited, and any manner that can perform separate serialization processing on the pointer field and the value field is applicable to the embodiments of the present application.
[0123] In an alternative embodiment of the present application, a method for serializing the pointer field of a target message object is provided, including: respectively allocating identification information for the target message object and other message objects; using the identification information of the target message object and the identification information of other message objects to participate in the serialization process instead of the pointer field in the target message object, so as to obtain the serialized result of the pointer field.
[0124] Optionally, using the identification information of the target message object and the identification information of other message objects to participate in the serialization process instead of the pointer field in the target message object, so as to obtain the serialized result of the pointer field, includes: generating header information for the target message object as the serialized result of the pointer field, and invalidating the pointer field of the target message object; the header information of the target message object at least includes the identification information of the target message object, and the identification information of other message objects pointed to by the pointer field of the target message object when the pointer field is non-empty.
[0125] It should be noted that the above embodiment describes the process of serializing the pointer field of the target message object from the perspective of the target message object. Figure 6a Describing the process of serializing the pointer fields of each message object from the perspective of the entire object graph, the target message object in the above embodiment can be implemented as Figure 6a any message object in the object graph shown in the embodiment, therefore, for a detailed introduction to the process of serializing the pointer field of the target message object, reference can be made to Figure 6a the embodiment shown, which will not be elaborated here. In addition, for the process of serializing the pointer field of an independent message object, reference can also be made to Figure 6a the embodiment shown, which will not be elaborated here. Figure 5 The flowchart of another data processing method is provided for an exemplary embodiment of the present application. This data processing method is used for deserializing a target message object, as Figure 5 shown, and the method includes:
[0126] 501. Receive the serialized data of multiple message objects, where the multiple message objects include a target message object and independent message objects. The independent message objects are the target-type data in the target message object.
[0127] 502. Parse the non-target-type data and the marker information of the target-type data from the serialized data of the target message object.
[0128] 503. Parse the configuration information and the target-type data from the serialized data of the independent message objects. The configuration information includes the marker information of the target-type data and a first pointer field.
[0129] 504. Configure pointer information pointing to the target-type data in the first pointer field according to the memory address information of the target-type data at the local end.
[0130] 505. Associate the non-target-type data, the first pointer field, and the target-type data of the target message object according to the marker information of the target-type data to obtain the target message object.
[0131] In this embodiment, for the detailed introduction of the target-type data and the second configuration information (or configuration information), reference can be made to the foregoing embodiments, and details will not be elaborated herein.
[0132] In an alternative embodiment, parsing the non-target-type data and the marker information of the target-type data from the serialized data of the target message object includes: parsing each data segment in the serialized data of the target message object one by one; when parsing the first data segment containing the first tag, extracting the encoded data from the first data segment according to the length information of the encoded data contained in the first data segment; decoding the encoded data to obtain the non-target-type data; when parsing the second data segment containing the second tag, extracting the marker information of the target-type data from the second data segment according to the length information of the marker information contained in the second data segment.
[0133] In an alternative embodiment, the data processing method of this embodiment further includes: parsing the header information of the independent message object from the serialized data of the independent message object. The header information of the independent message object includes the identification information of the independent message object, the identification information of the target message object, and the pointer information pointing to the independent message object. The pointer information is the address information of the independent message object in the second memory space; reconfiguring the pointer information pointing to the independent message object as the memory address information of the independent message object at the local end.
[0134] In an optional embodiment, the target message object belongs to an object graph, and there is a reference relationship between the target message object and other message objects in the object graph. The target message object further includes: a pointer field representing the reference relationship. The data processing method further includes: parsing, from the serialized data of the target message object, the identification information of the target message object and the identification information of other message objects that have a reference relationship with the target message object; and restoring the pointer field in the target message object according to the identification information of the target message object and the identification information of other message objects.
[0135] Optionally, parsing, from the serialized data of the target message object, the identification information of the target message object and the identification information of other message objects that have a reference relationship with the target message object includes: parsing, from the serialized data of the target message object, the header information of the target message object and the pointer field that has been made invalid; wherein, the header information of the target message object at least includes the identification information of the target message object and the identification information of other message objects pointed to by the pointer field before it was made invalid when the pointer field was non-empty.
[0136] Further optionally, the header information of the target message object includes a sequence number field, a reference field, and a second pointer field. The sequence number field carries the identification information of the target message object, and the reference field carries the identification information of other message objects pointed to by the pointer field before it was made invalid when the pointer field was non-empty. The data processing method further includes: when the value domain of the target message object is obtained, configuring, according to the memory address of the value domain of the target message object, pointer information pointing to the target message object in the second pointer field; and restoring the pointer field in the target message object according to the identification information of the target message object and the identification information of other message objects, including: when the value domains of all message objects in the object graph are obtained, for the target message object, if the identification information of other message objects it references is obtained from the reference field in its header information, configuring the pointer information in the second pointer field of the header information of other message objects to the pointer field that has been made invalid in the target message object according to the identification information of other message objects, so as to obtain the reference relationship between the target message object and other message objects.
[0137] It should be noted that in the above embodiment, the process of deserializing the pointer field of the target message object is described from the perspective of the target message object. Figure 7a Describing the process of deserializing the pointer fields of each message object from the perspective of the entire object graph, the target message object in the above embodiment can be implemented as Figure 7a any message object in the object graph shown in the embodiment. Therefore, for a detailed introduction to the serialization process of the pointer field of the target message object, reference can be made to Figure 7aThe embodiments shown are not described herein again. Additionally, regarding the process of deserializing the pointer field of an independent message object, reference can also be made to Figure 7a the embodiments shown, which are not described herein again.
[0138] In the above embodiments, message objects with a reference relationship all contain a pointer field. For example, there is a reference relationship between the target message object and other message objects in the object graph, so both the target message object and other message objects have a pointer field; also, for example, in the above embodiments, an independent message object needs to reference the target message object, so the independent message object can have a pointer field to represent the reference relationship between the two. Whether it is the target message object or the independent message object, regarding the serialization process of its pointer field, reference can be made to the relevant content in the following embodiments. The following embodiments describe the complete serialization and deserialization processes from the perspective of the object graph, but focus on the pointer field. The serialization method for the value field is not limited and reference can be made to the foregoing embodiments.
[0139] Embodiments for serializing and deserializing a pointer field:
[0140] Figure 6a is a flowchart of another object processing method provided for the exemplary embodiments of the present application, as Figure 6a shown, the method includes:
[0141] 601. Obtain an object graph to be serialized, where the object graph includes multiple message objects, and the pointer fields in the multiple message objects represent the reference relationships between the multiple message objects;
[0142] 602. Assign identification information to the multiple message objects respectively;
[0143] 603. Use the identification information of the multiple message objects to replace the pointer fields in the multiple message objects and participate in the serialization process of the multiple message objects to obtain the serialization data of the multiple message objects;
[0144] 604. Transmit the serialization data of the multiple message objects to the peer end, and the serialization data of the multiple message objects at least includes the identification information of the multiple message objects and the serialization results of the value fields in the multiple message objects.
[0145] In this embodiment, an object graph to be serialized is obtained. The object graph includes multiple message objects, and there are reference relationships among the multiple objects. Among them, a message object generally refers to various messages transmitted across platforms or over a network. Depending on the application scenario, the message object will be different. For example, the message object can be various messages transmitted between the request side and the service side in a remote call scenario, or various messages transmitted between microservices in a microservice scenario, or it can also be the interaction data between the client and the service side, or the interaction data between any two application programs. For example, the client is implemented as an application (APPlication, APP), and the user interacts with the service side through this application. The interaction data generated during the interaction process is the message object. Another example is that the application is a social application, and two users interact through the social application installed on their respective terminal devices. The interaction data generated during the interaction process is the message object. Taking a shopping APP as an example, the shopping request initiated by the user through the shopping APP is a message object A1. The message object A1 includes: {user identification (ID), request ID, and product ID}; the product ID corresponds to the message object A2. The message object A2 includes: {product category, product price, store ID, and preferential information}. The preferential information corresponds to the message object A3. The reference relationship existing among the message objects A1, A2, and A3 is expressed as: the message object A1 references the message object A2, and the message object A2 references the message object A3. Another example is that in the application scenario of large models, data can be abstracted into multiple dimensions, and the data in each dimension is used as a message object. There is a pointing relationship between the data in different dimensions, and this pointing relationship is the reference relationship between message objects. For example, taking students as an example, the basic information of students belongs to a message object B1 in one dimension, and the grade sheet of students belongs to another message object B2 in another dimension. Among them, the message object B1 can reference the message object B2. The ID of the student can be obtained from the message object B1, and the grades of the student can be queried in the message object B2 through the ID of the student.
[0146] In this embodiment, multiple message objects include a value field and a pointer field. The pointer field of the multiple message objects represents the reference relationship between the multiple message objects. Among them, each message object can reference one or more other message objects. At this time, the pointer field includes pointers to one or more other objects; alternatively, the message object may not reference other message objects. At this time, the pointer field of the message object is empty (NULL), that is, the pointer field is a null pointer. The value field of the multiple message objects is the value taken by the message object. The value taken by the message object can be an integer (int), a character (char), a floating point number (float), a boolean (boolean), etc., and no limitation is made thereto. For example, the value field of message object A1 is the user ID and the request ID, and the pointer field of message object A1 is: a pointer to message object A2. The value field of message object A2 is the product category, the product price, and the store id, and the pointer field of message object A2 is a pointer to message object A3. The value field of message object B1 can be the name, ID, etc. of a student, and the pointer field of message object B1 is a pointer to message object B2; the value field of message object B2 can be course grades such as "Chinese grade" or "math grade", and message object B2 does not reference other message objects, and the pointer field of message object B2 is empty.
[0147] In Figure 6b exemplarily shows an object graph, which includes 13 message objects. The value fields of the 13 message objects are respectively: m0, m1, m2,..., m11, and m12. There is a reference relationship among the 13 message objects in the object graph. For example, m0 references m1, m2, and m3; m1 references m4; m2 references m4, m5, m6, and m7; m3 references m7, m8, and m9; m5 references m0, etc. Among them, the pointer field of the message object is represented by a pointer (pointer, ptr). For example, the pointer field of m3 is represented as: ptr1 = m7, ptr2 = m8, and ptr3 = m9.
[0148] In this embodiment, unique identification information can be assigned to each message object for serializing each message object. Among them, the identification information of different message objects is different, and the identification information assigned to the message object in this embodiment is unique. The identification information can be any single or combination of numbers, letters, and symbols, etc. For example, the identification information can be a1, bb_2, or 3 - 4, etc., and no limitation is made thereto. In an optional embodiment, the message object can be the serial number or order in which each message object appears in the object graph. Among them, a certain message object can be used as the starting point, and the serial number or order in which each message object appears in the object graph can be determined by traversing the object graph according to the reference relationship between the message objects.
[0149] Due to the reference relationships among multiple message objects, when encoding the pointer fields, it is necessary to serialize the value fields of multiple message objects, store the serialization results in memory, and encode the pointer fields as the relative offsets in memory of the serialization results of the message objects. Therefore, it is necessary to complete the serialization of the entire object graph before sending the serialized data to the peer for deserialization. Only after the peer receives all the serialized data in the object graph can it perform deserialization, resulting in a relatively large end-to-end latency. In this embodiment, the process of serializing multiple message objects includes two types. One is to encode the value fields of multiple message objects, and the other is to use the identification information of multiple message objects to replace the pointer fields in the message objects and participate in the serialization process of these multiple message objects. That is to say, in the embodiments of the present application, the pointer fields of multiple message objects do not participate in the serialization process. The reference relationships among multiple message objects reflected in the pointer fields are replaced by the identification information of multiple message objects, so that there is no data dependency among the serialized data of multiple message objects (such as the encoded data of the value fields and the identification information), that is, the serialized data of multiple message objects are independent of each other. Thus, the serialized data of multiple message objects can be independently transmitted to the peer, providing conditions for the peer to perform deserialization processing on the serialized data of multiple message objects in parallel. Since there is no data dependency among the serialized data of multiple message objects, the peer can perform deserialization processing in parallel, instead of serially deserializing multiple message objects. It can perform deserialization processing on two or more message objects simultaneously, which can shorten the execution time of serialization processing -> network transmission -> deserialization processing and reduce the end-to-end latency.
[0150] Among them, the method of encoding the value fields of multiple message objects is not limited. Different encoding methods have different encoding rules. For example, when using the Varint encoding method to encode the value fields, Varint is a method for encoding value fields (such as numbers), and the encoded binary data is of variable length. For example, if the value field of a message object is implemented as the number 1 and the Varint encoding method is used to encode the number 1, the resulting binary representation is 0000 0001, occupying 1 byte. Another example is that the ZigZag encoding method can be used. ZigZag is an encoding scheme that maps signed integers to unsigned integers. For example, the signed integers 0, -1, 1, -2 are encoded as the unsigned integers 0, 1, 2, 3.
[0151] In the embodiment of the present application, identification information is assigned to each message object in the object graph, and the identification information of each message object is used to replace the pointer field of the message object to participate in the serialization process of the message object. That is to say, the pointer fields of multiple message objects do not participate in the serialization process, and the reference relationships between multiple message objects reflected in the pointer fields are replaced by the identification information of multiple message objects, so that there is no data dependency between the serialized data of multiple message objects included in the object graph; the serialized data without data dependency is provided to the peer end, so that the peer end can perform the deserialization process in a parallel manner to obtain the object graph, making the processes of serialization, network transmission, and deserialization no longer serial, and reducing the end-to-end latency.
[0152] In an optional embodiment, the implementation manner of using the identification information of multiple message objects to replace the pointer fields in multiple message objects and participating in the serialization process of multiple message objects to obtain serialized data of multiple message objects without data dependency includes: generating packet header information (pack head) for any message object, where the packet header information at least includes the identification information of any message object and the identification information of other message objects pointed to by the pointer field of any message object when the pointer field is not empty; generating the serialized data of any message object according to the packet header information of any message object and the value field in any message object, where, during the serialization process, the pointer field of any message object is processed as invalid. By adopting the above method of creating a packet header, the identification information of multiple message objects is used to replace the pointer fields in multiple message objects. Compared with the implementation manner of "serializing the message objects and then storing them in memory, and encoding the pointer fields of multiple message objects as relative offsets in memory in multiple message objects", the method provided by the embodiment of the present application does not need to traverse all message objects in memory to determine the relative offset, reduces the object graph traversal operation, has a simple implementation manner, high efficiency, and low cost. Thereby, it helps to reduce the end-to-end delay and improve the transmission efficiency.
[0153] Optionally, before generating the serialized data of any message object according to the packet header information of any message object and the value field in any message object, the pointer field of any message object can also be processed as invalid. For example, setting the pointer field in any message object to be empty to process the pointer field as invalid. Another example is encoding the pointer field in any message object as 0 to process the pointer field as invalid. Another example is to pre-negotiate with the peer end to agree that by default, the pointer field in any message object is not processed to process the pointer field as invalid. Among them, the two ends can communicate and negotiate, or the R & D personnel of the two ends can pre-negotiate in advance, and use the negotiation result as a capability of the serializer and deserializer, that is, the code logic for implementing serialization and deserialization that by default does not perform serialization and deserialization processing on the pointer field.
[0154] Optionally, the implementation method for generating the header information for any message object includes: for any message object, generating an empty header in a set format, where the empty header in the set format includes at least a sequence number field, a reference field, and a second pointer field. Taking the header information of the target message object as an example, the fields in the header information are described as follows: the sequence number field is used to carry the identification information of the target message object, the reference field is used to carry the identification information of the message object referenced by the target message object, and the second pointer field is used to carry the pointer information of the target message object, and the pointer information is the address information of the target message object in the second memory space at the local end; performing information configuration on each field in the empty header to obtain the header information of any message object; where the information configuration includes: adding the identification information of any message object to the sequence number field; adding the pointer information pointing to any message object to the second pointer field, and the pointer information is the address information of any message object in the second memory space at the local end; adding the identification information of other message objects pointed to by the pointer field in any message object when the pointer field is not empty to the reference field. It should be noted that when the pointer field in any message object is empty, it means that the any message object does not reference other message objects, the reference field is empty, and the header information does not include the identification information of other message objects.
[0155] Further optionally, the empty header further includes a type field; correspondingly, the information configuration further includes: adding the message type to which any message object belongs to the type field; different message types correspond to different serialization methods, and the serialization method refers to the encoding method of the value domain data.
[0156] When the empty header includes the type field, for different types of message objects, the processing methods for the value domain during serialization are different. For example, when the message type is implemented as an integer type, the method for serializing the value domain is to encode the integer data into byte stream data to obtain the value domain serialization result. When the message type is implemented as a character type or a byte type, the method for serializing the value domain is: not encoding the value domain and directly using the character type or byte type data as the value domain serialization result. When the header includes the type field, the message object can adapt to various message types, rather than a default one, improving the flexibility of the entire serialization scheme.
[0157] Such as Figure 6b and Figure 7bAs shown, the header of the message object is exemplarily shown. Among them, the header is represented as: [id (identification information), type (message type), ref id (identification information of other message objects pointed to), and msg_ptr (pointer information pointing to the message object)]. For example, the header of m0 is represented as [m0_id, type, m1_id, msg_ptr], and the msg_ptr of m0 points to m0; the header of m3 is represented as: [m3_id, type, m7_id, m8_id, m9_id, msg_ptr], and msg_ptr points to m3. During the serialization process, the pointer field of the message object is processed as invalid. For example, the pointer field of m3 is: ptr1 = m7, ptr2 = m8, and ptr3 = m9. After processing the pointer field of m3 as invalid, it is represented as: ptr1 = NULL, ptr2 = NULL, and ptr3 = NULL.
[0158] Further optionally, according to the header information of any message object and the value field in any message object, the serialized data of any message object is generated, including: determining the target serialization method according to the message type in the type field; performing serialization processing on the value field in any message object according to the target serialization method to obtain the value field serialization result; for example, in the case where the message type is integer, encoding the value field of the integer data into byte stream data; in the case where the message type is character type, directly using the value field of the character data as the value field serialization result; concatenating the header information of any message object, the value field serialization result, and the pointer field processed as invalid to obtain the independent serialized data of any message object. As Figure 6b shown, the independent serialized data corresponding to the message object m1 and the message object m3 are exemplarily shown.
[0159] In an optional embodiment, unique identification information is assigned to multiple message objects respectively, including: determining an initial message object from multiple message objects; for example, in the case where the object graph is implemented as a graph structure, the initial message object can be any message object; for another example, in the case where the object graph is implemented as a tree structure, the initial message object is implemented as the message object corresponding to the root node in the tree structure. Starting from the initial message object, traverse each message object according to the reference relationship between multiple message objects; for the currently traversed message object, determine whether identification information has been assigned to it; in the case where the judgment result is no, assign identification information to the currently traversed message object. Among them, the identification information of the message object can be a serialization number determined according to the serialization order of the message objects in the object graph, and different serialization orders result in different serialization numbers. The serialization number can be represented by one or more of numbers, letters, and symbols. For example, it can be represented by an integer character. For example, starting from 0 or 1, it is numbered incrementally in sequence according to the serialization order, and this is not limited.
[0160] Optionally, the method for determining whether identification information has been assigned to the currently traversed message object is not limited.
[0161] For example, the local end maintains a hash value list, and the hash values of the message objects to which identification information has been assigned are stored in the hash value list. Based on this, the hash value of the currently traversed message object can be calculated. For example, according to the attribute information of the currently traversed object, the hash value of the currently traversed message object is calculated. The attribute information of the message object can be the address information, value domain data, or metadata, etc. of the message object in the memory space. For example, the hash value of the current object can be calculated according to the address of the current message object in the memory, or the hash value of the current message object can be calculated according to the value domain of the current message object, and this is not limited. In the case where the hash value does not exist in the hash value list, it is determined that identification information has not been assigned to the currently traversed message object. In the case where the hash value exists in the hash value list, it is determined that identification information has been assigned to the currently traversed message object, and continue to traverse the object graph until identification information has been assigned to all message objects in the object graph.
[0162] For another example, a flag bit is set for each message object. In the case where identification information is assigned to the message object, the flag bit corresponding to the message object is set to a target value. The target value can be 0 or 1, etc. Based on this, determine whether the flag bit corresponding to the currently traversed message object is the target value; in the case where the flag bit is not the target value, it is determined that identification information has not been assigned to the currently traversed message object. In the case where the flag bit is the target value, it is determined that identification information has been assigned to the currently traversed message object, and then continue to traverse the object graph until identification information has been assigned to all message objects in the object graph.
[0163] In this embodiment, there is no limitation on the traversal method used to traverse the object graph. For example, it may adopt, but is not limited to, the breadth - first traversal method or the width - first traversal method, etc.
[0164] In the embodiments of the present application, there is no limitation on the implementation manner of transmitting the serialized data of multiple message objects to the peer end. In an alternative embodiment, after the entire serialization process is completed, the serialized data of the message objects obtained by serialization is transmitted to the peer end together. The way of transmitting together can be serial transmission or parallel transmission. Or, since the value domain and the pointer domain are encoded separately, the identification information of the message object is used to replace the pointer domain for serialization processing, and there is no data dependency between the serialized data of multiple message objects. Without waiting for all message objects to be serialized, the relative offset of the message object in the memory is used to encode the pointer domain. Therefore, during the serialization process, while serializing the message objects in the object graph, the serialized data of the message objects that have been serialized can be transmitted to the peer end, realizing the overlap of the serialization process and the transmission process of the serialized data, without waiting to transmit after all message objects are serialized. Correspondingly, without waiting to receive the serialized data of all message objects, deserialization can be performed, that is, the peer end can receive the serialized data while performing deserialization, reducing the end - to - end delay.
[0165] Figure 7a It is a schematic flow chart of another object processing method provided for the exemplary embodiments of the present application, as Figure 7a shown. This method includes:
[0166] 701. Receive the serialized data of multiple message objects transmitted from the peer end. There is no data dependency between the serialized data of multiple message objects. The multiple message objects belong to the same object graph, and there are reference relationships between the multiple message objects;
[0167] 702. Parse and process the serialized data of multiple message objects respectively in a parallel manner to obtain the identification information of multiple message objects and the value domains of multiple message objects;
[0168] 703. Restore the pointer domains in multiple message objects according to the identification information of multiple message objects to obtain the object graph.
[0169] In this embodiment, the implementation manner of receiving the serialized data of multiple message objects transmitted from the peer is not limited. According to the different transmission manners of the peer, the receiving manners are also different. For example, during the serialization process, the peer sequentially transmits the serialized data of multiple message objects. Correspondingly, the local end can sequentially receive the serialized data of multiple message objects sent by the peer in sequence. Another example is that after the serialization is completed, the peer transmits the serialized data of all message objects at once. If a serial transmission manner is adopted, the local end sequentially receives the serialized data transmitted by the peer. If a parallel transmission manner is adopted, the local end receives the serialized data of multiple message objects in parallel.
[0170] Furthermore, in this embodiment, multiple serialization threads or serialization processes can be used to receive the serialized data of multiple message objects transmitted from the peer. Further, since there is no data dependency between the serialized data of multiple message objects, the deserialization order between the serialized data of message objects does not need to be concerned. Therefore, multiple serialization threads or serialization processes are used to perform deserialization processing on the serialized data of multiple message objects in parallel. For example, taking threads 1, 2, and 3 as an example, assuming that thread 1 receives the serialized data of message objects a1 and a3, thread 2 receives the serialized data of message objects a2 and a4, and thread 3 receives the serialized data of message objects a5 and a6, then each thread can separately perform deserialization processing on the received serialized data of message objects, that is, to achieve parallel processing of deserialization, rather than performing deserialization processing on the serialized data of message objects a1 - a6 in sequence.
[0171] In this embodiment, the serialized data of multiple message objects are separately subjected to deserialization processing in parallel to obtain the identification information of multiple message objects and the value ranges of multiple message objects. The identification information of multiple message objects and the value ranges of multiple message objects can be stored in a global linked list or an array for subsequent pointer configuration. Among them, multiple serialization threads can be used to perform deserialization processing in parallel. For example, after each serialization thread receives the serialized data of a message object, it can perform deserialization processing without caring about the progress of deserialization processing performed by other serialization threads. Of course, in addition to using multiple serialization threads to perform deserialization processing, multiple serialization processes can also be used to perform deserialization processing, which is not limited herein.
[0172] In this embodiment, after the deserialization processing for each message object is completed, a pointer configuration operation can be performed, that is, the pointer fields in multiple message objects are restored according to the identification information of multiple message objects, so as to obtain an object graph based on the value ranges and pointer fields of multiple message objects.
[0173] Optionally, the embodiment of the present application further provides a pointer configuration thread. After each serialization thread finishes the deserialization operation, it provides an end signal to the pointer configuration thread, and the pointer configuration operation is executed after receiving the end signals of all serialization threads. Of course, a pointer configuration process can be used to execute the pointer configuration operation, and this is not limited herein.
[0174] In the embodiment of the present application, there is no data dependency between the serialized data of multiple message objects in the object graph. The deserialization process is performed on the serialized data of multiple message objects in parallel to obtain the unique identification information and value fields of multiple message objects. The pointer fields of multiple message objects are configured according to the identification information of multiple message objects to restore the object graph. During the whole process, the deserialization process is performed in parallel to improve the deserialization speed and reduce the end-to-end latency. Further, in terms of the transmission method, the deserialization process can be performed while receiving the serialized data, further reducing the end-to-end latency.
[0175] In an optional embodiment, an implementation manner of deserializing the serialized data of multiple message objects in parallel to obtain the identification information of multiple message objects and the value fields of multiple message objects includes: for the serialized data of any message object, parsing the serialized data of any message object to obtain the header information, the serialized result of the value field, and the pointer field that is marked as invalid of any message object; wherein, the header information of any message object at least includes the identification information of the any message object, and the identification information of other message objects pointed to by the pointer field before being marked as invalid when the pointer field is non-empty; performing deserialization processing on the serialized result of the value field of any message object to obtain the value field of any message object. Here, it is noted that if the pointer field before being marked as invalid is empty, it means that the any message object does not reference other message objects, and the header information does not include the identification information of other message objects. The detailed introduction of the header information and the pointer field marked as invalid can be seen in the foregoing, and will not be elaborated herein.
[0176] Optionally, an implementation structure of packet header information includes a sequence number field, a reference field, and a second pointer field. For the packet header information of any message object, the identification information of the any message object is carried in the sequence number field, and the identification information of other message objects pointed to by the pointer field before invalidation is carried in the reference field when the pointer field is not empty. Of course, if the any message object does not reference other message objects, its pointer field before invalidation is empty. Correspondingly, the reference field is empty and does not carry the identification information of other message objects, which conversely indicates that the any message object does not reference other message objects. The method provided by the embodiments of the present application further includes: when obtaining the value domain of any message object, configuring pointer information pointing to the any message object in the second pointer field according to the memory address of the value domain of the any message object. For example, in Figure 7b when receiving the value domain of a message object (such as, m3), storing m3 in the memory, and configuring the pointer information msr_ptr in the packet header corresponding to m3 as the memory address of m3 according to the memory address of m3; when receiving m7, storing m7 in the memory, and configuring the pointer information msr_ptr in the packet header corresponding to m7 as the memory address of m7 according to the memory address of m7; the same operation is performed on the value domains of other message objects, which will not be elaborated here.
[0177] Correspondingly, an implementation manner of restoring the pointer field in multiple message objects according to the identification information of multiple message objects to obtain an object graph includes: when obtaining the value domains of multiple message objects, for any message object, if the identification information of other message objects it references is obtained from the reference field in its packet header information, configuring the pointer information in the second pointer field of the packet header information of other message objects into the pointer field to be invalidated of the any message object according to the identification information of other message objects, so as to obtain the reference relationship between the any message object and other message objects; generating an object graph according to the value domains and pointer fields of multiple message objects. Further, for any message object, if the reference field in its packet header information is empty, that is, the identification information of other message objects it references cannot be obtained from the reference field, the pointer field to be invalidated of the any message object can be directly configured to be empty.
[0178] Further optionally, configuring the pointer information in the second pointer field of the packet header information of other message objects into the pointer field to be invalidated of the any message object according to the identification information of other message objects to obtain the reference relationship between the any message object and other message objects includes: obtaining the pointer information of other message objects from the second pointer field in the packet header information of other message objects according to the identification information of other message objects; configuring the pointer information of other message objects into the pointer field to be invalidated of the any message object to implement the reset of the pointer field.
[0179] For example, in Figure 7b , for the message object corresponding to m3, the identification information of other message objects it references is obtained from the reference field in its header information. For example, the identification information of other referenced objects is: m7_id, m8_id, and m9_id. At this time, the pointer field of the message object corresponding to m3 is processed as invalid; the pointer information (msr_ptr) in the second pointer field of the headers corresponding to m7_id, m8_id, and m9_id respectively is configured into the pointer field that is processed as invalid. For example, the pointer information (msr_ptr) is obtained from the header corresponding to m7_id, and this pointer information is the memory address of m7. This pointer information is configured into the pointer field of m3 that is processed as invalid, that is, ptr7 = m7. Similarly, ptr8 = m8, and ptr9 = m9.
[0180] Further optionally, the header information further includes a type field, and the message type of any message object is carried in the type field; deserializing the serialization result of the value domain of any message object to obtain the value domain of any message object, including: determining the target deserialization method according to the message type in the type field; and deserializing the serialization result of the value domain of any message object according to the target deserialization method to obtain the value domain of any message object. Among them, different message types apply different serialization methods and deserialization methods. In the embodiments of the present application, the message type is carried in the type field in the header information, which can support the serialization and deserialization processing of various message types, and this solution has higher flexibility.
[0181] In the embodiment of the present application, the implementation of the above-mentioned data processing method for serialization and deserialization (which may be referred to as serialization method and deserialization method) in a specific application is not limited. In one embodiment, the serialization and deserialization methods of the above-mentioned embodiment can be implemented as a serializer and a deserializer, and the serializer and the deserializer are implemented as library functions in the link library. Among them, some reusable function codes (such as functions, classes) are stored in the link library (Link Library) to facilitate the use of application developers. That is to say, application developers can directly reference the existing function codes in the link library during the application development process without developing them by themselves, which is conducive to improving the efficiency of application development. Among them, the link library containing the serializer and the deserializer can be a dynamic link library, or a static link library can be used, and the embodiment of the present application does not limit this. In the embodiment of the present application, taking the first application as an example, when the developer develops the first application, the first application is developed based on the link library containing the serializer and the deserializer, so that the first application has the ability to call the serializer in the link library for serialization processing during the message transmission process, and has the ability to call the deserializer in the link library for deserialization processing when receiving the message.
[0182] Wherein, in the case of using a static link library, during the development of the first application, the source code of the serializer and / or deserializer used in the source file of the first application is merged with the code file of the application to generate an independent executable file. In the case of using a dynamic link library, during the development of the first application, only a small amount of information such as the address of the dynamic link library is recorded in the executable file of the first application, and when the executable file of the first application is executed, it is dynamically loaded when the source code of the serializer and / or deserializer in the dynamic link library is called.
[0183] Based on the above, an embodiment of the present application further provides a data processing method, which is applied to a first application, the first application is developed based on a link library, the link library includes a serializer, and the method includes:
[0184] In response to a data transmission triggering event, a target message object is generated, the target message object includes at least a value domain, and the value domain includes at least target type data;
[0185] Call the serializer in the link library, which is used by the serializer Figure 2a The data processing method provided in the illustrated embodiment performs serialization processing on the target message object to obtain serialized data of the target message object, and the serialized data at least includes: first configuration information corresponding to the target type data;
[0186] The serialized data of the target message object is sent to the opposite end, and when the first configuration information is sent, the target type data is read from the first memory space and sent to the opposite end.
[0187] In this embodiment, the serializer refers to the serializer that executes the method shown above Figure 2a and Figure 4a For a detailed introduction to this data processing method, please refer to the foregoing, and details will not be elaborated here.
[0188] This embodiment of the present application also provides another data processing method, which is applied to a first application developed based on a link library. The link library includes a deserializer, and the method includes:
[0189] Receiving serialized data of a target message object sent by a peer end, where the target message object at least includes a value domain, and the value domain at least includes target type data;
[0190] Invoking the deserializer in the link library, and the deserializer uses the data processing method provided by the embodiment shown in Figure 3 to parse and process the serialized data of the target message object to obtain the target message object. For the detailed implementation manner of the data processing method, please refer to the foregoing, and no limitation is made here.
[0191] This embodiment of the present application also provides yet another data processing method, which is applied to a first application developed based on a link library. The link library includes a serializer, and the method includes:
[0192] Responding to a data transmission trigger event to generate a target message object, where the target message object at least includes a value domain, and the value domain at least includes target type data;
[0193] Invoking the serializer in the link library, and the serializer uses the data processing method provided by the embodiment shown in Figure 4a to serialize the target message object to obtain serialized data of the target message object and serialized data of an independent message object. The serialized data of the independent message object at least includes: second configuration information corresponding to the target type data;
[0194] Sending the serialized data of the target message object and the serialized data of the independent message object to the peer end, and when sending the second configuration information, reading the target type data from the first memory space and sending it to the peer end together. For the detailed implementation manner of the data processing method, please refer to the foregoing, and no limitation is made here.
[0195] This embodiment of the present application also provides yet another data processing method, which is applied to a first application developed based on a link library. The link library includes a deserializer, and the method includes:
[0196] Receive the serialized data of multiple message objects, where the multiple message objects include a target message object and independent message objects, and the independent message objects are target-type data in the target message object;
[0197] Call the deserializer in the link library, and the deserializer uses Figure 5 The data processing method provided by the illustrated embodiment to parse and process the serialized data of multiple message objects to obtain the target message object. For the detailed implementation of the data processing method, reference can be made to the foregoing, and no limitation is imposed thereon.
[0198] It should be noted that the execution subject of each step of the method provided by the foregoing embodiment can be the same device, or the method can also be executed by different devices as the execution subject. For example, the execution subject of steps 201 to 203 can be a device; for another example, the execution subject of steps 201 and 202 can be a device, and the execution subject of step 203 can be device B; and so on.
[0199] In addition, in some of the processes described in the foregoing embodiments and the accompanying drawings, multiple operations appear in a specific order, but it should be clearly understood that these operations can be executed not in the order in which they appear in this text or in parallel. The operation numbers such as 201 and 202 are only used to distinguish different operations, and the numbers themselves do not represent any execution order. In addition, these processes can include more or fewer operations, and these operations can be executed in sequence or in parallel. It should be noted that the descriptions such as "first" and "second" in this text are used to distinguish different messages, devices, modules, etc., and do not represent a sequence, nor do they limit that "first" and "second" are different types.
[0200] Figure 8a The structure diagram of a data processing device provided for an exemplary embodiment of the present application, and this device is used to implement Figure 2a The data processing method shown, as Figure 8a shown, this device includes: a loading module 81a, a generating module 82, a writing module 83a, a transceiver module 84a, and a reading module 85a.
[0201] The loading module 81a is used to load the target message object into the first memory space. The target message object at least includes a value domain, and the value domain at least includes target-type data, and the target-type data belongs to a data type that does not require encoding or remains unchanged before and after encoding;
[0202] A generating module 82a is configured to generate first configuration information for target data, and a writing module 83a is configured to write the first configuration information as partial serialized data of a target message object into a second memory space; the serialized data of the target message object further includes the target data located in a first memory space, and the first configuration information is used to mark the transmission position of the target data in the serialized data.
[0203] A transceiver module 84a is configured to send the serialized data of the target message object to the peer end, and a reading module 85a is configured to, when sending the first configuration information, read the target data from the first memory space and send it to the peer end together.
[0204] In an optional embodiment, the value range of the target message object further includes: non-target data; the apparatus further includes: an encoding module. The encoding module is configured to encode the non-target data to obtain encoded data, and the writing module is further configured to: write the encoded data as partial serialized data of the target message object into the second memory space; wherein, the first configuration information and the encoded data are stored in the second memory space in the order of the target data and the non-target data in the target message object.
[0205] Optionally, the writing module is specifically configured to: encapsulate the encoded data into a first data segment, the first data segment includes a first tag, length information of the encoded data, and the encoded data; the first tag indicates that the first data segment corresponds to non-target data; and write the first data segment into the data segment area in the second memory space in the order in which the non-target data appears in the target message object.
[0206] In an optional embodiment, the first configuration information includes a marking information and a pointer information, the marking information identifies the target data, and the pointer information is the memory address information of the target data at the peer end.
[0207] Optionally, the generating module is specifically configured to: generate a second data segment and an additional segment for the target data, the second data segment includes a second tag, length information of the marking information, and the marking information, the second tag indicates that the second data segment corresponds to the target data; the additional segment at least includes the marking information and the pointer information; the writing module is specifically configured to: write the second data segment into the data segment area in the second memory space in the order in which the target data appears in the target message object, and write the additional segment into the additional segment area in the second memory space; wherein, the additional segment area is located after the data segment area.
[0208] Further optionally, the additional segment further includes: a third tag and / or size information of the target data; the third tag is used to identify that the first serialization method is selected for the target data; the first serialization method refers to a method of serializing the target data as a part of the serialized data of the target message object based on the first configuration information.
[0209] Further optionally, the apparatus further includes an acquisition module and a selection module. Before generating the first configuration information for the target type of data, the acquisition module is configured to acquire the total data volume of the target type of data included in the target message object, and the selection module is configured to select the first serialization method from multiple serialization methods for the target type of data when the total data volume is within the set data volume range.
[0210] Further optionally, the selection module is further configured to: when the total data volume is greater than the upper limit value of the set data volume range, select the second serialization method from multiple serialization methods; when the total data volume is less than the lower limit value of the set data volume range, select the third serialization method from multiple serialization methods; wherein, the second serialization method refers to a method of serializing the target type of data as an independent message object having a reference relationship with the target message object; the third serialization method refers to a method of directly copying the target type of data as partial serialized data of the target message object from the first memory space to the second memory space.
[0211] Further optionally, in the case of selecting the second serialization method, after loading the target message object into the first memory space, the generation module is further configured to: generate serialized data of the target message object according to the non-target type of data and the tag information of the target type of data included in the value domain, and write it into the second memory space; generate the second configuration information for the target type of data as an independent message object, where the second configuration information includes the tag information of the target type of data and a first pointer field for carrying the memory address information of the independent message object at the peer end; the writing module is further configured to: write the second configuration information into the second memory space as partial serialized data of the independent message object; the serialized data of the independent message object further includes the target type of data located in the second memory space; the transceiver module is further configured to: send the serialized data of the target message object and the independent message object to the peer end, and when sending the second configuration information, read the target type of data from the second memory space and send it to the peer end together.
[0212] In an alternative embodiment, the apparatus further includes: an establishment module and a determination module. The establishment module is configured to establish an RDMA connection with the peer end in advance, and the transceiver module is configured to receive the starting address information of the memory space reserved by the peer end for the target message object; the determination module is configured to determine the memory address information of the target type of data at the peer end according to the starting address information of the reserved memory space and the address offset of the target type of data in the target message object.
[0213] Optionally, the transceiver module is specifically configured to: copy the serialized data from the second memory space to the reserved memory space of the peer in the RDMA manner according to the starting address information; and when the first configuration information is copied, copy the target type data from the first memory space to the position corresponding to the memory address information in the reserved memory space.
[0214] In an optional embodiment, the target message object belongs to an object graph, and there is a reference relationship between the target message object and other message objects in the object graph; wherein, the target message object further includes: a pointer field representing the reference relationship; the serialized data of the target message object further includes: the serialized result of the pointer field; the apparatus further includes: an allocation module and a substitution module, the allocation module is configured to allocate identification information for the target message object and other message objects respectively; the substitution module is configured to use the identification information of the target message object and the identification information of other message objects to substitute the pointer field in the target message object to participate in the serialization process to obtain the serialized result of the pointer field.
[0215] Optionally, the substitution module is specifically configured to: generate header information for the target message object as the serialized result of the pointer field, and invalidate the pointer field of the target message object; the header information of the target message object at least includes the identification information of the target message object, and the identification information of other message objects pointed to by the pointer field of the target message object when the pointer field is non-empty.
[0216] Further optionally, the generation module is specifically configured to: generate an empty header in a set format for the target message object, the empty header at least includes a sequence number field, a reference field and a second pointer field; configure the information of each field in the empty header to obtain the header information of the target message object; wherein, the apparatus further includes: an information configuration module; the information configuration module is configured to: add the identification information of the target message object to the sequence number field; add pointer information pointing to the target message object to the second pointer field, the pointer information is the address information of the serialized data of the target message object in the second memory space; add the identification information of other message objects pointed to by the pointer field in the target message object when the pointer field is non-empty to the reference field.
[0217] The embodiment of the present application further provides a data processing apparatus, which is used to implement Figure 3 the data processing method shown in Figure 8b as shown, the apparatus includes: a transceiver module 81b, a parsing module 82b, an identification module 83b and an obtaining module 84b.
[0218] The transceiver module 81b is configured to receive the serialized data of the target message object sent by the peer, the target message object at least includes a value domain, the value domain at least includes target type data, and the target type data belongs to a data type that does not need to be encoded or remains unchanged before and after encoding;
[0219] A parsing module 82b, configured to parse the serialized data to obtain at least first configuration information of the target type data, where the first configuration information is used to mark the transmission position of the target type data in the serialized data;
[0220] An identification module 83b, configured to identify the target type data included in the serialized data according to the first configuration information, and obtain a module 84b, configured to obtain a target message object according to the target type data.
[0221] In an optional embodiment, the value range of the target message object further includes: non-target type data, and the parsing module is further configured to: parse the non-target type data from the serialized data; correspondingly, the obtaining module is specifically configured to: obtain the target message object according to the target type data and the non-target type data.
[0222] Optionally, the parsing module is specifically configured to: parse each data segment in the serialized data one by one; when parsing the first data segment including the first tag, extract the encoded data from the first data segment according to the length information of the encoded data included in the first data segment; decode the encoded data to obtain the non-target type data.
[0223] In an optional embodiment, the parsing module is specifically configured to: parse each data segment in the serialized data one by one; when parsing the second data segment including the second tag, extract the marking information from the second data segment according to the length information of the marking information included in the second data segment, where the marking information represents the order in which the target type data appears in the target message object; when parsing the additional segment including the marking information in the serialized data, obtain pointer information from the additional segment, where the pointer information is the memory address information of the target type data at the local end; correspondingly, the identification module is specifically configured to: identify the target type data included in the serialized data according to the memory address information.
[0224] In an optional embodiment, the target message object belongs to an object graph, and there is a reference relationship between the target message object and other message objects in the object graph. The target message object further includes: a pointer field representing the reference relationship. The apparatus further includes: a restoration module; the parsing module is further configured to: parse the identification information of the target message object and the identification information of other message objects having a reference relationship with the target message object from the serialized data; the restoration module is configured to restore the pointer field in the target message object according to the identification information of the target message object and the identification information of other message objects.
[0225] Optionally, the parsing module is specifically configured to: parse the header information of the target message object and the pointer field that has been invalidated from the serialized data; where the header information includes at least the identification information of the target message object and the identification information of other message objects pointed to by the pointer field before it is invalidated when the pointer field is non-empty.
[0226] Further optionally, the packet header information includes a sequence number field, a reference field, and a second pointer field. The sequence number field carries the identification information of the target message object, and the reference field carries the identification information of other message objects pointed to by the pointer field before invalidation when it is non-empty. The apparatus further includes: a configuration module; the configuration module is configured to, when obtaining the value range of the target message object, configure pointer information pointing to the target message object in the second pointer field according to the memory address of the value range of the target message object; and a restoration module, specifically configured to: when obtaining the value ranges of each message object in the object graph, for the target message object, if the identification information of other message objects it references is obtained from the reference field in its packet header information, configure the pointer information in the second pointer field of the packet header information of other message objects into the pointer field after invalidation processing of the target message object, so as to obtain the reference relationship between the target message object and other message objects.
[0227] An embodiment of the present application further provides a data processing apparatus, which is used to implement Figure 4a the data processing method shown in the figure. The apparatus includes: a loading module, a generating module, a writing module, and a transceiver module.
[0228] The loading module is configured to load a target message object into a first memory space. The target message object includes at least a value range, and the value range includes target type data and non-target type data. The target type data belongs to a data type that does not need to be encoded or remains unchanged before and after encoding.
[0229] The generating module is configured to generate serialized data of the target message object according to the marking information of the non-target type data and the target type data, and write it into a second memory space; generate configuration information for the target type data as an independent message object. The configuration information includes the marking information of the target type data and a first pointer field for carrying the memory address information of the independent message object at the peer end.
[0230] The writing module is configured to write the configuration information as part of the serialized data of the independent message object into the second memory space; the serialized data of the independent message object further includes the target type data located in the first memory space.
[0231] The transceiver module is configured to send the serialized data of the target message object and the serialized data of the independent message object to the peer end, and when sending the configuration information, read the target type data from the first memory space and send it to the peer end together.
[0232] In an optional embodiment, the generating module is specifically configured to: encode non-target data to obtain encoded data, encapsulate the encoded data into a first data segment, where the first data segment includes a first tag, length information of the encoded data, and the encoded data; the first tag indicates that the first data segment corresponds to non-target data; generate a second data segment according to the marking information of the target data, where the second data segment includes a second tag, length information of the marking information, and the marking information, and the second tag indicates that the second data segment points to an independent message object.
[0233] In an optional embodiment, the configuration information further includes: a third tag and / or size information of the target data; the third tag is used to identify that the second serialization method is selected for the target data; the second serialization method refers to a method of serializing the target data as an independent message object having a reference relationship with the target message object.
[0234] Optionally, the apparatus further includes an obtaining module and a selecting module; before generating configuration information for the target data as an independent message object, the obtaining module is further configured to: obtain the total data volume of the target data included in the target message object, and the selecting module is configured to select the second serialization method from multiple serialization methods for the target data when the total data volume is greater than the upper limit value of the set data volume range.
[0235] Further optionally, the selecting module is further configured to: select the first serialization method from multiple serialization methods when the total data volume is within the set data volume range; select the third serialization method from multiple serialization methods when the total data volume is less than the lower limit value of the set data volume range; where the first serialization method refers to a method of serializing the target data as a part of the serialized data of the target message object based on the configuration information; the third serialization method refers to a method of directly copying the target data as part of the serialized data of the target message object from the first memory space to the second memory space.
[0236] In an optional embodiment, the apparatus further includes an allocation module; the allocation module is configured to allocate identification information for the target message object and the independent message object; the generating module is configured to generate header information for the independent message object, and the writing module is further configured to write the header information of the independent message object as part of the serialized data of the independent message object into the second memory space; where the header information of the independent message object at least includes the identification information of the target message object, the identification information of the independent message object, and pointer information pointing to the independent message object, and the pointer information is the address information of the independent message object in the second memory space.
[0237] Optionally, the generation module is specifically configured to: for an independent message object, generate an empty packet header in a set format, where the empty packet header includes at least a sequence number field, a reference field, and a second pointer field; configure information for each field in the empty packet header to obtain the packet header information of the independent message object; where the device further includes an information configuration module, and the information configuration module is configured to: add the identification information of the independent message object to the sequence number field; add pointer information pointing to the independent message object to the second pointer field; add the identification information of the target message object to the reference field.
[0238] In an alternative embodiment, the target message object belongs to an object graph, and there is a reference relationship between the target message object and other message objects in the object graph; where the target message object further includes: a pointer field representing the reference relationship; the serialized data of the target message object further includes: the serialized result of the pointer field; the device further includes a substitution module; an allocation module, configured to allocate identification information for the target message object and other message objects respectively; the substitution module, configured to use the identification information of the target message object and the identification information of other message objects to replace the pointer field in the target message object to participate in the serialization process to obtain the serialized result of the pointer field.
[0239] Optionally, the substitution module is specifically configured to: generate packet header information for the target message object as the serialized result of the pointer field, and invalidate the pointer field of the target message object; the packet header information of the target message object includes at least the identification information of the target message object and the identification information of other message objects pointed to by the pointer field of the target message object when the pointer field is non-empty.
[0240] The embodiments of the present application further provide a data processing device, which is used to implement Figure 5 the data processing method shown, and the device includes: a transceiver module, a parsing module, a configuration module, and an association module;
[0241] The transceiver module is configured to receive the serialized data of multiple message objects, where the multiple message objects include a target message object and an independent message object, and the independent message object is the target type data in the target message object;
[0242] The parsing module is configured to parse the non-target type data and the marker information of the target type data from the serialized data of the target message object; parse the configuration information and the target type data from the serialized data of the independent message object, where the configuration information includes the marker information of the target type data and a first pointer field;
[0243] The configuration module is configured to configure pointer information pointing to the target type data in the first pointer field according to the memory address information of the target type data at the local end;
[0244] An association module, configured to associate the non-target type data, the first pointer field, and the target type data of the target message object according to the marking information of the target type data, so as to obtain the target message object.
[0245] In an optional embodiment, the parsing module is specifically configured to: parse each data segment in the serialized data of the target message object one by one; when parsing the first data segment containing the first tag, extract the encoded data from the first data segment according to the length information of the encoded data contained in the first data segment; decode the encoded data to obtain the non-target type data; when parsing the second data segment containing the second tag, extract the marking information of the target type data from the second data segment according to the length information of the marking information contained in the second data segment.
[0246] In an optional embodiment, the parsing module is further configured to: parse the header information of the independent message object from the serialized data of the independent message object, where the header information of the independent message object includes the identification information of the independent message object, the identification information of the target message object, and the pointer information pointing to the independent message object, and the pointer information is the address information of the independent message object in the second memory space; the configuration module is further configured to: reconfigure the pointer information pointing to the independent message object as the memory address information of the independent message object at the local end.
[0247] In an optional embodiment, the target message object belongs to an object graph, and there is a reference relationship between the target message object and other message objects in the object graph. The target message object further includes: a pointer field representing the reference relationship. The apparatus further includes a restoration module; the parsing module is configured to parse the identification information of the target message object and the identification information of other message objects having a reference relationship with the target message object from the serialized data of the target message object; the restoration module is configured to restore the pointer field in the target message object according to the identification information of the target message object and the identification information of other message objects.
[0248] The detailed implementation manners and beneficial effects of the steps in the apparatus provided in the embodiments of the present application have been described in detail in the foregoing embodiments, and will not be elaborated herein.
[0249] Correspondingly, based on the above, an embodiment of the present application further provides a data processing apparatus, which corresponds to a first application, and the first application is developed based on a link library. The link library includes a serializer. The apparatus includes: a generation module, a call module, and a transceiver module.
[0250] The generation module is configured to generate a target message object in response to a data transmission trigger event. The target message object includes at least a value domain, and the value domain includes at least target type data.
[0251] The call module is configured to call the serializer in the link library, and the serializer adoptsFigure 2a The data processing method provided by the illustrated embodiment performs serialization processing on the target message object to obtain the serialized data of the target message object. The serialized data at least includes: the first configuration information corresponding to the target type data;
[0252] The transceiver module is configured to send the serialized data of the target message object to the peer end, and when sending the first configuration information, read the target type data from the first memory space and send it to the peer end together.
[0253] In this embodiment, the serializer refers to the serializer that executes the above Figure 2a and Figure 4a illustrated method. The first application can be any type of application program, such as, social, shopping, gaming, or live streaming, etc. For a detailed introduction to this data processing method, reference can be made to the foregoing, and details will not be elaborated here.
[0254] The embodiment of the present application further provides another data processing device. This device corresponds to the first application, and the first application is developed based on a link library. The link library includes a deserializer. The device includes: a transceiver module and a call module.
[0255] The transceiver module is configured to receive the serialized data of the target message object sent by the peer end. The target message object at least includes a value range, and the value range at least includes target type data;
[0256] The call module is configured to call the deserializer in the link library, and the deserializer uses the Figure 3 data processing method provided by the illustrated embodiment to perform parsing processing on the serialized data of the target message object to obtain the target message object. For the detailed implementation manner of the data processing method, reference can be made to the foregoing, and no limitation is made thereto.
[0257] The embodiment of the present application further provides yet another data processing device. This device corresponds to the first application, and the first application is developed based on a link library. The link library includes a serializer. The device includes: a generation module, a call module, and a transceiver module;
[0258] The generation module is configured to respond to a data transmission trigger event, generate a target message object, and load the target message object into the first memory space. The target message object at least includes a value range, and the value range at least includes target type data;
[0259] The call module is configured to call the serializer in the link library, and the serializer uses the Figure 4a data processing method provided by the illustrated embodiment to perform serialization processing on the target message object to obtain the serialized data of the target message object and the serialized data of the independent message object. The serialized data of the independent message object at least includes: the second configuration information corresponding to the target type data;
[0260] A transceiver module, configured to send serialized data of a target message object and serialized data of an independent message object to the peer end, and when sending second configuration information, read target type data from a first memory space and send it to the peer end together. For the detailed implementation of the data processing method, reference can be made to the foregoing, which is not limited herein.
[0261] An embodiment of the present application further provides another data processing device, which corresponds to a first application. The first application is developed based on a link library, and the link library includes a deserializer. The device includes: a transceiver module and a call module;
[0262] The transceiver module is configured to receive serialized data of multiple message objects, where the multiple message objects include a target message object and an independent message object, and the independent message object is target type data in the target message object;
[0263] The call module is configured to call the deserializer in the link library, and the deserializer uses Figure 5 the data processing method provided in the embodiment to parse and process the serialized data of multiple message objects to obtain a target message object.
[0264] For the detailed implementation of the data processing method, reference can be made to the foregoing, which is not limited herein.
[0265] Figure 9 The figure is a schematic structural diagram of an electronic device provided for an exemplary embodiment of the present application. The electronic device is used to implement Figure 2a the data processing method shown, as Figure 9 shown, the device includes: a memory 94 and a processor 95.
[0266] The memory 94 is configured to store a computer program and can be configured to store various other data to support operations on the electronic device. Examples of these data include instructions for any application program or method operating on the electronic device, etc.
[0267] The processor 95 is coupled to the memory 94 and is configured to execute the computer program in the memory 94 for: loading a target message object into a first memory space, where the target message object includes at least a value domain, the value domain includes at least target type data, and the target type data belongs to a data type that does not require encoding or remains unchanged before and after encoding; generating first configuration information for the target type data and writing the first configuration information as part of the serialized data of the target message object into a second memory space; the serialized data of the target message object further includes the target type data located in the first memory space, and the first configuration information is used to mark the transmission position of the target type data in the serialized data; sending the serialized data of the target message object to the peer end, and when sending the first configuration information, reading the target type data from the first memory space and sending it to the peer end together.
[0268] In an alternative embodiment, the value range of the target message object further includes: non-target data; the processor 95 is further configured to: encode the non-target data to obtain encoded data, and write the encoded data as part of the serialized data of the target message object into the second memory space; wherein, the first configuration information and the encoded data are stored in the second memory space in the order of the target data and the non-target data in the target message object.
[0269] Optionally, when writing the encoded data as part of the serialized data of the target message object into the second memory space, the processor is specifically configured to: encapsulate the encoded data into a first data segment, the first data segment includes a first tag, the length information of the encoded data, and the encoded data; the first tag indicates that the first data segment corresponds to non-target data; and write the first data segment into the data segment area in the second memory space in the order in which the non-target data appears in the target message object.
[0270] In an alternative embodiment, the first configuration information includes a marking information and a pointer information, the marking information identifies the target data, and the pointer information is the memory address information of the target data at the peer end.
[0271] Optionally, when generating the first configuration information for the target data and writing the first configuration information as part of the serialized data of the target message object into the second memory space, the processor is specifically configured to: generate a second data segment and an additional segment for the target data, the second data segment includes a second tag, the length information of the marking information, and the marking information, the second tag indicates that the second data segment corresponds to the target data; the additional segment at least includes the marking information and the pointer information; write the second data segment into the data segment area in the second memory space in the order in which the target data appears in the target message object, and write the additional segment into the additional segment area in the second memory space; wherein, the additional segment area is located after the data segment area.
[0272] Further optionally, the additional segment further includes: a third tag and / or the size information of the target data; the third tag is used to identify the selection of the first serialization method for the target data; the first serialization method refers to the method of serializing the target data as a part of the serialized data of the target message object based on the first configuration information.
[0273] Further optionally, before generating the first configuration information for the target data, the processor 95 is further configured to: obtain the total data volume of the target data included in the target message object, and when the total data volume is within the set data volume range, select the first serialization method from multiple serialization methods for the target data.
[0274] Further optionally, the processor is further configured to: when the total data volume is greater than the upper limit value of the set data volume range, select the second serialization method from multiple serialization methods; when the total data volume is less than the lower limit value of the set data volume range, select the third serialization method from multiple serialization methods; wherein, the second serialization method refers to a method of serializing the target type data as an independent message object having a reference relationship with the target message object; the third serialization method refers to a method of directly copying the target type data as a partial serialized data of the target message object from the first memory space to the second memory space.
[0275] Further, as Figure 9 shown, the electronic device further includes: a communication component 96, a display 97, a power supply component 98, an audio component 99 and other components. Figure 9 Only some components are schematically shown, which does not mean that the electronic device only includes Figure 9 the components shown. Additionally, Figure 9 the components within the dashed box in Figure 9 are optional components, rather than mandatory components, and can be determined according to the product form of the electronic device. The electronic device in this embodiment can be implemented as a terminal device such as a desktop computer, a laptop computer, a smart phone or an IOT device, or can also be a server device such as a conventional server, a cloud server or a server array. If the electronic device in this embodiment is implemented as a terminal device such as a desktop computer, a laptop computer, a smart phone, etc., it may include Figure 9 the components within the dashed box; if the electronic device in this embodiment is implemented as a server device such as a conventional server, a cloud server or a server array, it may not include
[0276] An embodiment of the present application further provides an electronic device, which can implement Figure 3 the data processing method shown, and the implementation structure of this electronic device is the same as or similar to the implementation structure of the Figure 9 electronic device shown, and can be implemented with reference to the structure of the Figure 9 electronic device shown. The electronic device provided in this embodiment and Figure 9The main differences between the electronic devices in the illustrated embodiments are as follows: the functions implemented by the processor executing the computer program stored in the memory are different. For the electronic device provided in this embodiment, when its processor executes the computer program stored in the memory, it can be used to: receive the serialized data of the target message object sent by the peer end, where the target message object at least includes a value domain, the value domain at least includes target type data, and the target type data belongs to a data type that does not require encoding or remains unchanged before and after encoding; parse the serialized data to obtain at least the first configuration information of the target type data, where the first configuration information is used to mark the transmission position of the target type data in the serialized data; identify the target type data included in the serialized data according to the first configuration information, and obtain the target message object according to the target type data.
[0277] In an alternative embodiment, the value domain of the target message object further includes: non-target type data, and the processor is further used to: parse the non-target type data from the serialized data; correspondingly, when the processor obtains the target message object according to the target type data, it is specifically used to: obtain the target message object according to the target type data and the non-target type data.
[0278] Optionally, when the processor parses the non-target type data from the serialized data, it is specifically used to: parse each data segment in the serialized data one by one; when parsing the first data segment containing the first tag, extract the encoded data from the first data segment according to the length information of the encoded data contained in the first data segment; decode the encoded data to obtain the non-target type data.
[0279] In an alternative embodiment, when the processor parses the serialized data to obtain at least the first configuration information of the target type data, it is specifically used to: parse each data segment in the serialized data one by one; when parsing the second data segment containing the second tag, extract the marking information from the second data segment according to the length information of the marking information contained in the second data segment, where the marking information represents the order in which the target type data appears in the target message object; when parsing the additional segment containing the marking information in the serialized data, obtain the pointer information from the additional segment, where the pointer information is the memory address information of the target type data at the local end; correspondingly, when the processor identifies the target type data included in the serialized data according to the first configuration information, it is specifically used to: identify the target type data included in the serialized data according to the memory address information.
[0280] In an alternative embodiment, the target message object belongs to an object graph, and there is a reference relationship between the target message object and other message objects in the object graph. The target message object further includes: a pointer field representing the reference relationship. The processor is further configured to: parse the identification information of the target message object and the identification information of other message objects having a reference relationship with the target message object from the serialized data; and restore the pointer field in the target message object according to the identification information of the target message object and the identification information of other message objects.
[0281] An embodiment of the present application further provides an electronic device, which is used to implement Figure 4a the data processing method shown. The implementation structure of this electronic device is the same as or similar to Figure 9 the implementation structure of the electronic device shown, and can be referred to Figure 9 for implementation according to the structure of the electronic device shown. The main difference between the electronic device provided in this embodiment and Figure 9 the electronic device in the embodiment shown lies in that: the functions implemented by the processor executing the computer program stored in the memory are different. For the electronic device provided in this embodiment, its processor executes the computer program stored in the memory and can be used to: load the target message object into the first memory space. The target message object at least includes a value field, and the value field includes target-type data and non-target-type data. The target-type data belongs to a data type that does not require encoding or remains unchanged before and after encoding; generate serialized data of the target message object according to the marking information of the non-target-type data and the target-type data, and write it into the second memory space; generate configuration information for the target-type data as an independent message object. The configuration information includes the marking information of the target-type data and a first pointer field for carrying the memory address information of the independent message object at the peer end; write the configuration information into the second memory space as part of the serialized data of the independent message object; the serialized data of the independent message object further includes the target-type data located in the first memory space; send the serialized data of the target message object and the serialized data of the independent message object to the peer end, and when sending the configuration information, read the target-type data from the first memory space and send it to the peer end together.
[0282] In an alternative embodiment, when the processor generates the serialized data of the target message object according to the marking information of the non-target-type data and the target-type data, it is specifically configured to: encode the non-target-type data to obtain encoded data, encapsulate the encoded data into a first data segment. The first data segment includes a first tag, the length information of the encoded data, and the encoded data; the first tag indicates that the first data segment corresponds to the non-target-type data; generate a second data segment according to the marking information of the target-type data. The second data segment includes a second tag, the length information of the marking information, and the marking information. The second tag indicates that the second data segment points to the independent message object.
[0283] In an alternative embodiment, the configuration information further includes: the third tag and / or the size information of the target type data; the third tag is used to identify the selection of the second serialization method for the target type data; the second serialization method refers to the method of serializing the target type data as an independent message object having a reference relationship with the target message object.
[0284] Optionally, before generating the configuration information for the target type data as an independent message object, the processor is further configured to: obtain the total data volume of the target type data included in the target message object, and when the total data volume is greater than the upper limit value of the set data volume range, select the second serialization method from multiple serialization methods for the target type data.
[0285] Further optionally, the processor is further configured to: when the total data volume is within the set data volume range, select the first serialization method from multiple serialization methods; when the total data volume is less than the lower limit value of the set data volume range, select the third serialization method from multiple serialization methods; wherein, the first serialization method refers to the method of serializing the target type data as a part of the serialized data of the target message object based on the configuration information; the third serialization method refers to the method of directly copying the partial serialized data of the target type data as the target message object from the first memory space to the second memory space.
[0286] In an alternative embodiment, the processor is further configured to: allocate identification information for the target message object and the independent message object; generate header information for the independent message object, and write the header information of the independent message object as part of the serialized data of the independent message object into the second memory space; wherein, the header information of the independent message object at least includes the identification information of the target message object, the identification information of the independent message object, and pointer information pointing to the independent message object, and the pointer information is the address information of the independent message object in the second memory space.
[0287] The embodiment of the present application further provides an electronic device, and the electronic device is used to implement Figure 5 the data processing method shown, and the implementation structure of this electronic device is the same as or similar to the implementation structure of the Figure 9 electronic device shown, and can be implemented with reference to the structure of the Figure 9 electronic device shown. The electronic device provided in this embodiment is the same as the Figure 9The main differences between the electronic devices in the illustrated embodiments are as follows: the functions implemented by the processor executing the computer program stored in the memory are different. For the electronic device provided in this embodiment, when the processor executes the computer program stored in the memory, it can be used to: receive serialized data of multiple message objects, where the multiple message objects include a target message object and independent message objects, and the independent message objects are target-type data in the target message object; parse the non-target-type data and the marker information of the target-type data from the serialized data of the target message object; parse the configuration information and the target-type data from the serialized data of the independent message object, where the configuration information includes the marker information of the target-type data and a first pointer field; configure pointer information pointing to the target-type data in the first pointer field according to the memory address information of the target-type data at the local end; and associate the non-target-type data, the first pointer field, and the target-type data of the target message object according to the marker information of the target-type data to obtain the target message object.
[0288] In an alternative embodiment, when the processor parses the non-target-type data and the marker information of the target-type data from the serialized data of the target message object, it is specifically used to: parse each data segment in the serialized data of the target message object one by one; when parsing the first data segment containing the first tag, extract the encoded data from the first data segment according to the length information of the encoded data contained in the first data segment; decode the encoded data to obtain the non-target-type data; and when parsing the second data segment containing the second tag, extract the marker information of the target-type data from the second data segment according to the length information of the marker information contained in the second data segment.
[0289] In an alternative embodiment, the processor is further used to: parse the header information of the independent message object from the serialized data of the independent message object, where the header information of the independent message object includes the identification information of the independent message object, the identification information of the target message object, and the pointer information pointing to the independent message object, and the pointer information is the address information of the independent message object in the second memory space; and reconfigure the pointer information pointing to the independent message object as the memory address information of the independent message object at the local end.
[0290] Optionally, the target message object belongs to an object graph, and there is a reference relationship between the target message object and other message objects in the object graph. The target message object further includes: a pointer field representing the reference relationship. The processor is further used to: parse the identification information of the target message object and the identification information of other message objects having a reference relationship with the target message object from the serialized data of the target message object; and restore the pointer field in the target message object according to the identification information of the target message object and the identification information of other message objects.
[0291] The detailed implementation manners and beneficial effects of the electronic device provided in the embodiments of the present application have been described in detail in the foregoing embodiments, and will not be elaborated herein.
[0292] Correspondingly, the embodiments of the present application further provide a computer-readable storage medium storing a computer program, and when the computer program is executed, it can implement each step executable by the electronic device in the method embodiment shown above. Figure 2a - Figure 7a The above-mentioned memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic memory, flash memory, magnetic disk or optical disc.
[0293] The above-mentioned communication component is configured to facilitate communication between the device where the communication component is located and other devices in a wired or wireless manner. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G / LTE, 5G and other mobile communication networks, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component further includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on technologies such as Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology and other technologies.
[0294]
[0295] The above-mentioned display includes a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can sense not only the boundaries of touch or swipe actions, but also detect the duration and pressure associated with the touch or swipe operation.
[0296] The above-mentioned power supply component provides power for various components of the device where the power supply component is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device where the power supply component is located.
[0297] The above-mentioned audio component can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC), which is configured to receive external audio signals when the device where the audio component is located is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in a memory or sent via a communication component. In some embodiments, the audio component further includes a speaker for outputting audio signals.
[0298] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk memory, Compact Disc Read-Only Memory (CD-ROM), optical memory, etc.) containing computer-usable program code.
[0299] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in one or more flows in the flowchart and / or one or more blocks in the block diagram.
[0300] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means that implement the function specified in one or more processes of the flowchart and / or one or more blocks of the block diagram.
[0301] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, so that the instructions executed on the computer or other programmable apparatus provide steps for implementing the function specified in one or more processes of the flowchart and / or one or more blocks of the block diagram.
[0302] In a typical configuration, a computing device includes one or more processors (Central Processing Unit, CPU), an input / output interface, a network interface, and memory.
[0303] The memory may include non-permanent memory in the form of computer-readable media, random access memory (Random Access Memory, RAM) and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
[0304] Computer-readable media includes both permanent and non-permanent, removable and non-removable media implemented by any method or technology for storing information. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change random access memory (Phase-change Random Access Memory, PRAM), static random access memory (SRAM), dynamic random access memory (Dynamic Random Access Memory, DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (Digital Video Disc, DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media such as modulated data signals and carrier waves.
[0305] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, commodity or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, commodity or device comprising the element.
[0306] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. A data processing method, It is characterized in that include: Loading a target message object into a first memory space, the target message object at least comprising a value domain, the value domain at least comprising target type data; Generate first configuration information for the target type data, and write the first configuration information into the second memory space as part of the serialized data of the target message object; The serialized data of the target message object also includes the target type data located in the first memory space, and the first configuration information is used to mark the transmission position of the target type data in the serialized data; The serialized data of the target message object is sent to the peer end, and when the first configuration information is sent, the target type data is read from the first memory space and sent to the peer end.
2. The method according to claim 1, It is characterized in that The value range of the target message object also includes: non-target data; the method also includes: Encoding the non-target data to obtain encoded data, and writing the encoded data into the second memory space as part of serialized data of the target message object; The first configuration information and the encoded data are stored in the second memory space in the order of the target data and the non-target data in the target message object.
3. The method according to claim 2, It is characterized in that Writing the encoded data as part of serialized data of the target message object into the second memory space includes: Encapsulating the encoded data into a first data segment, wherein the first data segment includes a first tag, length information of the encoded data, and the encoded data; the first tag indicates that the first data segment corresponds to the non-target data; The first data segment is written into the data segment area in the second memory space in the order in which the non-target data appears in the target message object.
4. The method according to claim 1, It is characterized in that The first configuration information includes tag information and pointer information, the tag information identifies the target data, and the pointer information is the memory address information of the target data at the other end.
5. The method according to claim 4, It is characterized in that Generating first configuration information for the target type data, and writing the first configuration information as part of the serialized data of the target message object into the second memory space, including: Generate a second data segment and an additional segment for the target type data, wherein the second data segment includes a second label, length information of the label information, and the label information, the second label indicates that the second data segment corresponds to the target type data; and the additional segment includes at least the label information and the pointer information; In the order in which the target type data appears in the target message object, the second data segment is written into the data segment area in the second memory space, and the additional segment is written into the additional segment area in the second memory space; wherein the additional segment area is located after the data segment area.
6. The method according to claim 5, It is characterized in that The additional segment also includes: a third tag and / or size information of the target data; the third tag is used to identify the first serialization method selected for the target data; The first serialization method refers to a method of serializing the target type data as a part of the serialization data of the target message object based on the first configuration information.
7. The method according to claim 6, It is characterized in that Before generating the first configuration information for the target data, the method further includes: The total data volume of the target type data contained in the target message object is obtained, and when the total data volume is within a set data volume range, the first serialization method is selected from multiple serialization methods for the target type data.
8. The method according to claim 7, It is characterized in that Also includes: When the total data volume is greater than the upper limit of the set data volume range, selecting a second serialization method from the multiple serialization methods; When the total data volume is less than the lower limit of the set data volume range, selecting a third serialization method from the multiple serialization methods; The second serialization method refers to a method of serializing the target data as an independent message object that has a reference relationship with the target message object; The third serialization method refers to a serialization method in which the target type data is directly copied from the first memory space to the second memory space as part of the serialization data of the target message object.
9. The method according to claim 4, It is characterized in that Also includes: Establishing a remote direct data access connection with the other end in advance, and receiving the starting address information of the memory space reserved for the target message object sent by the other end; The memory address information of the target data at the opposite end is determined according to the starting address information of the reserved memory space and the address offset of the target data in the target message object.
10. The method according to claim 9, It is characterized in that Sending serialized data of the target message object to the peer end, and when sending the first configuration information, reading the target type data from the first memory space and sending the target type data to the peer end, including: According to the starting address information, copying the serialized data from the second memory space to the reserved memory space of the peer end by remote direct data access; and When copying to the first configuration information, the target type data is copied from the first memory space to a position in the reserved memory space corresponding to the memory address information.
11. The method according to any one of claims 1 to 10, It is characterized in that The target message object belongs to an object graph, and there is a reference relationship between the target message object and other message objects in the object graph; Wherein, the target message object further includes: a pointer field indicating the reference relationship; the serialized data of the target message object further includes: a serialization result of the pointer field; The method further comprises: Allocating identification information to the target message object and other message objects respectively; The identification information of the target message object and the identification information of the other message objects are used to replace the pointer field in the target message object to participate in the serialization process, so as to obtain the serialization result of the pointer field.
12. A data processing method, It is characterized in that include: Receive serialized data of a target message object sent by a peer end, wherein the target message object includes at least a value field, and the value field includes at least target type data; Parsing the serialized data to obtain at least first configuration information of the target data, where the first configuration information is used to mark a transmission position of the target data in the serialized data; According to the first configuration information, the target type data contained in the serialized data is identified, and the target message object is obtained according to the target type data.
13. The method according to claim 12, It is characterized in that The value domain of the target message object also includes: non-target data, and the method further includes: parsing the non-target data from the serialized data; Correspondingly, obtaining the target message object according to the target data includes: obtaining the target message object according to the target data and the non-target data.
14. A data processing method, It is characterized in that include: Loading a target message object into a first memory space, the target message object at least comprising a value domain, the value domain comprising target-type data and non-target-type data; Generate serialized data of the target message object according to the tag information of the non-target data and the target data, and write the serialized data into the second memory space; Generate configuration information for the target data as an independent message object, wherein the configuration information includes tag information of the target data and a first pointer field for carrying memory address information of the independent message object at the opposite end; Writing the configuration information into the second memory space as part of the serialized data of the independent message object; the serialized data of the independent message object also includes the target type data located in the first memory space; The serialized data of the target message object and the serialized data of the independent message object are sent to the opposite end, and when sending the configuration information, the target type data is read from the first memory space and sent to the opposite end.
15. The method according to claim 14, It is characterized in that Generating serialized data of the target message object according to the tag information of the non-target data and the target data, including: Encoding the non-target data to obtain encoded data, and encapsulating the encoded data into a first data segment, wherein the first data segment includes a first tag, length information of the encoded data, and the encoded data; the first tag indicates that the first data segment corresponds to the non-target data; A second data segment is generated according to the tag information of the target data, wherein the second data segment includes a second tag, length information of the tag information, and the tag information, and the second tag indicates that the second data segment points to the independent message object.
16. The method according to claim 14, It is characterized in that The configuration information further includes: a third tag and / or size information of the target data; the third tag is used to identify the second serialization method selected for the target data; The second serialization method refers to a method of serializing the target type data as an independent message object that has a reference relationship with the target message object.
17. The method according to any one of claims 14 to 16, It is characterized in that Also includes: assigning identification information to the target message object and the independent message object; Generate header information for the independent message object, and write the header information of the independent message object into the second memory space as part of serialized data of the independent message object; The header information of the independent message object includes at least the identification information of the target message object, the identification information of the independent message object and the pointer information pointing to the independent message object, and the pointer information is the address information of the independent message object in the second memory space.
18. The method according to claim 17, It is characterized in that Generating header information for the independent message object, including: For the independent message object, generating an empty header of a set format, wherein the empty header at least includes a sequence number field, a reference field and a second pointer field; Performing information configuration on each field in the empty header to obtain header information of the independent message object; wherein the information configuration includes: Adding identification information of the independent message object in the sequence number field; Adding pointer information pointing to the independent message object in the second pointer field; The identification information of the target message object is added to the reference field.
19. A data processing method, It is characterized in that include: Receiving serialized data of a plurality of message objects, the plurality of message objects comprising a target message object and an independent message object, the independent message object being target-type data in the target message object; Parsing the non-target data of the target message object and the marking information of the target data from the serialized data of the target message object; Parsing configuration information of the independent message object and the target data from the serialized data of the independent message object, wherein the configuration information includes tag information and a first pointer field of the target data; According to the memory address information of the target data at the local end, configuring pointer information pointing to the target data in the first pointer field; According to the tag information of the target data, the non-target data of the target message object, the first pointer field and the target data are associated to obtain the target message object.
20. An electronic device, It is characterized in that include: Memory and processor; The memory is used to store a computer program; the processor is coupled to the memory and is used to execute the computer program to implement the steps in the method of any one of claims 1-11, claims 12-13, claims 14-18 and claim 19.
21. A computer-readable storage medium storing a computer program, It is characterized in that When the computer program is executed by a processor, the processor is caused to implement the steps of the method as claimed in any one of claims 1 to 11, claims 12 to 13, claims 14 to 18 and claim 19.