Data processing method and device, equipment and medium

By receiving business requests, dividing memory segments and creating tree nodes, only the data required for the business request is deserialized, which solves the problem of long deserialization time in the existing technology and improves processing efficiency.

CN120687499APending Publication Date: 2025-09-23TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410345993.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-22
Publication Date
2025-09-23

AI Technical Summary

Technical Problem

In the prior art, the entire serialized data stored in the database needs to be processed during deserialization, which results in excessively long processing time and reduced efficiency, especially when only partial data is required.

Method used

By receiving business requests, obtaining request field information, dividing memory fragments, creating root nodes and tree nodes, only deserializing the memory fragments required for the business request, generating request response data, and avoiding deserializing the complete data.

Benefits of technology

It significantly reduces the amount of data required for deserialization processing, improves processing efficiency, and reduces unnecessary data operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120687499A_ABST
    Figure CN120687499A_ABST
Patent Text Reader

Abstract

The invention provides a data processing method and device, equipment and a medium, which are used for improving deserialization efficiency. The method comprises the following steps: dividing an original serialized memory fragment according to request field information carried by a service request to obtain a memory fragment set, and creating a root node containing the original serialized memory fragment; if the request field information does not contain the nested field, obtaining a first memory fragment in a memory fragment set, and creating a tree node corresponding to a business field according to the field type of the business field associated with the first memory fragment; determining a deserialization child node of the root node according to a tree node corresponding to the service field, and inserting memory fragments except the first memory fragment in the memory fragment set into a non-deserialization segment in the root node to obtain an updated root node; and according to the updated root node and the data in the tree node corresponding to the service field, generating request response data corresponding to the service request and executing a service operation indicated by the service request.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data processing method, apparatus, device, and medium. Background Art

[0002] Before storing the data, the original data needs to be serialized to obtain serialized data that is easy to store and then stored in the database. If the data stored in the database needs to be used in business processing, the serialized data in the database needs to be deserialized, and then the deserialized data required for the business processing needs to be called. In the current deserialization process, when the business processing only needs to use part of the data in the database, it is still necessary to deserialize the entire serialized data stored in the database, and filter out the data required for the business processing from the complete deserialized data. It can be seen that this deserialization method increases the amount of data to be deserialized, causing the deserialization process to take too long and reducing the efficiency of the deserialization process. Summary of the Invention

[0003] The embodiments of the present application provide a data processing method, apparatus, device, and medium, which can reduce the amount of data to be deserialized, thereby improving the efficiency of deserialization processing.

[0004] On the one hand, an embodiment of the present application provides a data processing method, the method comprising:

[0005] Receive a business request for the original serialized memory fragment, obtain the request field information carried by the business request, divide the original serialized memory fragment according to the request field information, obtain a memory fragment set, and create a root node containing the original serialized memory fragment;

[0006] If the requested field information does not contain nested fields, obtain the first memory segment that matches the requested field information in the memory segment set, and create a tree node corresponding to the business field according to the field type corresponding to the business field associated with the first memory segment;

[0007] Determine the deserialized child node of the root node according to the tree node corresponding to the business field, insert the memory segments except the first memory segment in the memory segment set into the non-deserialized segment of the root node, and obtain an updated root node;

[0008] Request response data corresponding to the business request is generated based on the data in the updated root node and the data in the tree node corresponding to the business field, and the business operation indicated by the business request is executed based on the request response data.

[0009] In one aspect, an embodiment of the present application provides a data processing device, the device comprising:

[0010] A first node creation module is configured to receive a service request for an original serialized memory segment, obtain request field information carried in the service request, divide the original serialized memory segment according to the request field information, obtain a memory segment set, and create a root node containing the original serialized memory segment;

[0011] a second node creation module configured to obtain, if the requested field information does not contain nested fields, a first memory segment matching the requested field information from the memory segment set, and create a tree node corresponding to the business field according to a field type corresponding to the business field associated with the first memory segment;

[0012] A node update module is used to determine the deserialized child node of the root node according to the tree node corresponding to the business field, and insert the memory segments except the first memory segment in the memory segment set into the non-deserialized segment of the root node to obtain an updated root node;

[0013] The response data generation module is used to generate request response data corresponding to the business request based on the data in the updated root node and the data in the tree node corresponding to the business field, and execute the business operation indicated by the business request according to the request response data.

[0014] The first node creation module is specifically used to:

[0015] If the requested field information contains nested fields and non-nested fields, obtain the non-nested fields and the first subfield in the nested fields, and the field position range in the original serialized memory segment;

[0016] The original serialized fragment is trimmed according to the field position range corresponding to the non-nested field and the first subfield in the nested field to obtain a memory fragment set.

[0017] The second node creation module is specifically used for:

[0018] If the field type corresponding to the business field associated with the first memory segment includes a scalar type, obtaining deserialized data corresponding to the first memory segment;

[0019] A first candidate node including the first memory segment is created, and the deserialized data corresponding to the first memory segment is inserted into the first candidate node to obtain a tree node corresponding to the business field; the tree node corresponding to the business field is a leaf node.

[0020] The second node creation module is specifically used for:

[0021] If the field type corresponding to the business field associated with the first memory segment includes a message type, creating a second candidate node including the first memory segment;

[0022] Insert the first memory segment into the undeserialized segment of the second candidate node to obtain a tree node corresponding to the business field; the tree node corresponding to the business field does not contain a deserialized child node, and the tree node corresponding to the business field is a leaf node.

[0023] The second node creation module is specifically used for:

[0024] If the field type corresponding to the business field associated with the first memory segment includes an array type, creating a third candidate node including the first memory segment;

[0025] Obtaining an array element identifier associated with the business field in the request field information, obtaining a first sub-memory segment corresponding to the array element identifier from multiple sub-memory segments included in the first memory segment, and creating a fourth candidate node including the first sub-memory segment;

[0026] Insert the first child memory fragment into the non-deserialized segment of the fourth candidate node to obtain a first tree node; the first tree node does not contain a deserialized child node, and the first tree node is a leaf node;

[0027] Insert the first tree node into the deserialized child node of the third candidate node, and insert the sub-memory segments of the first memory segment except the first sub-memory segment into the non-deserialized segment of the third candidate node to obtain a second tree node; the second tree node is a non-leaf node;

[0028] The first tree node and the second tree node are determined as tree nodes corresponding to the business field.

[0029] The node update module is specifically used to:

[0030] Get the hierarchical identifier of the tree node corresponding to the business field;

[0031] Insert the tree node whose hierarchical identifier is adjacent to the root node in the tree node corresponding to the business field into the deserialized child node of the root node.

[0032] The business request includes a data call request, and the response data generation module is specifically used to:

[0033] Generate a data node subtree corresponding to the data call request based on the updated root node and the hierarchical identifier of the tree node corresponding to the business field;

[0034] If there is a leaf node containing deserialized data in the data node subtree, the leaf node containing the deserialized data is determined as the first call node, and the deserialized data in the first call node is determined as the first response data;

[0035] If there is a leaf node that does not contain deserialized data in the data node subtree, the leaf node that does not contain deserialized data is determined as the second call node, and the serialized data contained in the second call node is deserialized to obtain second response data;

[0036] The first response data and the second response data are encapsulated as request response data corresponding to the data call request, and the request response data is returned to the business object corresponding to the data call request.

[0037] The business request includes a data update request, and the response data generation module is specifically used to:

[0038] Generate a data node subtree corresponding to the data update request based on the updated root node and the hierarchical identifier of the tree node corresponding to the business field;

[0039] Perform data update operations on the tree nodes in the data node subtree according to the data update request to obtain an updated data node subtree;

[0040] According to the field type corresponding to the field associated with the tree node in the updated data node subtree, the data in the tree nodes contained in the updated data node subtree are serialized to obtain request response data corresponding to the data update request, and the original serialized memory segment is updated according to the request response data.

[0041] The response data generation module is specifically used to:

[0042] Determine, among the leaf nodes included in the data node subtree, an object to be modified corresponding to the data update operation, replace the data corresponding to the object to be modified with the update content indicated by the data update operation, and determine the leaf node containing the update content as the first update node;

[0043] According to the first update node, update the deserialized child node contained in the parent node of the first update node in the data node subtree to obtain a second update node;

[0044] According to the second update node, the deserialized child nodes contained in the parent node of the second update node in the data node subtree are updated until the update operation on the root node in the data node subtree is completed to obtain an updated data node subtree.

[0045] The response data generation module is specifically used to:

[0046] Determine a leaf node in the data node subtree as a first processing node, and determine a parent node of the first processing node in the data node subtree as a second processing node;

[0047] Deleting the first processing node from the deserialized child node of the second processing node to obtain a third update node, and updating the deserialized child nodes contained in the parent node of the third update node in the data node subtree according to the third update node, until the update operation on the root node in the data node subtree is completed to obtain the first node subtree;

[0048] The first processing node is deleted from the first node subtree to obtain an updated data node subtree.

[0049] The updated data node subtree includes a third tree node corresponding to a scalar type field, a fourth tree node corresponding to a message type field, and a fifth tree node corresponding to an array type field. The response data generation module is specifically configured to:

[0050] Serialize the deserialized data in the third tree node to obtain a first update fragment corresponding to the third tree node;

[0051] Determine the byte length corresponding to the fourth tree node, generate header update information corresponding to the fourth tree node based on the byte length, and concatenate the header update information with the memory fragment contained in the undeserialized segment in the fourth tree node to obtain a second update fragment corresponding to the fourth tree node;

[0052] Determine the memory segment contained in the undeserialized segment in the fifth tree node as the third update segment corresponding to the fifth tree node;

[0053] According to the hierarchical identifications of the third tree node, the fourth tree node and the fifth tree node in the updated data node subtree, the first update segment, the second update segment and the third update segment are combined to obtain request response data corresponding to the data update request.

[0054] The business request includes a data query request, and the response data generation module is specifically used to:

[0055] Generate a data node subtree corresponding to the data query request based on the updated root node and the hierarchical identifier of the tree node corresponding to the business field;

[0056] Delete the undeserialized segments contained in the non-leaf nodes in the data node subtree to obtain the second node subtree;

[0057] Serialize the data of the non-leaf nodes in the second node subtree to obtain the fourth update fragment, combine the fourth update fragment with the serialized data in the leaf nodes contained in the second node subtree to obtain request response data corresponding to the data query request, and return the request response data to the business object corresponding to the data query request.

[0058] The data processing device further includes a third node creation module, which is specifically configured to:

[0059] If the requested field information contains a nested field consisting of field a and field b, then the field types corresponding to field a and field b are obtained; field a is the first subfield of the nested field;

[0060] If the field type corresponding to field a is a message type, then a second memory segment matching field a is obtained from the memory segment set, and a fifth candidate node including the second memory segment is created;

[0061] If a sub-memory segment matching field b exists among the multiple sub-memory segments included in the second memory segment, and the field type corresponding to field b is a scalar type, then obtain the second sub-memory segment corresponding to field b in the second memory segment, obtain the deserialized data corresponding to the second sub-memory segment, and create a tree node corresponding to field b based on the deserialized data associated with the second sub-memory segment; the tree node corresponding to field b is a leaf node;

[0062] Insert the tree node corresponding to field b into the deserialized child node of the fifth candidate node, and insert the sub-memory segments of the second memory segment except the second sub-memory segment into the non-deserialized segment of the fifth candidate node to obtain the tree node corresponding to field a; the tree node corresponding to field a is a non-leaf node;

[0063] The tree node corresponding to field a and the tree node corresponding to field b are determined as the tree nodes corresponding to the nested fields; the tree nodes corresponding to the nested fields are used to generate a data node subtree corresponding to the business request.

[0064] The third node creation module is also used to:

[0065] If there is no sub-memory segment matching field b in the second memory segment, create a tree node with empty data for field b;

[0066] Insert the tree node corresponding to field b into the deserialized child node of the fifth candidate node, insert the second memory segment into the non-deserialized segment of the fifth candidate node, and obtain the tree node corresponding to field a.

[0067] One aspect of an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program. When the computer program is executed by the processor, the processor executes the steps of the method in one aspect of the embodiment of the present application.

[0068] On one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the steps of the method in one aspect of the embodiment of the present application are executed.

[0069] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method provided in various optional embodiments of the above-mentioned aspect.

[0070] In an embodiment of the present application, after receiving a business request, a root node containing the original serialized memory fragment can be created; if the request field information carried by the business request does not contain a nested field, a first memory fragment matching the request field information is obtained from the original serialized memory fragment, and a tree node corresponding to the business field is created according to the field type corresponding to the business field associated with the first memory fragment; further, the deserialized child node of the root node can be determined according to the tree node corresponding to the business field, and the memory fragments in the memory fragment set other than the first memory fragment are inserted into the undeserialized segment of the root node to obtain an updated root node; and then, based on the data in the updated root node and the data in the tree node corresponding to the business field, request response data corresponding to the business request can be generated, and the business operation indicated by the business request can be executed according to the request response data. It can be seen that in the deserialization process, the embodiment of the present application only involves the deserialization processing of the part of the memory fragment required by the business request, without the need to deserialize the complete original serialized memory fragment, which can significantly reduce the amount of data to be deserialized, thereby improving the efficiency of the deserialization processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0072] Figure 1 This is a schematic diagram of a network architecture provided by an embodiment of the present application;

[0073] Figure 2 is a schematic diagram of a serialized memory segment provided in an embodiment of the present application;

[0074] Figure 3This is a flow chart of a data processing method provided in an embodiment of the present application;

[0075] Figure 4 This is a schematic diagram of a process for cutting original serialized memory segments provided by an embodiment of the present application;

