Data service system and data calling method
By designing a data service system in a distributed database and using global routing components and communication components to achieve automatic routing, the distributed database's performance bottlenecks and capacity expansion restrictions are solved when processing large amounts of data, and efficient database performance and unlimited capacity expansion are achieved.
Patent Information
- Application Number
- CN202411951201.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-25
AI Technical Summary
There are performance bottlenecks in distributed databases when processing large amounts of data. Although the table and database partitioning method can improve performance, as application instances increase, the number of database links increases exponentially, consumes resources, affects performance and limits capacity expansion.
Design a data service system, by splitting the data to multiple databases, establishing a correspondence between the business unit identification and the database identification, and using global routing components and communication components to realize automatic routing, ensuring that the application instance of each business unit only calls its corresponding database.
It effectively solves the problems of distributed database performance bottlenecks and capacity expansion restrictions, and improves database performance by reducing the number of database links and resource consumption, and supports unlimited capacity expansion of the system.
Smart Images

Figure CN119884247A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to data processing technology, in particular to a data service system and a data calling method. Background Art
[0002] For distributed databases such as relational databases, when the amount of stored data reaches a certain amount, for example, when the amount of data reaches tens of millions or hundreds of millions, there is a performance bottleneck problem in data access to the database.
[0003] Currently, the performance bottleneck caused by accessing massive data is improved by sharding tables and databases. However, in this distributed data environment, the upper-level application system needs to link to all the shards. As the number of application instances in the application system increases, the number of database links also increases exponentially. These links consume database resources, which not only affects the performance of the application system when operating the database, but also affects the expansion of the application system due to the upper limit of resources. Summary of the invention
[0004] In order to overcome the deficiencies of the prior art, the present application provides a data service system and a data calling method to improve the performance of a distributed database and to eliminate the limitation of application system expansion.
[0005] An embodiment of the present application provides a data service system, which includes: a business system, which includes multiple business units, each business unit has a business unit identifier, and the business unit identifier corresponds to N application instances; N is a positive integer; a data system, which includes multiple databases, and the data system splits each batch of data into multiple databases based on the data attribute information of each batch of data; a corresponding relationship is formed between the business unit identifier and the database identifier; the N application instances corresponding to any business unit identifier call the database represented by the database identifier corresponding to the business unit identifier; a global routing component, which is used to determine the target business unit identifier corresponding to the service request according to the target data attribute information carried in the service request; and a communication component, which is used to select a target application instance from the N application instances corresponding to the target business unit identifier according to the target business unit identifier output by the global routing component, so that the target application instance calls the target database bound to the target business unit identifier to provide corresponding target data for the service request.
[0006] In one embodiment, if the target data attribute information is the same as the first data attribute information used when each batch of data is split and stored in multiple databases, a remainder operation is performed on the target data attribute information to obtain a remainder value, and the target business unit identifier corresponding to the obtained remainder value is searched from the correspondence between the set remainder value and the business unit identifier;
[0007] If the target data attribute information is different from the first data attribute information used when each batch of data is split and stored in multiple databases, the first data attribute information corresponding to the target data attribute information is found based on the correspondence between the stored target data attribute information and the first data attribute information, and a modulo operation is performed on the found first data attribute information to obtain the remainder value, and the target business unit identifier corresponding to the obtained remainder value is found from the correspondence between the set remainder value and the business unit identifier.
[0008] In one embodiment, the data system divides each batch of data into multiple databases according to the data attribute information of each batch of data, including at least one of the following methods:
[0009] For each piece of data attribute information, a modulo operation is performed on the data attribute information to obtain a remainder value, and a database corresponding to the obtained remainder value is searched from a correspondence relationship between the set remainder value and the database identifier;
[0010] For each piece of data attribute information, the data attribute information is hashed and modulo-calculated to obtain a modulus value, and a database corresponding to the obtained modulus value is searched from the correspondence between the set modulus value and the database identifier;
[0011] For each piece of data attribute information, according to the data attribute information range corresponding to each database identifier, determine the database corresponding to the data attribute information;
[0012] For each piece of data attribute information, the database corresponding to the data attribute information is calculated using a regular expression.
[0013] In one embodiment, any two business units in the business unit are business units that backup each other;
[0014] Among them, any application instance under any business unit of the two business units that back up each other not only calls the database represented by the database identifier corresponding to the business unit identifier of the business unit, but also calls the database represented by the database identifier corresponding to the business unit identifier of the other business unit.
[0015] In one embodiment, after the global routing component determines the target business unit identifier corresponding to the service request, if the business unit corresponding to the target business unit identifier is unavailable, the business unit identifier of another business unit that serves as a backup for the business unit is used as a new target business unit identifier.
[0016] In one embodiment, each piece of data attribute information establishes a corresponding relationship between a business unit identifier and a database identifier.
[0017] In one embodiment, selecting a target application instance from the N application instances corresponding to the target business unit identifier includes: selecting a target application instance from the N application instances corresponding to the target business unit identifier according to a load balancing principle.
[0018] The embodiment of the present application further provides a data calling method, which is based on the data service system provided by the above embodiment, and the data calling method includes:
[0019] According to the data attribute information of each batch of data, the batch of data is split and stored in multiple databases; a corresponding relationship is formed between the business unit identifier and the database identifier; any business unit identifier corresponds to N application instances; the N application instances corresponding to any business unit identifier call the database represented by the database identifier corresponding to the business unit identifier;
[0020] Determine the target business unit identifier corresponding to the service request according to the target data attribute information carried in the service request;
[0021] According to the target business unit identifier output by the global routing component, a target application instance is selected from the N application instances corresponding to the target business unit identifier, so that the target application instance calls the target database bound to the target business unit identifier to provide corresponding target data for the service request.
[0022] In one embodiment, determining the target business unit identifier corresponding to the service request according to the target data attribute information carried in the service request includes:
[0023] If the target data attribute information is the same as the first data attribute information used when each batch of data is split and stored in multiple databases, a remainder operation is performed on the target data attribute information to obtain a remainder value, and the target business unit identifier corresponding to the obtained remainder value is searched from the correspondence between the set remainder value and the business unit identifier;
[0024] If the target data attribute information is different from the first data attribute information used when each batch of data is split and stored in multiple databases, the first data attribute information corresponding to the target data attribute information is found based on the correspondence between the stored target data attribute information and the first data attribute information, and a modulo operation is performed on the found first data attribute information to obtain the remainder value, and the target business unit identifier corresponding to the obtained remainder value is found from the correspondence between the set remainder value and the business unit identifier.
[0025] The data system splits and stores each batch of data into multiple databases according to the data attribute information of each batch of data, including at least one of the following methods:
[0026] For each piece of data attribute information, a modulo operation is performed on the data attribute information to obtain a remainder value, and a database corresponding to the obtained remainder value is searched from a correspondence relationship between the set remainder value and the database identifier;
[0027] For each piece of data attribute information, the data attribute information is hashed and modulo-calculated to obtain a modulus value, and a database corresponding to the obtained modulus value is searched from the correspondence between the set modulus value and the database identifier;
[0028] For each piece of data attribute information, according to the data attribute information range corresponding to each database identifier, determine the database corresponding to the data attribute information;
[0029] For each piece of data attribute information, the database corresponding to the data attribute information is calculated using a regular expression.
[0030] In one embodiment, any two business units in the business unit are business units that backup each other;
[0031] Among them, any application instance under any business unit of the two business units that back up each other not only calls the database represented by the database identifier corresponding to the business unit identifier of the business unit, but also calls the database represented by the database identifier corresponding to the business unit identifier of the other business unit.
[0032] In one embodiment, the method further includes: after determining the target business unit identifier corresponding to the service request, if the business unit corresponding to the target business unit identifier is unavailable, using the business unit identifier of another business unit that serves as a backup for the business unit as a new target business unit identifier.
[0033] In one embodiment, each piece of data attribute information establishes a corresponding relationship between a business unit identifier and a database identifier.
[0034] In one embodiment, selecting a target application instance from the N application instances corresponding to the target business unit identifier includes: selecting a target application instance from the N application instances corresponding to the target business unit identifier according to a load balancing principle.
[0035] An embodiment of the present application also provides an electronic device, comprising: a processor and a computer-readable storage medium for storing computer program instructions, wherein the computer program instructions, when executed by the computer-readable storage medium, enable the processor to execute the steps of the above method.
[0036] An embodiment of the present application also provides a machine-readable storage medium, which stores computer program instructions. When the computer program instructions are executed, the steps of the above method can be implemented.
[0037] In this embodiment, the data system divides each batch of data into multiple databases based on the data attribute information of each batch of data, and each database stores the part of the business data corresponding to the business unit identifier. The global routing component determines the target business unit identifier corresponding to the service request based on the target data attribute information carried in the service request. The communication component is used to select a target application instance from the N application instances corresponding to the target business unit identifier based on the target business unit identifier output by the global routing component, and call the target database bound to the target business unit identifier based on the target application instance to provide the corresponding target data for the service request. This method of realizing automatic routing can better complete the service response.
[0038] Furthermore, the data is split into multiple databases, and each business unit ID corresponds to N application instances and only calls the database represented by the database ID corresponding to the business unit ID (in other words, the upper-layer application of each business unit only links to the database corresponding to the business unit). Compared with the strategy of splitting tables and databases, the upper-layer application no longer links to all databases, which greatly releases resources such as database links, leaving more resources for service requests, thereby improving database performance. At the same time, since resources such as database links no longer become bottlenecks, it is also more conducive to system expansion. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A block diagram of a data service system provided in an embodiment of the present application.
[0040] Figure 2 It is a flow chart of the data service method provided in the embodiment of the present application.
[0041] Figure 3 It is a flow chart of the data scheduling method provided in an embodiment of the present application.
[0042] Figure 4 It is a flow chart of the data service method provided in the embodiment of the present application.
[0043] Figure 5 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] The preferred embodiments of the present application are described in detail below in conjunction with the accompanying drawings so that the advantages and features of the present application can be more easily understood by those skilled in the art, thereby making a clearer and more definite definition of the protection scope of the present application.
[0045] See also Figure 1 , Figure 1 This is a block diagram of a data service system provided in an embodiment of the present application. Figure 1As shown, the data service system includes a business system 10 , a data system 20 , a global routing component 30 and a communication component 40 .
[0046] Business system 10, the business system includes multiple business units, the business unit has a business unit identifier, the business unit identifier corresponds to N application instances; N is a positive integer.
[0047] Data system 20, the data system includes multiple databases, and the data system splits the batch data into multiple databases according to the data attribute information of each batch of data; a corresponding relationship is formed between the business unit identifier and the database identifier; N application instances corresponding to any business unit identifier call the database represented by the database identifier corresponding to the business unit identifier.
[0048] The global routing component 30 is used to determine the target business unit identifier corresponding to the service request according to the target data attribute information carried in the service request.
[0049] The communication component 40 is used to select a target application instance from the N application instances corresponding to the target business unit identifier according to the target business unit identifier output by the global routing component, so that the target application instance calls the target database bound to the target business unit identifier to provide corresponding target data for the service request.
[0050] The specific operation steps of the above-mentioned business system 10, data system 20, global routing component 30 and communication component 40 will be explained in the form of specific embodiments later, and will not be repeated here.
[0051] The specific working method of the above data system 20 is described in detail below:
[0052] The data system splits the data into N databases based on the data attribute information of the business data to be stored (including but not limited to the customer number). Each database contains the full table structure of the application system to ensure high availability of the database.
[0053] Specifically, for example, the specific splitting rule may be: for each data attribute information, the data attribute information is subjected to a modulus operation to obtain a remainder value, and the database corresponding to the obtained remainder value is searched from the correspondence between the set remainder value and the database identifier. A deployment mode of dual computer rooms, 1 master and 3 slaves may be adopted in each database.
[0054] For example, N is 4, and the 8th to 14th digits of the customer number are modulo 64. After the modulo, the modulus value is 0-15 and stored in database 1, 16-31 is stored in database 2, 32-47 is stored in database 3, and 48-63 is stored in the database.
[0055] It should be noted that the specific splitting is not limited to the above method. It can also be that for each data attribute information, the data attribute information is hashed and modulo-calculated to obtain the modulus value, and the database corresponding to the obtained modulus value is searched from the correspondence between the set modulus value and the database identifier.
[0056] Alternatively, for each piece of data attribute information, the database corresponding to the data attribute information may be determined according to the data attribute information range corresponding to each database identifier.
[0057] Alternatively, for each piece of data attribute information, a database corresponding to the data attribute information is calculated by a regular expression. The above method is only an example and is not specifically limited.
[0058] The specific working method of the data system 20 is described in detail above:
[0059] The specific working method of the above business system 10 is described in detail below:
[0060] The business is divided into multiple business units, and the division of the business units is also based on the data attribute information. Then, N business units correspond to N databases. In other words, each piece of data attribute information establishes a corresponding relationship between the business unit identifier and the database identifier.
[0061] Specifically, a corresponding business unit identifier is assigned to each database. In addition, upper-layer application instances are also divided according to the business unit identifiers, so that one business unit identifier corresponds to N application instances, and each of the N application instances corresponding to the business unit identifier is linked to the database corresponding to the business unit identifier.
[0062] Exemplarily, the correspondence between N application instances and business unit identifiers is established in the following manner: when each application instance is started, the service is registered to the microservice framework with the corresponding business unit identifier, which realizes the establishment of the correspondence between N application instances and business unit identifiers.
[0063] For example, the business unit identifiers are divided into business unit 1, business unit 2, business unit 3 and business unit 4. Business unit 1 corresponds to database 1, and so on, which will not be repeated.
[0064] In this embodiment, by establishing a correspondence between N application instances and business unit identifiers, it is achieved that the N application instances corresponding to any business unit identifier can only call the database represented by the database identifier corresponding to the business unit identifier.
[0065] The specific working method of the above-mentioned business system 10 is described in detail above.
[0066] The specific working modes of the global routing component 30 and the communication component 40 are described in detail below:
[0067] When receiving an upper-level service request (target data attribute information carried in the service request, such as the target customer name), the communication component 40 calls the global routing component 30 to determine the target business unit identifier corresponding to the service request based on the target data attribute information carried in the service request.
[0068] Specifically, in the process of determining the target business unit identifier, the communication component 40
[0069] If the target data attribute information is the same as the first data attribute information used when each batch of data is split and stored in multiple databases, a remainder operation is performed on the target data attribute information to obtain a remainder value, and the target business unit identifier corresponding to the obtained remainder value is searched from the correspondence between the set remainder value and the business unit identifier;
[0070] If the target data attribute information is different from the first data attribute information used when each batch of data is split and stored in multiple databases, the first data attribute information corresponding to the target data attribute information is found based on the correspondence between the stored target data attribute information and the first data attribute information, and a modulo operation is performed on the found first data attribute information to obtain the remainder value, and the target business unit identifier corresponding to the obtained remainder value is found from the correspondence between the set remainder value and the business unit identifier.
[0071] For example, Example 1:
[0072] Business data is split according to customer number. The splitting rule is to take the 8-14 bits of the customer number and take the modulus of 64. The modulus value 0-15 corresponds to business unit 1, and the data is stored in database 1 corresponding to business unit 1. The modulus value 16-31 corresponds to business unit 2, and the data is stored in database 2 corresponding to business unit 2. The modulus value 32-47 corresponds to business unit 3, and the data is stored in database 3 corresponding to business unit 3. The modulus value 48-63 corresponds to business unit 4, and the data is stored in database 4 corresponding to business unit 4.
[0073] If the service request contains a customer number, the global routing component takes the 8th to 14th bits of the customer number and performs a modulo 64 operation. Based on the modulo result, the target business unit to which the customer number belongs is queried. The communication component then obtains an application instance under the target unit to complete the communication call. If there is no customer number in the service request, but only the ID number, the global routing component stores the correspondence between the ID number and the customer number. The global routing component will query the customer number based on the ID number, and then calculate the target business unit in the above manner to complete the communication call.
[0074] For example, combining Figure 2As shown, when the consumer system calls the service provider's service, the communication component 40 obtains the service provider's address information, and in the process of obtaining the address information, calls the global routing component 30 (for example, the global routing API) according to the target data attribute information to obtain the target business unit identifier of the target data attribute information. The communication component 40 then obtains the list of application instances under the unit according to the target business unit identifier, and obtains an available address from it according to the load balancing strategy to complete the service call (that is, selects the target application instance, and calls the target database bound to the target business unit identifier based on the target application instance to provide corresponding target data for the service request).
[0075] When the global routing API calculates the corresponding target business unit identifier based on the target data attribute information, the calculation rule is consistent with the database splitting rule. The specific splitting rules support direct modulus, hash modulus, regular expression, interval and other algorithms according to the data attribute information. The application system can select the appropriate splitting rule according to the data characteristics.
[0076] In order to adapt to various business scenarios, the above calculation process supports customized calculation strategies for the target business unit identifier, such as supporting the mapping of certain data attribute information to specified business unit identifiers, certain services mapping to specified business unit identifiers, etc. If there is no such specified mapping, the target business unit identifier is calculated through the target data attribute information.
[0077] It should be noted that the application system versions corresponding to the application instances deployed by each business unit are the same, with only some unit-based and database-related configurations being different. The application system does not need to be personalized for each business unit, and the consumer does not need to worry about which business unit or database the data is in during the system call process. The communication component 40 integrates the global routing component 30, which can automatically identify the business unit and complete the transaction requests and calls.
[0078] In one embodiment, in order to ensure certain high-availability scenarios, any two business units in the business unit are mutually backed-up business units. Among them, any application instance under any of the two mutually backed-up business units not only calls the database represented by the database identifier corresponding to the business unit identifier of the business unit, but also calls the database represented by the database identifier corresponding to the business unit identifier of another business unit. That is, the application instances of each business unit in the application system can adopt a cross-backup strategy. For example, Example 2: The system is divided into four business units, the business of business unit 1 and unit 3 are mutually primary and backup, and business unit 2 and business unit 4 are mutually primary and backup. In addition to linking to database 1 corresponding to business unit 1, business unit 1 will also link to database 3 of business unit 3. When all application instances of business unit 3 are down, the application instance of business unit 1 can also carry the transactions of business unit 3 and operate database 3 of business unit 3. The specific routing strategy of this function is implemented by the global routing component.
[0079] Specifically, after the global routing component determines the target business unit identifier corresponding to the service request, if the business unit corresponding to the target business unit identifier is unavailable, the business unit identifier of another business unit that serves as a backup for the business unit is used as the new target business unit identifier. For example, after determining the target business unit identifier in the manner of Example 1 above, if a problem occurs in the computer room where the target business unit is located, the target business unit is unavailable, and the business unit identifier of another business unit that serves as a backup for the business unit can be used as the new target business unit identifier, and then the business use case under the new target business unit is selected to call the database to provide services.
[0080] The specific working modes of the global routing component 30 and the communication component 40 are described in detail above.
[0081] So far, completed Figure 2 Description of the system shown.
[0082] pass Figure 2 The effect achieved by the system is that in this embodiment, the data system splits and stores each batch of data into multiple databases based on the data attribute information of each batch of data, and each database stores the part of the business data corresponding to the business unit identifier. The global routing component determines the target business unit identifier corresponding to the service request based on the target data attribute information carried in the service request. The communication component 40 is used to select a target application instance from the N application instances corresponding to the target business unit identifier based on the target business unit identifier output by the global routing component 30, and call the target database bound to the target business unit identifier based on the target application instance to provide the corresponding target data for the service request. This method of realizing automatic routing can better complete the service response.
[0083] Furthermore, the data is split into multiple databases, and each business unit ID corresponds to N application instances and only calls the database represented by the database ID corresponding to the business unit ID (in other words, the upper-layer application of each business unit only links to the database corresponding to the business unit). Compared with the strategy of splitting tables and databases, the upper-layer application no longer links to all databases, which greatly releases resources such as database links, leaving more resources for service requests, thereby improving database performance. At the same time, since resources such as database links no longer become bottlenecks, it is also more conducive to system expansion.
[0084] See also Figure 3 , Figure 3 is a flow chart of a data calling method provided in an embodiment of the present application. The method is applied to the above-mentioned data service system, such as Figure 3 As shown, the method includes the following steps.
[0085] S301, split the batch data into multiple databases based on the data attribute information of each batch of data; a corresponding relationship is established between the business unit identifier and the database identifier; any business unit identifier corresponds to N application instances; the N application instances corresponding to any business unit identifier call the database represented by the database identifier corresponding to the business unit identifier.
[0086] S302: Determine the target business unit identifier corresponding to the service request according to the target data attribute information carried in the service request.
[0087] S303, according to the target business unit identifier output by the global routing component, select a target application instance from the N application instances corresponding to the target business unit identifier, so that the target application instance calls the target database bound to the target business unit identifier to provide corresponding target data for the service request.
[0088] The specific implementation of the above steps S301, S302 and S303 refers to the specific working methods of the above global routing component 30 and the communication component 40, which will not be repeated here.
[0089] In one embodiment, determining the target business unit identifier corresponding to the service request according to the target data attribute information carried in the service request includes:
[0090] If the target data attribute information is the same as the first data attribute information used when each batch of data is split and stored in multiple databases, a remainder operation is performed on the target data attribute information to obtain a remainder value, and the target business unit identifier corresponding to the obtained remainder value is searched from the correspondence between the set remainder value and the business unit identifier;
[0091] If the target data attribute information is different from the first data attribute information used when each batch of data is split and stored in multiple databases, the first data attribute information corresponding to the target data attribute information is found based on the correspondence between the stored target data attribute information and the first data attribute information, and a modulo operation is performed on the found first data attribute information to obtain the remainder value, and the target business unit identifier corresponding to the obtained remainder value is found from the correspondence between the set remainder value and the business unit identifier.
[0092] The data system splits and stores each batch of data into multiple databases according to the data attribute information of each batch of data, including at least one of the following methods:
[0093] For each piece of data attribute information, a modulo operation is performed on the data attribute information to obtain a remainder value, and a database corresponding to the obtained remainder value is searched from a correspondence relationship between the set remainder value and the database identifier;
[0094] For each piece of data attribute information, the data attribute information is hashed and modulo-calculated to obtain a modulus value, and a database corresponding to the obtained modulus value is searched from the correspondence between the set modulus value and the database identifier;
[0095] For each piece of data attribute information, the database corresponding to the data attribute information is determined according to the data attribute information range corresponding to each database identifier.
[0096] In one embodiment, any two business units in the business unit are business units that backup each other;
[0097] Among them, any application instance under any business unit of the two business units that back up each other not only calls the database represented by the database identifier corresponding to the business unit identifier of the business unit, but also calls the database represented by the database identifier corresponding to the business unit identifier of the other business unit.
[0098] In one embodiment, the method further includes: after determining the target business unit identifier corresponding to the service request, if the business unit corresponding to the target business unit identifier is unavailable, using the business unit identifier of another business unit that serves as a backup for the business unit as a new target business unit identifier.
[0099] In one embodiment, each piece of data attribute information establishes a corresponding relationship between a business unit identifier and a database identifier.
[0100] In one embodiment, selecting a target application instance from the N application instances corresponding to the target business unit identifier includes: selecting a target application instance from the N application instances corresponding to the target business unit identifier according to a load balancing principle.
[0101] So far, completed Figure 3 Description of the process shown.
[0102] pass Figure 3 To achieve the effect of the process, this solution divides the business data and the application system as a whole into business units, and at the same time introduces global routing components and communication components to move the routing from the database connection layer to the application layer, and realizes the automatic identification function of data routing.
[0103] After business unitization, the data is split into N databases. Each database stores a part of the business data. After the split is completed, the part of the data is numbered and assigned a business unit ID. The application system deploys the application instance cluster according to the business unit ID. The application instance corresponding to the corresponding business unit ID only connects to the database corresponding to the business unit. During the transaction process, the application system is called through the communication component. During the call process, the business unit is identified through the global routing component, the database corresponding to the business unit where the transaction data is located is found, and the request is forwarded to the database corresponding to the business unit to complete the service call.
[0104] This solution splits the database through data splitting, reducing the amount of data in a single table. At the same time, the application and database are split into units together, reducing the number of database connections and access volume, and reducing the pressure on the database and the system. At the same time, the communication component is combined with the global routing component to complete the routing and service call functions of the unitized data. The entire process encapsulates the functions of each link through the communication component and the global routing component. During the application development process, there is no need to worry about the specific data splitting rules and routing strategies, and the function of senseless development is realized. At the same time, since the application instance of each business unit is only connected to the database of the business unit and the backup business unit, resource issues such as database connection are no longer a limiting condition for system expansion. The application system can be expanded at any time as its business volume grows.
[0105] In order to better illustrate the above method, Figure 4 The invention is described in detail by means of specific embodiments.
[0106] In this embodiment, the business system is represented by a customer center system, the data attribute information is user information, and the service request is to query user information.
[0107] Combination Figure 4 , the process includes the following steps:
[0108] 1. The customer center system divides customer data into four business units according to customer numbers. After the business units are divided, the customer data is divided into four databases according to the customer numbers. The specific division rule is that the 8-14 bits of the customer number are modulo 64. After the modulo is taken, the modulus value is 0-15 and stored in database 1 of business unit 1, 15-31 is stored in database 2 of business unit 2, 32-47 is stored in database 3 of business unit 3, and 48-63 is stored in database 4 of business unit 4.
[0109] 2. There are four business units in the customer center, and each business unit deploys 10 application instances. The application instance of each business unit is linked to the database of the business unit. At the same time, in order to improve the availability and disaster recovery of the system, a backup business unit is set up for each business unit. For example, business unit 1 and business unit 3 are mutually active and standby, and business unit 2 and business unit 4 are mutually active and standby. Business unit 1 is connected to database 3 of business unit 1 and business unit 3 at the same time. The same is true for other application instances. When all application instances on business unit 1 fail, business unit 3 can also carry the transactions of business unit 1. The specific routing rules and communication call methods are carried by the global routing component and communication component.
[0110] 3. When the customer center application instance is started, the service is registered to the registration center with the business unit identifier.
[0111] 4. When a transaction occurs, for example, the counter queries user information through the middle office, when the middle office system calls the customer center system, the communication component obtains the customer number in the request message, calls the global routing to calculate the business unit ID to which the customer number belongs, and the communication component then obtains the application instance information under the business unit based on the business unit ID, thereby completing the service call.
[0112] In this embodiment, the customer center system is divided into four business units, which reduces the number of visits to each database, reduces the pressure on database resources such as disks and CPUs, improves database performance, and also improves the processing capacity of the business system, solving the database performance and other problems existing in the traditional single database processing of massive data. In other words, it solves the problems of slow database data operations, database connection overlimit, CPU and other resource bottlenecks caused by the continuous growth of customer data in the customer center.
[0113] Furthermore, the application instance corresponding to each business unit in the solution is only connected to the database of the business unit and the backup business unit, and there is no resource bottleneck problem such as database connection that exists in the database and table division. That is, this embodiment solves the problems of data routing, system development, and deployment complexity caused by data database and table division.
[0114] Furthermore, the application system can expand the application instance of the application system at any time according to the growth of business volume to cope with the continuous growth of business volume. In other words, this solves the problem of system expansion after the application system continues to grow with the continuous growth of business volume.
[0115] Furthermore, the global routing component is combined with the microservice framework to implement data routing and service calls of the unitized application system, achieving seamless development.
[0116] The method provided in the embodiment of the present application is described above. The device provided in the embodiment of the present application is described below:
[0117] See also Figure 5 , Figure 5 This is a structural diagram of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the hardware structure may include: a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the method disclosed in the above example of this application.
[0118] On the basis of the above embodiments, this embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method described in the above embodiments.
[0119] In some implementations of this embodiment, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that when the computer program is executed by a processor, the steps of the method described in the above embodiment are implemented.
[0120] In some implementations of this embodiment, a computer program product is provided, including a computer program / instructions, characterized in that when the computer program is executed by a processor, the steps of the method described in the above embodiment are implemented.
[0121] The processor may include, but is not limited to, one or more processors or microprocessors. Each processor may be an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller, a microprocessor or other electronic components to execute the method in the above embodiments.
[0122] The computer-readable storage medium may be implemented by any type of volatile or non-volatile storage device or a combination thereof, and the computer-readable storage medium may include but is not limited to, for example, random access memory (RAM), read-only memory (ROM), flash memory, EPROM memory, EEPROM memory, registers, computer storage media (e.g., hard disk, floppy disk, solid-state drive, removable disk, CD-ROM, DVD-ROM, Blu-ray disc, etc.).
[0123] The computer-readable storage medium may also store at least one computer executable program / instruction, which may be, for example, a computer-readable instruction. The computer-readable storage medium includes, but is not limited to, for example, a volatile memory and / or a non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The computer-readable storage medium may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. For example, a non-transitory computer-readable storage medium may be connected to a computing device such as a computer, and then, when the computing device runs the computer-readable instructions stored on the computer-readable storage medium, the various methods described above may be performed.
[0124] In addition, the computer device may also include (but not limited to) a data bus, an input / output (I / O) bus, a display, and input / output devices (eg, keyboard, mouse, speaker, etc.).
[0125] The processor may communicate with external devices via an I / O bus via a wired or wireless network.
[0126] In one embodiment, the at least one computer executable instruction may also be compiled into or constitute a software product / computer program product, wherein one or more computer executable instructions are executed by a processor to perform the various functions and / or method steps in the embodiments described in the present technology.
[0127] In the embodiments provided in the present disclosure, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0128] It should be noted that in the present disclosure, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element limited by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0129] Although the embodiments disclosed in the present disclosure are as above, the above contents are only embodiments adopted for facilitating the understanding of the present disclosure and are not intended to limit the present disclosure. Any technician in the technical field to which the present disclosure belongs can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present disclosure, but the scope of patent protection of the present disclosure shall still be subject to the scope defined in the attached claims.
Claims
1. A data service system, characterized in that: The system comprises: A business system, wherein the business system includes a plurality of business units, each of which has a business unit identifier, and each of which corresponds to N application instances; N is a positive integer; A data system, wherein the data system includes a plurality of databases, wherein the data system divides each batch of data into the plurality of databases according to the data attribute information of each batch of data; a corresponding relationship is formed between the business unit identifier and the database identifier; and N application instances corresponding to any business unit identifier call the database represented by the database identifier corresponding to the business unit identifier; A global routing component, used to determine the target business unit identifier corresponding to the service request according to the target data attribute information carried in the service request; A communication component, wherein the communication component is used to select a target application instance from N application instances corresponding to the target business unit identifier based on the target business unit identifier output by the global routing component, so that the target application instance calls the target database bound to the target business unit identifier to provide corresponding target data for the service request.
2. The data service system according to claim 1, characterized in that: The step of determining the target business unit identifier corresponding to the service request according to the target data attribute information carried in the service request includes: If the target data attribute information is the same as the first data attribute information used when each batch of data is split and stored in multiple databases, a remainder operation is performed on the target data attribute information to obtain a remainder value, and a target business unit identifier corresponding to the obtained remainder value is searched from the correspondence between the set remainder value and the business unit identifier; If the target data attribute information is different from the first data attribute information used when each batch of data is split and stored in multiple databases, the first data attribute information corresponding to the target data attribute information is found based on the correspondence between the stored target data attribute information and the first data attribute information, and a modulo operation is performed on the found first data attribute information to obtain a remainder value, and the target business unit identifier corresponding to the remainder value is found from the correspondence between the set remainder value and the business unit identifier.
3. The data service system according to claim 1, characterized in that: The data system divides each batch of data into multiple databases according to the data attribute information of each batch of data, including: At least one of the following: For each piece of data attribute information, a modulo operation is performed on the data attribute information to obtain a remainder value, and a database corresponding to the obtained remainder value is searched from a correspondence relationship between the set remainder value and the database identifier; For each piece of data attribute information, the data attribute information is hashed and modulo-calculated to obtain a modulus value, and a database corresponding to the obtained modulus value is searched from the correspondence between the set modulus value and the database identifier; For each piece of data attribute information, according to the data attribute information range corresponding to each database identifier, determine the database corresponding to the data attribute information; For each piece of data attribute information, the database corresponding to the data attribute information is calculated using a regular expression.
4. The data service system according to claim 1, characterized in that: Any two of the business units are business units that back up each other; Among them, any application instance under any business unit of the two business units that back up each other not only calls the database represented by the database identifier corresponding to the business unit identifier of the business unit, but also calls the database represented by the database identifier corresponding to the business unit identifier of the other business unit.
5. The data service system according to claim 4, characterized in that: After determining the target business unit identifier corresponding to the service request, the global routing component uses the business unit identifier of another business unit that serves as a backup for the business unit as a new target business unit identifier if the business unit corresponding to the target business unit identifier is unavailable.
6. The data service system according to claim 1, characterized in that: Each piece of data attribute information establishes a corresponding relationship between the business unit identifier and the database identifier.
7. The data service system according to claim 1, characterized in that: The selecting a target application instance from the N application instances corresponding to the target business unit identifier includes: According to the load balancing principle, a target application instance is selected from the N application instances corresponding to the target business unit identifier.
8. A data calling method, the method being based on the data service system according to any one of claims 1 to 5, characterized in that: The data calling method comprises: According to the data attribute information of each batch of data, the batch of data is split and stored in the multiple databases; a corresponding relationship is formed between the business unit identifier and the database identifier; any business unit identifier corresponds to N application instances; the N application instances corresponding to any business unit identifier call the database represented by the database identifier corresponding to the business unit identifier; Determine the target business unit identifier corresponding to the service request according to the target data attribute information carried in the service request; According to the target business unit identifier output by the global routing component, a target application instance is selected from the N application instances corresponding to the target business unit identifier, so that the target application instance calls the target database bound to the target business unit identifier to provide corresponding target data for the service request.
9. The data calling method according to claim 8, characterized in that: The step of determining the target business unit identifier corresponding to the service request according to the target data attribute information carried in the service request includes: If the target data attribute information is the same as the first data attribute information used when each batch of data is split and stored in multiple databases, a remainder operation is performed on the target data attribute information to obtain a remainder value, and a target business unit identifier corresponding to the obtained remainder value is searched from the correspondence between the set remainder value and the business unit identifier; If the target data attribute information is different from the first data attribute information used when each batch of data is split and stored in multiple databases, the first data attribute information corresponding to the target data attribute information is found based on the correspondence between the stored target data attribute information and the first data attribute information, and a remainder operation is performed on the found first data attribute information to obtain a remainder value, and the target business unit identifier corresponding to the obtained remainder value is found from the correspondence between the set remainder value and the business unit identifier; and / or, The data system divides each batch of data into the multiple databases according to the data attribute information of each batch of data, including at least one of the following methods: For each piece of data attribute information, a modulo operation is performed on the data attribute information to obtain a remainder value, and a database corresponding to the obtained remainder value is searched from a correspondence relationship between the set remainder value and the database identifier; For each piece of data attribute information, the data attribute information is hashed and modulo-calculated to obtain a modulus value, and a database corresponding to the obtained modulus value is searched from the correspondence between the set modulus value and the database identifier; For each piece of data attribute information, according to the data attribute information range corresponding to each database identifier, determine the database corresponding to the data attribute information; For each piece of data attribute information, the database corresponding to the data attribute information is calculated by using a regular expression; and / or, Any two of the business units are business units that back up each other; Among them, any application instance under any business unit of the two business units that back up each other not only calls the database represented by the database identifier corresponding to the business unit identifier of the business unit, but also calls the database represented by the database identifier corresponding to the business unit identifier of the other business unit. and / or, The method further comprises: after determining the target business unit identifier corresponding to the service request, if the business unit corresponding to the target business unit identifier is unavailable, using the business unit identifier of another business unit that is a backup for the business unit as a new target business unit identifier; and / or, Each piece of data attribute information establishes a corresponding relationship between the business unit identifier and the database identifier; and / or, The selecting a target application instance from the N application instances corresponding to the target business unit identifier includes: According to the load balancing principle, a target application instance is selected from the N application instances corresponding to the target business unit identifier.