Retrieval method and computer device
By using multiple processors in the computing system to execute search requests in parallel and assign tasks according to database characteristics, the problem of low big data retrieval efficiency is solved, and an efficient and low-cost retrieval solution is achieved.
Patent Information
- Application Number
- PCT/CN2024/101952
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-15
- Filing Date
- 2024-06-27
- Publication Date
- 2025-01-02
AI Technical Summary
With the increase in the scale and complexity of big data, existing hardware cannot support high concurrent retrieval, resulting in low retrieval efficiency.
By using multiple processors in the computing system, the search request is allocated according to the characteristics of the database, the first processor and the second processor respectively execute different search requests, and perform searches in parallel, making full use of the heterogeneous computing architecture to improve search efficiency and the utilization rate of processor computing power.
There is no need to expand the capacity of hardware, reduce costs, significantly improve search efficiency and search accuracy, and ensure efficient retrieval of large-scale databases.
Smart Images

Figure CN2024101952_02012025_PF_FP_ABST
Abstract
Description
Retrieval method and computer equipment
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on June 28, 2023, with application number 202310782717.5 and application name “A search method”. This application also claims priority to the Chinese patent application filed with the State Intellectual Property Office on September 15, 2023, with application number 202311197640.1 and application name “Search method and computer device”. All of these contents are incorporated by reference into this application. Technical Field
[0002] The present invention relates to the field of computers, and in particular to a search method and computer equipment. Background Art
[0003] Currently, with the development of big data applications, massive amounts of data are being generated, including unstructured data such as images, text, video, and voice. The process of converting unstructured data into high-dimensional vectors and using them to represent the semantics of the unstructured data is called embedding. Furthermore, a single processor searches the database based on the search request to obtain search results. For example, vectors similar to the query content are retrieved from the database, enabling analysis and retrieval of unstructured data. However, as data size and complexity increase, current hardware cannot support high-concurrency searches, resulting in low retrieval efficiency.
[0004] Summary of the Invention
[0005] This application provides a retrieval method and computer equipment, thereby improving retrieval efficiency.
[0006] In a first aspect, a retrieval method is provided, which is applied to a computing system including a first processor and a second processor. The method includes: first, the first processor determines a database to be searched based on multiple retrieval requests, and then determines, based on characteristics of the database, that the first processor executes a first part of the retrieval requests among the multiple retrieval requests, and the second processor executes a second part of the retrieval requests among the multiple retrieval requests; that is, the first processor executes the first part of the retrieval requests to obtain a first retrieval result, and the second processor executes the second part of the retrieval requests to obtain a second retrieval result; finally, the retrieval results of the multiple retrieval requests are obtained based on the first retrieval result and the second retrieval result.
[0007] Compared to relying solely on a single processor to perform a search on a database based on a search request to obtain search results, the solution provided by this application determines the search scope based on the characteristics of the database for two processors to perform searches. This solution adaptively senses the characteristics of the database and allocates databases and multiple search requests to the two processors, allowing the two processors to perform searches based on the allocated databases and search requests. This approach fully utilizes the computing power of multiple types of processors and performs searches in parallel based on a heterogeneous computing architecture, improving search efficiency and the utilization of processor computing power without the need for hardware expansion, thus reducing costs.
[0008] In one possible implementation, determining that the first processor executes a first part of retrieval requests among multiple retrieval requests and the second processor executes a second part of retrieval requests among multiple retrieval requests based on characteristics of the database includes: when the size of the database is greater than the processing capacity of the first processor, sending multiple retrieval requests to the first processor and the second processor respectively, and the first part of retrieval requests and the second part of retrieval requests are both multiple retrieval requests.
[0009] In another possible implementation, the method includes dividing the database into a first sub-database and a second sub-database according to the capabilities of the first processor and the second processor; the first processor executes the first part of the retrieval request to obtain a first retrieval result, and the second processor executes the second part of the retrieval request to obtain a second retrieval result, including: the first processor queries the first part of the retrieval request in the first sub-database to obtain the first retrieval result, and the second processor queries the second part of the retrieval request in the second sub-database to obtain the second retrieval result.
[0010] In this way, when the computing power of a single processor cannot support the scale of the database, the database is divided according to the capabilities of different types of processors. Two processors respectively perform searches on multiple search requests based on part of the content in the database, that is, searches are performed in parallel based on different sub-databases, thereby effectively improving the search efficiency.
[0011] In another possible implementation, obtaining the retrieval results of the multiple retrieval requests based on the first retrieval result and the second retrieval result includes: selecting a retrieval result similar to the retrieval request from the first retrieval result and the second retrieval result to determine the retrieval results of the multiple retrieval requests.
[0012] In another possible implementation, determining that the first processor executes a first part of retrieval requests among multiple retrieval requests and the second processor executes a second part of retrieval requests among multiple retrieval requests based on characteristics of the database includes: when the size of the database is less than or equal to the processing capacity of the first processor, dividing the multiple retrieval requests into the first part of retrieval requests and the second part of retrieval requests based on the processing capacity of the first processor and the second processor.
[0013] In this way, the computing power of a single processor supports the scale of the database, and multiple search requests are divided according to the capabilities of different types of processors. Two processors respectively perform searches on the database based on some of the multiple search requests, that is, searches are performed in parallel based on different search requests, thereby effectively improving the search efficiency.
[0014] In another possible implementation, the first processor executes the first part of the retrieval request to obtain the first retrieval result, and the second processor executes the second part of the retrieval request to obtain the second retrieval result, including: the first processor queries the first part of the retrieval request in the database to obtain the first retrieval result, and the second processor queries the second part of the retrieval request in the database to obtain the second retrieval result.
[0015] Thus, by comparing the first search result and the second search result, a search result that is closer or more similar to the search request is obtained, thereby ensuring the accuracy of the search result.
[0016] In another possible implementation, the first processor executes the first part of the retrieval request to obtain the first retrieval result, and the second processor executes the second part of the retrieval request to obtain the second retrieval result, including: determining a retrieval algorithm based on the distribution characteristics of the database; the first processor executes the first part of the retrieval request according to the retrieval algorithm to obtain the first retrieval result, and the second processor executes the second part of the retrieval request according to the retrieval algorithm to obtain the second retrieval result.
[0017] In this way, a retrieval algorithm is determined based on the distribution characteristics of the database, and a retrieval is performed on the database based on the retrieval algorithm so that retrieval results similar to the retrieval request can be retrieved from the database as quickly as possible, thereby improving retrieval efficiency and retrieval accuracy.
[0018] In another possible implementation, determining the retrieval algorithm according to the distribution characteristics of the database includes: when the distribution characteristics are random distribution, determining the retrieval algorithm as an exact retrieval algorithm; when the distribution characteristics are dense distribution or sparse distribution, determining the retrieval algorithm as an approximate retrieval algorithm.
[0019] Since randomly distributed data has poor regularity, performing retrieval based on the exact retrieval algorithm ensures that similar results can be retrieved. Compared with the approximate retrieval algorithm, it avoids missed detection and thus improves retrieval accuracy.
[0020] Since densely distributed or sparsely distributed data has regularity, performing retrieval based on approximate retrieval algorithms ensures that similar results can be retrieved as quickly as possible, which improves retrieval efficiency compared to precise retrieval algorithms.
[0021] In another possible implementation, the method further includes: determining distribution characteristics based on statistical characteristics and attributes of the database.
[0022] Therefore, the retrieval algorithm is determined by the distribution characteristics of the database determined by the statistical characteristics and attributes of the database to improve the retrieval accuracy.
[0023] In another possible implementation, determining the retrieval algorithms on which the first processor and the second processor perform the retrieval based on the distribution characteristics of the database includes: determining multiple retrieval algorithms on which the first processor and the second processor perform the retrieval based on the distribution characteristics of the database; and determining the retrieval algorithm indicated by the user from the multiple retrieval algorithms.
[0024] In another possible implementation, a database includes vectors, and multiple search requests perform vector searches on the database. A first processor determines a vector library to be searched based on the multiple search requests; the first processor determines a search scheme based on characteristics of the vector library, where the search scheme is used to instruct at least two processors in the computing system to perform vector searches based on a vector search range and a vector search algorithm, where the vector search range indicates the range of the vector library and the range of the multiple search requests; the first processor performs a vector search based on the vector search range and the vector search algorithm indicated by the search scheme, to obtain a first search result; the second processor performs a vector search based on the vector search range and the vector search algorithm indicated by the search scheme, to obtain a second search result; and the first processor obtains search results for the multiple search requests based on the first and second search results.
[0025] In a second aspect, a retrieval device is provided, comprising modules for executing the internal retrieval method in the first aspect or any possible design of the first aspect. For example, the retrieval device comprises a communication module, a data perception module, and a data retrieval module.
[0026] The data perception module is used to determine the database that needs to be searched based on multiple search requests; the data perception module is also used to determine that the first processor executes the first part of the search requests among the multiple search requests, and the second processor executes the second part of the search requests among the multiple search requests based on the characteristics of the database; the data retrieval module is used to execute the first part of the search requests to obtain a first search result; the data retrieval module is also used to execute the second part of the search requests to obtain a second search result; the data retrieval module is also used to obtain the search results of multiple search requests based on the first search result and the second search result.
[0027] In one possible implementation, the data perception module determines, based on the characteristics of the database, that the first processor executes the first part of the retrieval requests among the multiple retrieval requests, and the second processor executes the second part of the retrieval requests among the multiple retrieval requests. Specifically, it is used to: when the size of the database is greater than the processing capacity of the first processor, send the multiple retrieval requests to the first processor and the second processor respectively, and the first part of the retrieval requests and the second part of the retrieval requests are both multiple retrieval requests.
[0028] In another possible implementation, the data perception module is also used to divide the database into a first sub-database and a second sub-database according to the capabilities of the first processor and the second processor; when the first processor of the data retrieval module executes the first part of the retrieval request to obtain the first retrieval result, and the second processor executes the second part of the retrieval request to obtain the second retrieval result, it is specifically used: the first processor queries the first part of the retrieval request in the first sub-database to obtain the first retrieval result, and the second processor queries the second part of the retrieval request in the second sub-database to obtain the second retrieval result.
[0029] In another possible implementation, when the data retrieval module obtains retrieval results of multiple retrieval requests based on the first retrieval result and the second retrieval result, it is specifically used to: select retrieval results similar to the retrieval request from the first retrieval result and the second retrieval result to determine the retrieval results of the multiple retrieval requests.
[0030] In another possible implementation, the data perception module determines, based on the characteristics of the database, that the first processor executes the first part of the retrieval requests among the multiple retrieval requests, and the second processor executes the second part of the retrieval requests among the multiple retrieval requests. Specifically, it is used to: when the size of the database is less than or equal to the processing capacity of the first processor, divide the multiple retrieval requests into the first part of the retrieval requests and the second part of the retrieval requests according to the processing capacity of the first processor and the second processor.
[0031] In another possible implementation, when the first processor of the data retrieval module executes the first part of the retrieval request to obtain the first retrieval result, and the second processor executes the second part of the retrieval request to obtain the second retrieval result, it is specifically used: the first processor queries the first part of the retrieval request in the database to obtain the first retrieval result, and the second processor queries the second part of the retrieval request in the database to obtain the second retrieval result.
[0032] In another possible implementation, when the first processor of the data perception module executes the first part of the retrieval request to obtain the first retrieval result, and the second processor executes the second part of the retrieval request to obtain the second retrieval result, it is specifically used to: determine the retrieval algorithm according to the distribution characteristics of the database; the first processor executes the first part of the retrieval request according to the retrieval algorithm to obtain the first retrieval result, and the second processor executes the second part of the retrieval request according to the retrieval algorithm to obtain the second retrieval result.
[0033] In another possible implementation, when the data perception module determines the retrieval algorithm based on the distribution characteristics of the database, it is specifically used to: when the distribution characteristics are random distribution, determine the retrieval algorithm as an exact retrieval algorithm; when the distribution characteristics are dense distribution or sparse distribution, determine the retrieval algorithm as an approximate retrieval algorithm.
[0034] In another possible implementation, the data perception module is further configured to determine distribution characteristics based on statistical characteristics and attributes of the database.
[0035] In another possible implementation, when the data perception module determines the retrieval algorithms on which the first processor and the second processor perform the retrieval based on the distribution characteristics of the database, it is specifically used to: determine multiple retrieval algorithms on which the first processor and the second processor perform the retrieval based on the distribution characteristics of the database; and determine the retrieval algorithm indicated by the user from the multiple retrieval algorithms.
[0036] In another possible implementation, a database includes vectors, and multiple search requests perform vector searches on the database. The data perception module is configured to determine a vector library to be searched based on the multiple search requests; and to determine a search scheme based on characteristics of the vector library, wherein the search scheme is configured to indicate a vector search range and a vector search algorithm based on which at least two processors in the computing system perform the vector search, and the vector search range is configured to indicate the range of the vector library and the range of the multiple search requests; the data retrieval module is configured to perform a vector search based on the vector search range and the vector search algorithm based on which the first processor performs the vector search as indicated by the search scheme, to obtain a first search result; the data retrieval module is further configured to perform a vector search based on the vector search range and the vector search algorithm based on which the second processor performs the vector search as indicated by the search scheme, to obtain a second search result; and the data retrieval module is further configured to obtain search results for the multiple search requests based on the first search result and the second search result.
[0037] In a third aspect, a computer device is provided, which includes a memory and multiple different types of processors, the memory being used to store a set of computer instructions; when the processor executes the set of computer instructions, the operating steps of the retrieval method in the first aspect or any possible implementation of the first aspect are executed.
[0038] In a fourth aspect, a data processing system is provided, which includes a client and multiple computer devices. The client is used to send a retrieval request to the computer device, and the computer device is used to execute the operating steps of the retrieval method in the first aspect or any possible implementation of the first aspect to realize the retrieval of multiple retrieval requests.
[0039] In a fifth aspect, a computer-readable storage medium is provided, comprising: computer software instructions; when the computer software instructions are executed in a computer device, the computer device executes the operating steps of the method described in the first aspect or any possible implementation of the first aspect.
[0040] In a sixth aspect, a computer program product is provided. When the computer program product is run on a computer, the computer is caused to execute the operating steps of the method described in the first aspect or any possible implementation of the first aspect.
[0041] The technical effects brought about by any design method from the second to the sixth aspects can refer to the technical effects brought about by the first aspect or different design methods, and will not be repeated here.
[0042] Based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] FIG1 is a schematic diagram of the architecture of a data processing system provided by the present application;
[0044] FIG2 is a schematic diagram of a flow chart of a retrieval method provided by this application;
[0045] FIG3 is a schematic diagram of performing vector retrieval based on a heterogeneous computing architecture provided by the present application;
[0046] FIG4 is a schematic diagram of a data-aware retrieval solution provided by this application;
[0047] FIG5 is a schematic diagram of performing a search based on a search scheme provided by the present application;
[0048] FIG6 is a schematic structural diagram of a retrieval device provided by the present application;
[0049] FIG7 is a schematic structural diagram of a computer device provided in this application. DETAILED DESCRIPTION
[0050] To facilitate understanding, the main terms involved in this application are first explained.
[0051] Vector: Also known as a Euclidean vector or geometric vector. In mathematics, a vector is a quantity that has both magnitude and direction. A vector can be represented by a line segment with an arrow; the direction of the arrow represents the vector's direction, and the length of the line segment represents the vector's magnitude. The quantity corresponding to a vector is called a quantity or scalar; quantities or scalars have only magnitude, not direction.
[0052] Since computers can only recognize numbers, they use a set of numbers to represent or identify objects. This set of numbers can be called a vector. A vector containing n numbers is called an n-dimensional vector. For example, when computers recognize images, they convert them into vectors of n or higher dimensions.
[0053] Vector retrieval: refers to retrieving vectors similar or close to the retrieval request from the database.
[0054] Application scenarios of vector retrieval include, but are not limited to, recommendation systems, image search, video fingerprinting, speech processing, and natural language processing. Examples include advertising recommendations, search engine word recommendations, image search, image search, video search, product search, and file retrieval.
[0055] In order to solve the problem of low retrieval efficiency, the present application provides a retrieval method, that is, after the first processor determines the database to be searched based on multiple retrieval requests, the first processor is determined to execute the first part of the retrieval requests among the multiple retrieval requests, and the second processor is determined to execute the second part of the retrieval requests among the multiple retrieval requests according to the characteristics of the database; that is, the first processor executes the first part of the retrieval request to obtain a first retrieval result, and the second processor executes the second part of the retrieval request to obtain a second retrieval result; finally, the retrieval results of the multiple retrieval requests are obtained based on the first retrieval result and the second retrieval result.
[0056] Compared to relying solely on a single processor to perform a search on a database based on a search request to obtain search results, the solution provided by this application determines the search scope based on the characteristics of the database for two processors to perform searches. This solution adaptively senses the characteristics of the database and allocates databases and multiple search requests to the two processors, allowing the two processors to perform searches based on the allocated databases and search requests. This approach fully utilizes the computing power of multiple types of processors, executing searches in parallel based on a heterogeneous computing architecture, improving search efficiency and increasing the utilization of processor computing power.
[0057] The following describes in detail the implementation of the search method provided by this application with reference to the accompanying drawings.
[0058] The solution provided in this application can be applied to a network with a client / server (C / S) architecture. A network with a client / server (C / S) architecture can include a single server or a server cluster. This application does not limit the type and function of the server. For example, the types of servers include blade servers, tower servers, cabinet servers, and rack servers. For another example, the server includes a storage server with storage function or a computing server with computing function, and the computing server also has storage function.
[0059] For example, FIG1 is a schematic diagram of the architecture of a data processing system provided by the present application. As shown in FIG1 , a data processing system 100 includes a client 110 , a computing cluster 120 , and a storage cluster 130 .
[0060] Storage cluster 130 includes at least two storage nodes 131. Each storage node 131 includes one or more controllers, a network interface card (NIC), and multiple hard disks. Hard disks are used to store data. Hard disks can be magnetic disks or other types of storage media, such as solid-state drives (SSDs) or shingled magnetic recording hard disks (SMDRs). Network interfaces are used to communicate with compute nodes 121 within compute cluster 120. Controllers are used to write data to or read data from the hard disks based on read / write data requests sent by compute nodes 121. During the data read / write process, the controllers need to convert the addresses in the read / write data requests into addresses that the hard disks can recognize.
[0061] The computing cluster 120 includes at least two computing nodes 121, which can communicate with each other. The computing node 121 is a computing device, such as a server, a desktop computer, or a controller of a storage array.
[0062] Client 110 communicates with computing cluster 120 and storage cluster 130 via network 140. For example, client 110 sends a search request to computing cluster 120 via network 140, requesting computing cluster 120 to perform a database search based on the search request and obtain search results similar to the search request. Network 140 can be an internal enterprise network (e.g., a local area network (LAN)) or the Internet. Client 110 refers to a computer connected to network 140, also known as a workstation. Different clients can share network resources (e.g., computing resources and storage resources).
[0063] For example, client 110 sends a big data service request to computing cluster 120 via network 140. Big data services are called jobs. Jobs can be divided into multiple tasks, which are executed in parallel by multiple computing nodes. The completion of all tasks marks the completion of a job. A task is generally a processing step for a portion of data or a phase within a job. All tasks are scheduled and completed in parallel or serially.
[0064] In some embodiments, computing cluster 120 includes control nodes 122. Control nodes and computing nodes can be independent physical devices, and control nodes can also be referred to as control devices or named nodes. Computing nodes can also be referred to as computing devices or data nodes. Control nodes 122 are used to manage and allocate tasks or retrieval requests. Multiple computing nodes can execute multiple tasks or retrieval requests in parallel to increase data processing speed.
[0065] In an embodiment of the present application, the storage cluster 130 stores a database. For example, the database includes vectors after unstructured data is vectorized (embedding). Among them, the vectors contained in a database may be obtained after vectorizing the same type of unstructured data. Alternatively, the vectors contained in a database may be obtained after vectorizing different types of unstructured data. For example, the vectors contained in the database are all obtained after image vectorization. For another example, the vectors contained in the database are all obtained after video vectorization. For another example, the vectors contained in the database are all obtained after image and video vectorization. In addition, the dimensions of the vectors contained in a database are the same. The dimensions of the vectors contained in different databases may be the same or different.
[0066] The computing cluster 120 includes a heterogeneous computing architecture to provide high-performance computing. For example, the computing nodes 121 may include computing units with computing capabilities, such as a central processing unit (CPU), a graphics processing unit (GPU), a data processing unit (DPU), a neural processing unit (NPU), and an embedded neural-network processing unit (NPU), to provide high-performance computing.
[0067] Client 110 is installed with client program 111. Client 110 runs client program 111 to display a user interface (UI). User 150 operates the UI to submit a search request. For example, user 150 operates the UI to submit multiple search requests. After receiving the search request, compute node 121 loads a database from storage cluster 130, performs a search based on the database, and obtains search results that are close to or similar to the search request. In some embodiments, after receiving the search request, compute node 121 loads a database from storage cluster 130, the database including vectors, performs a vector search based on the database, and obtains vectors that are close to or similar to the search request.
[0068] In other embodiments, computing node 121 performs searches based on a heterogeneous computing architecture. After a first processor determines a database to be searched based on multiple search requests, it determines, based on characteristics of the database, whether the first processor executes a first portion of the multiple search requests, and whether the second processor executes a second portion of the multiple search requests. Specifically, the first processor executes the first portion of the search requests to obtain a first search result, and the second processor executes the second portion of the search requests to obtain a second search result. Finally, search results for the multiple search requests are obtained based on the first and second search results.
[0069] Optionally, the system administrator 160 can call the application platform interface (API) 112 or the command-line interface (CLI) interface 113 through the client 110 to configure system information, such as the retrieval strategy configured for the computing node provided in the embodiment of the present application.
[0070] FIG1 is merely a schematic diagram. The embodiments of this application do not limit the device connection method or number of devices in a data processing system. For example, a data processing system may include multiple clients. A client may connect to multiple computing nodes. Different clients may establish connections with different computing nodes.
[0071] It should be noted that the vector search function provided in this application can be implemented by a software system, by a hardware device, or by a combination of a software system and a hardware device.
[0072] In one possible implementation, a cloud service provider abstracts the search functionality into a cloud service and deploys it in a cloud data center. Users can consult and purchase this cloud service through the cloud service platform. After purchasing this cloud service, users can submit a search request to the cloud data center through their terminal devices. The cloud data center then runs a search module to implement the search functionality provided by this application.
[0073] In another possible implementation, the retrieval module can be encapsulated as a software package by a software provider. The user purchases the software package and deploys it on his own server, or the user deploys it on a cloud server. For example, the retrieval module is deployed by the tenant in the computing resources (such as a virtual machine) of the cloud data center rented by the tenant. The tenant purchases the computing resource cloud service provided by the cloud service provider through the cloud service platform, and runs the retrieval module in the purchased computing resources so that the retrieval module performs the retrieval function provided by this application. Optionally, the retrieval module can also encrypt the data uploaded by the user and the file path of the data, avoiding direct contact with the data uploaded by the user without hindering the implementation effect, thereby ensuring information security.
[0074] Next, the search process is described in detail with reference to the accompanying drawings.
[0075] FIG2 is a flow chart of a retrieval method provided by the present application. Here, the heterogeneous computing architecture included in a computer device is used as an example for explanation. Assume that the computer device includes a first processor and a second processor, and the first processor and the second processor constitute a heterogeneous computing architecture. The first processor senses the characteristics of the database to determine a retrieval scheme, and the first processor and the second processor perform retrieval based on the retrieval scheme. The first processor can be a CPU. The second processor can be a GPU. The client can be the client shown in FIG1 . The computer device can be a computing node in the computing cluster described in FIG1 . As shown in FIG2 , the method includes the following steps.
[0076] Step 210: The client sends a search request.
[0077] The client can send a search request to the computer device via a network between the client and the computer device. The network can be an internal network (such as a local area network) or the Internet.
[0078] A search request indicates a search requirement. For example, a search request might be searching for images, searching for videos, or searching for items. A search request can include images, videos, or text.
[0079] Step 220: The first processor determines the databases to be searched by the multiple search requests.
[0080] If the search request includes unstructured data, the first processor, upon receiving the search request, may convert the unstructured data into a vector using a deep coding model, and determine a database similar to the converted vector for retrieval. Alternatively, a control node in the system may also convert the unstructured data into a vector using a deep coding model.
[0081] If the search request includes a vector, the first processor determines to search a database similar to the converted vector after receiving the search request.
[0082] In some embodiments, the dimensions of the vectors indicated by the multiple search requests are the same, and the database is determined according to the dimensions of the vectors included in the search requests.
[0083] In other embodiments, the multiple search requests indicate identifiers of databases to be searched, and the first processor determines the databases to be searched by the multiple search requests based on the identifiers of the databases.
[0084] Step 230: Determine, based on the characteristics of the database, that the first processor executes a first portion of the multiple search requests, and that the second processor executes a second portion of the multiple search requests.
[0085] The first processor determines a search scheme based on characteristics of the database. The search scheme indicates the search request, database, and search algorithm that two different types of processors in the computing system use to perform searches. It is also understandable that the first processor determines a search scope based on characteristics of the database. The search scope indicates the scope of the database and the scope of the multiple search requests that the two different types of processors use to perform searches.
[0086] Solution 1: The first processor divides the database to be searched into two sub-databases according to the characteristics of the database, and the two processors perform searches based on different sub-databases, multiple search requests, and a search algorithm determined according to the characteristics of the database.
[0087] Solution 2: The first processor divides multiple search requests into a first part of search requests and a second part of search requests according to the characteristics of the database. The two processors perform searches based on different search requests, the databases to be searched, and the search algorithms determined according to the characteristics of the database.
[0088] In some embodiments, the first processor determines the search request and database based on which the first and second processors will perform the search based on attributes of the database. For example, the attributes include the size of the database. For example, the database size may refer to the vector dimensions and number of vectors in the database. Larger vector dimensions and a greater number of vectors indicate a larger database size. The first processor may determine the database and search algorithm based on which the first and second processors will perform the search based on the size of the database.
[0089] For example, when the computing power of a single processor in the computing system supports the size of the database, or the size of the database is less than or equal to the processing power of the first processor, the retrieval scheme is determined to divide multiple retrieval requests so that the first processor and the second processor perform retrieval based on different retrieval requests.
[0090] The scale of a database supported by the computing power of a single processor refers to whether the computing power of a single processor meets the computational requirements for performing searches based on the database. Alternatively, the storage capacity of the storage medium associated with a single processor meets the size of the database, and the database can be loaded onto the storage medium of a single processor. For example, the database can be loaded into the High Bandwidth Memory (HBM) of a GPU or the CPU memory, enabling retrieval of results from the database that are close to or similar to the search request.
[0091] Multiple search requests are divided into two parts, such as a first part of search requests and a second part of search requests. The first part of search requests and the second part of search requests constitute multiple search requests. For example, the multiple search requests are divided into the first part of search requests and the second part of search requests based on the processing capabilities of the first processor and the second processor. The two processors search for vectors that are close or similar to the search requests in different parts based on the same database. That is, the two processors perform searches based on different search requests.
[0092] Compared with using a single processor to retrieve close or similar search results from a database for multiple search requests, multiple search requests are divided and two processors are used to perform searches on the two parts of the search requests respectively, thereby effectively improving the search efficiency.
[0093] For example, when the computing power of a single processor in a heterogeneous retrieval architecture does not support the scale of the database, or the size of the database is larger than the processing capacity of the first processor, the retrieval solution is determined to be to partition the database so that the first processor and the second processor perform retrieval based on different sub-databases.
[0094] The computing power of a single processor cannot support the scale of the database. This means that the computing power of a single processor does not meet the computational requirements of performing a search based on the database. Alternatively, the storage capacity of the storage medium associated with the single processor does not meet the size of the database, and the database cannot be loaded onto the storage medium of the single processor. For example, the database cannot be loaded into the GPU's HBM or the CPU's memory. Retrieving results from the database that are close or similar to the search request may result in errors or downtime.
[0095] The database is divided into two parts, such as a first sub-database and a second sub-database, which together form the database. For example, the database is divided into the first sub-database and the second sub-database based on the capabilities of the first processor and the second processor. The two processors search for similar or similar results based on the same multiple search requests based on different databases. That is, the two processors perform searches based on different databases.
[0096] Optionally, before the first processor core and the second processor execute the retrieval of the multiple retrieval requests, the database is divided into the first sub-database and the second sub-database based on the capabilities of the first processor and the second processor. Alternatively, after the first processor receives the multiple retrieval requests, the database is divided into the first sub-database and the second sub-database based on the capabilities of the first processor and the second processor. This application does not limit the timing of dividing the database.
[0097] Compared with using a single processor to retrieve search results that are close or similar to multiple search requests from the database, multiple databases are divided, and two processors are used to perform searches on multiple search requests based on two parts of the database respectively, thereby effectively improving the search efficiency without the need to expand hardware and reducing costs.
[0098] In other embodiments, the retrieval algorithm used by the first and second processors to perform the search is determined based on the distribution characteristics of the database. Compared to performing a search based on a single retrieval algorithm or randomly selecting a retrieval algorithm, performing a search based on a retrieval algorithm determined based on the distribution characteristics of the database effectively improves search accuracy.
[0099] Distribution characteristics include central tendency, dispersion, and shape. Central tendency reflects the degree to which data points converge or cluster around the central value. Dispersion reflects the tendency of data points to move away from the central value. The shape of the distribution reflects the skewness and kurtosis of the data distribution.
[0100] Relatively speaking, central tendency is also known as the "center of the data" or "central quantity." It represents the representative value of a set of data. The concept of central tendency is similar to that of the average. It can represent a certain characteristic of the population and indicate the common nature and general level of the public opinion phenomenon under study under certain time and space conditions.
[0101] In the embodiment of the present application, the distribution characteristics include random distribution, dense distribution and sparse distribution.
[0102] In some embodiments, the first processor determines the distribution feature based on statistical features and attributes of the database, wherein the statistical feature includes at least one of a mean, a standard deviation, or a variance of the database.
[0103] When the distribution characteristics are random, the retrieval algorithm is determined to be an exact retrieval algorithm. Exact retrieval algorithms include brute force retrieval algorithms. Because randomly distributed data has poor regularity, performing retrieval based on an exact retrieval algorithm ensures that possible results are retrieved. Compared to approximate retrieval algorithms, this algorithm avoids missed results, thereby improving retrieval accuracy.
[0104] When the distribution characteristics are dense or sparse, the retrieval algorithm is determined to be an approximate retrieval algorithm. For example, approximate retrieval algorithms include tree-based vector retrieval (such as Annoy, KD-Tree), space partitioning-based vector retrieval (such as LSH), graph-based vector retrieval (such as NSW, HNSW), and quantization coding-based vector retrieval (such as SQ, PQ). Due to the regularity of densely distributed or sparsely distributed data, performing retrieval based on an approximate retrieval algorithm ensures that possible results can be retrieved. Compared with the exact retrieval algorithm, the retrieval accuracy is ensured to reduce the amount of calculation.
[0105] For example, for searching high-dimensional vectors, a graph-based vector search can be used to perform vector search. For searching high-dimensional vectors, a space-partition-based vector search can be used to perform vector search.
[0106] For another example, for vectors of integer data, vector retrieval based on space partitioning can be used to perform vector retrieval.
[0107] Optionally, the database may be searched based on a user-specified search algorithm. For example, multiple search algorithms may be determined based on the distribution characteristics of the database, and the user-specified search algorithm may be determined from the multiple search algorithms. For example, the user-specified search algorithm may be determined from multiple approximate search algorithms.
[0108] Optionally, the retrieval algorithms used by the first processor and the second processor to perform the retrieval may be the same or different.
[0109] In some embodiments, the first processor may instruct the second processor to execute the database and search request based on which the search is performed. For example, in a partitioned search request scheme, the first processor performs a search of the first part of the search request on the database, and the first processor may send the second part of the search request to the second processor; the first processor performs a search of the second part of the search request on the database, and the first processor may send the first part of the search request to the second processor.
[0110] For another example, in a partitioned database scheme, the first processor performs a search for multiple search requests on the first sub-database, and the first processor instructs the second processor to perform a search for multiple search requests based on the second sub-database; the first processor performs a search for multiple search requests on the second sub-database, and the first processor instructs the second processor to perform a search for multiple search requests based on the first sub-database.
[0111] Step 240: The first processor executes the first partial search request to obtain a first search result.
[0112] The first processor performs a search according to the database, search request and search algorithm indicated by the search plan, and obtains a first search result.
[0113] The search plan indicates a database partitioning plan. For example, the search plan indicates a first sub-database on which the first processor performs a search. The first processor performs a search based on the first sub-database according to a search algorithm and multiple search requests to obtain a first search result. The first search result includes search results similar to the multiple search requests.
[0114] The first processor queries the first sub-database for the first part of the search request and obtains a first search result. For example, assume that the database includes 1 million vectors, each of which has a dimension of 128. The first sub-database includes 500,000 vectors, and the second sub-database includes 500,000 vectors. A vector search is required for 100 search requests, each of which has a dimension of 128. The first processor searches the 100 search requests based on the 500,000 vectors and obtains a first search result, which includes search results similar to the 100 search requests.
[0115] The search plan indicates the division of the multiple search requests. For example, the search plan instructs the first processor to execute a first portion of the search request according to which the search is performed. The first processor performs a search based on the database according to the search algorithm and the first portion of the search request to obtain a first search result. The first search result includes search results similar to the first portion of the search request.
[0116] The first processor queries the database for the first portion of search requests and obtains a first search result. For example, assume that the database includes 1 million vectors, each of which has a dimension of 128. A vector search is required for 100 search requests, each of which has a dimension of 128. The first portion of search requests includes 50 search requests, and the second portion of search requests includes 50 search requests. The first processor searches the 50 search requests based on the 1 million vectors and obtains a first search result, which includes search results similar to the 50 search requests.
[0117] Step 250: The second processor executes the second partial search request to obtain a second search result.
[0118] The second processor performs a search according to the database, search request and search algorithm indicated by the search plan, and obtains a second search result.
[0119] The search plan indicates a database partitioning scheme. For example, the search plan indicates a second sub-database on which the second processor performs a search. The second processor performs a search based on the second sub-database according to a search algorithm and multiple search requests to obtain second search results. The second search results include search results similar to the multiple search requests. The second processor searches the second sub-database for a second portion of the search request to obtain the second search results.
[0120] The search plan instructs the division of the search request into multiple parts. For example, the search plan instructs the second processor to execute a search based on a second portion of the search request. The second processor searches the database based on the search algorithm and the second portion of the search request to obtain a second search result. The second search result includes search results similar to the second portion of the search request. The second processor queries the database for the second portion of the search request to obtain the second search result.
[0121] Step 260: The first processor obtains search results of multiple search requests according to the first search result and the second search result.
[0122] The search scheme indicates a database partitioning scheme, and the first search results and the second search results each include two possible search results for the multiple search requests. The first processor then selects search results similar to the search request from the first search results and the second search results to determine the search results for the multiple search requests. That is, the search results for the multiple search requests may be selected from the first search results and the second search results based on similarity. For example, the first search results and the second search results may be compared to select a vector that is closer or more similar to the search request.
[0123] Assume that vector retrieval needs to be performed on 10 retrieval requests. The first processor performs vector retrieval on 3 retrieval requests, and the first retrieval result includes the retrieval results of the 3 retrieval requests. The second processor performs vector retrieval on the 3 retrieval requests, and the second retrieval result includes the retrieval results of the 3 retrieval requests. Comparing the first retrieval result and the second retrieval result, if the result of the 1st retrieval request in the first retrieval result is closer or more similar to the 1st retrieval request than the result of the 1st retrieval request in the second retrieval result, the result of the 2nd retrieval request in the first retrieval result is closer or more similar to the 1st retrieval request than the result of the 2nd retrieval request in the second retrieval result, and the result of the 3rd retrieval request in the second retrieval result is closer or more similar to the 1st retrieval request than the result of the 3rd retrieval request in the first retrieval result, then the retrieval results of the 3 retrieval requests include the result of the 1st retrieval request in the first retrieval result, the result of the 2nd retrieval request in the first retrieval result, and the result of the 3rd retrieval request in the second retrieval result.
[0124] The retrieval scheme indicates that multiple retrieval requests are divided, and the first retrieval result and the second retrieval result respectively include part of the retrieval results of the multiple retrieval requests. The first processor then merges the first retrieval result and the second retrieval result, and the retrieval results of the multiple retrieval requests include the first retrieval result and the second retrieval result.
[0125] For example, taking the sift1M dataset as an example, the dataset includes 1 million vectors, each with a dimension of 128. Vector searches need to be performed on 100 search requests, each with a dimension of 128. The first processor performs vector searches on the first through 50th search requests, and the first search results include the search results for the first through 50th search requests. The second processor performs vector searches on the 51st through 100th search requests, and the second search results include the search results for the 51st through 100th search requests. The first and second search results are merged to obtain the search results for the 100 search requests.
[0126] Optionally, the first processor may also feed back retrieval results of multiple retrieval requests, and the client displays the retrieval results of the multiple retrieval requests.
[0127] It should be noted that the above embodiment uses two processors executing a search in parallel as an example. In some embodiments, a search can also be executed in parallel based on three or more processors. Specifically, the database can be divided into three or more parts, or multiple search requests can be divided into three or more parts. The search results of the three or more processors executing the search can be merged, or the better search result can be selected from the search results of the three or more processors executing the search. This can improve search efficiency. The division method can be referred to the description of the above embodiment and will not be elaborated on here.
[0128] The application scenarios of the search method provided in the embodiments of the present application include but are not limited to the following scenarios:
[0129] Recommendation scenario: Based on the parallel retrieval of heterogeneous computing architecture, multi-source heterogeneous data such as user behavior, product attributes, and content features are retrieved and matched to improve the effectiveness and performance of the recommendation system, thereby increasing user satisfaction and retention rate.
[0130] Internet scenarios: Retrieve and analyze multimedia data such as web pages, text, images, and videos based on parallel retrieval in heterogeneous computing architectures, improve the ability to obtain and understand Internet information, and support various business scenarios such as search, advertising, and social networking.
[0131] Large model scenarios: Retrieve and optimize large-scale deep learning model parameters based on parallel retrieval in heterogeneous computing architectures, improve the training and deployment efficiency of large models, and reduce the computing and storage costs of large models.
[0132] As the amount of data and data dimensions of a database grow, more storage and computing resources are needed. For example, taking a database containing 100 million 1024-dimensional vectors as an example, the graph index construction for vector retrieval may occupy about 350 gigabytes (GB) of storage capacity. A single processor cannot carry such a large-scale database, and the computational complexity of performing retrieval based on a large-scale database is huge, which cannot meet high concurrency requirements. In order to solve the problem of large-scale databases and high-concurrency vector retrieval, hardware can be expanded, but this leads to increased hardware costs. If the database is compressed based on quantization and compression technology, the retrieval accuracy is reduced. For example, taking the IVFPQ algorithm as an example, the higher the model compression rate, the lower the algorithm accuracy. Therefore, the retrieval method provided in the embodiment of the present application determines whether to divide the database or divide multiple retrieval requests based on the characteristics of the database, so that two processors perform retrieval on multiple retrieval requests in parallel based on different databases or different retrieval requests, and retrieve the retrieval results of multiple retrieval requests more quickly. Therefore, there is no need to expand the hardware, and the retrieval is performed in parallel based on a heterogeneous computing architecture, achieving efficient retrieval on databases of different sizes, improving the utilization rate of processor computing power and the retrieval rate. In addition, determining the retrieval algorithm based on the distribution characteristics of the database effectively improves the retrieval accuracy compared to performing the retrieval based on a retrieval algorithm or randomly selecting a retrieval algorithm.
[0133] The vector search process is described below with reference to the accompanying drawings.
[0134] Figure 3 is a schematic diagram of a vector search based on a heterogeneous computing architecture provided by this application. The heterogeneous computing architecture includes a CPU 310 and an NPU 320. CPU 310 is responsible for index construction and resource scheduling. Index construction can refer to recalculating vectors into vector indexes. Resource scheduling can refer to the database, multiple search requests, and search algorithms based on which the processor performs vector searches. CPU 310 and NPU 320 perform vector searches, fully utilizing their computing power.
[0135] The CPU 310 and the NPU 320 first process the query data, for example, pre-process the retrieval request.
[0136] 1) The CPU 310 reads the database and determines whether to partition the database or partition the search request based on the data size, data distribution, and demand constraints.
[0137] 2) The CPU 310 selects different partitioning schemes based on data scale perception and performs parallel vector retrieval based on the heterogeneous computing architecture.
[0138] 3) The CPU 310 adaptively determines the retrieval algorithm by sensing the data distribution and selects a retrieval algorithm with affinity computing power.
[0139] 4) The CPU 310 determines the final search solution based on the requirements.
[0140] 5) The NPU 320 performs vector search based on the approximate search algorithm 1. The CPU 310 performs vector search based on the approximate search algorithm 2.
[0141] 6) The CPU 310 determines the retrieval results of the plurality of retrieval requests based on the retrieval results of the NPU 320 and the retrieval results of the CPU 310 .
[0142] FIG4 is a schematic diagram of a data-awareness-based retrieval solution provided in this application.
[0143] Data scale awareness is used to determine the partitioning scheme based on the size of the database. For example, for a large database, the partitioning scheme is to partition the database, while for a small database, the partitioning scheme is to partition the search requests.
[0144] Data distribution awareness is used to determine a retrieval algorithm based on the database's distribution characteristics. For example, the distribution characteristics are determined based on the database's statistical characteristics and attributes, and the retrieval algorithm is determined based on the distribution characteristics. Statistical characteristics include at least one of the database's mean, standard deviation, or variance. Attributes include vector dimension, number of vectors, and vector format. When the distribution characteristics are random, the retrieval algorithm is determined to be a brute force retrieval algorithm. When the distribution characteristics are dense, the retrieval algorithm is determined to be a vector retrieval based on spatial partitioning. When the distribution characteristics are sparse, the retrieval algorithm is determined to be a vector retrieval based on spatial partitioning or a graph-based vector retrieval.
[0145] Requirement-limited awareness is used to indicate whether to perform retrieval based on an exact retrieval algorithm or an approximate retrieval algorithm.
[0146] Figure 5 is a schematic diagram of a search scheme provided by this application. As shown in Figure 5 (a), the partitioning scheme is to partition the database. The database to be searched (ALLBase) is divided according to a partitioning ratio parameter (ratio), resulting in database 1 (base1) and database 2 (base2).
[0147] The database 1 is used as the database for the CPU to perform retrieval. The CPU obtains the corresponding CPU-affinity index by training the database 1 and stores it in a memory associated with the CPU.
[0148] The database 2 is used as the database for the NPU to perform retrieval. The NPU obtains the index of the corresponding affinity NPU by training the database 2 and stores it in the memory associated with the NPU.
[0149] Optionally, building the training database 1 and training the database 2 can be performed before partitioning the database, i.e., the database can be trained to obtain an index of the database. Partitioning the database can refer to partitioning the trained database. Training the database can refer to converting the database into an index structure suitable for querying. For example, performing a hash operation on the database to obtain a hash index.
[0150] During the retrieval phase, the CPU searches database 1 for the requested data and obtains retrieval result 1. The NPU searches database 2 for the requested data and obtains retrieval result 2. Based on the similarity, the retrieval result that is closer or more similar to the requested data is selected from retrieval result 1 and retrieval result 2.
[0151] As shown in (b) of Figure 5, the partitioning scheme is to partition the search request. The CPU and NPU perform vector search based on the database to be searched (ALLBase).
[0152] The database (ALLBase) is used as the database for CPU to perform retrieval. The CPU obtains the index of the corresponding affinity CPU by training the database and stores it in the memory associated with the CPU.
[0153] The database (ALLBase) is used as the database for the NPU to perform retrieval. The NPU obtains the index of the corresponding affinity CPU by training the database and stores it in the memory associated with the CPU.
[0154] In the retrieval phase, multiple retrieval requests (ALLQuery) are divided according to a division ratio parameter (ratio) to obtain retrieval request 1 (query1) and retrieval request 2 (query2). Query request 1 and retrieval request 2 may include one or more retrieval requests.
[0155] The CPU executes a search for search request 1 based on the index of the database constructed by the CPU to obtain search result 1. The NPU executes a search for search request 2 based on the index of the database constructed by the NPU to obtain search result 2. Search result 1 and search result 2 are combined to obtain the search result of the search request (ALLQuery).
[0156] It is understandable that in order to implement the functions in the above embodiments, the client and server (such as a storage server) include hardware structures and / or software modules corresponding to the execution of each function. It should be readily apparent to those skilled in the art that, in combination with the units and method steps of each example described in the embodiments disclosed in this application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.
[0157] The above description is in detail based on the search method provided by the present application in conjunction with Figures 1 to 5. The following description is based on the device provided by the present application in conjunction with Figure 6. These devices can be used to implement the functions of the computer device in the above method embodiment, and thus can also achieve the beneficial effects of the above method embodiment. In this embodiment, the device can be a computing node or control node as shown in Figure 2, or a module (such as a chip) applied to a computer device.
[0158] As shown in Figure 6, the retrieval device 600 includes a communication module 610, a data sensing module 620, a data retrieval module 630, and a storage module 640. The retrieval device 600 is used to implement the functions of the computer device in the method embodiment shown in Figure 2 above.
[0159] The communication module 610 is used to obtain multiple search requests.
[0160] The data sensing module 620 is used to determine the database to be searched based on the multiple search requests. For example, the data sensing module 620 is used to execute step 220 in FIG. 2 .
[0161] The data sensing module 620 is further configured to determine, based on characteristics of the database, that the first processor executes a first portion of the plurality of search requests, and that the second processor executes a second portion of the plurality of search requests. For example, the data sensing module 620 is configured to execute step 230 in FIG. 2 .
[0162] The data perception module 620 is specifically used to send multiple search requests to the first processor and the second processor respectively when the size of the database is greater than the processing capacity of the first processor. The first part of the search request and the second part of the search request are both multiple search requests.
[0163] The data perception module 620 is specifically configured to divide the database into a first sub-database and a second sub-database according to the capabilities of the first processor and the second processor.
[0164] The data perception module 620 is specifically used to divide multiple search requests into a first part of search requests and a second part of search requests according to the processing capabilities of the first processor and the second processor when the size of the database is less than or equal to the processing capability of the first processor.
[0165] The data perception module 620 is also used to perform demand-limited perception, that is, to determine the retrieval algorithm based on the distribution characteristics of the database; the first processor executes the first part of the retrieval request according to the retrieval algorithm to obtain the first retrieval result, and the second processor executes the second part of the retrieval request according to the retrieval algorithm to obtain the second retrieval result.
[0166] The data retrieval module 630 is configured to execute the first partial retrieval request to obtain a first retrieval result and execute the second partial retrieval request to obtain a second retrieval result. For example, the data retrieval module 630 is configured to execute steps 240 and 250 in FIG. 2 .
[0167] The data retrieval module 630 is further configured to obtain retrieval results of multiple retrieval requests based on the first retrieval result and the second retrieval result. For example, the data retrieval module 630 is configured to execute step 260 in FIG2 .
[0168] The storage module 640 is used to store the database and the search algorithm to facilitate the search. The storage module 640 can also store the search results.
[0169] It should be understood that the search device 600 of the embodiment of the present application can be implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD), wherein the PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. Alternatively, when the search method shown in FIG. 2 is implemented by software, the search device 600 and its modules can also be software modules.
[0170] According to the embodiment of the present application, the retrieval device 600 may correspond to executing the method described in the embodiment of the present application, and the above-mentioned and other operations and / or functions of each unit in the retrieval device 600 are respectively for implementing the corresponding processes of each method in Figure 2. For the sake of brevity, they are not repeated here.
[0171] FIG7 is a schematic diagram of the structure of a computer device 700 provided in this application. As shown in FIG7 , computer device 700 includes a processor 710, a bus 720, a memory 730, a communication interface 740, a memory 750 (also referred to as a main memory unit), and a processor 760. Processor 710, processor 760, memory 730, memory 750, and communication interface 740 are connected via bus 720.
[0172] It should be understood that in this embodiment, the processor 710 may be a CPU, but may also be other general-purpose processors, digital signal processors (DSP), ASICs, FPGAs or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0173] The computer device 700 may also include a graphics processing unit (GPU), a neural network processing unit (NPU), a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the program of the present application. For example, the processor 760 may be a GPU or an NPU.
[0174] Communication interface 740 is used to enable communication between computer device 700 and external devices or components. In this application, when computer device 700 is used to implement the client functionality shown in FIG. 2 , communication interface 740 is used to send a search request, thereby facilitating the joint search execution of processor 710 and processor 760. When computer device 700 is used to implement the functionality shown in FIG. 2 , communication interface 740 is used to receive a search request, thereby facilitating the joint search execution of processor 710 and processor 760.
[0175] The bus 720 may include a path for transmitting information between the above-mentioned components (such as the processor 710, the memory 750, and the storage 730). In addition to the data bus, the bus 720 may also include a power bus, a control bus, and a status signal bus. However, for the sake of clarity, various buses are labeled as bus 720 in FIG7. The bus 720 may be a Peripheral Component Interconnect Express (PCIe) bus, an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus 720 can be divided into an address bus, a data bus, a control bus, etc.
[0176] As an example, computer device 700 may include multiple processors. The processor may be a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and / or computing units for processing data (e.g., computer program instructions).
[0177] It is worth noting that FIG7 only takes the computer device 700 including one processor 710 and one memory 730 as an example. Here, the processor 710 and the memory 730 are respectively used to indicate a type of device or equipment. In a specific embodiment, the number of each type of device or equipment can be determined according to business requirements.
[0178] Memory 750 may be a volatile memory pool or a nonvolatile memory pool, or may include both volatile and nonvolatile memory. Nonvolatile memory may be read-only memory (ROM), programmable ROM (PROM), erasable programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM may be used, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced synchronous DRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus RAM (DR RAM). Memory 750 is used to store databases, search algorithms, search results, etc.
[0179] The memory 730 may correspond to a storage medium used to store information such as a database and a retrieval algorithm in the above method embodiment, for example, a disk such as a mechanical hard disk or a solid-state drive.
[0180] The computer device 700 may be a general-purpose device or a dedicated device. For example, the computer device 700 may be an edge device (e.g., a box carrying a chip with processing capabilities). Alternatively, the computer device 700 may be a server or other device with computing capabilities.
[0181] It should be understood that the computer device 700 according to this embodiment may correspond to the retrieval device 600 in this embodiment, and may correspond to executing the corresponding subject in any method in Figure 2, and the above-mentioned and other operations and / or functions of each module in the retrieval device 600 are respectively for realizing the corresponding processes of each method in Figure 2. For the sake of brevity, they will not be repeated here.
[0182] The method steps in this embodiment can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and storage medium can be located in an ASIC. In addition, the ASIC can be located in a computing device. Of course, the processor and storage medium can also exist as discrete components in a computing device.
[0183] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the process or function described in the embodiments of the present application is performed in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device. The computer program or instruction can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer program or instruction can be transmitted from one website, computer, server or data center to another website, computer, server or data center via wired or wireless means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, a hard disk, or a tape; it can also be an optical medium, such as a digital video disc (DVD); it can also be a semiconductor medium, such as a solid state drive (SSD). The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present application, and such modifications or substitutions should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A search method, characterized in that: Applied to a computing system, the computing system includes a first processor and a second processor, the method includes: The first processor determines a database to be searched by a plurality of search requests; Determine, according to the characteristics of the database, that the first processor executes a first part of the plurality of retrieval requests, and the second processor executes a second part of the plurality of retrieval requests; The first processor executes the first part of the search request to obtain a first search result, and the second processor executes the second part of the search request to obtain a second search result; The search results of the multiple search requests are obtained according to the first search result and the second search result.
2. The method according to claim 1, characterized in that The determining, according to the characteristics of the database, that the first processor executes a first part of the plurality of retrieval requests, and the second processor executes a second part of the plurality of retrieval requests comprises: When the size of the database is greater than the processing capability of the first processor, the multiple search requests are sent to the first processor and the second processor respectively, and the first partial search request and the second partial search request are both the multiple search requests.
3. The method according to claim 2, characterized in that The method includes dividing the database into a first sub-database and a second sub-database according to the capabilities of the first processor and the second processor; The first processor executes the first part of the search request to obtain a first search result, and the second processor executes the second part of the search request to obtain a second search result, including: The first processor queries the first sub-database for the first partial search request to obtain the first search result, and the second processor queries the second sub-database for the second partial search request to obtain the second search result.
4. The method according to claim 3, characterized in that The retrieval results of the multiple retrieval requests obtained according to the first retrieval result and the second retrieval result include: The search results of the plurality of search requests are determined by selecting search results similar to the search request from the first search results and the second search results.
5. The method according to claim 1, characterized in that The determining, according to the characteristics of the database, that the first processor executes a first part of the plurality of retrieval requests, and the second processor executes a second part of the plurality of retrieval requests comprises: When the size of the database is less than or equal to the processing capability of the first processor, the multiple search requests are divided into the first part of search requests and the second part of search requests according to the processing capabilities of the first processor and the second processor.
6. The method according to claim 5, characterized in that The first processor executes the first part of the search request to obtain a first search result, and the second processor executes the second part of the search request to obtain a second search result, including: The first processor queries the database for the first partial search request to obtain the first search result, and the second processor queries the database for the second partial search request to obtain the second search result.
7. The method according to claim 3 or 6, characterized in that: The first processor executes the first part of the search request to obtain a first search result, and the second processor executes the second part of the search request to obtain a second search result, including: Determining a retrieval algorithm according to the distribution characteristics of the database; The first processor executes the first partial search request according to the search algorithm to obtain a first search result, and the second processor executes the second partial search request according to the search algorithm to obtain a second search result.
8. The method according to claim 7, characterized in that Determining a retrieval algorithm according to the distribution characteristics of the database includes: When the distribution feature is a random distribution, determining that the retrieval algorithm is an accurate retrieval algorithm; When the distribution feature is dense distribution or sparse distribution, it is determined that the retrieval algorithm is an approximate retrieval algorithm.
9. The method according to claim 7 or 8, characterized in that: The method further comprises: The distribution characteristics are determined according to statistical characteristics and attributes of the database.
10. A computer device, characterized in that: The computer device includes a memory and multiple different types of processors, the memory is used to store a set of computer instructions; when the processor executes the set of computer instructions, the multiple different types of processors jointly execute the operating steps of any one of the methods described in claims 1-9.
Citation Information
Patent Citations
Retrieval method and computer equipment
CN119226428A
Database querying method and apparatus
CN105404690A
SQL-based resource allocation method and apparatus, and electronic device
CN110362404A
Database access operation deployment method and device and database access method and device
CN111198766A
Database query method and device, equipment and storage medium
CN113051068A