[0076] Figure 5 This is a schematic diagram of obtaining a memory segment set provided by an embodiment of the present application. Figure 1 ;

[0077] Figure 6 This is a schematic diagram of obtaining a memory segment set provided by an embodiment of the present application. Figure 2 ;

[0078] Figure 7 This is a schematic diagram of a data call provided by an embodiment of the present application;

[0079] Figure 8 This is a flow chart of a data update process based on a data node subtree provided by an embodiment of the present application;

[0080] Figure 9 This is an example of updating a data node subtree provided by the embodiment of the present application. Figure 1 ;

[0081] Figure 10 This is an example of updating a data node subtree provided by the embodiment of the present application. Figure 2 ;

[0082] Figure 11 This is a schematic diagram of a data update provided by an embodiment of the present application;

[0083] Figure 12 This is a schematic diagram of a data query provided by an embodiment of the present application;

[0084] Figure 13 This is a schematic diagram of creating a data node subtree provided by an embodiment of the present application;

[0085] Figure 14 is a structural diagram of a data processing device provided in an embodiment of the present application;

[0086] Figure 15 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0087] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0088] The data involved in this application must comply with the relevant laws, regulations and standards of the relevant regions when collecting, using and processing them.

[0089] To facilitate understanding of the technical solutions proposed in the embodiments of the present application, the technical terms involved in the embodiments of the present application are explained below.

[0090] Serialization: The process of packaging and splicing scattered data blocks in memory into a continuous data block according to certain encoding rules (for example, the Protobuf protocol). The serialized data block can be written to disk or transmitted over the network.

[0091] Deserialization: The reverse process of serialization, which is the process of restoring serialized data blocks into the original scattered data blocks. These scattered data blocks are organized according to a certain data structure to facilitate program code recognition and operation.

[0092] BufferSlice (BS): Continuous memory containing serialized data.

[0093] See Figure 1 , Figure 1 This is a schematic diagram of a network architecture provided by an embodiment of the present application. The network architecture may include a server 10d and a terminal cluster. The terminal cluster may include one or more terminal devices. There is no limit on the number of terminal devices included in the terminal cluster. Figure 1 As shown, the terminal cluster may specifically include terminal device 10a, terminal device 10b, and terminal device 10c, etc.; all terminal devices in the terminal cluster (for example, terminal device 10a, terminal device 10b, and terminal device 10c, etc.) may be connected to the server 10d through a network connection, so that each terminal device may exchange data with the server 10d through the network connection.

[0094] in, Figure 1The terminal devices in the terminal cluster shown may include but are not limited to: smart phones, tablet computers, laptops, PDAs, mobile internet devices (MIDs), wearable devices (such as smart watches, smart bracelets, etc.), smart voice interaction devices, smart home appliances (such as smart TVs, etc.), vehicle-mounted devices, aircraft and other electronic devices. This application does not limit the type of terminal devices.

[0095] Figure 1 The server 10d shown can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. This application does not limit the type of server.

[0096] In an embodiment of the present application, a database (Database) for storing business data may be provided in the server 10d. The database may be a local database or a cloud database. The database may be a key-value database (for example, a TcaplusDB database, a Redis database, etc.) or a relational database (for example, a MySQL database, etc.). The embodiment of the present application does not limit the type of database. It is understandable that before the data is stored, the original data needs to be serialized and then the serialized data is stored in the database. For ease of description, the embodiment of the present application takes the Protobuf protocol as an example to introduce the serialization process of the original data. For example, if the data to be stored is a table named "Player", the Protobuf protocol can be used to define the data structure of the Player table. A possible example code is as follows:

[0097] syntax="proto3"; / / Specify the syntax version of protobuf protocol as proto3

[0098] import "tcaplusservice.optionv1.proto"; / / Import another protobuf protocol definition file tcaplusservice.optionv1.proto

[0099] message Player / / defines an object named Player, whose field type is message type

[0100] {

[0101] option(tcaplusservice.tcaplus_primary_key) = "group_id,name"; / / Set an option for the Player. This option comes from the imported tcaplusservice.optionv1.proto file and specifies the group_id field and the name field as the primary key of the Player.

[0102] option(tcaplusservice.tcaplus_index) = "group_index(group_id)"; / / Set an option for the Player. This option comes from the imported tcaplusservice.optionv1.proto file and specifies the index of the group_id field as group_index

[0103] message Mail / / In Player, define a field named Mail, whose field type is message type

[0104] {

[0105] string title = 2; / / Define a field named title in the Mail field, whose field type is a string scalar type and the field identifier is 2;

[0106] string content = 3; defines a field named content in the Mail field, with a field type of string scalar type and a field identifier of 3;

[0107] }

[0108] message GameInfo / / In Player, define a field named GameInfo, whose field type is message type

[0109] {

[0110] int64 login_time = 1; / / Define a field named login_time in the GameInfo field, whose field type is int64 scalar type and field identifier is 1

[0111] int32 win_count = 2; / / Define a field named win_count in the GameInfo field, whose field type is int32 scalar type and field identifier is 2

[0112] int32 loss_count = 3; / / Define a field named loss_count in the GameInfo field, whose field type is int32 scalar type and field identifier is 3

[0113] };

[0114] int32 group_id = 1; / / In Player, define a field named group_id, whose field type is int32 scalar type and field identifier is 1

[0115] string name = 2; / / In Player, define a field named name, whose field type is a string scalar type and the field identifier is 2

[0116] int32 level = 3; / / In Player, define a field named level, whose field type is int32 scalar type and field identifier is 3

[0117] GameInfo game_info=4; / / In Player, define a field named game_info, the field type is the message type of the previously defined GameInfo field, and the field identifier is 4

[0118] repeated Mail mailbox = 5; / / In Player, define a field named mailbox. The field type is an array type, which can contain multiple Mails. The field identifier is 5

[0119] int32 history_score = 6; / / In Player, define a field named history_scores, the field type is int32 scalar type, and the field identifier is 6

[0120] map<string,string> extra_info=7; / / In Player, define a field named extra_info, the field type is a key-value pair type, and the field identifier is 7

[0121] }

[0122] After obtaining the data structure of the Player table, the Player message (the deserialized object in the Player) can be compactly combined according to the fields in the defined data structure, the field types corresponding to each field, and the combination order of each field to obtain the following: Figure 2The original serialized memory segment BS0 shown completes the serialization of the Player message and is then stored in the database. Field types can include scalar types, message types, and array types. Scalar types refer to single-value data types, such as integers (int32, int64), floating-point types, strings, and binary strings. Message types and array types are both composite data types, and array types can include message array types and key-value pairs (maps).

[0123] See Figure 2 , Figure 2 This is a schematic diagram of a serialized memory segment provided by an embodiment of the present application. Figure 2 As shown, the original serialized memory segment BS0 is the memory segment corresponding to the above Player table. The original serialized memory segment BS0 is obtained by combining the serialized data corresponding to multiple fields, wherein the game_info field is embedded with the login_time field, win_count field, and loss_count field in the GameInfo field; the mailbox field is embedded with the title field and content field in the Mail field. The original serialized memory segment BS0 records the field identifier (tag) defined above, which can be used to identify field information. Figure 2 As shown, the field identifier corresponding to the level field can be 3, and the field identifier corresponding to the mailbox field can be 5. Since the field type corresponding to the mailbox field is an array type, and the mailbox field contains 3 array elements, during the serialization process, the data corresponding to the 3 mailbox fields with a field identifier of 5 will be spliced ​​together. Therefore, the original serialized memory fragment BS0 contains the serialized data corresponding to the 3 mailbox fields with a field identifier of 5; similarly, the field type corresponding to the extra_info field is also an array type, and the extra_info field contains 3 array elements. The field identifier corresponding to the extra_info field is 7. Therefore, the original serialized memory fragment BS0 includes the serialized data corresponding to the 3 extra_info fields with a field identifier of 7. Optionally, the original serialized memory fragment BS0 may also include Figure 2 The field type and byte length corresponding to each field not shown in the figure are as follows.

[0124] When business processing requires the use of data in the original serialized memory segment BS0, the original serialized memory segment BS0 needs to be deserialized to retrieve the deserialized data required for business processing. In the current deserialization process, when business processing only needs to use part of the data in the original serialized memory segment BS0, it is still necessary to deserialize the entire original serialized memory segment BS0 stored in the database to filter out the data required for business processing from the complete deserialized data.

[0125] For example, the business operation indicated by a business request includes: "SELECT name, mailbox[0-1] FROM Player WHERE group_id = 101 AND name = 'xxx'", which indicates a query and return of the first two elements in the name and mailbox fields. Current deserialization methods require complete deserialization of the original serialized memory fragment BS0 to obtain the complete Player message. Only then can the first two elements in the name and mailbox fields be found from the complete Player message. Direct deserialization of the first two elements in the name and mailbox fields is not supported. This deserialization method increases the amount of data to be deserialized, causing the deserialization process to take an excessively long time. When the Player message is too large, the data processing cost increases, which in turn reduces the deserialization efficiency.

[0126] To solve the above problems, the embodiment of the present application creates a tree node corresponding to the fields required by the business request, and then generates request response data corresponding to the business request based on the tree node, without the need to deserialize the complete original serialized memory fragments stored in the database. This can significantly reduce the amount of data to be deserialized, and thus improve the efficiency of deserialization processing.

[0127] The following describes in detail the deserialization processing method involved in the embodiment of the present application. Figure 3 , Figure 3 This is a flow chart of a data processing method provided by an embodiment of the present application. The data processing method can be executed by a computer device, which can be Figure 1 The terminal device 10a shown, or it can also be Figure 1 The server 10d shown. Figure 3 As shown, the data processing method may include steps S101 to S104:

[0128] Step S101: receiving a service request for an original serialized memory segment, obtaining request field information carried by the service request, dividing the original serialized memory segment according to the request field information, obtaining a memory segment set, and creating a root node containing the original serialized memory segment.

[0129] The original serialized memory fragment can refer to the continuous memory in the database that contains complete serialized data. The original serialized memory fragment is obtained by serializing the business data corresponding to multiple fields. For details, see Figure 2 The original serialized memory segment BS0 shown is generated as described above.

[0130] A business request refers to a request initiated by a business object to obtain business services provided by a database. In embodiments of the present application, a business request may include, but is not limited to, one or more of: a data call request, a data update request, and a data query request. The information carried in the business request may include, but is not limited to, the object identifier corresponding to the business object, request field information, data source, business operation information, and other information. The request field information may refer to the fields required by the business request.

[0131] For example, a service request may include the following information: "SELECT * FROM Player WHERE group_id = 101 AND level > 5", which indicates a query and return of all data in the Player table where the group_id field is 101 and the level field is greater than 5. "SELECT" indicates that the service request is a data query request; "group_id" and "level" indicate the requested field information; and "group_id = 101 AND level > 5" indicates the query condition. Another example may include the following information: "UPDATE Player SET game_info.login_time = 1701154673 WHERE group_id = 101 AND name = 'xxx'", which indicates updating the value of the game_info.login_time field to 1701154673 in the Player table where the primary key is the group_id field 101 and the name field 'xxx'. Among them, "UPDATE" indicates that the service request is a data update request; "group_id=101AND name='xxx'" indicates the query identifier corresponding to the data source Player table; "game_info.login_time" indicates the request field information; and "1701154673" indicates the update content.

[0132] After obtaining the requested field information, the original serialized memory fragments can be divided according to the requested field information to obtain a memory fragment set, wherein the individual memory fragments contained in the memory fragment set can be spliced ​​to obtain the original serialized memory fragment. It can be understood that the fields in the embodiments of the present application may include nested fields and non-nested fields, wherein a nested field refers to a composite field obtained by combining multiple subfields, and a non-nested field refers to a field that only contains a single field element. For example, the game_info.win_count field includes the game_info subfield and the win_count subfield, therefore, the game_info.win_count field is a nested field; the level field only contains a single field, therefore, the level field is a non-nested field.

[0133] For non-nested fields in the request field information, the field position range of the non-nested fields in the original serialized memory fragment can be obtained, and then the original serialized memory fragment can be cut according to the field position range corresponding to the non-nested field to obtain the memory fragment corresponding to the non-nested field. Specifically, the memory fragment reading component (ProtoReader) can be used to read the field identifiers corresponding to each field contained in the original serialized memory fragment, and determine whether the corresponding field matches the field in the request field information based on the field identifier, and then cut out the memory fragment that matches the characters in the request field information from the original serialized memory fragment and add it to the memory fragment collection.

[0134] See Figure 4 , Figure 4 This is a flow chart of cutting original serialized memory segments provided by an embodiment of the present application. Figure 4As shown, ProtoReader can be used to sequentially read the header information of the fields contained in the original serialized memory segment. The field identifier corresponding to each field is obtained from the field header information. The field identifier is then determined to match the field identifier corresponding to the character in the requested field information. If not, the current field is skipped and the field identifier of the next field is read until a field with a matching field identifier is found. After finding a field with a matching field identifier, the byte length corresponding to the field is obtained. Based on the byte length, the field position range of the field in the original serialized memory segment is determined. Based on the field position range corresponding to the field, the memory segment corresponding to the field is cropped from the original serialized memory segment. When the field type corresponding to the field is a scalar type, the memory segment corresponding to the field and the deserialized data corresponding to the memory segment are output. When the field type corresponding to the field is a message type, the memory segment corresponding to the field is output. In particular, when the field type corresponding to the field is an array type, the output memory segment is a memory segment containing all of the fields. For example, if the field contains N array elements, the memory segment output for the field includes N memory segments, each with the same field identifier. When the requested field information contains multiple fields, the memory segments corresponding to the respective fields can be cut out from the original serialized memory segments in sequence according to the above method, and added to the memory segment set.

