Data exporting method and device, computer readable storage medium, and electronic device
By rationally allocating tasks across multiple task processing servers and utilizing hash space ring mapping and state management, the problem of insufficient server performance was solved, improving data export efficiency and user experience.
Patent Information
- Application Number
- CN202111223083.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-20
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2041-10-20
AI Technical Summary
In existing technologies, as the number of data export requests increases or the data volume grows, server performance becomes insufficient, leading to data export request timeouts and reduced user experience.
By determining the execution mapping relationship between data export requests and multiple task processing servers, the task processing servers are allocated reasonably. The hash space ring is used for mapping to avoid overloading a single server. Furthermore, data export efficiency is ensured through state management and dynamic adjustment of server resources.
It improved the efficiency of data export, avoided server resource shortages and the impact on other businesses, and enhanced the user experience.
Smart Images

Figure CN113971170B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and particularly relates to a data export method and device, a computer readable storage medium and an electronic device. BACKGROUND
[0002] With the development of computer technology, along with the advent of the era of big data, data needs to be collected, stored, exported and analyzed.
[0003] In the related art, the backend server processes all received data export requests by starting multiple threads, and finally the result of data export is directly returned to the front-end browser. With the increase in the number of data export requests, or with the increase in the amount of data to be exported, the server performance is obviously insufficient, resulting in request timeout of the data export request, increasing the data export time and the possibility of not being able to export data, and thus reducing the user experience of exporting data.
[0004] Therefore, there is an urgent need in the art to develop a new data export method and device.
[0005] It should be noted that the information disclosed in the above background section is only used to strengthen the understanding of the background of the present disclosure, and therefore can include information that does not constitute prior art known to those of ordinary skill in the art. SUMMARY
[0006] The purpose of the present disclosure is to provide a data export method, a data export device, a computer readable storage medium and an electronic device, and to at least partially overcome the problem of long time for exporting data caused by the related art.
[0007] Other characteristics and advantages of the present disclosure will become apparent from the following detailed description, or will be learned by practice of the present disclosure.
[0008] According to a first aspect of the embodiments of the present disclosure, a data export method is provided, the method comprising: receiving a plurality of data export requests sent by a front end, and determining a task identifier corresponding to each data export request; determining, according to the task identifier, a task processing server having an execution mapping relationship with each data export request from a plurality of task processing servers; wherein the task processing server is a server in the backend server for processing the data export request; and executing the data export request by using the task processing server to obtain a data export address, and sending the data export address to the front end.
[0009] In an example embodiment of the present application, the determining the task identifier corresponding to each data export request comprises: determining login information and export parameters from the data export request; if the login information satisfies a verification condition and there is to-be-exported data corresponding to the export parameters, determining the task identifier corresponding to each data export request; if the login information does not satisfy the verification condition or there is no to-be-exported data corresponding to the export parameters, generating prompt information prompting that the data export request fails, and sending the prompt information to the front end.
[0010] In an example embodiment of the present application, the determining the task processing server having an execution mapping relationship with the data export request from the task processing servers comprises: performing hash calculation on the task identifier to obtain a calculation result, and mapping the data export request to a hash space ring according to the calculation result; wherein the hash space ring also maps the task processing servers; and determining the task processing server having an execution mapping relationship with the data export request from the task processing servers according to a first mapping position of the data export request on the hash space ring and a second mapping position of the task processing server on the hash space ring.
[0011] In an example embodiment of the present application, the mapping the data export request to the hash space ring according to the calculation result comprises: determining a service type corresponding to the task identifier, and obtaining a mapping weight corresponding to the service type; and performing calculation on the calculation result by using the mapping weight to obtain an updated calculation result, so as to map the data export request to the hash space ring according to the updated calculation result.
[0012] In an example embodiment of the present application, the sending the data export address to the front end comprises: sending a second state to the front end; wherein the second state is a state indicating that an export task has been completed, and the export task corresponds to the task identifier; obtaining a data export address request sent by the front end, and sending the data export address corresponding to the data export address request to the front end.
[0013] In an example embodiment of the present application, before the second state is sent to the front end, the method further comprises: if the task processing server having the execution mapping relationship with the data export request is determined in the plurality of task processing servers, sending the first state to the front end; wherein the first state is a state indicating that the export task is being processed; obtaining a state query request sent by the front end at a preset time interval; wherein the state query request is used to query the state of the export task, and the state query request is sent by the front end in response to the received first state; querying the state corresponding to the export task, and if the state changes from the first state to the second state, sending the second state to the front end and removing the export task.
[0014] In an example embodiment of the present application, the method further comprises: calculating a maintenance time of the state of the export task maintained in the first state; if the maintenance time is greater than or equal to a time threshold, increasing the number of task processing servers, and performing hash calculation on the server identifiers of the increased task processing servers to obtain a hash calculation result; updating the mapping relationship between the increased task processing servers and the hash space ring according to the hash calculation result, so as to determine the task processing server having the execution mapping relationship with the data export request in the plurality of task processing servers again; wherein the hash space ring is used to determine the task processing server having the execution mapping relationship with the data export request in the plurality of task processing servers.
[0015] According to a second aspect of the embodiments of the present application, a data export device is provided, which comprises: a receiving module configured to receive a plurality of data export requests sent by a front end and determine a task identifier corresponding to each of the data export requests; a determining module configured to determine a task processing server having an execution mapping relationship with each of the data export requests in a plurality of task processing servers according to the task identifier; wherein the task processing server is a server in the back end server processing the data export request; and an executing module configured to execute the data export request by using the task processing server to obtain a data export address, and send the data export address to the front end.
[0016] According to a third aspect of the embodiments of the present application, an electronic device is provided, which comprises: a processor and a memory; wherein the memory has stored computer readable instructions, and the computer readable instructions are executed by the processor to implement the data export method of any of the example embodiments.
[0017] According to a fourth aspect of the embodiments of the present application, a computer readable storage medium is provided, which stores a computer program. The computer program is executed by a processor to implement the data export method in any of the above example embodiments.
[0018] According to the above technical solution, the data export method, the data export device, the computer storage medium and the electronic device in the example embodiments of the present application have at least the following advantages and positive effects:
[0019] In the method and device provided in the example embodiments of the present application, on the one hand, the task processing server having the execution mapping relationship with the data export request can be determined in the plurality of task processing servers, so that the situation that all data export requests are processed by the same task processing server is avoided. Moreover, through the execution mapping relationship, the corresponding task processing server can be reasonably allocated for each data export request. Even if the number of data export requests is too large, the problem of insufficient server resources and long data export time will not occur, and the efficiency of data export is improved. On the other hand, the task processing server is the server in the back-end server processing the data export request, and the data export request is decoupled from other businesses, so that the influence of the data export request on other businesses is avoided.
[0020] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0021] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0022] Figure 1 The flowchart schematically shows the data export method in the embodiments of the present disclosure;
[0023] Figure 2 The flowchart schematically shows the process of determining the task identifier corresponding to the data export request in the data export method in the embodiments of the present disclosure;
[0024] Figure 3 The flowchart schematically shows the process of determining the processing task server having the execution mapping relationship with the data export request in the embodiments of the present disclosure;
[0025] Figure 4 The structural diagram of the hash space ring in the embodiments of the present disclosure is schematically shown;
[0026] Figure 5 A flowchart schematically showing mapping of a data export request to a hash space ring in an embodiment of the present disclosure is shown;
[0027] Figure 6 A front-end browser page schematic diagram in an embodiment of the present disclosure is shown schematically;
[0028] Figure 7 A front-end browser page schematic diagram after sending a data export address to the front end in an embodiment of the present disclosure is shown schematically;
[0029] Figure 8 A flowchart schematically showing sending of a data export address to the front end in an embodiment of the present disclosure is shown;
[0030] Figure 9 A flowchart schematically showing sending of a second state to the front end in an embodiment of the present disclosure is shown;
[0031] Figure 10 A flowchart schematically showing re-determination of a task processing server having an execution mapping relationship with a data export request in an embodiment of the present disclosure is shown;
[0032] Figure 11 A system architecture diagram in a data export method in an application scenario in an embodiment of the present disclosure is shown schematically;
[0033] Figure 12 A flowchart schematically showing a data export method in an application scenario in an embodiment of the present disclosure is shown;
[0034] Figure 13 A structure schematic diagram of a data export device in an application scenario in an embodiment of the present disclosure is shown schematically;
[0035] Figure 14 An electronic device for a data export method in an embodiment of the present disclosure is shown schematically;
[0036] Figure 15 A computer readable storage medium for a data export method in an embodiment of the present disclosure is shown schematically. DETAILED DESCRIPTION
[0037] Example implementations are now described with reference to the drawings. Example implementations can, however, be implemented in many different forms and should not be construed as limited to the examples set forth herein; rather, these implementations are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the example implementations to those skilled in the art. The features, structures, or characteristics described in connection with the examples can be combined in any suitable manner in one or more implementations. In the following description, numerous specific details are provided, in order to provide a thorough understanding of the example implementations. One skilled in the relevant art will recognize, however, that the implementations can be practiced without one or more of the specific details, or with other methods, components, materials, and so forth. In other instances, well-known structures have not been described in detail in order to avoid obscuring the
[0038] The terms "one", "a", "an", and "the" as used herein mean "at least one" or "one or more" unless expressly specified otherwise. The term "includes" means "includes without limitation" and the term "including" means "including without limitation". The term "coupled" means directly or indirectly connected, without necessarily being in physical contact, and the term "connected" means physically, logically, or communicatively connected.
[0039] In addition, the accompanying drawings are included to provide a thorough understanding of the present disclosure and are not intended to be exhaustive or to limit the present disclosure to a specific form. The same reference numbers in different drawings identify the same or similar elements, and thus repeated description of these reference numbers will be omitted. Some of the block diagrams in the drawings are functional entities, and do not necessarily correspond to physical or logical independent entities.
[0040] To solve the problems in the related art, the present disclosure provides a data export method. Figure 1 A flowchart of the data export method is shown as Figure 1 The data export method includes at least the following steps:
[0041] Step S110. Receive a plurality of data export requests sent by the front end, and determine a task identifier corresponding to each data export request.
[0042] Step S120. According to the task identifier, determine a task processing server having an execution mapping relationship with each data export request from a plurality of task processing servers; wherein the task processing server is a server in the back end server processing the data export request.
[0043] Step S130. Execute the data export request by using the task processing server to obtain a data export address, and send the data export address to the front end.
[0044] In the method and device provided in the example embodiments of the present disclosure, on the one hand, the task processing server that has an execution mapping relationship with the data export request can be determined among the plurality of task processing servers, so that the situation that all data export requests are processed by the same task processing server is avoided, and through the execution mapping relationship, the corresponding task processing server can be reasonably allocated for each data export request, so that even if the number of data export requests is too large, the problem of insufficient server resources and long data export time does not occur, and the efficiency of data export is improved; on the other hand, the task processing server is a server in the back-end server that processes data export requests, and the data export request is decoupled from other businesses, so that the influence of the data export request on other businesses is avoided.
[0045] The steps of the data export method will be described in detail below.
[0046] In step S110, a plurality of data export requests sent by the front end are received, and a task identifier corresponding to each data export request is determined.
[0047] In the example embodiments of the present disclosure, the data export request is a request sent by the front end, through which the data required by the user can be exported, and the to-be-exported task sent by the user contains a plurality of data export requests. The to-be-exported task can be sent by the user to the front end, can be sent by the background administrator to the front end, or can be sent by any personnel requiring data to the front end. Specifically, the to-be-exported task can be sent by the user to the browser page in the front end, or can be sent by the user to the application program in the front end, and the present example embodiments do not specially limit this.
[0048] It is worth noting that the data export request is a non-blocking request mode. Specifically, it can be a non-blocking ajax (Asynchronous JavaScript And XML, which refers to Asynchronous JavaScript and XML) request. Through this kind of request, other operations in the front end can not be affected, thereby improving the user experience.
[0049] In order to distinguish different data export requests, different task identifiers are allocated to different data export requests.
[0050] For example, a data export request A sent by the front-end browser page is received, and the purpose of the data export request A is to export the to-be-exported data B required by the user. After receiving the data export request A, the task identifier A1 corresponding to the data export request A is determined.
[0051] In the optional embodiments, Figure 2A flowchart illustrating a process of determining a task identifier corresponding to a data export request in a data export method is shown as Figure 2 The method comprises at least the following steps: in step S210, determining login information and export parameters from the data export request.
[0052] The login information refers to information of a user sending the data export request. Specifically, the login information can be a login nickname of the user, a login account of the user, or a login password of the user, which is not specially limited in the present example embodiment.
[0053] The purpose of the user sending the data export request is to export the data to be exported required by the user. The export parameters refer to parameters corresponding to the data to be exported and describing the data to be exported, such as a data item of the data to be exported or a quantity of the data to be exported, which is not specially limited in the present example embodiment.
[0054] For example, the user sending the data export request A is user 1, and the data to be exported corresponding to the data export request A is data B. At this time, the login information of user 1 and the export parameters corresponding to data B can be obtained. Specifically, the login information can include the login account and the login password of user 1, and the export parameters can include the data item content of data B, i.e., the player nickname of game XX.
[0055] In step S220, if the login information satisfies the verification condition and there is data to be exported corresponding to the export parameters, a task identifier corresponding to each data export request is determined.
[0056] The verification condition refers to a condition for verifying whether the user sending the data export request is a legal user.
[0057] For example, the verification condition includes user 1, user 2, and user 3. The login information is user 1, which obviously satisfies the verification condition. In addition, there is data B corresponding to the export parameter player nickname of game XX, so the task identifier corresponding to the data export request is determined to be A1, and the data export request is further executed.
[0058] In step S230, if the login information does not satisfy the verification condition or there is no data to be exported corresponding to the export parameters, a prompt information indicating that the data export request fails is generated to send the prompt information to the front end.
[0059] When the login information does not satisfy the verification condition, it proves that the user sending the data export request is an illegal user. When there is no data to be exported corresponding to the export parameters, it proves that the data export request at this time is an invalid request. Therefore, in the two cases, the prompt information indicating that the data export request fails needs to be generated to prompt the user.
[0060] For example, the verification condition includes user 1, user 2 and user 3, and the login information is user 4. Obviously, the login information does not meet the verification condition at this time, the user initiating the data login request is an illegal user, and prompt information indicating that the data export request fails is generated to alert the illegal user.
[0061] In the example embodiment, the login information and the export parameter are determined from the data export request, it is judged whether the login information meets the verification condition, and whether there is to-be-exported data corresponding to the export parameter. When the login information does not meet the verification condition or there is no to-be-exported data corresponding to the export parameter, not only the subsequent execution steps of the export data request are not continued to avoid unnecessary performance loss, but also prompt information is generated to increase the user experience.
[0062] In step S120, according to the task identifier, a task processing server having an execution mapping relationship with the data export request is determined from a plurality of task processing servers; wherein the task processing server is a server in the backend server for processing the data export request.
[0063] In the example embodiment of the present disclosure, the task processing server refers to a server specially used for processing the data export request, and different task processing servers are allocated for different data export requests according to different task identifiers to execute the data export request.
[0064] For example, the data export request is A, the task identifier is A1, and according to the task identifier A1, the task processing server having an execution mapping relationship with the data export request A is determined from the task processing server 1, the task processing server 2 and the task processing server 3, which is the task processing server 2. Therefore, the task processing server 2 is the task processing server for executing the data export request A.
[0065] In an optional embodiment, Figure 3 A flowchart for determining a processing task server having an execution mapping relationship with a data export request in a data export method is shown, as shown in Figure 3 The method at least includes the following steps: in step S310, the task identifier is hashed to obtain a calculation result, and the data export request is mapped to a hash space ring according to the calculation result; wherein the task processing server is also mapped on the hash space ring.
[0066] The hash space ring refers to a virtual circular ring, and the virtual circular ring is organized clockwise by the entire hash value space. The task processing server can be mapped to the hash space ring by hash calculation on the server identifier of the task processing server. Similarly, the data export request can be mapped to the same hash space ring according to the calculation result obtained by hash calculation on the task identifier.
[0067] For example, Figure 4 A structure diagram of the hash space ring is shown as Figure 4 The virtual circular ring 410 is the hash space ring. It is assumed that the hash value space of the hash space ring 410 is 2 32 The position of the number 420 is the starting point of the hash space ring, that is, the position of the hash value space 0. The position of the number 430 is the end point of the hash space ring, that is, the position of the hash value space 2 32 -1. It should be noted that, since the hash space ring 410 is organized in the clockwise direction, the position of the starting point of the hash space ring is the same as the position of the end point.
[0068] The task identifier A1 corresponding to the data export request A, the task identifier B1 corresponding to the data export request B, the task identifier C1 corresponding to the data export request C, and the task identifier D1 corresponding to the data export request D are subjected to hash calculation, and the data export request A is mapped to the position A1-1 on the hash space ring according to the calculation result. Similarly, the data export request B is mapped to the position B1-1 on the hash space ring, the data export request C is mapped to the position C1-1 on the hash space ring, the data export request D is mapped to the position D1-1 on the hash space ring, the task processing server 1 is mapped to the position E1-1 on the hash space ring, the task processing server 2 is mapped to the position F1-1 on the hash space ring, the task processing server 3 is mapped to the position G1-1 on the hash space ring, the task processing server 4 is mapped to the position H1-1 on the hash space ring, and the task processing server 5 is mapped to the position I1-1 on the hash space ring.
[0069] In step S320, the task processing server having an execution mapping relationship with the data export request is determined from the plurality of task processing servers according to the first mapping position of the data export request on the hash space ring and the second mapping position of the task processing server on the hash space ring.
[0070] The first mapping position refers to mapping the data export request to a position on the hash space ring according to the task identifier, and the second mapping position refers to mapping the task processing server to a position on the hash space ring according to the hash value of the task processing server identifier. Based on the first mapping position and the second mapping position, the task processing server having an execution mapping relationship with the data export request can be determined from the plurality of task processing servers.
[0071] For example, as shown in FIG. 1, the task processing server 1 has an execution mapping relationship with the data export request A, the task processing server 2 has an execution mapping relationship with the data export request B, the task processing server 3 has an execution mapping relationship with the data export request C, and the task processing server 4 has an execution mapping relationship with the data export request D. Figure 4 As shown in FIG. 1, the task processing server 1 has an execution mapping relationship with the data export request A, the task processing server 2 has an execution mapping relationship with the data export request B, the task processing server 3 has an execution mapping relationship with the data export request C, and the task processing server 4 has an execution mapping relationship with the data export request D.
[0072] In the example embodiment, the task processing server having an execution mapping relationship with the data export request is determined through the first mapping position and the second mapping position on the hash space ring, which avoids the situation that all data export requests are assigned to the same task processing server. This not only increases the efficiency of data export and improves the user experience, but also avoids the occurrence of memory shortage and memory overflow.
[0073] In an optional embodiment, the data export request is mapped to the hash space ring through the following steps. Figure 5 FIG. 2 shows a flowchart of a data export method, and FIG. 3 shows a flowchart of a data export method. Figure 5 As shown in FIG. 3, the method comprises the following steps: in step S510, determining a business type corresponding to the task identifier and obtaining a mapping weight corresponding to the business type.
[0074] The business type describes which business the data export request belongs to, and different business types have different mapping weights.
[0075] For example, there are a task identifier A and a task identifier B. The business type corresponding to the task identifier A is a user business, and the business type corresponding to the task identifier B is a management business. Since the priority of the user business is higher than that of the management business, a higher mapping weight is set for the task identifier A.
[0076] In step S520, the mapping weight is used to calculate the updated calculation result, so as to map the data export request to the hash space ring according to the updated calculation result.
[0077] The task identifier is hashed to obtain the calculation result. The result is then recalculated using the mapping weight to obtain the updated result. At this point, the data export request is remapped onto the hash space ring based on the updated result, so as to redetermine the task processing server with the execution mapping relationship to the data export request.
[0078] For example, such as Figure 4 As shown, based on task type A11 corresponding to task identifier A1, task type B11 corresponding to task identifier B1, task type C11 corresponding to task identifier C1, and task type D11 corresponding to task identifier D1, the mapping weight of task type A11 is determined to be 0.5, the mapping weight of task type B11 is 0.3, the mapping weight of task identifier C11 is 0.2, and the mapping weight of task identifier D11 is 0.1.
[0079] Following a clockwise search, data export request A is currently located at position D1-1 on hash space ring 410, data export request B at position C1-1, data export request C at position B1-1, and data export request D at position A1-1. Based on this, the task processing server with the execution mapping relationship with data export request A is task processing server 4, the task processing server with the execution mapping relationship with data export request B is task processing server 3, the task processing server with the execution mapping relationship with data export request C is task processing server 2, and the task processing server with the execution mapping relationship with data export request D is task processing server 1. Furthermore, the execution capabilities of task processing servers 4, 3, 2, and 1 decrease sequentially, thereby enabling the data export request of business type A11 to be executed more efficiently.
[0080] In this exemplary embodiment, the mapping weight corresponding to the data export request is determined according to the business type, and then the data export request is remapped onto the hash space ring. This not only improves the processing efficiency of the data export request, but also allows for the allocation of more reasonable task processing servers for different data export requests from the perspective of business type.
[0081] In step S130, the task processing server executes a data export request to obtain the data export address, and then sends the data export address to the front end.
[0082] In an exemplary embodiment of this disclosure, a task processing server is used to execute a data export request to obtain the data to be exported, and the export address corresponding to the data to be exported is sent to the front end so that the user can download the data to be exported according to the export address.
[0083] For example, Figure 6 A front-end browser page diagram is shown as Figure 6 As shown, the page 610 is a front-end browser page, the control 620 is an export control, when a user performs a touch operation on the export control 620, a data export request can be received, the control 630 is a delete control, when a user performs a touch operation on the delete control 630, the export address can be deleted.
[0084] Figure 7 A front-end browser page diagram after sending the data export address to the front-end is shown as Figure 7 As shown, the address 710 is a data export address, the control 720 is a download control, when a user performs a touch operation on the download control 720, the to-be-exported data corresponding to the data export address will be downloaded, the control 730 is a cancel control, when a user performs a touch operation on the cancel control 730, the download of the to-be-exported data will be canceled.
[0085] In an optional embodiment, Figure 8 A flow diagram of sending the data export address to the front-end in the data export method is shown as Figure 8 As shown, the method at least includes the following steps: in step S810, the second state is sent to the front-end; wherein the second state is a state indicating that the export task has been completed, and the export task corresponds to the task identifier.
[0086] The export task is a task corresponding to the task identifier, that is, the export task corresponds to the data export request, after the task processing server completes the execution of the export task, the state of the export task will be changed to the completed state, that is, the state of the export task will be changed to the second state, and the second state will be sent to the front-end.
[0087] For example, when the task processing server completes the execution of the export task A, the state of the export task A is changed to the second state, the data export request corresponding to the export task is A11, and A11 is sent from the front-end browser page B, based on this, the second state is sent to the front-end browser page B.
[0088] In step S820, the data export address request sent by the front-end is obtained, and the data export address corresponding to the data export address request is sent to the front-end.
[0089] Wherein, after the front-end receives the second state, the front-end sends the data export address request, that is, the data export address request corresponding to the to-be-exported data is obtained, based on this, the data export address corresponding to the data export address request is sent to the front-end.
[0090] For example, asFigure 7 As shown, after obtaining the data export address request corresponding to the data to be exported, the data export address is sent to the front end, and the address 710 is the data export address received by the front end.
[0091] In the present exemplary embodiment, the data export address request is obtained only when the state of the export task is the second state, thereby perfecting the logic of sending the data export address to the front end, avoiding the situation that the data export address request is still sent when the export task is not in the second state, avoiding unnecessary performance loss, and improving the execution efficiency of the data export request.
[0092] In an optional embodiment, Figure 9 As shown, the flowchart before the second state is sent to the front end in the data export method is shown, and the method comprises the following steps: Figure 9 As shown, the method comprises the following steps: in step S910, if a task processing server having an execution mapping relationship with the data export request is determined in a plurality of task processing servers, a first state is sent to the front end; wherein the first state is a state indicating that the export task is being processed.
[0093] After determining the task processing server having the execution mapping relationship with the data export request, the task processing server starts to execute the data export request, based on which, the export task corresponding to the data export request is in the state of being processed at this time, i.e. the export task is in the first state at this time, the first state is sent to the front end, and the front end will identify the first state at this time, and then determine that the data export request is being processed.
[0094] For example, in the task processing server 1, the task processing server 2 and the task processing server 3, the task processing server executing the data export request A is determined as the task processing server 1, and the state of the export task A11 corresponding to the data export request A is in the first state at this time.
[0095] In step S920, a state query request sent by the front end at a predetermined time interval is obtained; wherein the state query request is used to query the state of the export task, and the state query request is sent by the front end in response to the received first state.
[0096] The state query request, i.e. the request for querying the state of the export task, and the state query request is sent only when the front end receives the state of the export task as the first state.
[0097] For example, the first state of the export task is sent to the front end, the front end identifies the first state to determine that the export task is in the state of being processed at this time, and then sends the state query request.
[0098] In step S930, the state corresponding to the export task is queried, and if the state changes from the first state to the second state, the second state is sent to the front end, and the export task is removed.
[0099] In the method, each time a state query request is received, the state of the export task is queried, and if the state of the export task changes from the first state to the second state, that is, the state of the export task changes from the processing state to the completed state, it is proved that the export task has been completed, the second state is sent to the front end, the front end sends a data export address request, and the export task is removed, that is, no state query request is sent for the export task.
[0100] For example, after receiving a state query request, the state of the export task is queried, and if the state of the export task changes from the first state to the second state, the second state is sent to the front end, the front end identifies the second state, and determines that the export task has been completed, and the export task is removed, and no state query request is sent for the export task.
[0101] In the example embodiment, the state query request is sent at a preset time interval, the state of the export task can be obtained in time, and the export task is removed when the export task is in the second state, so that the situation that the state query request is continuously sent when the export task is in the second state is avoided, the execution efficiency of the data export request is improved, and unnecessary performance loss is avoided.
[0102] In an optional embodiment, Figure 10 A flowchart of a method for determining a task processing server having an execution mapping relationship with a data export request is shown in FIG. 10. Figure 7 As shown in FIG. 10, the method includes the following steps: in step S1010, the time for which the state of the export task is maintained in the first state is calculated.
[0103] The maintenance time is the time for which the export task is in the processing state, that is, the time for which the export task is in the first state.
[0104] For example, the state query request is sent at a preset time interval of 2 seconds, and if the state of the export task changes from the first state to the second state when the fourth state query request is sent, the maintenance time for which the state of the export task is maintained in the first state is calculated to be 6 seconds.
[0105] In step S1020, if the maintenance time is greater than or equal to the time threshold, the number of task processing servers is increased, and the server identifier of the increased task processing server is hashed to obtain a hash calculation result.
[0106] The time threshold is a threshold of the processing performance of the task processing server. If the maintenance time is greater than the time threshold, it proves that the processing performance of the task processing server at this time is weak, that is, the task processing server currently possessed cannot complete the processing of the data export request within the specified time, and therefore the number of task processing servers needs to be increased, and the server identifier of the increased task processing server is calculated to map the newly added task processing server to the hash space ring.
[0107] For example, the time threshold is 2 seconds, and the maintenance time is 6 seconds. Obviously, the maintenance time is greater than the time threshold at this time. At this time, three task processing servers are added, specifically, task processing server 6, task processing server 7 and task processing server 8 are added, and the server identifiers of the above three task processing servers are calculated by hash to map the above three task processing servers to the hash space ring as shown in Figure 4 .
[0108] In step S1030, the mapping relationship between the increased task processing server and the hash space ring is updated according to the hash calculation result, so as to determine the task processing server having the execution mapping relationship with the data export request in the plurality of task processing servers again; wherein the hash space ring is used to determine the task processing server having the execution mapping relationship with the data export request in the plurality of task processing servers.
[0109] After the newly added task processing server is mapped to the hash space ring, the execution mapping relationship between the data export request and the task processing server needs to be determined again according to the first mapping position and the second mapping position.
[0110] For example, after the new task processing server is mapped to the hash space ring as shown in Figure 4 , the execution mapping relationship between the data export request and the task processing server needs to be determined again according to the first mapping position and the second mapping position in the clockwise direction, so as to execute the data export request.
[0111] In the example embodiment, the number of task processing servers can be flexibly increased according to the relationship between the maintenance time and the time threshold, which improves the execution speed of the task processing server, reduces the time for the user to obtain the data to be exported, and improves the user experience.
[0112] In the methods and apparatus provided in the exemplary embodiments of this disclosure, on the one hand, a task processing server with an execution mapping relationship with the data export request can be determined among multiple task processing servers, avoiding the situation where all data export requests are processed by the same task processing server. Furthermore, through the execution mapping relationship, a corresponding task processing server can be reasonably allocated to each data export request, so even if the number of data export requests is too large, there will be no problem of insufficient server resources or long data export time, thus improving the efficiency of data export. On the other hand, the task processing server is the server in the backend server that processes the data export request, decoupling the data export request from other services and avoiding the impact of the data export request on other services.
[0113] The data export method in this embodiment will be described in detail below with reference to an application scenario.
[0114] Figure 11 The system architecture diagram in the data export method under the application scenario is shown, such as... Figure 11 As shown, device 1110 is a computer terminal, server 1112 is a front-end server, server 1114 is an interface server, server 1116 is a file server, server 1120 is a result server, server 1122 is a cache server, and library 1124 is a log library.
[0115] When a user operates the export control in computer terminal 1110, the front-end server 1112 will receive multiple data export requests corresponding to the task to be exported. The front-end server 1112 will perform basic verification on the data export request, that is, determine whether the login information meets the verification conditions, and return the verification result to computer terminal 1110. After the basic verification, data verification will be performed, that is, determine whether there is data to be exported corresponding to the export parameters.
[0116] If either the basic validation or the data validation fails, the failed result is stored in the result server 1120, and the status of the export task is set to the second status.
[0117] Once the basic verification and data verification are passed, the interface server 1114 will be used to determine the task processing server that has an execution mapping relationship with the data export request. After the task processing server is determined, the data export request will be executed, and the execution result data to be exported will be stored in the file server 1116. The data export address corresponding to the data to be exported will be stored in the file storage. The record of this completion will be written to the log database 1124, and the execution completion status, i.e., the second status, will be sent to the result server 1120.
[0118] In addition, after the interface server 1114 determines the task processing server that has an execution mapping relationship with the data export request, it will also send the first status to the result server 1120. The result server 1120 will also receive status query requests sent by the computer terminal 1110 at preset time intervals to query the status of the export task. After the status of the task to be exported changes from the first status to the second status, the query for the status of the export task will stop. The result server 1120 will also cache the status of the export task in the cache server 1122.
[0119] Figure 12 The diagram illustrates the data export method in an application scenario, such as... Figure 12 As shown, step S1211 is when the user clicks the export control on the page to send a data export request; step S1212 is the process of the front-end server performing basic verification and data verification; step S1213 is the process of generating a prompt message if either the basic verification or the data verification fails; step S1214 is the process of obtaining the task identifier corresponding to the data export request if both the basic verification and the data verification pass; step S1215 is the process of determining the task processing server with the execution mapping relationship with the data export request; step S1216 is the process of obtaining a status query request at a preset time interval; step S1217 is the process of obtaining the data to be exported if the status of the export task changes from the first status to the second status; step S1218 is the process of generating a data export address and sending the data export address to the front end; step S1219 is the process of setting the status of the export task to the second status after sending the export address, at which point the export task will be removed and no more status query requests will be sent for that export task; and step S1220 is the process of displaying the data to be exported corresponding to the data export address on the front end when the user touches the data export address.
[0120] In this application scenario, on the one hand, a task processing server with an execution mapping relationship to the data export request can be identified among multiple task processing servers. This avoids the situation where all data export requests are processed by the same task processing server. Furthermore, through the execution mapping relationship, a corresponding task processing server can be reasonably allocated to each data export request. Even if the number of data export requests is too large, there will be no problem of insufficient server resources or long data export time, thus improving the efficiency of data export. On the other hand, the task processing server is the server in the backend server that processes data export requests, decoupling data export requests from other business operations and avoiding the impact of data export requests on other business operations.
[0121] Furthermore, in an exemplary embodiment of this disclosure, a data export apparatus is also provided. Figure 13A structural schematic diagram of the data export apparatus is shown as Figure 13 As shown, the data export apparatus 1300 can include a receiving module 1310, a determining module 1320 and an executing module 1330. Wherein:
[0122] The receiving module 1310 is configured to receive a plurality of data export requests sent by the front end, and determine a task identification corresponding to each data export request; the determining module 1320 is configured to determine, according to the task identification, a task processing server having an execution mapping relationship with each data export request from among a plurality of task processing servers; wherein the task processing server is a server in the back end server that only processes data export requests; the executing module 1330 is configured to execute the data export request by using the task processing server to obtain a data export address, and transmit the data export address to the front end.
[0123] The specific details of the above data export apparatus 1300 have been described in detail in the corresponding data export method, and thus will not be described here.
[0124] It should be noted that although several modules or units of the data export apparatus 1300 are mentioned in the above detailed description, such division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into a plurality of modules or units.
[0125] In addition, in the exemplary embodiments of the present disclosure, an electronic device capable of implementing the above method is also provided.
[0126] The electronic device 1400 according to such embodiments of the present disclosure will be described below with reference to Figure 14 . Figure 14 The electronic device 1400 shown is merely an example, and should not impose any limitation on the functions and use range of the embodiments of the present disclosure.
[0127] As shown in Figure 14 , the electronic device 1400 is in the form of a general computing device. The components of the electronic device 1400 can include, but are not limited to, the above-mentioned at least one processing unit 1410, the above-mentioned at least one storage unit 1420, a bus 1430 connecting different system components including the storage unit 1420 and the processing unit 1410, and a display unit 1440.
[0128] The storage unit stores program codes which can be executed by the processing unit 1410, so that the processing unit 1410 performs the steps described in the above "Exemplary Methods" section according to various exemplary embodiments of the present application.
[0129] The storage unit 1420 can include a readable medium in the form of volatile storage such as a random access memory (RAM) 1421 and / or cache memory 1422, and also can include a non-volatile storage such as a read-only memory (ROM) 1423.
[0130] The storage unit 1420 can further include a program / utility 1424 having a set (at least one) of program modules 1425, including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which can give a real presence of a network environment in one or a combination of these examples.
[0131] The bus 1430 can represent one or more of several types of bus structures, including a storage unit bus or bus controller, a peripheral bus, a graphics acceleration port, a processing unit bus, or a local bus using any of a variety of bus architectures.
[0132] The electronic device 1400 can also communicate with one or more external devices 1470 such as a keyboard or pointing device, a Bluetooth device, etc.; other devices that enable a user to interact with the electronic device 1400; and / or one or more devices that enable the electronic device 1400 to communicate with one or more other computing devices. Such communication can occur via an input / output (I / O) interface 1450. Still yet, the electronic device 1400 can communicate with one or more networks, such as a local area network (LAN), a general wide area network (WAN), and / or a public network, such as the Internet, via a network adapter 1460. As depicted, the network adapter 1460 can communicate with the other components of the electronic device 1400 via the bus 1430. It should be appreciated that although the network adapter 1460 is depicted as a single component, the network adapter 1460 can comprise two or more components that work together to facilitate communications with one or more other computing devices.
[0133] Those skilled in the art can easily understand from the above description of the embodiments that the example embodiments described herein can be implemented by software or by software in combination with necessary hardware. Therefore, the technical solutions according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a U disk, a mobile hard disk, etc.) or a network, and includes a plurality of instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to perform the methods according to the embodiments of the present disclosure.
[0134] In the example embodiments of the present disclosure, a computer readable storage medium is also provided, on which a program product capable of implementing the above-mentioned method of the present disclosure is stored. In some possible embodiments, various aspects of the present disclosure can also be implemented in the form of a program product, which includes program codes for causing a terminal device to perform the steps described in the above-mentioned “example method” section according to various example embodiments of the present disclosure when the program product is run on the terminal device.
[0135] Reference Figure 15 As shown, a program product 1500 for implementing the above-mentioned method according to the embodiments of the present disclosure is described, which can adopt a portable compact disc read-only memory (CD-ROM) and include program codes, and can be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited to this, and in this document, the readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, device or apparatus.
[0136] The program product can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium may, for example, be but is not limited to an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples (non-exhaustive list) of the readable storage medium include an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0137] A computer readable signal medium can include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated signal can take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium can be any computer readable medium that can be
[0138] Program code embodied on a computer readable medium can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0139] Computer program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computing device, partly on the user's computing device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device or entirely on the remote computing device or server. In the latter scenario, the remote computing device can be connected to the user's computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computing device, such as through the Internet using an Internet Service Provider. The application is related to the use of computer system 100 for online analytics, example, any type of online analytical processing (OLAP). The computer system 100 is only one example of a possible
[0140] Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the features disclosed herein. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the disclosure being indicated by the following claims.
Claims
1. A data export method, characterized in that, The method includes: Receive multiple data export requests sent by the front end and determine the task identifier corresponding to each data export request; Based on the task identifier, the task processing server that has an execution mapping relationship with each data export request is determined among multiple task processing servers; wherein, the task processing server is the server in the backend server that processes the data export request; The task processing server is used to execute the data export request to obtain the data export address, and the data export address is sent to the front end. The method further includes: Calculate the duration for which the export task remains in the first state; the export task corresponds to the task identifier, and the first state indicates that the export task is being processed. If the maintenance time is greater than or equal to the time threshold, the number of task processing servers is increased, and the server identifiers of the increased task processing servers are hashed to obtain the hash calculation result. The mapping relationship between the added task processing server and the hash space ring is updated based on the hash calculation result, so as to re-determine the task processing server with the execution mapping relationship with the data export request among the multiple task processing servers; wherein, the hash space ring is used to determine the task processing server with the execution mapping relationship with the data export request among the multiple task processing servers.
2. The data export method according to claim 1, characterized in that, The determination of the task identifier corresponding to each data export request includes: The login information and export parameters are determined from the data export request; If the login information meets the verification conditions and there is data to be exported corresponding to the export parameters, determine the task identifier corresponding to each data export request. If the login information does not meet the verification conditions, or if there is no data to be exported corresponding to the export parameters, a prompt message indicating that the data export request failed is generated and sent to the front end.
3. The data export method according to claim 1, characterized in that, The step of determining, based on the task identifier, the task processing server among multiple task processing servers that has an execution mapping relationship with the data export request includes: The task identifier is hashed to obtain the calculation result, and the data export request is mapped to the hash space ring according to the calculation result; wherein, the hash space ring also maps the task processing server; Based on the first mapping position of the data export request on the hash space ring and the second mapping position of the task processing server on the hash space ring, the task processing server that has an execution mapping relationship with the data export request is determined among the plurality of task processing servers.
4. The data export method according to claim 3, characterized in that, The step of mapping the data export request onto the hash space ring based on the calculation result includes: Determine the business type corresponding to the task identifier, and obtain the mapping weight corresponding to the business type; The updated calculation result is obtained by using the mapping weights to calculate the calculation result, and the data export request is mapped onto the hash space ring according to the updated calculation result.
5. The data export method according to claim 1, characterized in that, Sending the data export address to the front end includes: The second status is sent to the front end; wherein the second status indicates that the export task has been completed. Obtain the data export address request sent by the front end, and send the data export address corresponding to the data export address request to the front end.
6. The data export method according to claim 5, characterized in that, Before sending the second state to the front end, the method further includes: If a task processing server with the execution mapping relationship to the data export request is identified among the multiple task processing servers, the first status is sent to the front end; Obtain the status query request sent by the front end at a preset time interval; wherein, the status query request is used to query the status of the exported task, and the status query request is sent by the front end in response to the received first status; Query the status corresponding to the export task. If the status changes from the first status to the second status, send the second status to the front end and remove the export task.
7. A data export device, characterized in that, include: The receiving module is configured to receive multiple data export requests sent by the front end and determine the task identifier corresponding to each data export request. The determination module is configured to determine, based on the task identifier, a task processing server among multiple task processing servers that has an execution mapping relationship with each data export request; wherein, the task processing server is a server among backend servers that processes the data export request; The execution module is configured to use the task processing server to execute the data export request to obtain the data export address, and then send the data export address to the front end; The device is further configured to: Calculate the duration for which the export task remains in the first state; the export task corresponds to the task identifier, and the first state indicates that the export task is being processed. If the maintenance time is greater than or equal to the time threshold, the number of task processing servers is increased, and the server identifiers of the increased task processing servers are hashed to obtain the hash calculation result. The mapping relationship between the added task processing server and the hash space ring is updated based on the hash calculation result, so as to re-determine the task processing server with the execution mapping relationship with the data export request among the multiple task processing servers; wherein, the hash space ring is used to determine the task processing server with the execution mapping relationship with the data export request among the multiple task processing servers.
8. An electronic device, characterized in that, include: processor; Memory for storing the executable instructions of the processor; The processor is configured to execute the data export method of any one of claims 1-6 by executing the executable instructions.
9. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is executed by a processor, it implements the data export method according to any one of claims 1-6.
Citation Information
Patent Citations
Affinity dynamic load balancing method based on consistent hash algorithm
CN107197035A
Data export method, device and system
CN111352951A
Task scheduling method and device, equipment and storage medium
CN113408745A