Method, electronic device and computer program product for querying data
By distinguishing between local and global data identifiers in a distributed system and using a combined routing strategy of local and global distributed hash tables, the query latency problem caused by node mobility and data identifier changes is solved, achieving efficient and flexible data retrieval.
Patent Information
- Application Number
- CN202210837573.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-15
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2042-07-15
AI Technical Summary
In distributed systems, node mobility and changes in the geographic information identifiers of data lead to query latency and performance degradation, especially when querying global data across regions, where existing technologies struggle to efficiently locate target data.
By determining whether the target data identifier is a local or global data identifier at the request node, the corresponding local or global distributed hash table is used for querying. Combining the routing strategies of local and global hash tables, the data search path is optimized.
It enables low-latency and high-efficiency data querying in distributed systems, reduces the time cost of cross-regional queries, and improves the flexibility and efficiency of data retrieval.
Smart Images

Figure CN117435587B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of this disclosure relate to the field of data processing, and more specifically, to methods, electronic devices, and computer program products for querying data in a distributed system. Background Technology
[0002] Nodes in edge architectures are typically widely and dynamically distributed, exhibiting network instability. Distributed systems employing decentralized technologies can address these issues while providing users with low-latency and efficient data services.
[0003] Distributed hash tables (DHTs) are used in distributed systems as "infrastructure" to store large amounts of data, such as the identifiers of each node, metadata, and the distances between nodes. Nodes in a distributed system can use the distributed hash table to find target data. Summary of the Invention
[0004] Embodiments of this disclosure provide a method, electronic device, and computer program product for querying data in a distributed system.
[0005] According to a first aspect of this disclosure, a method for querying data is provided. The method includes, upon receiving a query request for target data at a requesting node, determining a data identifier for the target data. The method further includes determining whether the data identifier for the target data is a local data identifier or a global data identifier. The method also includes, in response to determining that the data identifier is a local data identifier, querying the target data using a local distributed hash table; and in response to determining that the data identifier is a global data identifier, querying the target data using a global distributed hash table.
[0006] According to a second aspect of this disclosure, an electronic device is provided. The electronic device includes at least one processor; and a memory coupled to the at least one processor and having instructions stored thereon, the instructions causing the electronic device to perform actions when executed by the at least one processor, the actions including: upon receiving a query request for target data at a requesting node, determining a data identifier for the target data; determining whether the data identifier for the target data is a local data identifier or a global data identifier; in response to determining that the data identifier is a local data identifier, querying the target data using a local distributed hash table; and in response to determining that the data identifier is a global data identifier, querying the target data using a global distributed hash table.
[0007] According to a third aspect of this disclosure, a computer program product is provided, which is tangibly stored on a non-volatile computer-readable medium and includes machine-executable instructions that, when executed, cause a machine to perform the steps of the method in the first aspect of this disclosure. Attached Figure Description
[0008] The above and other objects, features and advantages of this disclosure will become more apparent from the more detailed description of exemplary embodiments of this disclosure taken in conjunction with the accompanying drawings, in which the same reference numerals generally represent the same elements.
[0009] Figure 1 The illustration shows a schematic diagram of an example environment 100 in which the devices and / or methods according to embodiments of the present disclosure may be implemented;
[0010] Figure 2 A flowchart illustrating a method 200 for querying data according to an embodiment of the present disclosure is shown;
[0011] Figure 3 The illustration shows a schematic diagram of a dual distributed hash table 300 at a node according to an embodiment of the present disclosure;
[0012] Figure 4 The illustration shows a flowchart 400 of another embodiment of querying using both a local distributed hash table and a global distributed hash table according to an embodiment of the present disclosure;
[0013] Figure 5 The illustration shows a schematic diagram 500 of another embodiment of querying using both a local distributed hash table and a global distributed hash table according to an embodiment of the present disclosure;
[0014] Figure 6 The diagram illustrates the management of geographic information identifiers within a node; and
[0015] Figure 7 A schematic block diagram of an example device 700 suitable for implementing embodiments of the present disclosure is shown. Detailed Implementation
[0016] As mentioned above, due to the mobility of nodes, when a node queries or retrieves data outside its own region or data that does not belong to any region, the node may need to traverse a longer search path or take more hops using a distributed hash table to locate the target data or its associated metadata. Since cross-regional searches can typically be time-consuming, this leads to a decrease in the performance of querying and retrieving data in a distributed system. Furthermore, the geographic identifier for specific data may change. For example, a vehicle or mobile phone storing the target data might act as the target data node. When this vehicle or mobile phone leaves one region and enters another, the geographic identifier of the target data may change accordingly. In this case, if the requesting data node continues to use the unchanged geographic identifier to query the target data, the query may fail due to the change in the geographic identifier.
[0017] Furthermore, some data is used as global data within the distributed system. In such cases, querying target data based on geographic information in local data identifiers may take longer than directly querying global data, resulting in greater latency. For example, in a distributed system using a city as its core, the electricity price for that city is uniform and globally applicable, not uniquely owned by any single community or unit. In this scenario, if a requesting node (such as a mobile phone) wants to query the adjusted electricity price, it can directly search within the distributed system based on attributes of the target data itself, such as the global identifier of the target data, thereby reducing the query time.
[0018] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0019] In the description of embodiments of this disclosure, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0020] To address at least the aforementioned and other potential problems, embodiments of this disclosure provide a method for querying data. The method includes, upon receiving a query request for target data at a requesting node, determining a data identifier for the target data. The method includes determining whether the data identifier of the target data is a local data identifier or a global data identifier. The method further includes, in response to determining that the data identifier is a local data identifier, querying the target data using a local distributed hash table; and in response to determining that the data identifier is a global data identifier, querying the target data using a global distributed hash table. By using the method disclosed in this invention, it is possible to find various types of data among nodes in a distributed system in a low-latency, flexible, and efficient manner, based on factors such as the distance between nodes and the attributes of the data itself.
[0021] The basic principles and several exemplary embodiments of this disclosure will now be described in detail with reference to the accompanying drawings. Figure 1 A schematic diagram of a distributed system 100 in which the devices and / or methods of embodiments of the present disclosure may be implemented is shown. It should be understood that... Figure 1 The number and arrangement of nodes, elements and regions shown are merely examples; the distributed system 100 may include different numbers and arrangements of nodes, elements and regions.
[0022] like Figure 1 As shown, a distributed system 100 includes nodes A112 to M118 and regions 102 to 10n.
[0023] A node can be any device with computing or storage resources. For example, a node may possess common capabilities such as receiving and sending data requests, real-time data analysis, local data storage, and real-time network connectivity. Nodes typically include various types of terminal devices. Examples of terminal devices include, but are not limited to: desktop computers, laptops, smartphones, wearable devices, security equipment, smart manufacturing equipment, smart home devices, IoT devices, smart cars, drones, and so on. It should be understood that although... Figure 1 Only nodes A 112 to M 118 are shown in the diagram, but this is merely exemplary and not a specific limitation of this disclosure. The distributed system 100 may include any number and type of nodes.
[0024] Distributed system 100 can be divided into various regions based on factors such as geographical proximity. As an example, Figure 1The distributed system 100 in the diagram illustrates n regions: regions 102 to 10n. A region can refer to an area divided based on factors such as geographical location, logical location, etc., like a neighborhood, a street block, a city, etc. Depending on whether nodes fall within the actual physical distance range or logical distance range of the region, a region can contain zero or more nodes. For example... Figure 1 As shown, since nodes A112, B113, C114, and D115 all fall within the actual physical distance range of region 102, nodes E116 and F117 fall within the actual physical distance range of region 104, and node M118 falls within the actual physical distance range of region 10n, region 102 can contain nodes A112, B113, C114, and D115, region 104 can contain nodes E116 and F117, and region 10n can contain node M118. It should be understood that although... Figure 1 Only regions 102 to 10n and nodes A112 to M118 are shown in the diagram, but this is merely exemplary and not a specific limitation of this disclosure. The distributed system 100 may include any number of regions, divided according to any criteria. It should also be understood that the above-described criteria for dividing regions into which nodes fall are merely exemplary and can be determined based on any factors; this disclosure does not impose any limitations.
[0025] Each node in the distributed system 100 can store data and / or metadata of that data. For example, one node stores data, and another node stores the metadata corresponding to that data. The metadata describes the attributes of the data and may include a data identifier, which includes a hash identifier obtained by hashing the data using a hash algorithm. Further, the data generator can classify the data identifier into local data identifiers and global data identifiers based on the corresponding attributes of the data; for example, when generating data, the data generator can classify the data identifier into local data identifiers and global data identifiers based on whether the data will be used in a certain region or will be used across the distributed system 100, wherein the local data identifier may have a geographic information identifier representing the region where the node storing the data is located. Taking nodes in region 102 as an example, node A 112 in region 102 has data a', while node B 113 stores metadata associated with data a'. The metadata may include the data identifier corresponding to data a' and the routing information of data a'. If it is determined that data a' will be used within region 102, a hash identifier hash(a') can be obtained by hashing data a', and a geographical information identifier 102- representing the region where the node storing the data is added by the data generator can be added. That is, the data identifier can be represented as a local data identifier 102-hash(a'). For example, in response to the fact that data a' can also be used across the entire distributed system 100, the data identifier associated with data a' may only include the hash identifier obtained by hashing data a', i.e., the global identifier hash(a'). The global identifier hash(a') can then be stored at node M 118, where node M 118 may be the node closest to node A 112 relative to the entire distributed system 100. It should be understood that although the above examples use whether the data will be used in a certain area or across a distributed system 100 as the standard to divide data identifiers into local data identifiers and global data identifiers, this is merely exemplary and not a specific limitation of this disclosure. In this disclosure, all data identifiers can be divided into any type of data identifier according to any standard, and this disclosure does not limit this. Routing information may include the routing information of data a'. In addition, metadata may also include the size of the data, the data source, etc., and this disclosure does not limit this.
[0026] The above combination Figure 1 An example distributed system 100 according to some embodiments of the present disclosure is described below. Reference will be made to... Figure 2 This describes a flowchart of a method 200 for data storage according to some embodiments of the present disclosure. Method 200 can be described by... Figure 1The distributed system 100 is implemented. It should be understood that method 200 can also be performed by other suitable devices or apparatuses. Method 200 may include additional actions not shown and / or the actions shown may be omitted; the scope of this disclosure is not limited in this respect. For ease of explanation, reference will be made to... Figure 1 Let's describe method 200.
[0027] like Figure 2 As shown in box 202, the requesting node in the distributed system 100 receives a query request for target data and determines the data identifier of the target data. As mentioned above, the node can be a terminal device with capabilities such as receiving and sending data requests, real-time data analysis, local data storage, and real-time network connectivity. Therefore, the requesting node can determine the data identifier for the target data from the received query request.
[0028] At box 204, the requesting node in distributed system 100 determines whether the data identifier of the target data is a local data identifier or a global data identifier. As described above, the data identifier of the target data can be divided into local and global data identifiers based on whether the data will be used within a certain region or across the distributed system. The local data identifier may have a geographic information identifier representing the region where the node storing the data is located. By determining whether the data identifier of the target data contains a geographic information identifier, the requesting node can determine whether the data identifier of the target data is a local or global data identifier. For example, as... Figure 1 As shown, node A 112 stores target data a'. Node C 114, located in the same region as node A 112, may receive query requests for target data a' from other nodes in the same region. Since these are query requests from the same region, the data identifier for the target data in the request can be a local data identifier, i.e., 102-hash(a'), where "102-" represents the geographical information identifier of the target data in region 102, and hash(a') represents the hash identifier obtained by hashing data a'. Node C 114 may also receive query requests for target data a' from other nodes outside region 102 in the distributed system 100. In this request, the data identifier for the target data can be the global data identifier hash(a').
[0029] At box 206, in response to determining that the data identifier is a local data identifier, the requesting node in the distributed system 100 can use a local distributed hash table to query the target data. In this disclosure, each node can store a dual-distributed hash table (DHT), which is formed based on the distance from that node to other nodes, and the dual-distributed hash table can include both a local distributed hash table and a global distributed hash table. This disclosure will be referenced below. Figure 3 This section will describe in detail the construction process of the dual distributed hash table.
[0030] At box 208, in response to determining that the data identifier is a global data identifier, the requesting node in the distributed system 100 can use the global distributed hash table to query the target data.
[0031] In some embodiments, after receiving a data storage request, a node in the distributed system 100 stores the data at its own location. For example, node A 112 may store target data a' at node A 112 after receiving a data storage request, and node B 113 may store target data b' at node B 113.
[0032] In some embodiments, the first node in the distributed system 100 may store the metadata of its data in a second node located in the same region as the first node, based on a local distributed hash table. Alternatively or additionally, the second node may be the node closest to the first node in the same region, and the distance between the first and second nodes can be obtained by calculating the XOR distance. The metadata may include a data identifier and routing information, wherein the data identifier includes a hash identifier obtained by hashing the data using a hash algorithm, and the routing information may record the routing data to that data. The data identifiers stored in nodes located in the same region may have the same geographical information identifier representing the region where the node is located. For example, nodes A 112, B 113, C 114, and D 115 in the distributed system 100 are all located in region 102, so they can all have the geographical information identifier "102-", while nodes E 116 and F 117 in the distributed system 100 are located in region 104, so they can all have the geographical information identifier "104-". As an example, node B 113 also stores metadata associated with data a', which may include the local data identifier "102-hash(a')" and routing information from node B 113 to node A 112 where data a' is stored.
[0033] In some embodiments, the first node in the distributed system 100 may store the metadata of the data in a third node in the distributed system based on a global distributed hash table. Additionally or alternatively, the third node may be the node in the distributed system 100 that is closest to the first node. However, since the algorithm used to find the third node based on the global distributed hash table may be different from the algorithm used to find the second node based on the local distributed hash table, the closest node determined by the two algorithms may be different. Additionally or alternatively, the data identifier in the node stored according to the global distributed hash table may not have a geographical identifier. For example, since in Figure 1Node M 118 is the closest node to node A 112 in the distributed system 100. Therefore, node M 118 can store metadata associated with data a' in node A. Since the metadata stored in node M 118 is stored based on a global distributed hash table, the data identifier in the metadata at node M 118 can be represented as "hash(a')" without having a geographic information identifier.
[0034] Additionally or alternatively, the process by which a node stores metadata on a second node located in the same region based on a local distributed hash table can be performed in parallel with the process by which a node stores metadata on a third node based on a global distributed hash table. For example, Figure 1 Node A 112 can simultaneously store metadata associated with data a' in both node B 113 and node M 118.
[0035] In some embodiments, requesting a node to query target data using both a local distributed hash table and a global distributed hash table simultaneously includes: stopping the query for target data using the global distributed hash table in response to finding the target data using the local distributed hash table; and stopping the query for target data using the local distributed hash table in response to finding the target data using the global distributed hash table. For example, node C114 can simultaneously query target data a' based on both the local distributed hash table and the global distributed hash table stored at node C114, and once the target data a' is found through one of the hash tables, the search in the other hash table is stopped.
[0036] In some embodiments, the requesting node's use of a local distributed hash table to query target data may include: sending a query request for the target data to multiple nodes within a first distance range based on the local distributed hash table; and, in response to the failure to find the target data from the multiple nodes within the first distance range, sending a query request for the target data to multiple nodes within a second distance range, wherein the distance in the second distance range is greater than the distance in the first distance range. For example, node C 114 may first send a query request for target data d' to nodes A 112 and B 113 within the first distance range, where the first distance range can be any value smaller than the size of region 102. If the target data d' or metadata associated with the target data d' is not found at nodes A 112 and B 113, node C 114 further sends a query request for the target data d' to node D 115 within the second distance range, where the second distance range can be any value larger than the first distance range and smaller than the size of region 102. It should be understood that the distance range can be any value away from the requesting node, and this disclosure does not impose any limitation. Alternatively or concurrently, metadata of the target data can be stored in multiple nodes. In response to querying the metadata of the target data at one of the multiple nodes, the requesting node C 114 can find the node storing the target data d' based on the routing information associated with the metadata, thereby finding the target data d'.
[0037] The following will combine Figure 1 and Figure 3 This describes the process of establishing a dual distributed hash table 300 associated with a node at that node.
[0038] Taking node C114 in distributed system 100 as an example, node C114 can first traverse all nodes in region 102, and record each node in region 102 in its local hash table according to its distance from node C114, as the first part of its local hash table. For example, in Figure 3 In the example, since nodes A and B 113 are within the same distance range as node C 114, nodes A and B 113 are recorded within the distance range of the local hash table of node C 114 [2]. 0 ,2 1 In ), and because node D115 is far from node C114, node D115 is recorded in the distance range of the local hash table of node C114 [2]. 1 ,2 2In this context, it should be understood that the distance between nodes can be a logical distance obtained using an XOR operation. Additionally or alternatively, the distance between nodes can also be the actual physical distance between nodes, which is not limited herein. Additionally or alternatively, the distance range of the first part of the local hash table can be a region of size 102.
[0039] In the manner described above, node C 114 then traverses nodes E 116 and F 117 in region 104 and records them in node C 114's local hash table as the second part of its local hash table. Alternatively or additionally, the distance range of the second part of the local hash table can be the size of region 104.
[0040] Similarly, node C 114 can record each node in the distributed system 100 in its local hash table, up to the last node, such as node M 118 in region 10n.
[0041] The process of building a global distributed hash table at a node can include generating the global distributed hash table based on the distance between the requesting node and all nodes in the distributed system. For example, it can be done based on the identifier space of the entire distributed system (which can be 2^32 bytes). 256 A hash operation is performed on each node to obtain a node identifier that is longer than the node identifier recorded in the local hash table. Since the node identifier obtained in this way is calculated relative to the entire distributed system, the logical distance between nodes is relatively large. Therefore, the nodes in the resulting global distributed hash table are usually located at the bottom of the global distributed hash table.
[0042] It should be understood that the methods for determining node identifiers described above are merely exemplary and are not intended to limit the scope of this disclosure. Any suitable method can be used to determine node identifiers, such as using other hash algorithms to determine the hash value of a node.
[0043] The following will be Figure 4 and Figure 5 Another example of using both local and global distributed hash tables for querying according to embodiments of this disclosure will be discussed in conjunction. Figure 4 The illustration shows a flowchart 400 of another embodiment of querying using both a local distributed hash table and a global distributed hash table according to an embodiment of the present disclosure;
[0044] like Figure 4In method 400, at block 402, the requesting node first receives a query request for the target data and determines whether the data identifier of the target data is a local data identifier or a global data identifier. If the data identifier of the target data is local data, the requesting node uses a local distributed hash table to query the target data. For example, in Figure 5 Node A 512 receives a query request for target data b' stored at node B 516, and in response to determining that the data identifier of target data b' has local data, determines to use the local distributed hash table of node A 512 to query target data b'.
[0045] At box 404, the requesting node can then determine whether the geographic information identifier of the local data identifier of the target data is the same as the geographic information identifier of the requesting node. For example, when node A512 attempts to query target data b', node C can first determine whether the geographic information identifier of the target data is the same as the geographic information identifier of the requesting node.
[0046] At box 406, if it can be determined that the geographic identifier of the target data is the same as the geographic identifier of the requesting node, then the requesting node uses a local distributed hash table to query the target data. In this example, if the geographic identifier of the local data identifier of target data b' has the same geographic identifier "512-" as node A 512, then node A can continue to use the local distributed hash table to query the target data.
[0047] At box 408, if the geographic identifier of the target data differs from the geographic identifier of the requesting node, the requesting node can use both the local distributed hash table and the global distributed hash table to query the target data. For example, in Figure 5If node A 512 determines that the geographic information identifier of the target data b' is different from the geographic information identifier of node A 512 itself (i.e., in this example, the geographic information identifier of the target data b' is "504-", while the geographic information identifier of node A 512 is "502-"), then node A 512 can simultaneously use both the local distributed hash table and the global distributed hash table to query the target data b'. Node A 512 can find the local data identifier 504-hash(b') associated with the target data b' at node C 513 in region 504 by querying the local distributed hash table, and find the node B 514 storing the target data b' based on the routing information associated with the data identifier 504-hash(b') at node C 513. Meanwhile, node A 512 can find the global data identifier hash(b') associated with the target data b' at node M 515 in the distributed system 500 by querying the global distributed hash table, and find node B 514 storing the target data b' based on the routing information associated with the data identifier hash(b') at node M 515. Once node A 512 finds the target data b' by querying one of the local distributed hash table or the global distributed hash table, node A 512 stops querying the other distributed hash table.
[0048] Figure 6The diagram illustrates the management of geographic information identifiers within a node. A node may include an API component 601, a data processing and storage component 602, and a network component 603. The network component 603 may further include a DHT component 604 and a P2P component 606. According to embodiments of this disclosure, geographic information identifiers may be used only when the node processes information with other nodes in the distributed system, such as when the node's API component needs to program the node to record node information in a local distributed hash table, or when comparing the distance between a requesting node and the distance in the requesting node's distributed hash table. In such cases, the geographic information identifier can be added to the node's data identifier, enabling rapid distance comparison with other nodes. In another embodiment, the node's P2P component 606 may need to use the geographic information identifier when the node transmits data with another node via P2P transmission. When processing information within a node, the use of geographic information identifiers may not be necessary. Therefore, when using data identifiers in the data processing and storage components 602 within the node, geographic information identifiers can be removed. By applying this mechanism, this disclosure provides a flexible routing strategy for network components 603, including distributed hash tables, while maintaining the consistency and independence of data used in the internal data processing components and storage repository 602, and saving storage space within the node.
[0049] Figure 7 A schematic block diagram of an example device 700 that can be used to implement embodiments of the present disclosure is shown. Figure 1 The nodes in the process can be implemented using device 700. As shown, device 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes based on computer program instructions stored in read-only memory (ROM) 702 or loaded from storage unit 708 into random access memory (RAM) 703. RAM 703 can also store various programs and data required for the operation of device 700. CPU 701, ROM 702, and RAM 703 are interconnected via bus 704. Input / output (I / O) interface 705 is also connected to bus 704.
[0050] Multiple components in device 700 are connected to I / O interface 705, including: input unit 706, such as keyboard, mouse, etc.; output unit 707, such as various types of monitors, speakers, etc.; storage page 708, such as disk, optical disk, etc.; and communication unit 709, such as network card, modem, wireless transceiver, etc. Communication unit 709 allows device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0051] The various processes and handling described above, such as methods 200 and 400, can be executed by processing unit 701. For example, in some embodiments, methods 200 and 400 can be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by CPU 701, one or more actions of methods 200 and 400 described above can be performed.
[0052] This disclosure can be a method, apparatus, system, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for performing various aspects of this disclosure.
[0053] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0054] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0055] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.
[0056] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0057] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0058] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0059] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0060] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical applications, or technical improvements to the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for querying data, the method comprising: Upon receiving a query request for target data at the request node, determine the data identifier of the target data; Determine whether the data identifier of the target data is a local data identifier or a global data identifier, wherein the local data identifier includes a geographic information identifier and a hash identifier of the target data, and the global data identifier includes the hash identifier of the target data; In response to determining that the data identifier is the local data identifier, a local distributed hash table is used to query the target data; and In response to determining that the data identifier is the global data identifier, the target data is queried using a global distributed hash table.
2. The method of claim 1, wherein using a local distributed hash table to query the target data comprises: Determine whether the geographic information identifier of the local data identifier of the target data is the same as the geographic information identifier of the request node; In response to the fact that the geographic information identifier of the local data identifier of the target data is the same as the geographic information identifier of the request node, the local distributed hash table is used to query the target data; as well as In response to the fact that the geographic information identifier of the local data identifier of the target data is different from the geographic information identifier of the requesting node, the local distributed hash table and the global distributed hash table are used simultaneously to query the target data.
3. The method of claim 2, wherein using the local distributed hash table to query the target data comprises: Based on the local distributed hash table, query requests for the target data are sent to multiple nodes within a first distance range; In response to the failure to find the target data from the plurality of nodes within the first distance range, a query request for the target data is sent to the plurality of nodes within the second distance range, wherein the distance in the second distance range is greater than the distance in the first distance range.
4. The method of claim 2, wherein simultaneously using the local distributed hash table and the global distributed hash table to query the target data comprises: In response to finding the target data using the local distributed hash table, stop using the global distributed hash table to query the target data. as well as In response to finding the target data using the global distributed hash table, the query for the target data using the local distributed hash table is stopped.
5. The method of claim 1, wherein the request node is located in the first region, and the method further comprises: The first part of the local distributed hash table is generated based on the distance between the requesting node and other nodes in the first region; The second part of the local distributed hash table is generated based on the distance between the requesting node and the nodes in the second region; as well as The local distributed hash table is generated based at least on the first part and the second part.
6. The method according to claim 5, further comprising: The global distributed hash table is generated based on the distance between the requesting node and all nodes in the distributed system.
7. The method according to claim 1, further comprising: In response to receiving a data storage request at the first node, the data is stored at the first node; Based on the local distributed hash table, the metadata of the data is stored in a second node that is in the same region as the first node; as well as Based on the global distributed hash table, the metadata of the data is stored on a third node in the distributed system.
8. An electronic device, comprising: At least one processor; as well as A memory, coupled to at least one processor, and having instructions stored thereon, which, when executed by the at least one processor, cause the electronic device to perform actions, including: Upon receiving a query request for target data at the request node, determine the data identifier of the target data; Determine whether the data identifier of the target data is a local data identifier or a global data identifier, wherein the local data identifier includes a geographic information identifier and a hash identifier of the target data, and the global data identifier includes the hash identifier of the target data; In response to determining that the data identifier is the local data identifier, a local distributed hash table is used to query the target data; and In response to determining that the data identifier is the global data identifier, the target data is queried using a global distributed hash table.
9. The electronic device of claim 8, wherein using a locally distributed hash table to query the target data comprises: Determine whether the geographic information identifier of the local data identifier of the target data is the same as the geographic information identifier of the request node; In response to the fact that the geographic information identifier of the local data identifier of the target data is the same as the geographic information identifier of the request node, the local distributed hash table is used to query the target data; as well as In response to the fact that the geographic information identifier of the local data identifier of the target data is different from the geographic information identifier of the requesting node, the local distributed hash table and the global distributed hash table are used simultaneously to query the target data.
10. The electronic device of claim 9, wherein using the local distributed hash table to query the target data comprises: Based on the local distributed hash table, query requests for the target data are sent to multiple nodes within a first distance range; In response to the failure to find the target data from the plurality of nodes within the first distance range, a query request for the target data is sent to the plurality of nodes within the second distance range, wherein the distance in the second distance range is greater than the distance in the first distance range.
11. The electronic device of claim 9, wherein simultaneously using the local distributed hash table and the global distributed hash table to query the target data comprises: In response to finding the target data using the local distributed hash table, stop using the global distributed hash table to query the target data. as well as In response to finding the target data using the global distributed hash table, the query for the target data using the local distributed hash table is stopped.
12. The electronic device of claim 8, wherein the request node is located in the first region, and the electronic device further comprises: The first part of the local distributed hash table is generated based on the distance between the requesting node and other nodes in the first region; The second part of the local distributed hash table is generated based on the distance between the requesting node and the nodes in the second region; as well as The local distributed hash table is generated based at least on the first part and the second part.
13. The electronic device according to claim 12, further comprising: The global distributed hash table is generated based on the distance between the requesting node and all nodes in the distributed system.
14. The electronic device according to claim 8, further comprising: In response to receiving a data storage request at the first node, the data is stored at the first node; Based on the local distributed hash table, the metadata of the data is stored in a second node that is in the same region as the first node; as well as Based on the global distributed hash table, the metadata of the data is stored on a third node in the distributed system.
15. A computer program product tangibly stored on a non-volatile computer-readable medium and comprising machine-executable instructions that, when executed, cause a machine to perform the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method, device and system for establishing distribution type network
CN101771715A
Data query method and device and electronic equipment
CN113377774A