[0135] In an embodiment of the present application, when reading the field identifiers corresponding to the fields in the original serialized memory segment, the field identifiers corresponding to the fields that are not related to the requested field information can be skipped, and only the memory segments corresponding to the fields related to the requested field information can be processed, thereby helping to improve the efficiency of data processing.

[0136] For ease of understanding, this embodiment of the application uses the example of requesting field information including the level field, game_info field, and mailbox field to illustrate the process of obtaining a memory segment set. The level field, game_info field, and mailbox field are all non-nested fields; the field identifiers defined for the level field, game_info field, and mailbox field in the original serialized memory segment BS0 are 3, 4, and 5, respectively.

[0137] Specifically, see Figure 5 , Figure 5 This is a schematic diagram of obtaining a memory segment set provided by an embodiment of the present application. Figure 1. The field identifiers contained in the original serialized memory segment BS0 can be read in sequence through ProtoReader. Since the field identifiers corresponding to the group_id field and the name field do not match the field identifiers corresponding to the fields in the requested field information, the group_id field and the name field are skipped. When the field identifier read is 3, the byte length of the field (level field) corresponding to the field identifier 3 is obtained, and the field position range of the level field in the original serialized memory segment BS0 is determined based on the byte length. Then, based on the field position range corresponding to the level field, the memory segment BS2 corresponding to the level field is cut out from the original serialized memory segment BS0, and the memory segment BS2 is added to the memory segment set.

[0138] It can be understood that when cutting out the memory segment BS2, the memory segment BS1 can be cut out at the same time. The memory segment BS1 is the memory segment corresponding to the group_id field and the name field, and the memory segment BS1 is added to the memory segment set. After completing the cutting of the memory segment BS2 corresponding to the level field, the memory segment BS3 corresponding to the game_info field can be cut out from the original serialized memory segment BS0 in the same manner, and the memory segment BS4, memory segment BS5 and memory segment BS6 corresponding to the mailbox field can be cut out, and the memory segment BS3, memory segment BS4, memory segment BS5 and memory segment BS6 are added to the memory segment set. After completing the cutting of the memory segment corresponding to the mailbox field, the cutting is ended, and the remaining memory segments (memory segment BS7) in the original serialized memory segment BS0 are added to the memory segment set. As shown in FIG. Figure 5 As shown, after the trimming is completed, a memory segment set including memory segment BS1, memory segment BS2, memory segment BS3, memory segment BS4, memory segment BS5, memory segment BS6 and memory segment BS7 can be obtained.

[0139] For nested fields included in the requested field information, the field position range of the first subfield in the nested field in the original serialized memory segment can be obtained, and then the original serialized memory segment can be trimmed according to the field position range corresponding to the first subfield in the nested field, and the trimmed memory segment can be added to the memory segment collection.

[0140] For ease of understanding, this embodiment of the application uses the example of requesting field information including the level field and the game_info.win_count field to describe the process of obtaining a memory segment set when the requesting field information contains nested fields. The level field is a non-nested field, the game_info.win_count field is a nested field, the first subfield of the game_info.win_count field is the game_info field, and the win_count field has a field identifier of 2 in the memory segment corresponding to the game_info field; the level field has a field identifier of 3, and the game_info field has a field identifier of 4.

[0141] Specifically, see Figure 6 , Figure 6 This is a schematic diagram of obtaining a memory segment set provided by an embodiment of the present application. Figure 2 . The acquisition process of the memory segment corresponding to the level field (memory segment BS2) and the memory segment corresponding to the group_id field and the name field (memory segment BS1) can refer to the description above and will not be repeated here. After completing the cutting of the memory segment BS2 corresponding to the level field, the original serialized memory segment BS0 can be read through ProtoReader until the field identifier is 4, and the byte length of the field (game_info field) corresponding to the field identifier 4 is obtained. According to the byte length, the field position range of the game_info field in the original serialized memory segment BS0 is determined, and then according to the field position range corresponding to the field, the memory segment BS3 corresponding to the game_info field is cut out from the original serialized memory segment BS0, and the memory segment BS3 is added to the memory segment set. After cutting the memory segment BS3, the cutting is ended, and the remaining memory segments (memory segment BS4) in the original serialized memory segment BS0 are added to the memory segment set. As shown in FIG. Figure 6 As shown, after the trimming is completed, a memory segment set including the memory segment BS1, the memory segment BS2, the memory segment BS3 and the memory segment BS4 can be obtained.

[0142] Furthermore, after obtaining memory segment BS3, memory segment BS3 can be further cut according to actual needs to obtain the sub-memory segment corresponding to the win_count field. Specifically, the field identifiers corresponding to the various fields contained in memory segment BS3 can be read using ProtoReader. When the field identifier is 2, the byte length of the field corresponding to the field identifier 2 (the win_count field) is obtained. Based on the byte length, the field position range of the win_count field in memory segment BS3 is determined. Then, based on the field position range corresponding to the win_count field, the sub-memory segment corresponding to the win_count field is cut out from memory segment BS3.

[0143] It is understandable that, for nested fields, the above embodiment only introduces in detail the implementation method of ProtoReader reading one layer of serialized data at a time. In actual applications, ProtoReader can be used to read multiple layers of nested serialized data at a time according to actual conditions.

[0144] Furthermore, a root node (root) containing the original serialized memory fragment can be created. That is, the original serialized memory fragment can be determined as the serialized data in the root node, and the deserialized child node of the root node is empty. It is understandable that the root node can be created when a service request is received, or after the memory fragment set is obtained. This embodiment of the application does not limit this.

[0145] Step S102: If the requested field information does not contain nested fields, a first memory segment matching the requested field information is obtained from the memory segment set, and a tree node corresponding to the business field is created according to the field type corresponding to the business field associated with the first memory segment.

[0146] In an embodiment of the present application, the first memory segment is a memory field in a memory segment set that matches the request field information. The number of the first memory segments may be one or more, and this embodiment of the present application does not limit this. The business field refers to the field corresponding to the first memory segment; the field type corresponding to the business field may include one or more of a scalar type, a message type, and an array type, and the tree node corresponding to the business field may be determined based on the field type corresponding to the business field. Among them, the tree node corresponding to the business field may include the memory segment corresponding to the business field; when the tree node corresponding to the business field is a leaf node, the tree node corresponding to the business field may also include undeserialized segments or deserialized data associated with the request field; when the tree node corresponding to the business field is a non-leaf node, the tree node corresponding to the business field may also include undeserialized segments and deserialized sub-nodes. The following details the creation process of the tree nodes of the business fields corresponding to each field type.

[0147] When the field type corresponding to the business field associated with the first memory fragment includes a scalar type, the tree node corresponding to the business field is a leaf node. The process of creating the tree node corresponding to the business field includes: obtaining the deserialized data corresponding to the first memory fragment, wherein the deserialization process is the inverse process of serialization, and the specific deserialization method can be determined based on the encoding protocol used for serialization; then, a first candidate node containing the first memory fragment can be created. In other words, the first memory fragment can be determined as the serialized data in the first candidate node, and the deserialized data and deserialized child nodes in the first candidate node are both empty. Furthermore, the deserialized data corresponding to the first memory fragment can be inserted into the first candidate node to obtain a tree node corresponding to the business field. In other words, when the field type corresponding to the business field includes a scalar type, the tree node corresponding to the business field can include the first memory fragment and the deserialized data corresponding to the first memory fragment, but does not include a deserialized child node, that is, the deserialized child node of the tree node is empty.

[0148] When the field type corresponding to the business field associated with the first memory fragment includes a message type, the process of creating a tree node corresponding to the business field includes: creating a second candidate node including the first memory fragment, that is, the first memory fragment can be determined as the serialized data in the second candidate node, and the undeserialized segment and the deserialized child node in the second candidate node are both empty. Furthermore, the first memory fragment can be inserted into the undeserialized segment in the second candidate node to obtain a tree node corresponding to the business field, which can be a leaf node. In other words, when the field type corresponding to the business field includes a message type, the tree node corresponding to the business field does not include a deserialized child node, that is, the deserialized child node of the tree node is empty; the tree node can include: ① the first memory fragment, which can be used as the serialized data of the tree node; ② the undeserialized segment, which includes the first memory fragment.

[0149] When the field type corresponding to the business field associated with the first memory segment includes an array type, the first memory segment may include multiple sub-memory segments, each sub-memory segment corresponding to an array element identifier, and the array element identifier is used to identify the information of each sub-memory segment in the first memory segment; the first sub-memory segment is the sub-memory segment in the first memory segment that matches the array element identifier in the request field information; the process of creating a tree node corresponding to the business field includes: creating a third candidate node including the first memory segment, which can determine the first memory segment as the serialized data in the third candidate node, and the deserialization child node of the third candidate node is empty. Obtaining the array element identifier associated with the business field in the request field information, obtaining the first sub-memory segment corresponding to the array element identifier from the multiple sub-memory segments included in the first memory segment, creating a fourth candidate node including the first sub-memory segment, which can determine the first sub-memory segment as the serialized data in the fourth candidate node, and the deserialization child node of the fourth candidate node is empty.

[0150] After generating the fourth candidate node, the first sub-memory fragment can be inserted into the non-deserialized segment in the fourth candidate node to obtain the first tree node. At this time, the first tree node may include: ① the first sub-memory fragment, the first sub-memory fragment serves as the serialized data of the first tree node; ② the non-deserialized segment, the non-deserialized segment includes the first sub-memory fragment. Optionally, the first sub-memory fragment may also be deserialized to obtain the deserialized data corresponding to the first sub-memory fragment, and the deserialized data corresponding to the first sub-memory fragment may be inserted into the fourth candidate node to obtain the first tree node. At this time, the first tree node may include: the first sub-memory fragment and the deserialized data corresponding to the first sub-memory fragment. In an embodiment of the present application, the first tree node does not contain a deserialized child node, that is, the deserialized child node of the first tree node is empty.

[0151] Furthermore, the first tree node can be inserted into the deserialized child node of the third candidate node, and the sub-memory segments in the first memory segment other than the first sub-memory segment can be inserted into the undeserialized segment of the third candidate node to obtain a second tree node. That is, the second tree node can include: ① the first memory segment, which serves as the serialized data of the second tree node; ② the undeserialized segment, which includes the sub-memory segments in the first memory segment other than the first sub-memory segment; and ③ the deserialized child node, which includes the first tree node. The first tree node and the second tree node are then determined to be the tree nodes corresponding to the business field. That is, when the field type corresponding to the business field includes an array type, the tree node corresponding to the business field includes the first tree node and the second tree node, wherein the first tree node is a leaf node and the parent node of the first tree node is the second tree node.

[0152] It can be understood that when there are multiple business fields and the field types corresponding to the multiple business fields include multiple field types, the tree nodes corresponding to the multiple business fields can be obtained according to the creation method of the tree nodes corresponding to different field types. No further details will be given here.

[0153] Step S103: determining the deserialized child node of the root node according to the tree node corresponding to the business field, inserting the memory segments in the memory segment set except the first memory segment into the non-deserialized segment of the root node to obtain an updated root node.

[0154] In an embodiment of the present application, the deserialized child node of the root node can be determined based on the tree node corresponding to the business field. Specifically, the hierarchical identifier of the tree node corresponding to the business field can be obtained; and the tree node whose hierarchical identifier is adjacent to the root node in the tree node corresponding to the business field is inserted into the deserialized child node of the root node.

[0155] Among them, the level identifier corresponding to the tree node can be used to identify the identification information of the depth of the tree node in the data node subtree (DeltaTree). Tree nodes at the same level in the data node subtree have the same level identifier, and the root node is also regarded as a tree node of the data node subtree. The data node subtree is generated by the tree nodes corresponding to the root node and the business field, and its generation process will be described in detail below. The level identifier corresponding to each tree node can be set in ascending order from top to bottom according to the level of each tree node in the data node subtree. For example, the level identifier corresponding to the root node can be set to "1", and the level identifier corresponding to the child node (first-order neighbor node) of the root node can be set to "2", and so on. It can be understood that the level identifier corresponding to each tree node can be set together when creating the tree node.

[0156] For example, the level identifier corresponding to the root node is 1, the number of tree nodes corresponding to the business field is multiple, and the tree nodes corresponding to the business field include tree node 1, tree node 2 and tree node 3. Among them, the level identifier corresponding to tree node 1 is 3, and the level identifiers corresponding to tree node 2 and tree node 3 are both 2. Then the level identifiers corresponding to tree node 2 and tree node 3 are adjacent to the root node. Therefore, tree node 2 and tree node 3 can be inserted into the deserialized child node of the root node.

[0157] When the request field information does not contain nested fields, the first memory segment is the memory segment corresponding to the field required by the business request in the memory segment set. The memory segments other than the first memory segment in the memory segment set are unnecessary memory segments and do not need to be deserialized. Therefore, the memory segments other than the first memory segment in the memory segment set can be inserted into the undeserialized segment in the root node. Optionally, the undeserialized segment in the root node can include the original serialized memory segment, and the first memory segment can be deleted from the original serialized memory segment contained in the undeserialized segment in the root node, so that the undeserialized segment of the updated root node includes: the child memory segments other than the first memory segment in the memory segment set.

[0158] The updated root node may include: ① the original serialized memory fragment, which serves as the serialized data of the updated root node; ② the undeserialized segment, which includes the child memory fragments in the memory fragment set except the first memory fragment; ③ the deserialized child node, which includes the tree node whose level identifier is adjacent to the updated root node in the tree node corresponding to the business field. The updated root node is the tree node obtained by updating the aforementioned root node, and the two have the same level identifier.

