Data processing method and device based on dual-machine-room active-active, computer equipment and medium
By dynamically adjusting the access weight value and routing request of the dual computer room, the problem of idle resources in the backup computer room is solved, and the efficient utilization of resources and the rapid response efficiency of the credit system are achieved.
Patent Information
- Application Number
- CN202410928395.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-09-20
AI Technical Summary
In the traditional primary and secondary computer room model, the server resources in the secondary computer room have been idle for a long time, resulting in resource waste, inability to fully utilize, and inability to provide business support under normal circumstances.
Adopt a data processing method based on dual computer rooms and active-active, dynamically adjust the access weight values of the main computer room and the backup computer room, and route the request based on the response failure rate of the historical acquisition request, ensuring that the request is processed in the computer room with better status, and when it fails, Obtain data from the main database or slave database to avoid resource waste.
Make full use of server resources in the backup computer room to avoid resource waste, improve the response efficiency and availability of the credit system, and ensure rapid response to upstream application acquisition requests in the event of a failure.
Smart Images

Figure CN118677953A
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, device, computer equipment and storage medium based on dual-machine room dual-active. Background Art
[0002] With the rapid development of Internet finance, the stable operation of the credit system has become the key to business continuity. The credit system adopts a backup solution of the main and standby computer rooms. The main computer room is generally used to undertake the user's business, and the standby computer room is used to back up the data, configuration, and business of the data center in the main computer room. Usually only the main computer room undertakes the user's business. When the data center in the main computer room fails, the traffic can be switched to the data center in the standby computer room to ensure the high availability of the business.
[0003] In the traditional master-slave computer room model, the business only runs in the data center of the master computer room. Combined with the disaster recovery level requirements and business needs, a large number of backup servers are deployed in the backup center of the backup computer room. However, the backup center only provides disaster recovery services for the business. Only when a disaster occurs and the production data center is paralyzed, the business system of the backup center will start these backup servers, resulting in a waste of server resources in the backup center of the backup computer room. Summary of the invention
[0004] Based on this, it is necessary to provide a data processing method, device, computer equipment and storage medium based on dual computer room dual active to address the above technical problems, which can make full use of the server resources in the backup computer room and avoid the data center in the backup computer room being idle all year round and causing waste of server resources.
[0005] A data processing method based on dual-computer room dual-active is applied to a credit system, comprising: receiving a current acquisition request for target credit data initiated by an upstream application; in response to the current acquisition request, acquiring an access weight value of a main computer room and an access weight value of a backup computer room at the current moment, wherein the access weight values of the main computer room and the backup computer room at the current moment are dynamically adjusted according to the response failure rate of historical acquisition requests for multiple historical credit data of the computer room before the moment when the current acquisition request is received; judging based on the access weight value of the main computer room and the access weight value of the backup computer room at the current moment whether to route the current acquisition request to the main computer room; Computer room or standby computer room; when routing the current acquisition request to the main computer room, receiving the target credit data returned by the main computer room, and returning the target credit data to the upstream application, wherein the main computer room queries the target credit data from the main database of the main computer room, and if the query fails, then query the target credit data from the slave database of the main computer room; when routing the current acquisition request to the standby computer room, receiving the target credit data returned by the standby computer room, and returning the target credit data to the upstream application, wherein the standby computer room queries the target credit data from the main database of the standby computer room, and if the query fails, then query the target credit data from the slave database of the standby computer room.
[0006] In one of the embodiments, a data processing method based on dual-computer room dual-active also includes: identifying whether the routing switch is turned on, if the routing switch is in the on state, recording the routing information of the current acquisition request when routing the current acquisition request to the main computer room, the routing information includes the identification information of the current acquisition request and the identification information of the main computer room each time the current acquisition request is routed, when routing the current acquisition request to the main computer room, if feedback information that the current acquisition request response fails is received, then the current acquisition request continues to be routed to the main computer room based on the routing information until the target credit data returned by the main computer room is received; if the routing switch is in the on state, then when routing the current acquisition request to the backup computer room, recording the routing information of the current acquisition request, the routing information includes the identification information of the current acquisition request and the identification information of the backup computer room each time the current acquisition request is routed, when routing the current acquisition request to the backup computer room, if feedback information that the current acquisition request response fails is received, then the current acquisition request continues to be routed to the backup computer room based on the routing information until the target credit data returned by the backup computer room is received.
[0007] In one of the embodiments, a data processing method based on dual-computer room dual-active also includes: when routing the current acquisition request to the main computer room, if the received feedback information is the first feedback information, then based on the routing information, continue to route the current acquisition request to the main computer room until the target credit data returned by the main computer room is received, and the first feedback information indicates that the current acquisition request response failed due to the non-main computer room; if the received feedback information is the second feedback information, then the current acquisition request is routed to the backup computer room, and the second feedback information indicates that the main computer room failed to respond to the current acquisition request; when routing the current acquisition request to the backup computer room, if the received feedback information is the third feedback information, then based on the routing information, continue to route the current acquisition request to the backup computer room until the target credit data returned by the backup computer room is received, and the third feedback information indicates that the current acquisition request response failed due to the non-backup computer room; if the received feedback information is the fourth feedback information, then the current acquisition request is routed to the main computer room, and the fourth feedback information indicates that the backup computer room failed to respond to the current acquisition request.
[0008] In one of the embodiments, a data processing method based on dual computer room dual active also includes: if after the current acquisition request continues to be routed to the main computer room based on the routing information, the target credit data returned by the main computer room is not received after the first set time period, when it is confirmed that there is no delay in the data synchronization between the main computer room and the backup computer room, the routing switch is turned off, and when it is confirmed that the routing switch is in the off state, the access weight value of the main computer room and the access weight value of the backup computer room are obtained again, and the access weight values of the main computer room and the backup computer room obtained again are dynamically adjusted according to the response failure rate of the historical acquisition requests of multiple historical credit data of the computer room before the moment when the routing switch is confirmed to be in the off state; based on the access weight value of the main computer room and the access weight value of the backup computer room obtained again, it is determined whether the current acquisition request is routed to the main computer room or the backup computer room.
[0009] In one of the embodiments, if the received feedback information is the second feedback information, then after the step of routing the current acquisition request to the standby computer room, the step further includes: if information is received from the standby computer room indicating that the standby computer room has failed to respond to the current acquisition request, then instructing the standby computer room to obtain target credit data from an external data source; receiving the target credit data returned by the standby computer room, and returning the target credit data to the upstream application; wherein, after the standby computer room obtains the target credit data from the external data source, the target credit data is stored in the main database of the standby computer room, and the target credit data is synchronized to the slave database of the main computer room.
[0010] In one of the embodiments, if the received feedback information is the fourth feedback information, then after the step of routing the current acquisition request to the main computer room, the step further includes: if information is received from the main computer room indicating that the standby computer room has failed to respond to the current acquisition request, then instructing the main computer room to obtain target credit data from an external data source; receiving the target credit data returned by the main computer room, and returning the target credit data to the upstream application; wherein, after the main computer room obtains the target credit data from the external data source, the target credit data is stored in the main database of the main computer room, and the target credit data is synchronized to the slave database of the standby computer room.
[0011] In one of the embodiments, after the step of determining whether to route the current acquisition request to the main computer room or the backup computer room based on the access weight value of the main computer room and the access weight value of the backup computer room at the current moment, it also includes: taking the moment when the current acquisition request is received as the statistical time starting point, counting the response failure rate of the acquisition request for credit data in the main computer room over a period of time, when the response failure rate of the main computer room over a period of time is greater than the first failure rate threshold, setting the weight value of the main computer room to 0 and setting the weight value of the main computer room to the first set value after a second set time period; when the response failure rate of the main computer room over a period of time is greater than the third failure rate threshold and less than the second failure threshold, setting the weight value of the main computer room to the second set value, wherein the first set value and the second set value are the same or different, the first failure rate threshold is greater than the second failure rate threshold, and the second failure rate threshold is greater than the third failure rate threshold.
[0012] A data processing device based on dual-machine room dual-active, applied to a credit system, comprising: a receiving module, used to receive a current acquisition request for target credit data initiated by an upstream application; an acquisition module, used to respond to the current acquisition request, and acquire the access weight value of the main machine room and the access weight value of the standby machine room at the current moment, wherein the access weight values of the main machine room and the standby machine room at the current moment are dynamically adjusted according to the response failure rate of the historical acquisition request of multiple historical credit data of the machine room before the moment when the current acquisition request is received; a judgment module, used to judge whether to route the current acquisition request based on the access weight value of the main machine room and the access weight value of the standby machine room at the current moment To the main computer room or the standby computer room; the first feedback module is used to receive the target credit data returned by the main computer room when the current acquisition request is routed to the main computer room, and return the target credit data to the upstream application, wherein the main computer room queries the target credit data from the main database of the main computer room, and if the query fails, then query the target credit data from the slave database of the main computer room; the second feedback module is used to receive the target credit data returned by the standby computer room when the current acquisition request is routed to the standby computer room, and return the target credit data to the upstream application, wherein the standby computer room queries the target credit data from the main database of the standby computer room, and if the query fails, then query the target credit data from the slave database of the standby computer room.
[0013] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of any of the above-mentioned embodiments are implemented.
[0014] A computer-readable storage medium stores a computer program, which implements the steps of any of the above-mentioned method embodiments when the computer program is executed by a processor.
[0015] The above-mentioned data processing method, device, computer equipment and storage medium based on dual-computer room dual-active include: receiving a current acquisition request for target credit data initiated by an upstream application; in response to the current acquisition request, acquiring the access weight value of the main computer room and the access weight value of the backup computer room at the current moment, the access weight values of the main computer room and the backup computer room at the current moment are dynamically adjusted according to the response failure rate of the historical acquisition request of multiple historical credit data of the computer room before the moment when the current acquisition request is received; judging whether to allocate the current acquisition request to the backup computer room based on the access weight value of the main computer room and the access weight value of the backup computer room at the current moment Routing to the main computer room or the standby computer room; when routing the current acquisition request to the main computer room, receiving the target credit data returned by the main computer room, and returning the target credit data to the upstream application, wherein the main computer room queries the target credit data from the main database of the main computer room, and if the query fails, then query the target credit data from the slave database of the main computer room; when routing the current acquisition request to the standby computer room, receiving the target credit data returned by the standby computer room, and returning the target credit data to the upstream application, wherein the standby computer room queries the target credit data from the main database of the standby computer room, and if the query fails, then query the target credit data from the slave database of the standby computer room.
[0016] When the credit system receives a request for obtaining credit data initiated by an upstream application, it routes the request to the main computer room or the backup computer room according to the access weight value of the main computer room and the access weight value of the backup computer room. Therefore, the server resources of the backup computer room can be fully utilized to avoid wasting the server resources of the backup computer room. In addition, the access weight values of the main computer room and the backup computer room are dynamically adjusted according to the response failure rate of the historical acquisition requests of multiple historical credit data of the computer room. Therefore, when selecting the main computer room or the backup computer room based on the access weight value, the computer room with a better status can be selected to respond to the acquisition request of the upstream application, thereby quickly responding to the upstream application and ensuring the response efficiency of the credit system. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is an application environment diagram of a data processing method based on dual-machine room dual-active in one embodiment;
[0018] Figure 2 A schematic diagram of a flow chart of a data processing method based on dual-machine-room dual-active in one embodiment;
[0019] Figure 3 It is a structural block diagram of a data processing device based on dual-machine room dual-active in one embodiment;
[0020] Figure 4 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0022] The present application provides a data processing method based on dual-machine room dual-active, which is applied to Figure 1 In the application environment shown. Figure 1 As shown, the credit system 102 is used to execute a data processing method based on dual computer rooms and dual active of the present application. Specifically, the credit system 102 receives a current acquisition request for target credit data initiated by an upstream application, and in response to the current acquisition request, obtains the access weight value of the main computer room 1042 and the access weight value of the backup computer room 1044 at the current moment. The access weight values of the main computer room 1042 and the backup computer room 1044 at the current moment are dynamically adjusted according to the response failure rate of the historical acquisition requests of multiple historical credit data of the computer room before the moment when the current acquisition request is received. Based on the access weight value of the main computer room 1042 and the access weight value of the backup computer room 1044 at the current moment, it is determined whether to route the current acquisition request to the main computer room 1042 or the backup computer room 1044. When the fetch request is routed to the main computer room 1042, the target credit data returned by the main computer room 1042 is received, and the target credit data is returned to the upstream application, wherein the main computer room 1042 queries the target credit data from the main computer room 1042 master database, and if the query fails, the target credit data is then queried from the slave database of the main computer room 1042. When the current fetch request is routed to the backup computer room 1044, the target credit data returned by the backup computer room 1044 is received, and the target credit data is returned to the upstream application, wherein the backup computer room 1044 queries the target credit data from the main computer room 1044 master database, and if the query fails, the target credit data is then queried from the slave database of the backup computer room 1044. Among them, the credit data in the main computer room 1042 and the backup computer room 1044 are derived from the external data source 202. That is, after the credit data is requested from the external data source 202, it is cached in the computer room for the credit system request call.
[0023] In one embodiment, Figure 2 As shown, a data processing method based on dual-machine room dual-active is provided, and the method is applied to Figure 1 Taking the credit system 102 in the example as an example, the following steps are included:
[0024] S202, receiving a current acquisition request for target credit data initiated by an upstream application.
[0025] In this embodiment, the credit system is mainly used to provide credit data collection services. When an upstream application sends a request to obtain credit data to the credit system, the credit system first determines whether there are collection records within the cache period. When there are collection records within the validity period, the stored collected credit data is directly returned. When there are no collection records, an external data source is requested to obtain the latest credit data. Among them, the collection records are written to the main library of the main computer room and synchronized to the slave library of the backup computer room, or, the collection records are written to the main library of the backup computer room and synchronized to the slave library of the main computer room. When the credit system reads the collection records from any computer room, it needs to read the main library and slave library of the computer room in order to traverse all the collection records of credit data in the computer room.
[0026] Among them, Figure 1 As shown in the figure, dual computer rooms refer to the main computer room and the backup computer room. Active-active means that both the main computer room and the backup computer room are responsible for the user's business at the same time, that is, they provide credit data reading for users of upstream applications at the same time. The main computer room and the backup computer room are real-time backups for each other. The slave database in the main computer room is used to back up the data in the main database of the slave computer room, including credit data and collection records. The slave database in the backup computer room is used to back up the data in the main database of the main computer room, including credit data and collection records.
[0027] S204, in response to the current acquisition request, obtain the access weight value of the main computer room and the access weight value of the backup computer room at the current moment, and the access weight values of the main computer room and the backup computer room at the current moment are dynamically adjusted according to the response failure rate of the historical acquisition request of multiple historical credit data of the computer room before the moment of receiving the current acquisition request.
[0028] In this embodiment, the credit system monitors and records the response of the acquisition request of the credit data of the main computer room and the slave computer room in real time. The access weight value of each computer room is dynamically adjusted according to the response failure rate of the historical acquisition request of multiple historical credit data of each computer room. Here, the access weight value of the main computer room and the access weight value of the backup computer room at the current moment refer to: taking the moment of receiving the current acquisition request as the current moment, the access weight value of the main computer room and the access weight value of the backup computer room are read respectively.
[0029] The access weight value refers to the probability of accessing the computer room. The sum of the access weight values of the main computer room and the backup computer room is 1. If the access weight value of the main computer room is 50% and the access weight value of the backup computer room is 50%, it means that the probability of routing any credit data acquisition request to the main computer room is 50%, and the probability of routing to the backup computer room is also 50%.
[0030] S206: Based on the access weight value of the main computer room and the access weight value of the backup computer room at the current moment, it is determined whether to route the current acquisition request to the main computer room or the backup computer room.
[0031] In this embodiment, the access weight value of the main computer room and the access weight value of the backup computer room at the current moment are used to determine whether the current acquisition request for the target credit data is routed to the main computer room or the backup computer room. The greater the access weight value of the main computer room at the current moment, the greater the probability that the current acquisition request is routed to the main computer room, and vice versa. The smaller the probability that the current acquisition request is routed to the main computer room. Therefore, the access weight value of the main computer room and the access weight value of the backup computer room can be used to dynamically adjust the request access volume of the main computer room and the backup computer room. In the case that the response failure rate of any computer room is high, the acquisition request is controlled to be routed to another computer room, ensuring a rapid response to the acquisition request of resource data and ensuring the response efficiency of the credit system.
[0032] S208, when routing the current acquisition request to the main computer room, receiving the target credit data returned by the main computer room, and returning the target credit data to the upstream application, wherein the main computer room queries the target credit data from the main computer room's main database, and if the query fails, then queries the target credit data from the main computer room's secondary database.
[0033] In this embodiment, Figure 1 As shown, the main computer room is configured with a master database and a slave database. The slave database in the main computer room is the credit data that is synchronously backed up in the main database of the standby computer room. The credit data in the main database of the main computer room will also be synchronously backed up to the slave database of the standby computer room. Therefore, the full amount of credit data of the credit system is stored in both the main computer room and the standby computer room. If the current acquisition request is routed to the main computer room, the main computer room queries the target credit data from the main database of the main computer room. If the query fails, the target credit data is queried from the slave database of the main computer room. The main computer room returns the queried target credit data to the credit system, and then the credit system returns it to the upstream application.
[0034] S210, when routing the current acquisition request to the standby computer room, receiving the target credit data returned by the standby computer room, and returning the target credit data to the upstream application, wherein the standby computer room queries the target credit data from the main database of the standby computer room, if the query fails, then queries the target credit data from the slave database of the standby computer room.
[0035] In this embodiment, if the current acquisition request is routed to the standby computer room, the standby computer room queries the target credit data from the main database of the standby computer room. If the query fails, the target credit data is queried from the slave database of the standby computer room. The standby computer room returns the queried target credit data to the credit system, and then the credit system returns it to the upstream application.
[0036] Therefore, when the credit system receives the current acquisition request for the target credit data initiated by the upstream application, it routes the current acquisition request to the main computer room or the backup computer room according to the access weight values of the main computer room and the backup computer room at the current moment. Therefore, the server resources of the backup computer room can be fully utilized to avoid wasting the server resources of the backup computer room. In addition, the access weight values of the main computer room and the backup computer room at the current moment are dynamically adjusted according to the response failure rate of the historical acquisition requests of multiple historical credit data of the computer room. Therefore, when selecting the main computer room or the backup computer room based on the access weight values of the main computer room and the backup computer room at the current moment, the computer room with a better status can be selected to respond to the acquisition request of the upstream application, thereby quickly responding to the upstream application and ensuring the response efficiency of the credit system.
[0037] In one embodiment, the above S208 also includes: identifying whether the routing switch is turned on, if the routing switch is in the on state, then when the current acquisition request is routed to the main computer room, the routing information of the current acquisition request is recorded, the routing information includes the identification information of the current acquisition request and the identification information of the main computer room each time the current acquisition request is routed, when the current acquisition request is routed to the main computer room, if the feedback information of the current acquisition request response failure is received, then the current acquisition request is continued to be routed to the main computer room based on the routing information until the target credit data returned by the main computer room is received. The above S210 also includes: if the routing switch is in the on state, then when the current acquisition request is routed to the backup computer room, the routing information of the current acquisition request is recorded, the routing information includes the identification information of the current acquisition request and the identification information of the backup computer room each time the current acquisition request is routed, when the current acquisition request is routed to the backup computer room, if the feedback information of the current acquisition request response failure is received, then the current acquisition request is continued to be routed to the backup computer room based on the routing information until the target credit data returned by the backup computer room is received.
[0038] In this embodiment, a routing switch is configured in the credit system. When the routing switch is in the on state, the credit system records the routing information of each current acquisition request. That is, it records which computer room the current acquisition request is routed to each time. Therefore, when the current acquisition request fails to respond, the routing information can be recorded to know which computer room the current acquisition request is routed to, so as to continue to route the current acquisition request to the last computer room. Specifically, the routing information is recorded through a routing record table. The routing record table records the user ID of the current acquisition request, the time of each routing of the current acquisition request, the response status of each current acquisition request, and the address of the computer room to which it is routed each time. Through the routing information, each time the current acquisition request fails to respond, it can be determined which computer room the current acquisition request is routed to, and then the current acquisition request can continue to be routed to the computer room.
[0039] There are many reasons why the current acquisition request for the target credit data fails to respond. It may be that the network delay causes the computer room to fail to return the target credit data to the credit system in time, it may be that the current acquisition request is lost in the process of the credit system routing the current acquisition request to the computer room, it may be that the gateway assembly request fails to send the current acquisition request to the computer room, or it may be that the computer room does not respond to the current acquisition request. In the case where the computer room has responded to the current acquisition request but failed to return the target credit data to the credit system, if the credit system routes the current acquisition request to another computer room, two computer rooms will respond to the current acquisition request at the same time. This situation will cause the two computer rooms to record the response process of the current acquisition request at the same time, resulting in redundant information records. In addition, if another computer room fails to respond to the current acquisition request, the credit system will determine that the target credit data has not been collected, and will instruct the computer room to query from the external data source. At this time, the target credit data will be repeatedly collected. Therefore, when the current acquisition request fails to respond, repeatedly routing the current acquisition request to the same computer room can avoid the situation of repeated responses to the current acquisition request.
[0040] In one example, if feedback information indicating that the current acquisition request has failed to respond is received, the step of continuing to route the current acquisition request to the main computer room based on the routing information until the target credit data returned by the main computer room is received includes: when routing the current acquisition request to the main computer room, if the received feedback information is the first feedback information, the current acquisition request is continued to be routed to the main computer room based on the routing information until the target credit data returned by the main computer room is received, the first feedback information indicating that the current acquisition request has failed to respond due to the non-main computer room, and if the received feedback information is the second feedback information, the current acquisition request is routed to the backup computer room, and the second feedback information indicates that the main computer room has failed to respond to the current acquisition request. The above-mentioned step of continuing to route the current acquisition request to the standby computer room based on the routing information until the target credit data returned by the standby computer room is received if feedback information indicating that the current acquisition request has failed to respond is received, includes: when routing the current acquisition request to the standby computer room, if the received feedback information is the third feedback information, continuing to route the current acquisition request to the standby computer room based on the routing information until the target credit data returned by the standby computer room is received, the third feedback information indicating that the current acquisition request has failed to respond due to the non-standby computer room, and if the received feedback information is the fourth feedback information, routing the current acquisition request to the main computer room, and the fourth feedback information indicating that the standby computer room has failed to respond to the current acquisition request.
[0041] Specifically, the specific reason for the failure of the current acquisition request response is confirmed from the feedback information of the failure of the current acquisition request response. If the response failure is caused by reasons other than the computer room, the current acquisition request continues to be routed to the computer room until the target credit data returned by the computer room is received. If the response failure is caused by reasons of the computer room, the current acquisition request is switched to another computer room. It can be that the failure of the response is caused by the computer room based on the error code in the feedback information of the failure of the current acquisition request response. For example, when the current acquisition request was routed to the main computer room last time, it was determined based on the error code that the last request was 100% failed. At this time, the state of the routing switch can be ignored and the route can be directly made to the backup computer room based on the weight. Therefore, it is possible to avoid the situation where repeated visits to the failed computer room result in a slow response speed for the current acquisition request.
[0042] In one example, after the above-mentioned step of continuing to route the current acquisition request to the main computer room based on the routing information, it also includes: if after continuing to route the current acquisition request to the main computer room based on the routing information, the target credit data returned by the main computer room is not received after the first set time period, when it is confirmed that there is no delay in the data synchronization between the main computer room and the backup computer room, the routing switch is turned off, and when it is confirmed that the routing switch is in the off state, the access weight value of the main computer room and the access weight value of the backup computer room are obtained again, and the access weight values of the main computer room and the backup computer room obtained again are dynamically adjusted according to the response failure rate of the historical acquisition requests for multiple historical credit data of the computer room before the moment when the routing switch is confirmed to be in the off state; based on the access weight value of the main computer room and the access weight value of the backup computer room obtained again, it is determined whether to route the current acquisition request to the main computer room or the backup computer room.
[0043] In this example, if the main computer room fails to respond to the current acquisition request for a period of time, the routing switch needs to be turned off. In this case, it is necessary to ensure that there is no delay in the cross-synchronization of data between the main database and the slave database in the main and backup computer rooms before turning off the routing switch, so as to ensure that both the main computer room and the backup computer room store the full amount of credit data.
[0044] After the routing switch is turned off, the credit system re-determines which computer room the current acquisition request should be routed to based on the access weight value. As mentioned above, the credit system monitors and records the response of the acquisition request of the credit data of the main computer room and the slave computer room in real time, and dynamically adjusts the access weight value of the computer room based on the response failure rate of the historical acquisition request of the historical credit data of the computer room. After the credit system turns off the routing switch, the access weight value of each computer room is re-acquired. The access weight value obtained at this time is dynamically adjusted and determined based on the response failure rate of the historical acquisition request of the historical credit data of the computer room before the routing switch was turned off. Therefore, if the computer room fails to return the target credit data for a period of time, it may be that the server resources of the computer room are tight. Turning off the routing switch will no longer control the current acquisition request to access the same computer room. The current acquisition request will be randomly routed to the computer room based on the access weight value, which can balance the use of the server resources of the two computer rooms.
[0045] In one example, if the received feedback information is the second feedback information, then after the step of routing the current acquisition request to the standby computer room, the method further includes: if information is received from the standby computer room indicating that the standby computer room has failed to respond to the current acquisition request, then instructing the standby computer room to obtain target credit data from an external data source; receiving the target credit data returned by the standby computer room, and returning the target credit data to the upstream application; wherein, after the standby computer room obtains the target credit data from the external data source, the target credit data is stored in the standby computer room's main database, and the target credit data is synchronized to the main computer room's slave database.
[0046] In one example, if the received feedback information is the fourth feedback information, then after the step of routing the current acquisition request to the main computer room, the method further includes: if information is received from the main computer room indicating that the standby computer room has failed to respond to the current acquisition request, then instructing the main computer room to obtain target credit data from an external data source; receiving the target credit data returned by the main computer room, and returning the target credit data to the upstream application; wherein, after the main computer room obtains the target credit data from the external data source, the target credit data is stored in the main database of the main computer room, and the target credit data is synchronized to the slave database of the standby computer room.
[0047] Specifically, if the main computer room fails to respond to the current acquisition request, and after routing the current acquisition request to the standby computer room, the standby computer room fails to respond to the current acquisition request, it means that the target credit data has not been collected in both the main and standby computer rooms. At this time, the credit system instructs the standby computer room to collect the target credit data from the external data source. While the standby computer room returns the collected target credit data to the credit system, it stores the target credit data in the main database of the standby computer room, and cross-synchronizes it to the slave database of the main computer room. Similarly, after the standby computer room fails to respond to the current acquisition request, and after routing the current acquisition request to the main computer room, the main computer room fails to respond to the current acquisition request, it means that the target credit data has not been collected in both the main and standby computer rooms. The main computer room collects the target credit data from the external data source and returns it to the credit system. It is stored in the main database of the main computer room at the same time, and cross-synchronized to the slave database of the standby computer room at the same time.
[0048] Specifically, when the master database and slave database of the master and standby computer rooms are cross-synchronized, the master database allows read and write operations, and the slave database only allows read operations. Therefore, repeated writing of credit data is avoided. When the master and standby computer rooms cross-synchronize credit data without delay, the credit data stored in the master and slave databases of the main computer room are equal to the credit data stored in the master and slave databases of the master and standby computer rooms, and both are full data. Therefore, dual-active is guaranteed in dual computer rooms to avoid waste of resources. In addition, there will be no repeated query of external data sources, which can ensure safe query of external data sources.
[0049] In one embodiment, after the above-mentioned step of determining whether to route the current acquisition request to the main computer room or the backup computer room based on the access weight value of the main computer room and the access weight value of the backup computer room at the current moment, it also includes: taking the moment when the current acquisition request is received as the statistical time starting point, counting the response failure rate of the acquisition request for credit data in the main computer room within a period of time, when the response failure rate of the main computer room within a period of time is greater than the first failure rate threshold, setting the weight value of the main computer room to 0 and setting the weight value of the main computer room to the first set value after a second set time period; when the response failure rate of the main computer room within a period of time is greater than the third failure rate threshold and less than the second failure threshold, setting the weight value of the main computer room to the second set value, wherein the first set value and the second set value are the same or different, the first failure rate threshold is greater than the second failure rate threshold, and the second failure rate threshold is greater than the third failure rate threshold.
[0050] Specifically, the credit system configures the initial access weight values of the two computer rooms to be 50% and 50% respectively. The proportion of the subsequent access weight values is dynamically adjusted according to the response failure rate of the computer room's credit data acquisition request. For example: if the failure rate of the main computer room in the past minute is greater than 50%, the traffic in the main computer room is dynamically adjusted to 0%. That is, the access weight value of the main computer room is 0. If the failure rate of the main computer room in the past minute is less than <20% and greater than 10%, the traffic in the main computer room is dynamically adjusted to 20%, etc. That is, the access weight value of the main computer room is 20%. Therefore, the active-active dual-use of the primary and standby computer rooms is guaranteed to be available at the same time, while also avoiding waste of resources.
[0051] It should be understood that, although the steps in the flowchart are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0052] The present application also provides a data processing device based on dual-machine room dual-active. Figure 3As shown, a data processing device based on dual-machine room dual-active includes a receiving module 302, an acquisition module 304, a judgment module 306, a first feedback module 308 and a second feedback module 310. The receiving module 302 is used to receive a current acquisition request for target credit data initiated by an upstream application; the acquisition module 304 is used to respond to the current acquisition request and acquire the access weight value of the main machine room and the access weight value of the backup machine room at the current moment, and the access weight values of the main machine room and the backup machine room at the current moment are dynamically adjusted according to the response failure rate of the historical acquisition request of multiple historical credit data of the machine room before the moment when the current acquisition request is received; the judgment module 306 is used to determine whether to route the current acquisition request to the main machine room or the backup machine room based on the access weight value of the main machine room and the access weight value of the backup machine room at the current moment; the first feedback module 308 and the second feedback module 310 are used to determine whether to route the current acquisition request to the main machine room or the backup machine room based on the access weight value of the main machine room and the access weight value of the backup machine room at the current moment; Module 308 is used to receive the target credit data returned by the main computer room when the current acquisition request is routed to the main computer room, and return the target credit data to the upstream application, wherein the main computer room queries the target credit data from the main database of the main computer room, and if the query fails, then query the target credit data from the slave database of the main computer room; the second feedback module 310 is used to receive the target credit data returned by the standby computer room when the current acquisition request is routed to the standby computer room, and return the target credit data to the upstream application, wherein the standby computer room queries the target credit data from the main database of the standby computer room, and if the query fails, then query the target credit data from the slave database of the standby computer room.
[0053] In one of the embodiments, a data processing device based on dual-computer room dual-active also includes a routing control module, which is used to identify whether the routing switch is turned on. If the routing switch is in the on state, when the current acquisition request is routed to the main computer room, the routing information of the current acquisition request is recorded, and the routing information includes the identification information of the current acquisition request and the identification information of the main computer room each time the current acquisition request is routed. When the current acquisition request is routed to the main computer room, if feedback information that the current acquisition request response fails is received, the current acquisition request is continued to be routed to the main computer room based on the routing information until the target credit data returned by the main computer room is received; if the routing switch is in the on state, when the current acquisition request is routed to the standby computer room, the routing information of the current acquisition request is recorded, and the routing information includes the identification information of the current acquisition request and the identification information of the standby computer room each time the current acquisition request is routed. When the current acquisition request is routed to the standby computer room, if feedback information that the current acquisition request response fails is received, the current acquisition request is continued to be routed to the standby computer room based on the routing information until the target credit data returned by the standby computer room is received.
[0054] In one of the embodiments, the routing control module is also used for, when routing the current acquisition request to the main computer room, if the received feedback information is the first feedback information, then based on the routing information, continue to route the current acquisition request to the main computer room until the target credit data is received from the main computer room, the first feedback information indicates that the current acquisition request failed to respond due to the non-main computer room, if the received feedback information is the second feedback information, then route the current acquisition request to the backup computer room, the second feedback information indicates that the main computer room failed to respond to the current acquisition request; when routing the current acquisition request to the backup computer room, if the received feedback information is the third feedback information, then based on the routing information, continue to route the current acquisition request to the backup computer room until the target credit data is received from the backup computer room, the third feedback information indicates that the current acquisition request failed to respond due to the non-backup computer room, if the received feedback information is the fourth feedback information, then route the current acquisition request to the main computer room, the fourth feedback information indicates that the backup computer room failed to respond to the current acquisition request.
[0055] In one of the embodiments, the judgment module 306 is also used for, if after the current acquisition request continues to be routed to the main computer room based on the routing information, the target credit data returned by the main computer room is not received after the first set period of time, and when it is confirmed that there is no delay in the data synchronization between the main computer room and the backup computer room, turning off the routing switch, and when it is confirmed that the routing switch is in the off state, obtaining the access weight value of the main computer room and the access weight value of the backup computer room again, the access weight values of the main computer room and the backup computer room obtained again are dynamically adjusted according to the response failure rate of the historical acquisition requests for multiple historical credit data of the computer room before the moment when the routing switch is confirmed to be in the off state; based on the access weight value of the main computer room and the access weight value of the backup computer room obtained again, it is determined whether the current acquisition request is routed to the main computer room or the backup computer room.
[0056] In one of the embodiments, if the received feedback information is the second feedback information, then after routing the current acquisition request to the standby computer room, it also includes: if information is received from the standby computer room indicating that the standby computer room has failed to respond to the current acquisition request, then instructing the standby computer room to obtain target credit data from an external data source; receiving the target credit data returned by the standby computer room, and returning the target credit data to the upstream application; wherein, after the standby computer room obtains the target credit data from the external data source, the target credit data is stored in the main database of the standby computer room, and the target credit data is synchronized to the slave database of the main computer room.
[0057] In one of the embodiments, if the received feedback information is the fourth feedback information, then after routing the current acquisition request to the main computer room, it also includes: if information returned by the main computer room indicating that the standby computer room has failed to respond to the current acquisition request is received, then instructing the main computer room to obtain target credit data from an external data source; receiving the target credit data returned by the main computer room, and returning the target credit data to the upstream application; wherein, after the main computer room obtains the target credit data from the external data source, the target credit data is stored in the main database of the main computer room, and the target credit data is synchronized to the slave database of the standby computer room.
[0058] In one of the embodiments, after determining to route the current acquisition request to the main computer room or the backup computer room based on the access weight value of the main computer room and the access weight value of the backup computer room at the current moment, it also includes: taking the moment when the current acquisition request is received as the statistical time starting point, counting the response failure rate of the acquisition request for credit data in the main computer room over a period of time, when the response failure rate of the main computer room over a period of time is greater than the first failure rate threshold, setting the weight value of the main computer room to 0 and setting the weight value of the main computer room to the first set value after a second set time period; when the response failure rate of the main computer room over a period of time is greater than the third failure rate threshold and less than the second failure threshold, setting the weight value of the main computer room to the second set value, wherein the first set value and the second set value are the same or different, the first failure rate threshold is greater than the second failure rate threshold, and the second failure rate threshold is greater than the third failure rate threshold.
[0059] For the specific definition of a data processing device based on dual-machine room dual-active, please refer to the definition of a data processing method based on dual-machine room dual-active in the above text, which will not be repeated here. Each module in the above-mentioned data processing device based on dual-machine room dual-active can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0060] In one embodiment, a computer device is provided. The computer device may be a server supporting the operation of the credit system 102. The internal structure diagram thereof may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to interact with upstream applications for data, etc. When the computer program is executed by the processor, the above-mentioned data processing method based on dual-machine room dual-active is implemented.
[0061] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0062] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented: receiving a current acquisition request for target credit data initiated by an upstream application; in response to the current acquisition request, acquiring an access weight value of the main computer room and an access weight value of the backup computer room at the current moment, wherein the access weight values of the main computer room and the backup computer room at the current moment are dynamically adjusted according to the response failure rate of historical acquisition requests for multiple historical credit data of the computer room before the current acquisition request is received; based on the access weight value of the main computer room and the access weight value of the backup computer room at the current moment, The access weight value of the computer room determines whether the current acquisition request is routed to the main computer room or the backup computer room; when the current acquisition request is routed to the main computer room, the target credit data returned by the main computer room is received, and the target credit data is returned to the upstream application, wherein the main computer room queries the target credit data from the main database of the main computer room, and if the query fails, the target credit data is queried from the slave database of the main computer room; when the current acquisition request is routed to the backup computer room, the target credit data returned by the backup computer room is received, and the target credit data is returned to the upstream application, wherein the backup computer room queries the target credit data from the main database of the backup computer room, and if the query fails, the target credit data is queried from the slave database of the backup computer room.
[0063] In one of the embodiments, the processor implements the following steps when executing the computer program: identifying whether the routing switch is turned on, if the routing switch is in the on state, recording the routing information of the current acquisition request when routing the current acquisition request to the main computer room, the routing information includes the identification information of the current acquisition request and the identification information of the main computer room each time the current acquisition request is routed, when routing the current acquisition request to the main computer room, if feedback information that the current acquisition request response fails is received, then the current acquisition request continues to be routed to the main computer room based on the routing information until the target credit data returned by the main computer room is received; if the routing switch is in the on state, then recording the routing information of the current acquisition request when routing the current acquisition request to the backup computer room, the routing information includes the identification information of the current acquisition request and the identification information of the backup computer room each time the current acquisition request is routed, when routing the current acquisition request to the backup computer room, if feedback information that the current acquisition request response fails is received, then the current acquisition request continues to be routed to the backup computer room based on the routing information until the target credit data returned by the backup computer room is received.
[0064] In one of the embodiments, the processor implements the following steps when executing the computer program: when routing the current acquisition request to the main computer room, if the received feedback information is the first feedback information, then the current acquisition request continues to be routed to the main computer room based on the routing information until the target credit data returned by the main computer room is received, and the first feedback information indicates that the current acquisition request response failed due to the non-main computer room; if the received feedback information is the second feedback information, then the current acquisition request is routed to the backup computer room, and the second feedback information indicates that the main computer room fails to respond to the current acquisition request; when routing the current acquisition request to the backup computer room, if the received feedback information is the third feedback information, then the current acquisition request continues to be routed to the backup computer room based on the routing information until the target credit data returned by the backup computer room is received, and the third feedback information indicates that the current acquisition request response failed due to the non-backup computer room; if the received feedback information is the fourth feedback information, then the current acquisition request is routed to the main computer room, and the fourth feedback information indicates that the backup computer room fails to respond to the current acquisition request.
[0065] In one of the embodiments, the processor implements the following steps when executing the computer program: if after the current acquisition request is routed to the main computer room based on the routing information, the target credit data returned by the main computer room is not received after the first set period of time, when it is confirmed that there is no delay in the data synchronization between the main computer room and the backup computer room, the routing switch is turned off, and when it is confirmed that the routing switch is in the off state, the access weight value of the main computer room and the access weight value of the backup computer room are acquired again, and the access weight values of the main computer room and the backup computer room acquired again are dynamically adjusted according to the response failure rate of the historical acquisition requests for multiple historical credit data of the computer room before the moment when the routing switch is confirmed to be in the off state; based on the access weight value of the main computer room and the access weight value of the backup computer room acquired again, it is determined whether to route the current acquisition request to the main computer room or the backup computer room.
[0066] In one of the embodiments, the processor implements the following steps when executing the computer program: if information is received from the standby computer room indicating that the standby computer room has failed to respond to the current acquisition request, the standby computer room is instructed to obtain target credit data from an external data source; the target credit data returned by the standby computer room is received, and the target credit data is returned to the upstream application; wherein, after the standby computer room obtains the target credit data from the external data source, the target credit data is stored in the main database of the standby computer room, and the target credit data is synchronized to the slave database of the main computer room.
[0067] In one of the embodiments, the processor implements the following steps when executing the computer program: if information is received from the main computer room indicating that the backup computer room has failed to respond to the current acquisition request, the main computer room is instructed to obtain target credit data from an external data source; the target credit data returned by the main computer room is received, and the target credit data is returned to the upstream application; wherein, after the main computer room obtains the target credit data from the external data source, the target credit data is stored in the main database of the main computer room, and the target credit data is synchronized to the slave database of the backup computer room.
[0068] In one of the embodiments, the processor implements the following steps when executing the computer program: taking the moment when the current acquisition request is received as the statistical time starting point, counting the response failure rate of the credit data acquisition request in the main computer room within a period of time, when the response failure rate in the main computer room within a period of time is greater than the first failure rate threshold, setting the weight value of the main computer room to 0 and setting the weight value of the main computer room to the first set value after a second set time period; when the response failure rate in the main computer room within a period of time is greater than the third failure rate threshold and less than the second failure threshold, setting the weight value of the main computer room to the second set value, wherein the first set value and the second set value are the same or different, the first failure rate threshold is greater than the second failure rate threshold, and the second failure rate threshold is greater than the third failure rate threshold.
[0069] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: receiving a current acquisition request for target credit data initiated by an upstream application; in response to the current acquisition request, acquiring an access weight value of the main computer room and an access weight value of the backup computer room at the current moment, wherein the access weight values of the main computer room and the backup computer room at the current moment are dynamically adjusted according to the response failure rate of historical acquisition requests for multiple historical credit data of the computer room before the current acquisition request is received; based on the access weight value of the main computer room and the access weight value of the backup computer room at the current moment Determine whether to route the current acquisition request to the main computer room or the standby computer room; when routing the current acquisition request to the main computer room, receive the target credit data returned by the main computer room, and return the target credit data to the upstream application, wherein the main computer room queries the target credit data from the main computer room's main database, and if the query fails, then query the target credit data from the main computer room's slave database; when routing the current acquisition request to the standby computer room, receive the target credit data returned by the standby computer room, and return the target credit data to the upstream application, wherein the standby computer room queries the target credit data from the main computer room's main database, and if the query fails, then query the target credit data from the standby computer room's slave database.
[0070] In one of the embodiments, the computer program implements the following steps when executed by the processor: identifying whether the routing switch is turned on; if the routing switch is in the on state, recording the routing information of the current acquisition request when routing the current acquisition request to the main computer room, the routing information including the identification information of the current acquisition request and the identification information of the main computer room each time the current acquisition request is routed; when routing the current acquisition request to the main computer room, if feedback information indicating that the current acquisition request fails to respond is received, then the current acquisition request continues to be routed to the main computer room based on the routing information until the target credit data returned by the main computer room is received; if the routing switch is in the on state, recording the routing information of the current acquisition request when routing the current acquisition request to the backup computer room, the routing information including the identification information of the current acquisition request and the identification information of the backup computer room each time the current acquisition request is routed; when routing the current acquisition request to the backup computer room, if feedback information indicating that the current acquisition request fails to respond is received, then the current acquisition request continues to be routed to the backup computer room based on the routing information until the target credit data returned by the backup computer room is received.
[0071] In one of the embodiments, the computer program implements the following steps when executed by the processor: when routing the current acquisition request to the main computer room, if the received feedback information is the first feedback information, then the current acquisition request continues to be routed to the main computer room based on the routing information until the target credit data returned by the main computer room is received, and the first feedback information indicates that the current acquisition request response failed due to the non-main computer room; if the received feedback information is the second feedback information, then the current acquisition request is routed to the backup computer room, and the second feedback information indicates that the main computer room failed to respond to the current acquisition request; when routing the current acquisition request to the backup computer room, if the received feedback information is the third feedback information, then the current acquisition request continues to be routed to the backup computer room based on the routing information until the target credit data returned by the backup computer room is received, and the third feedback information indicates that the current acquisition request response failed due to the non-backup computer room; if the received feedback information is the fourth feedback information, then the current acquisition request is routed to the main computer room, and the fourth feedback information indicates that the backup computer room failed to respond to the current acquisition request.
[0072] In one of the embodiments, the computer program implements the following steps when executed by the processor: if after the current acquisition request is routed to the main computer room based on the routing information, the target credit data returned by the main computer room is not received after the first set period of time, after confirming that there is no delay in the data synchronization between the main computer room and the backup computer room, the routing switch is turned off, and when confirming that the routing switch is in the off state, the access weight value of the main computer room and the access weight value of the backup computer room are acquired again, and the access weight values of the main computer room and the backup computer room acquired again are dynamically adjusted according to the response failure rate of the historical acquisition requests for multiple historical credit data of the computer room before the moment when the routing switch is confirmed to be in the off state; based on the access weight value of the main computer room and the access weight value of the backup computer room acquired again, it is determined whether the current acquisition request is routed to the main computer room or the backup computer room.
[0073] In one of the embodiments, the computer program implements the following steps when executed by the processor: if information is received from the standby computer room indicating that the standby computer room has failed to respond to the current acquisition request, instructing the standby computer room to obtain target credit data from an external data source; receiving the target credit data returned by the standby computer room, and returning the target credit data to the upstream application; wherein, after the standby computer room obtains the target credit data from the external data source, the target credit data is stored in the main database of the standby computer room, and the target credit data is synchronized to the slave database of the main computer room.
[0074] In one of the embodiments, the computer program implements the following steps when executed by the processor: if information is received from the main computer room indicating that the backup computer room has failed to respond to the current acquisition request, instructing the main computer room to obtain target credit data from an external data source; receiving the target credit data returned by the main computer room, and returning the target credit data to the upstream application; wherein, after the main computer room obtains the target credit data from the external data source, the target credit data is stored in the main database of the main computer room, and the target credit data is synchronized to the slave database of the backup computer room.
[0075] In one of the embodiments, the computer program implements the following steps when executed by the processor: taking the moment when the current acquisition request is received as the statistical time starting point, counting the response failure rate of the credit data acquisition request in the main computer room within a period of time; when the response failure rate in the main computer room within a period of time is greater than the first failure rate threshold, setting the weight value of the main computer room to 0 and setting the weight value of the main computer room to the first set value after a second set time period; when the response failure rate in the main computer room within a period of time is greater than the third failure rate threshold and less than the second failure threshold, setting the weight value of the main computer room to the second set value, wherein the first set value and the second set value are the same or different, the first failure rate threshold is greater than the second failure rate threshold, and the second failure rate threshold is greater than the third failure rate threshold.
[0076] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0077] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0078] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A data processing method based on dual-machine room dual-active, characterized in that: Applied to a credit system, the method comprises: Receive the current acquisition request of the target credit data initiated by the upstream application; In response to the current acquisition request, the access weight value of the main computer room and the access weight value of the backup computer room at the current moment are acquired, and the access weight values of the main computer room and the backup computer room at the current moment are dynamically adjusted according to the response failure rate of the historical acquisition request of multiple historical credit data of the computer room before the moment when the current acquisition request is received; Based on the access weight value of the main computer room and the access weight value of the standby computer room at the current moment, it is determined whether to route the current acquisition request to the main computer room or the standby computer room; When routing the current acquisition request to the computer room, receiving the target credit data returned by the computer room, and returning the target credit data to the upstream application, wherein the computer room queries the target credit data from the main database of the computer room, and if the query fails, then queries the target credit data from the slave database of the computer room; When the current acquisition request is routed to the standby computer room, the target credit data returned by the standby computer room is received, and the target credit data is returned to the upstream application, wherein the standby computer room queries the target credit data from the main database of the standby computer room. If the query fails, the target credit data is queried from the slave database of the standby computer room.
2. The method according to claim 1, characterized in that The method further comprises: Identify whether the routing switch is turned on. If the routing switch is turned on, when routing the current acquisition request to the computer room, record the routing information of the current acquisition request, the routing information includes the identification information of the current acquisition request and the identification information of the computer room each time the current acquisition request is routed. When routing the current acquisition request to the computer room, if feedback information indicating that the current acquisition request fails to respond is received, continue to route the current acquisition request to the computer room based on the routing information until the target credit data returned by the computer room is received; If the routing switch is in the on state, then when the current acquisition request is routed to the standby computer room, the routing information of the current acquisition request is recorded, the routing information including the identification information of the current acquisition request and the identification information of the standby computer room each time the current acquisition request is routed, and when the current acquisition request is routed to the standby computer room, if feedback information indicating that the current acquisition request response fails is received, the current acquisition request continues to be routed to the standby computer room based on the routing information until the target credit data returned by the standby computer room is received.
3. The method according to claim 2, characterized in that The method further comprises: When routing the current acquisition request to the main computer room, if the received feedback information is the first feedback information, then continue routing the current acquisition request to the main computer room based on the routing information until the main computer room returns the target credit data, the first feedback information indicating that the current acquisition request failed to respond due to the non-main computer room, if the received feedback information is the second feedback information, then route the current acquisition request to the standby computer room, the second feedback information indicating that the main computer room failed to respond to the current acquisition request; When routing the current acquisition request to the standby computer room, if the received feedback information is the third feedback information, the current acquisition request continues to be routed to the standby computer room based on the routing information until the standby computer room returns the target credit data, and the third feedback information indicates that the current acquisition request failed to respond due to the non-standby computer room. If the received feedback information is the fourth feedback information, the current acquisition request is routed to the main computer room, and the fourth feedback information indicates that the standby computer room failed to respond to the current acquisition request.
4. The method according to claim 3, characterized in that The method further comprises: If after the current acquisition request is routed to the main computer room based on the routing information, the target credit data is not received from the main computer room after the first set period of time, upon confirming that there is no delay in data synchronization between the main computer room and the backup computer room, the routing switch is turned off, and upon confirming that the routing switch is in the off state, the access weight value of the main computer room and the access weight value of the backup computer room are acquired again, and the access weight values of the main computer room and the backup computer room acquired again are dynamically adjusted according to the response failure rate of the historical acquisition requests for multiple historical credit data of the computer room before the moment when the routing switch is confirmed to be in the off state; Based on the access weight value of the main computer room and the access weight value of the standby computer room obtained again, it is determined whether the current acquisition request is routed to the main computer room or the standby computer room.
5. The method according to claim 3, characterized in that: After the step of routing the current acquisition request to the standby computer room if the received feedback information is the second feedback information, the method further includes: If the standby computer room returns information indicating that the standby computer room has failed to respond to the current acquisition request, instructing the standby computer room to acquire the target credit data from an external data source; receiving the target credit data returned by the standby computer room, and returning the target credit data to the upstream application; After the standby computer room obtains the target credit data from the external data source, the target credit data is stored in the main database of the standby computer room, and the target credit data is synchronized to the slave database of the main computer room.
6. The method according to claim 3, characterized in that: After the step of routing the current acquisition request to the computer room if the received feedback information is the fourth feedback information, the method further includes: If the host computer room returns information indicating that the standby computer room has failed to respond to the current acquisition request, the host computer room is instructed to acquire the target credit data from an external data source; receiving the target credit data returned by the main computer room, and returning the target credit data to the upstream application; After the main computer room obtains the target credit data from the external data source, the target credit data is stored in the main database of the main computer room, and the target credit data is synchronized to the slave database of the standby computer room.
7. The method according to claim 1, characterized in that After the step of determining, based on the access weight value of the main computer room and the access weight value of the standby computer room at the current moment, whether to route the current acquisition request to the main computer room or the standby computer room, the method further includes: Taking the moment of receiving the current acquisition request as the statistical time starting point, the response failure rate of the credit data acquisition request of the computer room within a period of time is counted, and when the response failure rate of the computer room within a period of time is greater than the first failure rate threshold, the weight value of the computer room is set to 0 and the weight value of the computer room is set to the first set value after a second set time period; When the response failure rate of the computer room over a period of time is greater than the third failure rate threshold and less than the second failure threshold, the weight value of the computer room is set to a second set value, wherein the first set value and the second set value are the same or different, the first failure rate threshold is greater than the second failure rate threshold, and the second failure rate threshold is greater than the third failure rate threshold.
8. A data processing device based on dual-machine room dual-active, characterized in that: Applied to a credit system, the device comprises: A receiving module, used to receive a current acquisition request for target credit data initiated by an upstream application; An acquisition module, for acquiring, in response to the current acquisition request, an access weight value of the main computer room and an access weight value of the standby computer room at the current moment, wherein the access weight values of the main computer room and the standby computer room at the current moment are dynamically adjusted according to the response failure rate of the historical acquisition request of multiple historical credit data of the computer room before the moment when the current acquisition request is received; A judgment module, used for judging whether to route the current acquisition request to the main computer room or the standby computer room based on the access weight value of the main computer room and the access weight value of the standby computer room at the current moment; A first feedback module is used for receiving the target credit data returned by the main computer room when routing the current acquisition request to the main computer room, and returning the target credit data to the upstream application, wherein the main computer room queries the target credit data from the main computer room's main database, and if the query fails, queries the target credit data from the main computer room's secondary database; The second feedback module is used to receive the target credit data returned by the standby computer room when routing the current acquisition request to the standby computer room, and return the target credit data to the upstream application, wherein the standby computer room queries the target credit data from the main database of the standby computer room. If the query fails, the target credit data is queried from the slave database of the standby computer room.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