[0159] Step S104: Generate request response data corresponding to the business request based on the updated data in the root node and the data in the tree node corresponding to the business field, and execute the business operation indicated by the business request based on the request response data.

[0160] In an embodiment of the present application, a data node subtree corresponding to a business request can be generated based on the hierarchical identifiers of the tree nodes corresponding to the updated root node and the business field. It can be understood that in an embodiment of the present application, the memory fragment of each tree node in the data node tree uses a pointer to point to the location of the field in the original serialized memory fragment, so the constructed data node subtree does not require memory allocation and data copying, which helps to reduce memory usage pressure. The data node subtree constructed in the embodiment of the present application can be used in application scenarios such as data call scenarios, data update scenarios, and data query scenarios.

[0161] When a business request includes a data call request, the data node subtree can be used in the data call scenario. The data call request can be used to instruct the business object to return the deserialized data corresponding to the requested field information. When a business request includes a data call request, it mainly involves calling the leaf nodes of the data node subtree. The leaf nodes in the data node subtree may or may not contain deserialized data.

[0162] Specifically, if there is a leaf node containing deserialized data in the data node subtree, the leaf node containing the deserialized data is determined as the first call node, and the deserialized data in the first call node is determined as the first response data; if there is a leaf node that does not contain deserialized data in the data node subtree, the leaf node that does not contain deserialized data is determined as the second call node, and the serialized data contained in the second call node is deserialized to obtain the second response data; the first response data and the second response data are encapsulated as request response data corresponding to the data call request, and the request response data is returned to the business object corresponding to the data call request. Optionally, if the data node subtree only contains the first call node, the second response data is empty, and the first response data can be determined as the request response data corresponding to the data call request; if the data node subtree only contains the second call node, the first response data is empty, and the second response data can be determined as the request response data corresponding to the data call request.

[0163] For ease of understanding, the embodiment of the present application takes the request field information including the level field, game_info field, mailbox[0] field, history_score field and extra_info['key10'] field as an example to describe in detail the creation process of the data node subtree and the application process of the data node subtree. Among them, the level field, game_info field, mailbox[0] field, history_score field and extra_info['key10'] field are all non-nested fields; the field type corresponding to the level field is a scalar type; the field type corresponding to the game_info field is a message type; the mailbox[0] field represents the field corresponding to the first array element in the mailbox field, the field type corresponding to mailbox is an array type, "[0]" represents the array element identifier, specifically representing the first array element in the mailbox field; the field type corresponding to the history_score field is a scalar array type (also called a compact array type), and the scalar array type belongs to the scalar type; the extra_info['key10'] field represents the field corresponding to the key value of 10 in the extra_info field, the field type corresponding to extra_info is a map type, and the map type belongs to the array type, "['key10']" represents the map element identifier, which represents the map element with a key value of 10. It can be understood that the level field, game_info field, mailbox[0] field, history_score field and extra_info['key10'] field are all the business fields mentioned above, and the memory segments corresponding to the level field, game_info field, mailbox[0] field, history_score field and extra_info['key10'] field can all be the first memory segments mentioned above.

[0164] Specifically, see Figure 7 , Figure 7 This is a schematic diagram of a data call provided by an embodiment of the present application. Figure 7As shown, the business object can initiate a data call request to the database storing the original serialized memory fragment BS0. After receiving the data call request, a root node corresponding to the original serialized memory fragment BS0 can be created. At this time, the deserialized child node of the root node is empty, and the undeserialized segment of the root node contains the original serialized memory fragment BS0. Then, based on the request field information in the data call request, it can be determined whether the fields contained in the request field information exist in the original serialized memory fragment BS0. If a field does not exist, an alarm message is returned to the business object to prompt the business object that the requested field is incorrect; and it can be determined whether the array element identifier in the request field information is valid. If not, an alarm message is returned to the business object to prompt the business object that the array element identifier sent by the business object is incorrect. If the field exists and the array element identifier is valid, the field in the original serialized memory fragment BS0 is accessed on demand based on the request field information. Specifically, when ProtoReader reads the field identifier corresponding to the level field in the original serialized memory segment BS0, it cuts out the memory segment corresponding to the level field (for example, memory segment BS2) from the original serialized memory segment BS0, and then creates a tree node corresponding to the level field. The process of creating the tree node corresponding to the level field can refer to the process of creating the tree node corresponding to the field whose field type is a scalar type above, and will not be repeated here.

[0165] like Figure 7 As shown, tree node 30b corresponds to the level field. The parent node of tree node 30b is the root node. Tree node 30b may include: memory segment BS2 and the deserialized data corresponding to memory segment BS2, which may specifically be a value of the int32 scalar type. Memory segment BS2 serves as the serialized data in tree node 30b. Because the field type corresponding to the level field is a scalar type, tree node 30b is a leaf node. After obtaining the tree node corresponding to the level field, it can be inserted into the deserialized child node of the root node, and memory segment BS2 is deleted from the undeserialized segment of the root node.

[0166] Furthermore, the field identifier corresponding to the game_info field is obtained, and the field identifier corresponding to the game_info field is searched in the deserialized child node of the root node. If a child node with the same field identifier as the field corresponding to the game_info field exists, the child node is returned. If it does not exist, the memory fragment in the undeserialized segment of the root node is read through ProtoReader. If the field identifier corresponding to the game_info field exists in the memory fragment in the undeserialized segment, the memory fragment corresponding to the game_info field (for example, memory fragment BS3) is cut out from the memory fragment in the undeserialized segment, and then a tree node corresponding to the game_info field is created. The process of creating the tree node corresponding to the game_info field can refer to the process of creating the tree node corresponding to the field whose field type is the message type above, and will not be repeated here.

[0167] like Figure 7 As shown, tree node 30c corresponds to the game_info field. Its parent node is the root node, and its deserialized child node is empty. Tree node 30c may include: ① memory segment BS3, which serves as the serialized data for tree node 30c; and ② an undeserialized segment, which includes memory segment BS3. After creating the tree node corresponding to the game_info field, it may be inserted into the deserialized child node of the root node. Memory segment BS3 may then be deleted from the undeserialized segment of the root node.

[0168] Furthermore, the field identifier corresponding to the mailbox field is obtained, and the field identifier corresponding to the mailbox field is searched in the deserialized child node of the root node. If a child node with the same field identifier as the mailbox field exists, the child node is returned. If not, the memory fragment in the undeserialized segment of the root node is read through ProtoReader. If the field identifier corresponding to the mailbox field exists in the memory fragment in the undeserialized segment, the memory fragment corresponding to the mailbox field (for example, memory fragment BS11) is cut out from the memory fragment in the undeserialized segment, and then a tree node containing memory fragment BS11 is created (hereinafter referred to as the sixth candidate node). At this time, the undeserialized segment in the sixth candidate node includes memory fragment BS11, and the deserialized child node is empty. Further, a child node matching the array element identifier [0] is searched in the deserialized child node of the sixth candidate node. If a child node matching the array element identifier [0] exists, the child node is returned. If it does not exist, then cut out the sub-memory segment (memory segment BS4) corresponding to the mailbox[0] field from the undeserialized segment contained in the sixth candidate node, and then create Figure 7The creation process of the tree node 30e shown in FIG. 30e can refer to the creation process of the first tree node above, and the specific creation process will not be repeated here. Figure 7 As shown, the tree node 30e is a leaf node, the deserialized child node in the tree node 30e is empty, and the tree node 30e may include: ① memory segment BS4, which may be used as serialized data of the tree node 30e; ② undeserialized segment, which includes the memory segment BS4.

[0169] After obtaining the tree node 30e, the tree node 30e can be inserted into the position corresponding to the array element identifier [0] in the deserialized child node of the sixth candidate node, and the values ​​of the remaining positions are set to null. The value of the position corresponding to the array element identifier [0] in the undeserialized segment of the sixth candidate node is set to null, and the result is as follows: Figure 7 As shown in the tree node 30d, the parent node of the tree node 30d is the root node, and the child node is the tree node 30e. Figure 7 As shown, the tree node 30d may include: ① memory segment BS11, which can be used as the serialized data of the tree node 30d; ② an undeserialized segment, in which the value of the position where the array element identifier [0] is located is null, the position where the array element identifier [1] is located includes the memory segment BS5, and the position where the array element identifier [2] is located includes the memory segment BS6; ③ a deserialized child node, in which the position where the array element identifier [0] is located in the deserialized child node is the tree node 30e (the tree node corresponding to the mailbox[0] field), the value of the position where the array element identifier [1] is located is null, and the value of the position where the array element identifier [2] is located is null. After the tree node 30d is created, it can be inserted into the deserialized child node of the root node, and the memory segment BS11 can be deleted from the undeserialized segment of the root node.

[0170] Furthermore, obtain the field identifier corresponding to the history_score field, search for the field identifier corresponding to the history_score field in the deserialized child node of the root node, and if there is a child node with the same field identifier as the history_score field, return the child node. If it does not exist, read the memory fragment in the undeserialized segment of the root node through ProtoReader. If there is a field identifier corresponding to the history_score field in the memory fragment in the undeserialized segment, cut out the memory fragment corresponding to the history_score field (for example, memory fragment BS7) in the memory fragment in the undeserialized segment, and then create a tree node corresponding to the history_score field. The process of creating the tree node corresponding to the history_score field can refer to the process of creating the tree node corresponding to the field whose field type is a scalar type above, and will not be repeated here.

[0171] like Figure 7 As shown, tree node 30f corresponds to the history_score field. Its parent node is the root node. Tree node 30f can include memory segment BS7 and the deserialized data (deserialized scalar array) corresponding to memory segment BS7. Memory segment BS9 can serve as the serialized data in tree node 30f. After tree node 30f is created, it can be inserted into the deserialized child node of the root node. Memory segment BS7 is deleted from the undeserialized segment of the root node.

[0172] Furthermore, obtain the field identifier corresponding to the extra_info field, search for the field identifier corresponding to the extra_info field in the deserialized child node of the root node, and if there is a child node with the same field identifier as the extra_info field, return the child node. If not, read the memory fragment in the undeserialized segment of the root node through ProtoReader. If there is a field identifier corresponding to the extra_info field in the memory fragment in the undeserialized segment, cut out the memory fragment corresponding to the extra_info field (for example, memory fragment BS12) in the memory fragment in the undeserialized segment, and then create a tree node containing memory fragment BS12 (hereinafter referred to as the seventh candidate node). At this time, the undeserialized segment in the seventh candidate node includes memory fragment BS12, and the deserialized child node is empty. Further, search for a child node that matches the map element identifier ['key10'] in the deserialized child node of the seventh candidate node. If there is a child node that matches the map element identifier ['key10'], return the child node. If it does not exist, the sub-memory segment (memory segment BS10) corresponding to extra_info['key10'] is cut out from the undeserialized segment contained in the seventh candidate node, and then the sub-memory segment BS10 is created. Figure 7 The creation process of the tree node 30i shown in FIG. 30i can refer to the creation process of the first tree node above, and the specific creation process will not be repeated here. Figure 7 As shown, tree node 30i is a leaf node, and the deserialized child node of tree node 30e is empty. Tree node 30i may include: ① memory segment BS10, which may be used as serialized data of tree node 30i; ② deserialized data corresponding to memory segment BS10, which is the deserialized data corresponding to the value corresponding to key10, and may specifically be a string scalar type value, etc.

[0173] After obtaining the tree node 30i, the tree node 30i can be inserted into the deserialized child node in the seventh candidate node, and the memory field BS10 is deleted from the undeserialized segment in the seventh candidate node, and the memory fields BS8 and BS9 are retained, so as to obtain the following: Figure 7 As shown in the tree node 30g, the parent node of the tree node 30g is the root node, and the child node is the tree node 30i. Figure 7As shown, tree node 30g may include: ① memory segment BS12, which can serve as the serialized data of tree node 30g; ② an undeserialized segment, which includes memory fields BS8 and BS9; and ③ a deserialized child node, including tree node 30i. After obtaining tree node 30g, it can be inserted into the deserialized child node of the root node. Memory segment BS12 is deleted from the undeserialized segment of the root node, resulting in tree node 30a. Tree node 30a is the final updated root node.

[0174] like Figure 7 As shown, the tree node 30a may include: ① memory segment BS0, which can be used as serialized data of the tree node 30a; ② undeserialized segment, which includes the memory segment BS1; ③ deserialized child nodes, which include the tree node corresponding to the level field (tree node 30b), the tree node corresponding to the game_info field (tree node 30c), the tree node corresponding to the mailbox field (tree node 30d), the tree node corresponding to the history_score field (tree node 30f) and the tree node corresponding to the extra_info field (tree node 30g).

[0175] It is understandable that when each tree node is created, a level identifier can be set for each tree node. After obtaining the tree node 30a, the tree node 30b, the tree node 30c, the tree node 30d, the tree node 30e, the tree node 30f, the tree node 30g and the tree node 30i, the level identifier corresponding to each tree node is obtained, and the following is generated according to the level identifier corresponding to each tree node. Figure 7 A data node subtree 30 is shown.

[0176] like Figure 7As shown, the leaf nodes in the data node subtree 30 include tree node 30b, tree node 30c, tree node 30e, tree node 30f and tree node 30i, among which tree node 30b, tree node 30f and tree node 30i are leaf nodes containing deserialized data. Therefore, the first call node in the data node subtree 30 includes tree node 30b, tree node 30f and tree node 30i; the deserialized data in tree node 30b, tree node 30f and tree node 30i can be determined as first response data; tree node 30c and tree node 30d are leaf nodes that do not contain deserialized data. Therefore, the second call node in the data node subtree 30 includes tree node 30c and tree node 30e, and the memory segment BS3 in tree node 30c and the memory segment BS4 in tree node 30e can be deserialized to obtain second response data, and the first response data and the second response data are encapsulated as request response data corresponding to the data call request, and the request response data is returned to the business object corresponding to the data call request.

[0177] In an embodiment of the present application, when a business request includes a data call request, by constructing a data node subtree corresponding to the fields required by the data call request, and then generating a data response request corresponding to the data call request based on the leaf nodes in the data node subtree, there is no need to generate a complete binary tree corresponding to the original serialized memory fragment, and then obtain the data response request corresponding to the data call request from the complete binary tree. This can significantly reduce the amount of data to be deserialized, and thus improve the efficiency of deserialization processing.

[0178] When the business request includes a data update request, the data node subtree can be applied to the data update scenario, and the data update request can be used to indicate the update of the fields in the original serialized memory segment. Figure 8 The process of updating data based on the data node subtree is described in detail, namely Figure 8 It is for the above Figure 3 The specific implementation process of step S104 in the corresponding embodiment.

[0179] See Figure 8 , Figure 8 This is a flow chart of a data update process based on a data node subtree provided by an embodiment of the present application. Figure 8 As shown, the process of updating data based on the data node subtree may include steps S201 to S203:

[0180] Step S201: Generate a data node subtree corresponding to the data update request according to the updated root node and the hierarchical identifier of the tree node corresponding to the business field.

[0181] Step S202: performing a data update operation on the tree nodes in the data node subtree according to the data update request to obtain an updated data node subtree.

[0182] In the embodiment of the present application, the data update operation may include one or more of a data modification operation, a field deletion operation, and a field addition operation. When the data update operation is a data modification operation or a field deletion operation, the process of creating a data node subtree can refer to the description above and will not be repeated here.

[0183] Among them, the process of performing a data modification operation on a tree node in a data node subtree may include: determining the object to be modified corresponding to the data update operation in the leaf nodes contained in the data node subtree, where the object to be modified is the object in the leaf node that needs to be modified; replacing the data corresponding to the object to be modified with the update content indicated by the data update operation, and determining the leaf node containing the update content as the first update node; based on the first update node, updating the deserialized child node contained in the parent node of the first update node in the data node subtree to obtain a second update node; based on the second update node, updating the deserialized child node contained in the parent node of the second update node in the data node subtree, until the update operation on the root node in the data node subtree is completed to obtain the updated data node subtree. It can be understood that when the parent node of the first update node in the data node subtree is the root node, the second update node is the root node that completes the update operation.

[0184] For ease of description, this embodiment of the application takes the data update request used to indicate that the value in the extra_info['key10'] field contained in the original serialization fragment BS0 is modified to "111" as an example to describe the update process of the data node subtree. Figure 9 , Figure 9 This is an example of updating a data node subtree provided by the embodiment of the present application. Figure 1 When the business field is the extra_info['key10'] field, the following can be constructed: Figure 9 The specific construction process of the data node subtree 40a shown can be referred to the description above and will not be repeated here. When updating the data node subtree 40a, each tree node can be updated in the order of updating from bottom to top. Among them, tree node 41c is the leaf node of the data node subtree 40a, tree node 41a is the root node of the data node subtree 40a, tree node 41b is the parent node of tree node 41c, and tree node 41a is the parent node of tree node 41b. Figure 9As shown, the object to be modified can be determined as value in tree node 41c, and the value in tree node 41c can be replaced with the update content "111" indicated by the update operation; since the field type corresponding to the field of tree node 41c is a scalar type, the deserialized data in tree node 41c can be directly modified to obtain tree node 42c (the first update node) whose deserialized data contains the update content "111".

[0185] like Figure 9 As shown, the deserialized child node of tree node 41b includes tree node 41c. After the tree node 42c is updated, the tree node 41c in the deserialized child node included in the tree node 41b can be updated to tree node 42c to obtain tree node 42b (the second updated node). Similarly, the deserialized child node of tree node 41a includes tree node 41b. After the tree node 42b is updated, the tree node 41b in the deserialized child node included in the tree node 41a can be updated to tree node 42b to obtain tree node 42a. Since tree node 41a is the root node, after completing the update operation on tree node 41a, the update process ends, and the result is as shown below. Figure 9 Data node subtree 40b is shown. In this embodiment of the present application, the tree nodes that have undergone data updates in the updated data node subtree are referred to as dirty nodes, and the tree nodes that have not undergone data updates are referred to as clean nodes. Data node subtree 40b is the data node subtree obtained by completing the update operation on data node subtree 40a. Data node subtree 40b may include tree nodes 42a, tree nodes 42b, and tree nodes 42c. Tree nodes 42a, 42b, and 42c are all dirty nodes.

[0186] Among them, the process of performing a field modification operation on a tree node in a data node subtree may include: determining a leaf node in the data node subtree as a first processing node, and determining the parent node of the first processing node in the data node subtree as a second processing node; deleting the first processing node in the deserialized child node of the second processing node to obtain a third update node, and updating the deserialized child node contained in the parent node of the third update node in the data node subtree according to the third update node, until the update operation on the root node in the data node subtree is completed to obtain the first node subtree; deleting the first processing node in the first node subtree to obtain an updated data node subtree. It can be understood that when the second processing node is the root node, the third update node is the root node that completes the update operation. Optionally, the first processing node can also be deleted first in the data node subtree, and then the first processing node can be deleted from the deserialized child node of the second processing node. The embodiment of the present application does not limit the deletion order of the first processing node.

[0187] For ease of description, this embodiment of the application takes the data update request used to indicate the deletion of the mailbox[0] field in the original serialization fragment BS0 as an example to describe the update process of the data node subtree. This update process is also applicable to the data node subtree whose field type to be deleted is a message type or a map type. For details, please refer to Figure 10 , Figure 10 This is an example of updating a data node subtree provided by the embodiment of the present application. Figure 2 When the business field is mailbox[0] field, the following can be constructed: Figure 10 The specific construction process of the data node subtree 50a shown can be referred to the description above and will not be repeated here. When updating the data node subtree 50a, each tree node can be updated in an update order from bottom to top. Among them, tree node 51c is a leaf node of the data node subtree 50a, tree node 51a is the root node of the data node subtree 50a, tree node 51b is the parent node of tree node 51c, tree node 51a is the parent node of tree node 51b, tree node 51c can also be called a first processing node, and tree node 51b can also be called a second processing node.

[0188] like Figure 10 As shown, the deserialized child node of tree node 51b includes tree node 51c. Tree node 51c can be deleted in the deserialized child node of tree node 51b to obtain tree node 52b (the third updated node), and tree node 52b is marked as a dirty node. Optionally, when tree node 51c is deleted in the deserialized child node of tree node 51b, the memory segment (memory segment BS2) contained in tree node 51b can be deleted at the same time, so that the updated tree node 52b does not contain memory segment BS2. Similarly, the deserialized child node of tree node 51a includes tree node 51b. After tree node 52b is updated, tree node 51b in the deserialized child node contained in tree node 51a can be updated to tree node 52b to obtain tree node 52a, and tree node 52a can be marked as a dirty node, as shown below. Figure 10 Data node subtree 50b (first node subtree) is shown. Furthermore, tree node 51c can be deleted from data node subtree 50b to obtain data node subtree 50c. Data node subtree 50c is the data node subtree obtained by completing the update operation on data node subtree 50a. Data node subtree 50c may include tree node 52a and tree node 52b, both of which are dirty nodes.

[0189] When the data update operation is a field addition operation, the created data node subtree contains a tree node corresponding to a field with empty data. For ease of description, this embodiment of the application takes the data update request to add the info_id field in the original serialized memory segment as an example to describe the creation process of the data node subtree. Figure 10 The original serialized memory segment BS0 shown does not contain the info_id field.

[0190] Specifically, when a data update request indicating the addition of the info_id field is received, a root node corresponding to the original serialized memory segment BS0 can be created, and the deserialized child node of the root node is empty. The field identifiers corresponding to the fields contained in the original serialized memory segment BS0 are read through ProtoReader, and an attempt is made to find a field identifier that matches the info_id field. If there is no field identifier that matches the info_id field in the original serialized memory segment BS0, it indicates that the data corresponding to the info_id field is empty. At this time, a tree node with empty data can be created for the info_id field, and the tree node corresponding to the info_id field is added to the deserialized child node of the root node to obtain the updated root node.

[0191] Furthermore, a data node subtree corresponding to the data update request can be generated based on the updated root node and the tree node corresponding to the info_id field. The empty data in the tree node corresponding to the info_id field can be replaced with the updated content indicated by the data update request to update the tree node corresponding to the info_id field. The root node in the data node subtree is updated based on the tree node corresponding to the updated info_id field to obtain an updated data node subtree. The update process of the data node subtree corresponding to the field addition operation is similar to the update process of the data node subtree corresponding to the data modification operation. The specific update process can be referred to the description above and will not be repeated here.

[0192] It can be understood that the field addition operation can also include adding new elements to existing fields, for example, inserting array elements in a field with an array type, inserting map elements in a field with a map type, etc. The corresponding data node tree generation process is similar to the above, and the embodiments of the present application will not go into details about this.

[0193] Step S203: Serialize the data in the tree nodes contained in the updated data node subtree according to the field type corresponding to the field associated with the tree node in the updated data node subtree, obtain request response data corresponding to the data update request, and update the original serialized memory segment according to the request response data.

[0194] It can be understood that the field types corresponding to the fields associated with the tree nodes in the updated data node subtree may include one or more of the scalar types, message types, and array types mentioned above. For ease of understanding, the tree node corresponding to the scalar type field in the updated data node subtree may be determined as the third tree node, the tree node corresponding to the message type field may be determined as the fourth tree node, and the tree node corresponding to the array type field may be determined as the fifth tree node. In other words, the tree nodes in the updated data node subtree may include one or more of the third tree node, the fourth tree node, and the fifth tree node. For example, the tree nodes in the updated data node subtree may include the fourth tree node, may include the third tree node and the fourth tree node at the same time, or may include the fourth tree node and the fifth tree node at the same time; or may include the third tree node, the fourth tree node, and the fifth tree node at the same time.

[0195] The following describes the serialization process of the data in the third tree node, the fourth tree node, and the fifth tree node respectively. For the third tree node, the deserialized data in the third tree node can be serialized to obtain the first update fragment corresponding to the third tree node. The first update fragment is the memory fragment obtained by serializing the third tree node. For the fourth tree node, the byte length corresponding to the fourth tree node can be determined. The byte length can be determined based on the data contained in the fourth tree node. The header update information corresponding to the fourth tree node is generated based on the byte length. The header update information and the memory fragment contained in the undeserialized segment in the fourth tree node are then spliced ​​together to obtain the second update fragment corresponding to the fourth tree node. The second update fragment is the memory fragment obtained by serializing the fourth tree node. The fifth tree node does not contain header information. The memory fragment contained in the undeserialized segment in the fifth tree node can be determined as the third update fragment corresponding to the fifth tree node. The third update fragment is the memory fragment obtained by serializing the fifth tree node.

[0196] After obtaining the update fragments corresponding to the tree nodes in the updated data node subtree according to the above processing method, the update fragments corresponding to the tree nodes can be combined according to the hierarchical identification of each tree node in the updated data node subtree to obtain the request response data corresponding to the data update request. For example, the updated data node subtree includes the third tree node, the fourth tree node and the fifth tree node. The first update fragment, the second update fragment and the third update fragment can be combined according to the hierarchical identification of the third tree node, the fourth tree node and the fifth tree node in the updated data node subtree to obtain the request response data corresponding to the data update request. The request response data is a re-serialized memory fragment, and the request response data can be used to replace the original serialized memory fragment stored in the database, thereby realizing the data update of the original serialized memory fragment.

[0197] Optionally, in some possible implementations, the updated data node subtree may include clean nodes. The tree nodes in the updated data node subtree may be traversed, tree nodes marked as dirty nodes may be processed, and tree nodes marked as clean nodes may be skipped. Specifically, the data in the dirty nodes may be serialized to obtain update fragments corresponding to the dirty nodes. The update fragments corresponding to the dirty nodes are then combined with memory fragments in the clean nodes to obtain request response data corresponding to the data update request. The original serialized memory fragments are then updated based on the request response data. After the update is complete, the dirty nodes in the updated data node subtree are re-marked as clean nodes.

[0198] For ease of understanding, the present embodiment takes the updated data node subtree including the third tree node, the fourth tree node and the fifth tree node as an example to describe the serialization process of each tree node in detail. Figure 11 , Figure 11 This is a schematic diagram of a data update provided by an embodiment of the present application. Figure 11 As shown, the request field information carried by the data update request may include the level field, the game_info field, and the mailbox[0] field. According to the field type corresponding to each field, the following can be constructed: Figure 11 The specific construction process of the data node subtree 60 shown can be referred to the above description, which will not be repeated here. Then, according to the data update request, the data node subtree 60 is updated to obtain the data node subtree 61. Figure 11 As shown, data updates have occurred on each tree node in data node subtree 61 relative to tree nodes 60a, 60b, 60c, 60d, and 60e in data node subtree 60. Therefore, tree nodes 61a, 61b, 61c, 61d, and 61e in data node subtree 61 are all dirty nodes, requiring reserialization of each tree node in data node subtree 61. Specifically, the third tree node in data node subtree 61 includes tree node 61b; the fourth tree node is multiple and includes tree node 61a, 61c, and 61e; and the fifth tree node includes tree node 61c.

[0199] Among them, the process of serializing each tree node in the data node subtree 61 can include: serializing the deserialized data in the tree node 61b to obtain the memory segment NewBS2 (the first update segment corresponding to the tree node 61b), replacing the memory segment BS2; determining the byte length corresponding to the tree node 61c according to the data contained in the tree node 61c, and then generating the header update information of the memory segment NewBS3 (the second update segment corresponding to the tree node 61c) according to the byte length; similarly, determining the byte length corresponding to the tree node 61e according to the data contained in the tree node 61e, and then generating the header update information of the memory segment NewBS4 (the second update segment corresponding to the tree node 61e) according to the byte length; since the field type corresponding to the field of the tree node 61d is an array type and there is no header information, no processing is required here. Tree node 61a is the root node of data node subtree 61. The root node belongs to the fourth tree node. Based on the data contained in tree node 61a, the byte length corresponding to tree node 61a can be determined, a new memory segment (hereinafter referred to as candidate memory segment) can be allocated, and the header information of the candidate memory segment (the second update segment corresponding to tree node 61a) can be generated based on the byte length corresponding to tree node 61a.

[0200] Furthermore, the data node subtree 61 is traversed in a pre-order manner, and the memory fragment of each tree node in the data node subtree 61 is copied to the tail of the candidate memory fragment, and the tail offset of the candidate memory fragment is increased, wherein the initial value of the tail offset of the candidate memory fragment is 0. The traversal order of each tree node in the data node subtree 61 is tree node 61a, tree node 60b, tree node 60c, tree node 60d and tree node 60e. Specifically, the data obtained after splicing the header information in the tree node 61a and the memory fragments (memory fragment BS1 and memory fragment BS7) contained in the undeserialized segment is the second update fragment corresponding to the tree node 61a, and the header information, memory fragment BS1 and memory fragment BS7 in the tree node 61a are copied to the candidate memory fragment; the first update fragment corresponding to the tree node 61b is the memory fragment NewBS2, and the memory fragment NewBS2 can be copied to the candidate memory fragment.

[0201] In an embodiment of the present application, the data obtained after splicing the header information of the memory segment NewBS3 in the tree node 61c and the memory segment (memory segment NewBS3) contained in the undeserialized segment is the second update segment corresponding to the tree node 61c, and the header information of the memory segment NewBS3 and the memory segment NewBS3 are copied to the candidate memory segment; the memory segments (memory segment BS5 and memory segment BS6) contained in the undeserialized segment of the tree node 61d are the third update segment corresponding to the tree node 61d, and the tree node 61e is nested. The data obtained by splicing the header information of the memory segment NewBS4 in the tree node 61e and the memory segment (memory segment NewBS4) contained in the undeserialized segment (the second update segment corresponding to the tree node 61e) is copied to the tree node 61d, and the memory segments BS5, memory segment BS6 and the header information of the memory segment NewBS4 and the memory segment NewBS4 are combined to obtain the memory segment NewBS8, and the memory segment NewBS8 is copied to the tree node 61e to generate the following Figure 11 The updated serialized memory segment NewBS0 is shown. This is the final updated memory segment, and its tail offset is the byte length of the serialized updated memory segment NewBS0. After obtaining the updated serialized memory segment NewBS0, the original serialized memory segment BS0 stored in the database is replaced with the updated serialized memory segment NewBS0.

[0202] In an embodiment of the present application, when a service request includes a data update request, the data node subtree is updated through an update operation corresponding to the data update request, and the tree nodes contained in the updated data node subtree are then reserialized to obtain request response data corresponding to the data update request. As can be seen, after executing the update operation, only the tree nodes in the updated data node subtree need to be reserialized, which can significantly reduce data processing pressure and costs.

[0203] When the business request includes a data query request, the data node subtree can be applied to the data query scenario, and the data call request can be used to indicate that the serialized data (request response data) corresponding to the request field information is sent to the business object. The generation process of the request response data corresponding to the data query request may include: generating a data node subtree corresponding to the data query request according to the hierarchical identifier of the tree node corresponding to the updated root node and the business field; the creation process of the data node subtree can refer to the description above and will not be repeated here; deleting the undeserialized segments contained in the non-leaf nodes in the data node subtree to obtain a second node subtree; serializing the data of the non-leaf nodes in the second node subtree to obtain a fourth update fragment, combining the fourth update fragment with the serialized data in the leaf nodes contained in the second node subtree to obtain the request response data corresponding to the data query request, and returning the request response data to the business object corresponding to the data query request; the specific implementation process of serializing the data of the non-leaf nodes in the second node subtree can refer to the description above and will not be repeated here.

[0204] For ease of understanding, this embodiment of the application takes the request field information including the level field as an example to describe the data query process in detail. Figure 12 , Figure 12 This is a schematic diagram of a data query provided by an embodiment of the present application. Figure 12 As shown, the business object can initiate a data query request containing the level field to the database storing the original serialized memory fragment BS0. When the data query request is received, the following data query request can be constructed based on the field type corresponding to the level field: Figure 12 The specific construction process of the data node subtree 70 shown can refer to the description above and will not be repeated here. In the data node subtree 70, the tree node 70a is the root node (non-leaf node), and the tree node 70b is the leaf node, wherein the undeserialized segments in the tree node 70a include the memory segment BS1 and the memory segment BS3. Traverse the data node subtree 70, delete the undeserialized segments contained in the tree node 70a in the data node subtree 70, and obtain the data node subtree 71 (the second node subtree). Figure 12 As shown, data node subtree 71 includes tree node 71a and tree node 70b. Tree node 71a is the tree node obtained after tree node 70a is updated, and the undeserialized segment in tree node 71a is empty. It can be understood that in the embodiment of the present application, the non-leaf nodes (tree node 71a) in data node subtree 71 generate data updates, while the leaf nodes do not generate data updates. Therefore, tree node 71a is a dirty node and tree node 70b is a clean node.

[0205] Furthermore, the data node subtree 71 is traversed, and the data in the tree node 71a is serialized to obtain the fourth update fragment corresponding to the tree node 71a. Among them, the field type corresponding to the field of the tree node 71a is a message type. The byte length corresponding to the tree node 71a can be determined based on the data contained in the tree node 71a, and then the header update information corresponding to the tree node 71a is generated based on the byte length. Since the undeserialized segment of the tree node 71a is empty, the header update information corresponding to the tree node 71a can be determined as the fourth update fragment corresponding to the tree node 71a. The fourth update fragment corresponding to the tree node 71a and the serialized data (memory fragment BS2) in the tree node 70b are then spliced ​​to obtain the request response data corresponding to the data query request, and the request response data is returned to the business object corresponding to the data query request.

[0206] Optionally, after generating the data node subtree 70, a third node subtree with empty data can also be created, and the tree node in the data node subtree 70 that matches the query data required by the data query request is determined as the eighth candidate node. The eighth candidate node is inserted into the third node subtree to obtain a fourth node subtree, and then the data of the tree nodes contained in the fourth node subtree is serialized to obtain request response data corresponding to the data query request.

[0207] In an embodiment of the present application, when a business request includes a data query request, a data node subtree corresponding to the fields required by the data query request is constructed, and then the undeserialized segments contained in the non-leaf nodes in the data node subtree are deleted, and the updated non-leaf nodes are reserialized to obtain the updated fragments corresponding to the updated non-leaf nodes, and the updated fragments are combined with the serialized data in the data node subtree to obtain the request response data corresponding to the data query request; there is no need to generate a complete binary tree corresponding to the original serialized memory fragment, and then obtain the data response request corresponding to the data query request from the complete binary tree, which can significantly reduce the amount of data for deserialization processing and thereby improve the efficiency of deserialization processing.

[0208] Optionally, the requested field information may also include nested fields. A nested field may include multiple subfields. The field type corresponding to each subfield in the nested field may be obtained, and then a tree node corresponding to the nested field may be created based on the field type corresponding to each subfield in the nested field. For ease of description, the process of creating a tree node corresponding to the nested field is described in detail using the example of a nested field including field a and field b ("ab"), where field a is the first subfield of the nested field and field b is the second field of the nested field. Generally speaking, the field type corresponding to subfields in a nested field other than the last subfield is not a scalar field. In other words, the field type corresponding to field a is not a scalar type.

[0209] Specifically, the memory segment that matches field a in the memory segment set can be determined as the second memory segment, and a fifth candidate node containing the second memory segment is created. In this case, the deserialized child node of the fifth candidate node is empty. The second memory segment may include multiple sub-memory segments. If a sub-memory segment that matches field b exists in the second memory segment, the second sub-memory segment corresponding to field b is obtained from the second memory segment, and a tree node corresponding to field b is created based on the second memory segment. In other words, the second sub-memory segment is a sub-memory segment within the memory segment corresponding to the first sub-field of the nested field. When the field type corresponding to field b includes a scalar type, the created tree node corresponding to field b may include the second sub-memory segment and the deserialized data corresponding to the second sub-memory segment. The specific creation process can be referred to the creation process of tree node 30b and will not be further described here. When the field type corresponding to field b includes a message type, the tree node corresponding to field b may include: ① a second sub-memory segment, which can be used as serialized data of the tree node corresponding to field b; ② an undeserialized segment, which includes the sub-second memory segment. The specific creation process can refer to the creation process of tree node 30c, which will not be repeated here. When the field type corresponding to field b includes an array type, the creation process of the tree node corresponding to field b can refer to the creation process of the first tree node and the second tree node, which will not be repeated here. After obtaining the tree node corresponding to field b, the tree node corresponding to field b can be inserted into the deserialized child node of the fifth candidate node, and the sub-memory segments in the second memory segment except the second sub-memory segment can be inserted into the undeserialized segment in the fifth candidate node to obtain the tree node corresponding to field a.

[0210] Optionally, if there is no sub-memory segment matching field b in the second memory segment, a tree node with empty data is created for field b. The creation process can refer to the creation process of the tree node corresponding to the info_id field in the previous article; then, the tree node corresponding to field b is inserted into the deserialized child node of the fifth candidate node, and the second memory segment is inserted into the non-deserialized segment in the fifth candidate node to obtain the tree node corresponding to field a.

[0211] After obtaining the tree node corresponding to field a and the tree node corresponding to field b, the tree nodes corresponding to the nested fields are determined; and then a data node subtree corresponding to the business request is generated according to the tree nodes corresponding to the nested fields.

[0212] For ease of understanding, the embodiment of the present application takes the request field information including the level field and the game_info.win_count field as an example to describe in detail the process of creating a data node subtree corresponding to a business request containing nested fields. In actual applications, a business request may only contain nested fields. The process of creating a data node subtree corresponding to a business request containing only nested fields can refer to the description below and will not be repeated here. Among them, the game_info.win_count field is a nested field, the game_info field is the first subfield in the game_info.win_count field, the field type corresponding to the game_info field is a message type, and the field type corresponding to the win_count field is a scalar type.

[0213] Specifically, see Figure 13 , Figure 13 This is a schematic diagram of creating a data node subtree provided by an embodiment of the present application. A root node corresponding to the original serialized memory segment BS0 can be created. At this time, the deserialized child node of the root node is empty, and the undeserialized segment of the root node contains the original serialized memory segment BS0. The original serialized memory segment BS0 can be read by ProtoReader. When the field identifier corresponding to the level field is read in the original serialized memory segment BS0, the memory segment corresponding to the level field is cut out (for example, memory segment BS2), and a tree node corresponding to the level field is created to obtain the following: Figure 13 The tree node 80b is shown. The creation process of tree node 80b can refer to the creation process of tree node 30b above and will not be repeated here. After obtaining the tree node corresponding to the level field, it can be inserted into the deserialized child node of the root node, and the memory segment BS2 is deleted from the undeserialized segment in the root node.

[0214] Furthermore, the field identifier corresponding to the game_info field is obtained, and the memory segment in the undeserialized segment of the root node is read through ProtoReader. If the field identifier corresponding to the game_info field exists in the undeserialized memory segment of the root node, the memory segment corresponding to the game_info field is cut out from the undeserialized memory segment of the root node (for example, memory segment BS3), and then a tree node (fifth candidate node) containing the game_info field is created. At this time, the deserialized child node of the fifth candidate node is empty, and the undeserialized segment of the fifth candidate node contains the memory segment BS3. Get the field identifier corresponding to the win_count field, and read the memory segment in the unreversed segment of the fifth candidate node through ProtoReader. If the field identifier corresponding to the win_count field exists in the memory segment contained in the unreversed segment of the fifth candidate node, then cut out the sub-memory segment corresponding to the win_count field (for example, memory segment BS3.2) in the memory segment contained in the unreversed segment of the fifth candidate node. Memory segment BS3.2 can also be called the second sub-memory segment, and then create a tree node corresponding to the win_count field. The creation process of the tree node corresponding to the win_count field can refer to the creation process of the tree node corresponding to the field whose field type is a scalar type above, and will not be repeated here. Figure 13 As shown, the tree node 80d is the tree node corresponding to the win_count field, and the tree node 80d may include: the memory segment BS3.2 and the deserialized data corresponding to the memory segment BS3.2, which may specifically be a value of the int32 scalar type.

[0215] After the tree node 80d is generated, the tree node 80d can be inserted into the deserialized child node of the fifth candidate node, and the memory segment BS3.2 is deleted from the non-deserialized segment of the fifth candidate node, so as to obtain the following: Figure 13 The tree node 80c is shown. Figure 13 As shown, the tree node 80c may include: ① memory segment BS3, which can be used as serialized data of the tree node 80c; ② undeserialized segment, which includes memory segment BS3.1 and memory segment BS3.3; ③ deserialized child node, which includes tree node 80d. Among them, tree node 80c and tree node 80d are tree nodes corresponding to the game_info.win_count field. After obtaining the tree node 80d, it can be inserted into the deserialized child node of the root node, and the memory segment BS3 can be deleted from the undeserialized segment in the root node to obtain tree node 80a, which is the root node finally updated. Then, according to the hierarchical identifiers corresponding to tree nodes 80a, 80b, 80c and 80d, the following can be generated. Figure 13 The data node subtree 80 shown. After the data node subtree 80 is generated, request response data corresponding to the business request can be generated based on the data in the tree nodes contained in the data node subtree 80, and then the business operation indicated by the business request can be executed based on the request response data. The generation process of the request response data can refer to the description above and will not be repeated here.

[0216] To verify the effectiveness of the deserialization and serialization scheme proposed in the embodiment of the present application (hereinafter referred to as this scheme for ease of description), this scheme is compared with the official Protobuf library for performance, and the computational time is used as the evaluation metric, where the less computational time is used, the better the performance. A protobuf message (a deserialized object in protobuf format) containing multiple fields (including scalars, nested messages, arrays, and maps) is used as test data. The size of the array type field and the map type field in the protobuf message are both 1000, and the length of the memory fragment after serialization of the protobuf message is 54KB.

[0217] In a data call scenario, we tested the performance of our solution and the official Protobuf library by reading the two nested fields "all_type.info.info_id" in a protobuf message. Our solution took 11 microseconds, while the official Protobuf library took 547 microseconds.

[0218] In a data update scenario, we deserialized the two nested fields "all_type.info.info_id" in a protobuf message, modified their values, and then reserialized them. We tested the performance of this solution and the official Protobuf library. Our solution took 13 microseconds, while the official Protobuf library took 750 microseconds.

[0219] As can be seen, compared to the official Protobuf library, this solution significantly reduces time consumption in data call and data update scenarios, achieving excellent performance optimization. The larger the Protobuf message, the more pronounced the optimization effect. This demonstrates that using this solution to process database data can reduce runtime overhead and improve deserialization efficiency.

[0220] In an embodiment of the present application, after receiving a business request, a root node containing the original serialized memory fragment can be created; if the request field information carried by the business request does not contain a nested field, a first memory fragment matching the request field information is obtained from the original serialized memory fragment, and a tree node corresponding to the business field is created according to the field type corresponding to the business field associated with the first memory fragment; further, the deserialized child node of the root node can be determined according to the tree node corresponding to the business field, and the memory fragments in the memory fragment set other than the first memory fragment are inserted into the undeserialized segment of the root node to obtain an updated root node; and then, based on the data in the updated root node and the data in the tree node corresponding to the business field, request response data corresponding to the business request can be generated, and the business operation indicated by the business request can be executed according to the request response data. It can be seen that in the deserialization process, the embodiment of the present application only involves the deserialization processing of the part of the memory fragment required by the business request, without the need to deserialize the complete original serialized memory fragment, which can significantly reduce the amount of data to be deserialized, thereby improving the efficiency of the deserialization processing.

[0221] See Figure 14 , Figure 14 1 is a structural diagram of a data processing device provided in an embodiment of the present application. It is understandable that the data processing device 1 can be applied in a terminal device or a server. Figure 14 As shown, the data processing device 1 may include a first node creation module 11, a second node creation module 12, a node update module 13, and a response data generation module 14, wherein:

[0222] The first node creation module 11 is configured to receive a service request for an original serialized memory segment, obtain request field information carried in the service request, divide the original serialized memory segment according to the request field information, obtain a memory segment set, and create a root node containing the original serialized memory segment;

[0223] The second node creation module 12 is configured to obtain a first memory segment matching the requested field information from the memory segment set if the requested field information does not contain a nested field, and create a tree node corresponding to the business field according to the field type corresponding to the business field associated with the first memory segment;

[0224] A node updating module 13 is configured to determine a deserialized child node of the root node according to the tree node corresponding to the business field, and insert memory segments other than the first memory segment in the memory segment set into the non-deserialized segment of the root node to obtain an updated root node;

[0225] The response data generation module 14 is configured to generate request response data corresponding to the business request based on the updated data in the root node and the data in the tree node corresponding to the business field, and execute the business operation indicated by the business request based on the request response data.

[0226] In a possible implementation, the first node creation module 11 is specifically configured to:

[0227] If the requested field information contains nested fields and non-nested fields, obtain the non-nested fields and the first subfield in the nested fields, and the field position range in the original serialized memory segment;

[0228] The original serialized fragment is trimmed according to the field position range corresponding to the non-nested field and the first subfield in the nested field to obtain a memory fragment set.

[0229] In a possible implementation, the second node creation module 12 is specifically configured to:

[0230] If the field type corresponding to the business field associated with the first memory segment includes a scalar type, obtaining deserialized data corresponding to the first memory segment;

[0231] A first candidate node including the first memory segment is created, and the deserialized data corresponding to the first memory segment is inserted into the first candidate node to obtain a tree node corresponding to the business field; the tree node corresponding to the business field is a leaf node.

[0232] In a possible implementation, the second node creation module 12 is specifically configured to:

[0233] If the field type corresponding to the business field associated with the first memory segment includes a message type, creating a second candidate node including the first memory segment;

[0234] Insert the first memory segment into the undeserialized segment of the second candidate node to obtain a tree node corresponding to the business field; the tree node corresponding to the business field does not contain a deserialized child node, and the tree node corresponding to the business field is a leaf node.

[0235] In a possible implementation, the second node creation module 12 is specifically configured to:

[0236] If the field type corresponding to the business field associated with the first memory segment includes an array type, creating a third candidate node including the first memory segment;

[0237] Obtaining an array element identifier associated with the business field in the request field information, obtaining a first sub-memory segment corresponding to the array element identifier from multiple sub-memory segments included in the first memory segment, and creating a fourth candidate node including the first sub-memory segment;

[0238] Insert the first child memory fragment into the non-deserialized segment of the fourth candidate node to obtain a first tree node; the first tree node does not contain a deserialized child node, and the first tree node is a leaf node;

[0239] Insert the first tree node into the deserialized child node of the third candidate node, and insert the sub-memory segments of the first memory segment except the first sub-memory segment into the non-deserialized segment of the third candidate node to obtain a second tree node; the second tree node is a non-leaf node;

[0240] The first tree node and the second tree node are determined as tree nodes corresponding to the business field.

[0241] In a possible implementation, the node updating module 13 is specifically configured to:

[0242] Get the hierarchical identifier of the tree node corresponding to the business field;

[0243] Insert the tree node whose hierarchical identifier is adjacent to the root node in the tree node corresponding to the business field into the deserialized child node of the root node.

[0244] In a possible implementation, the service request includes a data call request, and the response data generation module 14 is specifically configured to:

[0245] Generate a data node subtree corresponding to the data call request based on the updated root node and the hierarchical identifier of the tree node corresponding to the business field;

[0246] If there is a leaf node containing deserialized data in the data node subtree, the leaf node containing the deserialized data is determined as the first call node, and the deserialized data in the first call node is determined as the first response data;

[0247] If there is a leaf node that does not contain deserialized data in the data node subtree, the leaf node that does not contain deserialized data is determined as the second call node, and the serialized data contained in the second call node is deserialized to obtain second response data;

[0248] The first response data and the second response data are encapsulated as request response data corresponding to the data call request, and the request response data is returned to the business object corresponding to the data call request.

[0249] In a possible implementation, the service request includes a data update request, and the response data generation module 14 is specifically configured to:

[0250] Generate a data node subtree corresponding to the data update request based on the updated root node and the hierarchical identifier of the tree node corresponding to the business field;

[0251] Perform data update operations on the tree nodes in the data node subtree according to the data update request to obtain an updated data node subtree;

[0252] According to the field type corresponding to the field associated with the tree node in the updated data node subtree, the data in the tree nodes contained in the updated data node subtree are serialized to obtain request response data corresponding to the data update request, and the original serialized memory segment is updated according to the request response data.

[0253] In a possible implementation, the response data generating module 14 is specifically configured to:

[0254] Determine, among the leaf nodes included in the data node subtree, an object to be modified corresponding to the data update operation, replace the data corresponding to the object to be modified with the update content indicated by the data update operation, and determine the leaf node containing the update content as the first update node;

[0255] According to the first update node, update the deserialized child node contained in the parent node of the first update node in the data node subtree to obtain a second update node;

[0256] According to the second update node, the deserialized child nodes contained in the parent node of the second update node in the data node subtree are updated until the update operation on the root node in the data node subtree is completed to obtain an updated data node subtree.

[0257] In a possible implementation, the response data generating module 14 is specifically configured to:

[0258] Determine a leaf node in the data node subtree as a first processing node, and determine a parent node of the first processing node in the data node subtree as a second processing node;

[0259] Deleting the first processing node from the deserialized child node of the second processing node to obtain a third update node, and updating the deserialized child nodes contained in the parent node of the third update node in the data node subtree according to the third update node, until the update operation on the root node in the data node subtree is completed to obtain the first node subtree;

[0260] The first processing node is deleted from the first node subtree to obtain an updated data node subtree.

[0261] In a possible implementation, the updated data node subtree includes a third tree node corresponding to a scalar type field, a fourth tree node corresponding to a message type field, and a fifth tree node corresponding to an array type field. The response data generation module 14 is specifically configured to:

[0262] Serializing the deserialized data in the third tree node to obtain a first update fragment corresponding to the third tree node;

[0263] Determine the byte length corresponding to the fourth tree node, generate header update information corresponding to the fourth tree node based on the byte length, and concatenate the header update information with the memory fragment contained in the undeserialized segment in the fourth tree node to obtain a second update fragment corresponding to the fourth tree node;

[0264] Determine the memory segment contained in the undeserialized segment in the fifth tree node as the third update segment corresponding to the fifth tree node;

[0265] According to the hierarchical identifications of the third tree node, the fourth tree node and the fifth tree node in the updated data node subtree, the first update segment, the second update segment and the third update segment are combined to obtain request response data corresponding to the data update request.

[0266] In a possible implementation, the service request includes a data query request, and the response data generation module 14 is specifically configured to:

[0267] Generate a data node subtree corresponding to the data query request based on the updated root node and the hierarchical identifier of the tree node corresponding to the business field;

[0268] Delete the undeserialized segments contained in the non-leaf nodes in the data node subtree to obtain the second node subtree;

[0269] Serialize the data of the non-leaf nodes in the second node subtree to obtain the fourth update fragment, combine the fourth update fragment with the serialized data in the leaf nodes contained in the second node subtree to obtain request response data corresponding to the data query request, and return the request response data to the business object corresponding to the data query request.

[0270] In a possible implementation, the data processing device 1 may further include a third node creation module 15, and the third node creation module 15 is specifically configured to:

[0271] If the requested field information contains a nested field consisting of field a and field b, then the field types corresponding to field a and field b are obtained; field a is the first subfield of the nested field;

[0272] If the field type corresponding to field a is a message type, then a second memory segment matching field a is obtained from the memory segment set, and a fifth candidate node including the second memory segment is created;

[0273] If a sub-memory segment matching field b exists among the multiple sub-memory segments included in the second memory segment, and the field type corresponding to field b is a scalar type, then obtain the second sub-memory segment corresponding to field b in the second memory segment, obtain the deserialized data corresponding to the second sub-memory segment, and create a tree node corresponding to field b based on the deserialized data associated with the second sub-memory segment; the tree node corresponding to field b is a leaf node;

[0274] Insert the tree node corresponding to field b into the deserialized child node of the fifth candidate node, and insert the sub-memory segments of the second memory segment except the second sub-memory segment into the non-deserialized segment of the fifth candidate node to obtain the tree node corresponding to field a; the tree node corresponding to field a is a non-leaf node;

[0275] The tree node corresponding to field a and the tree node corresponding to field b are determined as the tree nodes corresponding to the nested fields; the tree nodes corresponding to the nested fields are used to generate a data node subtree corresponding to the business request.

[0276] In a possible implementation, the third node creation module 15 is further configured to:

[0277] If there is no sub-memory segment matching field b in the second memory segment, create a tree node with empty data for field b;

[0278] Insert the tree node corresponding to field b into the deserialized child node of the fifth candidate node, insert the second memory segment into the non-deserialized segment of the fifth candidate node, and obtain the tree node corresponding to field a.

[0279] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0280] According to an embodiment of the present application, the steps involved in the data processing method shown above can be performed by Figure 14 The data processing device 1 shown in FIG. 1 is executed by each module. For example, Figure 3 The step S101 shown can be performed by Figure 14 The first node creation module 11 is executed as shown, Figure 3 Step S102 shown can be performed by Figure 14 The second node creation module 12 is executed as shown, Figure 3 Step S103 shown can be performed by Figure 14 The node update module 13 shown is executed, Figure 3 Step S104 shown can be performed by Figure 14 The response data generation module 14 shown is executed, etc.

[0281] According to one embodiment of the present application, Figure 14 The various modules in the data processing device 1 shown can be individually or all combined into one or several units to constitute, or one (some) of the units can be further split into at least two functionally smaller sub-units, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above modules are divided based on logical functions. In actual applications, the functions of one module can also be implemented by at least two units, or the functions of at least two modules can be implemented by one unit. In other embodiments of the present application, the data processing device 1 may also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of at least two units.

[0282] In an embodiment of the present application, after receiving a business request, a root node containing the original serialized memory fragment can be created; if the request field information carried by the business request does not contain a nested field, a first memory fragment matching the request field information is obtained from the original serialized memory fragment, and a tree node corresponding to the business field is created according to the field type corresponding to the business field associated with the first memory fragment; further, the deserialized child node of the root node can be determined according to the tree node corresponding to the business field, and the memory fragments in the memory fragment set other than the first memory fragment are inserted into the undeserialized segment of the root node to obtain an updated root node; and then, based on the data in the updated root node and the data in the tree node corresponding to the business field, request response data corresponding to the business request can be generated, and the business operation indicated by the business request can be executed according to the request response data. It can be seen that in the deserialization process, the embodiment of the present application only involves the deserialization processing of the part of the memory fragment required by the business request, without the need to deserialize the complete original serialized memory fragment, which can significantly reduce the amount of data to be deserialized, thereby improving the efficiency of the deserialization processing.

[0283] See Figure 15 , Figure 15 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 15As shown, the computer device 1000 can be a terminal device or a server, and will not be limited here. For ease of understanding, this application takes the computer device as an example of a terminal device. The computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. The communication bus 1002 is used to achieve connection and communication between these components. The user interface 1003 may include a display (Display), a keyboard (Keyboard), and optionally, the user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Figure 15 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application.

[0284] Among them, Figure 15 In the computer device 1000 shown, the network interface 1004 can provide network communication functions; the user interface 1003 is mainly used to provide an interface for user input; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:

[0285] Receive a business request for the original serialized memory fragment, obtain the request field information carried by the business request, divide the original serialized memory fragment according to the request field information, obtain a memory fragment set, and create a root node containing the original serialized memory fragment;

[0286] If the requested field information does not contain nested fields, obtain the first memory segment that matches the requested field information in the memory segment set, and create a tree node corresponding to the business field according to the field type corresponding to the business field associated with the first memory segment;

[0287] Determine the deserialized child node of the root node according to the tree node corresponding to the business field, insert the memory segments except the first memory segment in the memory segment set into the non-deserialized segment of the root node, and obtain an updated root node;

[0288] Request response data corresponding to the business request is generated based on the data in the updated root node and the data in the tree node corresponding to the business field, and the business operation indicated by the business request is executed based on the request response data.

[0289] It should be understood that the computer device 1000 described in the embodiment of the present application can execute the above Figure 3 The description of the data processing method in the corresponding embodiment can also be performed as described above. Figure 14 The description of the data processing device in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here either.

[0290] In addition, it should be noted that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the data processing device 1 mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the above-mentioned Figure 3 The description of the data processing method in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, the program instructions can be deployed on a computer device for execution, or on multiple computer devices located at one location, or on multiple computer devices distributed at multiple locations and interconnected by a communication network. Multiple computer devices distributed at multiple locations and interconnected by a communication network can constitute a blockchain system.

[0291] In addition, it should be noted that: the embodiment of the present application also provides a computer program product or computer program, which may include computer instructions, which may be stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor may execute the computer instructions, so that the computer device performs the above Figure 3 Therefore, the description of the data processing method in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated here. For technical details not disclosed in the computer program product or computer program embodiments involved in this application, please refer to the description of the method embodiments of this application.

[0292] It should be noted that for the aforementioned various method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0293] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.

[0294] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.

[0295] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When executed, the program can include the processes in the above-described method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0296] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A data processing method, characterized in that: include: Receive a service request for an original serialized memory segment, obtain request field information carried by the service request, divide the original serialized memory segment according to the request field information to obtain a memory segment set, and create a root node containing the original serialized memory segment; If the requested field information does not include a nested field, obtaining a first memory segment that matches the requested field information from the memory segment set, and creating a tree node corresponding to the business field according to a field type corresponding to the business field associated with the first memory segment; Determine the deserialized child node of the root node according to the tree node corresponding to the business field, insert the memory segments in the memory segment set except the first memory segment into the non-deserialized segment of the root node, and obtain an updated root node; Generate request response data corresponding to the service request based on the data in the updated root node and the data in the tree node corresponding to the service field, and execute the service operation indicated by the service request based on the request response data.

2. The method according to claim 1, characterized in that The original serialized memory segments are divided according to the request field information to obtain a memory segment set, including: If the requested field information includes nested fields and non-nested fields, obtaining the non-nested field and the first subfield of the nested field, and the field position range in the original serialized memory segment; The original serialization fragment is trimmed according to the field position range corresponding to the non-nested field and the first subfield in the nested field to obtain the memory fragment set.

3. The method according to claim 1, characterized in that The step of creating a tree node corresponding to the business field according to the field type corresponding to the business field associated with the first memory segment includes: If the field type corresponding to the business field associated with the first memory segment includes a scalar type, obtaining deserialized data corresponding to the first memory segment; A first candidate node including the first memory segment is created, and deserialized data corresponding to the first memory segment is inserted into the first candidate node to obtain a tree node corresponding to the business field; the tree node corresponding to the business field is a leaf node.

4. The method according to claim 1, wherein The step of creating a tree node corresponding to the business field according to the field type corresponding to the business field associated with the first memory segment includes: If the field type corresponding to the business field associated with the first memory segment includes a message type, creating a second candidate node including the first memory segment; Insert the first memory segment into the non-deserialized segment of the second candidate node to obtain a tree node corresponding to the business field; the tree node corresponding to the business field does not contain a deserialized child node, and the tree node corresponding to the business field is a leaf node.

5. The method according to claim 1, wherein The step of creating a tree node corresponding to the business field according to the field type corresponding to the business field associated with the first memory segment includes: If the field type corresponding to the business field associated with the first memory segment includes an array type, creating a third candidate node including the first memory segment; Obtaining an array element identifier associated with the business field from the request field information, obtaining a first sub-memory segment corresponding to the array element identifier from a plurality of sub-memory segments included in the first memory segment, and creating a fourth candidate node including the first sub-memory segment; Inserting the first child memory segment into the non-deserialized segment of the fourth candidate node to obtain a first tree node; the first tree node does not contain a deserialized child node, and the first tree node is a leaf node; Inserting the first tree node into the deserialized child node of the third candidate node, and inserting the sub-memory segments of the first memory segment except the first sub-memory segment into the non-deserialized segment of the third candidate node to obtain a second tree node; the second tree node is a non-leaf node; The first tree node and the second tree node are determined as tree nodes corresponding to the business field.

6. The method according to claim 1, wherein The determining the deserialized child node of the root node according to the tree node corresponding to the business field includes: Obtaining the level identifier of the tree node corresponding to the business field; In the tree node corresponding to the business field, a tree node whose hierarchical identifier is adjacent to the root node is inserted into the deserialized child node of the root node.

7. The method according to claim 1, characterized in that The service request includes a data call request; Generating request response data corresponding to the service request according to the data in the updated root node and the data in the tree node corresponding to the service field, and executing the service operation indicated by the service request according to the request response data, includes: Generate a data node subtree corresponding to the data call request according to the updated root node and the hierarchical identifier of the tree node corresponding to the business field; If there is a leaf node containing deserialized data in the data node subtree, the leaf node containing the deserialized data is determined as the first call node, and the deserialized data in the first call node is determined as the first response data; If there is a leaf node that does not contain deserialized data in the data node subtree, the leaf node that does not contain deserialized data is determined as the second call node, and the serialized data contained in the second call node is deserialized to obtain second response data; The first response data and the second response data are encapsulated as request response data corresponding to the data call request, and the request response data is returned to the business object corresponding to the data call request.

8. The method according to claim 1, characterized in that The service request includes a data update request; Generating request response data corresponding to the service request according to the data in the updated root node and the data in the tree node corresponding to the service field, and executing the service operation indicated by the service request according to the request response data, includes: Generate a data node subtree corresponding to the data update request according to the updated root node and the hierarchical identifier of the tree node corresponding to the business field; Performing a data update operation on the tree nodes in the data node subtree according to the data update request to obtain an updated data node subtree; According to the field type corresponding to the field associated with the tree node in the updated data node subtree, the data in the tree nodes contained in the updated data node subtree are serialized to obtain request response data corresponding to the data update request, and the original serialized memory fragment is updated according to the request response data.

9. The method according to claim 8, characterized in that The performing a data update operation on the tree nodes in the data node subtree according to the data update request to obtain an updated data node subtree includes: Determining, among the leaf nodes included in the data node subtree, an object to be modified corresponding to the data update operation, replacing data corresponding to the object to be modified with update content indicated by the data update operation, and determining the leaf node containing the update content as a first update node; According to the first update node, update the deserialized child node contained in the parent node of the first update node in the data node subtree to obtain a second update node; According to the second update node, the deserialized child nodes contained in the parent node of the second update node in the data node subtree are updated until the update operation on the root node in the data node subtree is completed to obtain an updated data node subtree.

10. The method according to claim 8, characterized in that The performing a data update operation on the tree nodes in the data node subtree according to the data update request to obtain an updated data node subtree includes: Determine a leaf node in the data node subtree as a first processing node, and determine a parent node of the first processing node in the data node subtree as a second processing node; Deleting the first processing node from the deserialized child node of the second processing node to obtain a third updated node, and updating the deserialized child nodes contained in the parent node of the third updated node in the data node subtree according to the third updated node, until the update operation on the root node in the data node subtree is completed to obtain the first node subtree; The first processing node is deleted from the first node subtree to obtain an updated data node subtree.

11. The method according to claim 8, characterized in that The updated data node subtree includes a third tree node corresponding to a scalar type field, a fourth tree node corresponding to a message type field, and a fifth tree node corresponding to an array type field; The serializing of the data in the tree nodes included in the updated data node subtree according to the field type corresponding to the field associated with the tree nodes in the updated data node subtree to obtain request response data corresponding to the data update request includes: Serializing the deserialized data in the third tree node to obtain a first update fragment corresponding to the third tree node; Determining a byte length corresponding to the fourth tree node, generating header update information corresponding to the fourth tree node according to the byte length, and concatenating the header update information with a memory fragment included in an undeserialized segment in the fourth tree node to obtain a second update fragment corresponding to the fourth tree node; Determine the memory segment contained in the undeserialized segment in the fifth tree node as the third update segment corresponding to the fifth tree node; According to the hierarchical identifications of the third tree node, the fourth tree node and the fifth tree node in the updated data node subtree, the first update fragment, the second update fragment and the third update fragment are combined to obtain request response data corresponding to the data update request.

12. The method according to claim 1, characterized in that The business request includes a data query request; Generating request response data corresponding to the service request according to the data in the updated root node and the data in the tree node corresponding to the service field, and executing the service operation indicated by the service request according to the request response data, includes: Generate a data node subtree corresponding to the data query request according to the updated root node and the hierarchical identifier of the tree node corresponding to the business field; Deleting the undeserialized segments contained in the non-leaf nodes in the data node subtree to obtain a second node subtree; Serialize the data of the non-leaf nodes in the second node subtree to obtain a fourth update fragment, combine the fourth update fragment with the serialized data in the leaf nodes contained in the second node subtree to obtain request response data corresponding to the data query request, and return the request response data to the business object corresponding to the data query request.

13. The method according to claim 1, wherein The method further comprises: If the requested field information contains a nested field consisting of field a and field b, then the field types corresponding to field a and field b are obtained; field a is the first subfield of the nested field; If the field type corresponding to the field a is a message type, obtaining a second memory segment matching the field a from the memory segment set, and creating a fifth candidate node including the second memory segment; If a sub-memory segment matching the field b exists among the multiple sub-memory segments included in the second memory segment, and the field type corresponding to the field b is a scalar type, then obtaining the second sub-memory segment corresponding to the field b in the second memory segment, obtaining the deserialized data corresponding to the second sub-memory segment, and creating a tree node corresponding to the field b based on the deserialized data associated with the second sub-memory segment; the tree node corresponding to the field b is a leaf node; Insert the tree node corresponding to the field b into the deserialized child node of the fifth candidate node, and insert the sub-memory segments of the second memory segment except the second sub-memory segment into the non-deserialized segment of the fifth candidate node to obtain the tree node corresponding to the field a; the tree node corresponding to the field a is a non-leaf node; The tree node corresponding to the field a and the tree node corresponding to the field b are determined as the tree nodes corresponding to the nested field; the tree nodes corresponding to the nested field are used to generate a data node subtree corresponding to the business request.

14. The method according to claim 13, characterized in that The method further comprises: If there is no sub-memory segment matching the field b in the second memory segment, creating a tree node with empty data for the field b; Insert the tree node corresponding to the field b into the deserialized child node of the fifth candidate node, insert the second memory segment into the non-deserialized segment of the fifth candidate node, and obtain the tree node corresponding to the field a.

15. A data processing device, characterized in that: include: A first node creation module is configured to receive a service request for an original serialized memory segment, obtain request field information carried in the service request, divide the original serialized memory segment according to the request field information to obtain a memory segment set, and create a root node containing the original serialized memory segment; a second node creation module configured to, if the request field information does not include a nested field, obtain a first memory segment matching the request field information from the memory segment set, and create a tree node corresponding to the business field based on a field type corresponding to the business field associated with the first memory segment; a node updating module, configured to determine a deserialized child node of the root node according to the tree node corresponding to the business field, and insert memory segments other than the first memory segment in the memory segment set into the non-deserialized segment of the root node to obtain an updated root node; The response data generation module is used to generate request response data corresponding to the business request based on the data in the updated root node and the data in the tree node corresponding to the business field, and execute the business operation indicated by the business request according to the request response data.

16. A computer device, characterized in that: including memory and processor; The memory is connected to the processor, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method according to any one of claims 1 to 14.

17. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 14.

18. A computer program product, characterized in that The method comprises computer instructions, which implement the method according to any one of claims 1 to 14 when executed by a processor.