Cross-machine-room data access method and device

By determining the delay of direct cross-computer room access and indirect access at the application level between the first and second computer rooms, and selecting access methods with smaller delays for data access, the problem of time-consuming data access across computer rooms is solved, and the problem of cross-computer room data access is improved Data access efficiency.

CN119201987APending Publication Date: 2024-12-27NETSUNION CLEARING CORP
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310774431.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-27
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The existing cross-computer room data access method takes a long time, resulting in low data access efficiency.

Method used

By determining the delay between the first computer room and the second computer room, the delay of the access directly across the computer room and the indirect access of the application layer is selected for data access.

Benefits of technology

It reduces the delay in data access across computer rooms, improves data access efficiency, and meets the delay requirements for data access across computer rooms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201987A_ABST
    Figure CN119201987A_ABST
Patent Text Reader

Abstract

The invention discloses a cross-machine-room data access method and device.The method comprises the steps that under the condition that a first machine room accesses data in a second machine room, time delay of a first access mode and time delay of a second access mode are determined, the first access mode represents direct cross-machine-room access to a database of the second machine room, and the second access mode represents direct cross-machine-room access to the database of the second machine room; the second access mode represents that a database of the second machine room is indirectly accessed through an application layer of the second machine room; and determining a target access mode according to the time delay of the first access mode and the time delay of the second access mode, and accessing data in the second machine room through the target access mode. The time delays of different access modes can be determined during cross-machine-room data access, and the appropriate access mode is intelligently selected according to the time delays of the different access modes to perform cross-machine-room data access, so that the time delay requirement of cross-machine-room data access can be met, the data access time delay is reduced, and the data access efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and device for accessing data across computer rooms. Background Art

[0002] Usually, in order to improve service availability and load capacity, services can be deployed in multiple computer rooms, that is, multiple computer rooms can be used to provide services. Multiple computer rooms can be deployed in different locations or regions, with one computer room as the main computer room and the other computer rooms as backup computer rooms. The main computer room can be responsible for processing data write operations, and the backup computer room can synchronize data with the main computer room to ensure data consistency.

[0003] In the related art, data access can be performed between the main computer room and the backup computer room, for example, the backup computer room can query data in the database of the main computer room, etc. However, the current cross-computer room data access method has the problem of being time-consuming, resulting in low data access efficiency. Summary of the invention

[0004] The embodiments of the present application provide a cross-computer room data access method and device, which are used to solve the current problem that cross-computer room data access takes a long time and has low data access efficiency.

[0005] To solve the above technical problems, the embodiments of the present application are implemented as follows:

[0006] First, a cross-computer room data access method is proposed, including:

[0007] In the case where the first computer room accesses data in the second computer room, determining a latency of a first access mode and a latency of a second access mode, wherein the first access mode represents direct cross-computer room access to the database of the second computer room, and the second access mode represents indirect access to the database of the second computer room through an application layer of the second computer room;

[0008] A target access method is determined according to the time delay of the first access method and the time delay of the second access method, and the data in the second computer room is accessed through the target access method.

[0009] In a second aspect, a cross-computer room data access device is proposed, comprising:

[0010] A determination module, when the first computer room accesses data in the second computer room, determines a delay of a first access mode and a delay of a second access mode, wherein the first access mode represents direct cross-computer room access to the database of the second computer room, and the second access mode represents indirect access to the database of the second computer room through the application layer of the second computer room;

[0011] The data access module determines a target access method according to the latency of the first access method and the latency of the second access method, and accesses the data in the second computer room through the target access method.

[0012] In a third aspect, an electronic device is provided, the electronic device comprising:

[0013] Processor; and

[0014] A memory arranged to store computer executable instructions which, when executed, cause the processor to:

[0015] In the case where the first computer room accesses data in the second computer room, determining a latency of a first access mode and a latency of a second access mode, wherein the first access mode represents direct cross-computer room access to the database of the second computer room, and the second access mode represents indirect access to the database of the second computer room through an application layer of the second computer room;

[0016] A target access method is determined according to the time delay of the first access method and the time delay of the second access method, and the data in the second computer room is accessed through the target access method.

[0017] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores one or more programs, and when the one or more programs are executed by an electronic device including a plurality of application programs, the electronic device performs the following method:

[0018] In the case where the first computer room accesses data in the second computer room, determining a latency of a first access mode and a latency of a second access mode, wherein the first access mode represents direct cross-computer room access to the database of the second computer room, and the second access mode represents indirect access to the database of the second computer room through an application layer of the second computer room;

[0019] A target access method is determined according to the time delay of the first access method and the time delay of the second access method, and the data in the second computer room is accessed through the target access method.

[0020] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:

[0021] When the first computer room wants to access data in the second computer room across computer rooms, for two different access methods, namely, the first access method of directly accessing the database of the second computer room across computer rooms and the second access method of indirectly accessing the database of the second computer room through the application layer of the second computer room, the delays of the two access methods can be determined, and then the target access method is determined according to the delays of the two access methods and the data in the second computer room is accessed through the target access method. In this way, since the delays of different access methods can be determined when accessing data across computer rooms, and the appropriate access method can be intelligently selected according to the delays of different access methods for data access across computer rooms, the delay requirements for data access across computer rooms can be met, thereby reducing data access delays and improving data access efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0023] Figure 1 It is a flowchart of a method for accessing data across computer rooms according to an embodiment of the present application;

[0024] Figure 2 is a schematic diagram of a first access method of an embodiment of the present application;

[0025] Figure 3 is a schematic diagram of a second access method of an embodiment of the present application;

[0026] Figure 4 It is a flowchart of a method for accessing data across computer rooms according to an embodiment of the present application;

[0027] Figure 5 is a schematic diagram of the structure of an electronic device according to an embodiment of the present application;

[0028] Figure 6 It is a structural diagram of a data access device across computer rooms in one embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.

[0030] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0031] Figure 1 It is a flowchart of a method for accessing data across computer rooms according to an embodiment of the present application. Figure 1 The cross-machine-room data access method shown can be executed by the first machine room. In other words, the cross-machine-room data access method can be executed by software or hardware installed in the first machine room. Figure 1 The cross-computer room data access method shown may include the following steps.

[0032] S102: When the first computer room accesses data in the second computer room, determine the latency of a first access method and the latency of a second access method, wherein the first access method represents direct cross-computer room access to the database of the second computer room, and the second access method represents indirect access to the database of the second computer room through the application layer of the second computer room.

[0033] In an embodiment of the present application, the access method for accessing data across computer rooms may include a first access method and a second access method. When the first computer room accesses data in the second computer room, that is, when the first computer room has a need to access data across computer rooms, the first computer room may determine the delay of the first access method and the delay of the second access method before accessing the data.

[0034] The first access mode indicates that the first computer room can directly access the database in the second computer room across computer rooms, that is, the first computer room can directly send its data access request to the database in the second computer room. Figure 2 As shown, Figure 2 Taking cross-computer room data query as an example, when the first computer room performs cross-computer room data query in the second computer room through the first access method, the application layer of the first computer room can directly send the data query request to the database of the second computer room for data query. After the database of the second computer room obtains the corresponding result, it can return the query result directly to the application layer of the first computer room.

[0035] The second access mode indicates that the first computer room indirectly accesses the database of the second computer room through the application layer of the second computer room, that is, the first computer room first sends its data access request (http request) to the application layer of the second computer room, and then the application layer of the first computer room accesses the database of the second computer room. Figure 3 As shown, Figure 3 Taking cross-computer room data query as an example, when the first computer room performs cross-computer room data query in the second computer room through the second access method, the application layer of the first computer room can first send the data query request to the application layer of the second computer room, and then the application layer of the second computer room forwards it to the database of the second computer room for data query. After the database of the second computer room obtains the corresponding result, it can return the query result to the application layer of the second computer room, and then the application layer of the second computer room returns the query result (http return) to the application layer of the first computer room.

[0036] Optionally, the first computer room is the main computer room and the second computer room is the backup computer room, or the first computer room is the backup computer room and the second computer room is the main computer room, or both the first computer room and the second computer room are backup computer rooms, which is not specifically limited here.

[0037] Optionally, as an embodiment, when determining the delay of the first access mode and the delay of the second access mode, the following steps may be included:

[0038] Acquire a first parameter related to a delay of a first access mode and a second parameter related to a delay of a second access mode;

[0039] Determining a delay of a first access mode according to a first parameter;

[0040] The delay of the second access mode is determined according to the second parameter.

[0041] The first parameter may be a parameter that affects the delay of the first access method. Optionally, the first parameter may include a first duration and a first number, wherein the first duration is the duration of the first computer room directly accessing the database of the second computer room across computer rooms, that is, the duration consumed by the first computer room sending a data access request to the database of the second computer room and receiving a response result, and the first number is the number of database operations involved in the first computer room's cross-computer room access to the data in the second computer room, that is, the first computer room's cross-computer room data access needs to be implemented by several operations on the database of the second computer room.

[0042] The first duration can be detected by the first computer room. For example, the application layer of the first computer room can initiate a ping command or a simple SQL command such as SELECT 1 to the database of the second computer room, and then record the response duration of the command. The response duration is the first duration. The first number can be determined by code analysis. For example, for a certain data access request, the method code used to implement the data access request is known. By analyzing the code, it can be determined how many database operations are involved in the data access process. The number of database operations involved can then be annotated in the method code. The annotations in the code can be used to determine the number of database operations involved when the first computer room performs data access across computer rooms. It should be understood that only one implementation method of how to determine the first duration and the first number is illustrated here. In actual applications, the first duration and the first number can also be determined by other methods, which will not be illustrated one by one here.

[0043] In the case where the first parameter includes the first duration and the first number, when determining the delay of the first access mode according to the first parameter, the delay of the first access mode can be determined according to the first duration and the first number included in the first parameter. Optionally, the product of the first duration and the first number can be determined as the delay of the first access mode, that is, when the first computer room directly accesses the database of the second computer room across computer rooms, the access delay is equal to the product of the number of database operations involved in this data access and the time consumed for each direct cross-computer room access to the database.

[0044] The above-mentioned second parameter may be a parameter that affects the delay of the second access method. Optionally, the second parameter may include a second duration, a third duration and a second number, the second duration being the duration of the first computer room accessing the application layer of the second computer room across computer rooms, that is, the duration consumed by the first computer room sending a data access request to the application layer of the second computer room and receiving a response result, the third duration being the duration of the application layer of the second computer room accessing the database of the second computer room, that is, the duration consumed by the second computer room sending a data access request to the database of the second computer room and receiving a response result, the second number being the number of database operations involved in the application layer of the second computer room accessing the database of the second computer room, that is, the application layer of the first computer room needs to perform several operations on the local database in this cross-computer room data access to achieve cross-computer room data access, and the second number may be the same as the above-mentioned first number.

[0045] The second duration can be detected by the first computer room. For example, the application layer of the first computer room can initiate a heartbeat packet to the application layer of the second computer room and record the response duration, and the response duration is the second duration. The third duration can be detected by the second computer room. For example, the application layer of the second computer room can initiate a ping command or a simple SQL command such as SELECT 1 to the database of the second computer room, and then record the response duration of the command. The response duration is the third duration. The second number can be determined by code analysis. For details, please refer to the method for determining the first number mentioned above, which will not be described in detail here. It should be understood that in actual applications, the second duration, the third duration and the second number can also be determined by other methods, which will not be given examples one by one here.

[0046] In the case where the second parameter includes the second duration, the third duration and the second number of times, when determining the delay of the second access mode according to the second parameter, the delay of the second access mode can be determined according to the second duration, the third duration and the second number of times included in the second parameter. Optionally, the product of the third duration and the second number of times can be added to the second duration, and the result of the addition can be determined as the delay of the second access mode, that is, when the first computer room indirectly accesses the database of the second computer room through the application layer of the second computer room, the access delay is equal to the sum of the access delay between the application layer of the first computer room and the application layer of the second computer room and the delay of the second computer room accessing the local database multiple times.

[0047] After the delay of the first access mode and the delay of the second access mode are determined by the above method, S104 may be executed.

[0048] S104: Determine a target access mode according to the delay of the first access mode and the delay of the second access mode, and access the data in the second computer room through the target access mode.

[0049] In an embodiment of the present application, after determining the delay of the first access method and the delay of the second access method, one access method can be selected from the two access methods as the target access method based on the delay, and the data in the second computer room can be accessed through the target access method.

[0050] Optionally, as an embodiment, when determining the target access mode according to the latency of the first access mode and the latency of the second access mode, the following steps may be included:

[0051] Determining whether a delay of the first access mode is less than a delay of the second access mode;

[0052] If yes, the first access mode is determined as the target access mode;

[0053] If not, the second access mode is determined as the target access mode.

[0054] That is to say, the access method with the smaller latency between the first access method and the second access method can be used as the target access method. For example, if the latency of the first access method is smaller, the first access method can be used as the target access method. When data is accessed across computer rooms, the application layer of the first computer room can send the data access request directly across computer rooms to the database of the second computer room, and then the database of the second computer room returns the access result directly to the first computer room. If the latency of the second access method is smaller, the second access method can be used as the target access method. When data is accessed across computer rooms, the application layer of the first computer room can send the data access request to the application layer of the second computer room, and then the application layer of the second computer room forwards it to the database of the second computer room. After the database of the second computer room obtains the corresponding result, it can return the result to the application layer of the second computer room, and then the application layer of the second computer room returns it to the application layer of the first computer room.

[0055] In this way, since the access method with lower latency can be used as the target access method and data access across computer rooms is performed through the target access method, the latency requirement for data access across computer rooms can be met, thereby reducing data access latency and improving data access efficiency.

[0056] Optionally, if the latency of the first access method is the same as the latency of the second access method, you can select either method as the target access method to access the data in the second computer room. The specific access process can refer to the corresponding content above and will not be described in detail here.

[0057] Optionally, as an embodiment, the size of the first parameter and / or the size of the second parameter in the above S102 can be dynamically adjustable, for example, the first parameter and / or the second parameter can be dynamically adjusted according to actual business needs. On the basis that the first parameter and / or the second parameter are dynamically adjustable, the delay of the first access method and / or the delay of the second access method are also dynamically adjustable, that is, the delay of the first access method can be adjusted by adjusting the size of the first parameter, and the delay of the second access method can be adjusted by adjusting the size of the second parameter. In this way, since the delay of the first access method and / or the delay of the second access method can be dynamically adjusted by dynamically adjusting the size of the first parameter and / or the second parameter, the intelligent selection result of the cross-computer room data access method can be intervened by adjusting the first parameter and / or the second parameter, so that the selected access method is more in line with actual business needs.

[0058] Optionally, as an embodiment, before determining the time delay of the first access mode and the time delay of the second access mode, or before determining the target access mode according to the time delay of the first access mode and the time delay of the second access mode, the following steps may be further included:

[0059] Determine whether the access method for data access across computer rooms has been pre-specified;

[0060] If yes, access the data in the second computer room according to a pre-specified access method.

[0061] That is to say, before intelligently selecting the appropriate cross-computer room data access method based on the delay, it can be determined whether a certain access method (such as the first access method, the second access method or other access method) is pre-specified. If a certain access method is pre-specified, it is necessary to use the specified access method for cross-computer room data access. If the access method is not pre-specified, the appropriate access method can be intelligently selected according to the above-mentioned method for cross-computer room data access. For example, if the system forces the use of the first access method (that is, the system specifies the use of the first access method) for cross-computer room data access, then when the first computer room performs cross-computer room data access, it needs to perform data access through the first access method. If the system does not force the use of a certain access method for cross-computer room data access, then when the first computer room performs cross-computer room data access, it can determine the delay of the first access method and the delay of the second access method, and intelligently select the appropriate access method for cross-computer room data access based on the delay.

[0062] In this way, before intelligently selecting the data access method across computer rooms, it is possible to determine whether the system has pre-specified a certain access method, and if it has been specified, perform data access across computer rooms through the specified access method. Therefore, in actual applications, it is possible to flexibly set whether to force the use of a certain access method for data access across computer rooms based on actual business needs, thereby making the access method used for data access across computer rooms more flexible and in line with business needs.

[0063] To facilitate understanding of the cross-computer room data access method provided in the embodiment of the present application, please refer to Figure 4 The embodiment shown. Figure 4 The illustrated embodiment may include the following steps:

[0064] S401: When data is accessed across computer rooms in a first computer room, determining whether an access method has been pre-specified.

[0065] The cross-computer room data access here can be the first computer room accessing the data in the second computer room across the computer room. The pre-specified access mode can be the first access mode or the second access mode. The first access mode represents direct cross-computer room access to the database of the second computer room, which may be represented as the direct access mode below. The second access mode represents indirect access to the database of the second computer room through the application layer of the second computer room, which may be represented as the forwarding access mode below.

[0066] If the access method has been pre-specified, S406 may be executed; if the access method has not been pre-specified, S402 may be executed.

[0067] S402: Determine a delay of a direct access mode and a delay of a forwarding access mode.

[0068] S403: Determine whether the delay of the direct access mode is less than the delay of the forwarding access mode.

[0069] If it is less than, S404 can be executed; if it is not less than, S405 can be executed.

[0070] S404: Access data across computer rooms through direct access.

[0071] Specifically, the application layer of the first computer room can directly send a data access request to the database of the second computer room for data access, and the database of the second computer room can directly return the access result to the application layer of the first computer room.

[0072] S405: Access data across computer rooms by forwarding access.

[0073] Specifically, the application layer of the first computer room can first send the data access request to the application layer of the second computer room, and then the application layer of the second computer room forwards it to the database of the second computer room for data access. The database of the second computer room can return the access result to the application layer of the second computer room, and then the application layer of the second computer room returns the access result to the application layer of the first computer room.

[0074] S406: Access data across computer rooms through a specified access method.

[0075] If the designated access mode is a direct access mode, S406 may be replaced by S404; if the designated access mode is a forwarding access mode, S406 may be replaced by S405.

[0076] The specific implementation of the above S401 to S406 can be found in Figure 1 The specific implementation of the corresponding steps in the illustrated embodiment will not be repeated here.

[0077] It should be noted that the process of intelligently selecting data access methods across computer rooms in the embodiments of the present application can be a dynamic process, that is, each time the first computer room accesses data across computer rooms, it can intelligently select a data access method based on the technical solution provided in the embodiments of the present application, so that each time data is accessed across computer rooms, data can be accessed through an appropriate access method, thereby reducing data access latency and improving data access efficiency.

[0078] The technical solution provided by the embodiment of the present application can determine the delays of two different access methods, namely, the first access method of directly accessing the database of the second computer room across the computer room and the second access method of indirectly accessing the database of the second computer room through the application layer of the second computer room, when the first computer room wants to access the data in the second computer room across the computer room. Then, the target access method is determined according to the delays of the two access methods and the data in the second computer room is accessed through the target access method. In this way, since the delays of different access methods can be determined when accessing data across computer rooms, and the appropriate access method can be intelligently selected according to the delays of different access methods for data access across computer rooms, the delay requirements for data access across computer rooms can be met, thereby reducing data access delays and improving data access efficiency.

[0079] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0080] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 5 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.

[0081] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0082] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.

[0083] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a data access device across computer rooms at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:

[0084] In the case where the first computer room accesses data in the second computer room, determining a latency of a first access mode and a latency of a second access mode, wherein the first access mode represents direct cross-computer room access to the database of the second computer room, and the second access mode represents indirect access to the database of the second computer room through an application layer of the second computer room;

[0085] A target access method is determined according to the time delay of the first access method and the time delay of the second access method, and the data in the second computer room is accessed through the target access method.

[0086] The above application Figure 5The method performed by the cross-machine room data access device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in software form. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0087] The electronic device may also perform Figures 1 to 4 The method realizes the data access device across the computer room. Figures 1 to 4 The functions in the illustrated embodiment will not be described in detail in the embodiments of the present application.

[0088] Of course, in addition to software implementation methods, the electronic device of the present application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0089] The embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to execute Figures 1 to 4 The method of the embodiment shown is specifically used to perform the following operations:

[0090] In the case where the first computer room accesses data in the second computer room, determining a latency of a first access mode and a latency of a second access mode, wherein the first access mode represents direct cross-computer room access to the database of the second computer room, and the second access mode represents indirect access to the database of the second computer room through an application layer of the second computer room;

[0091] A target access method is determined according to the time delay of the first access method and the time delay of the second access method, and the data in the second computer room is accessed through the target access method.

[0092] Figure 6 This is a schematic diagram of the structure of a cross-computer room data access device 60 according to an embodiment of the present application. Figure 6 In a software implementation, the cross-computer room data access device 60 may include: a determination module 61 and a data access module 62, wherein:

[0093] Determining module 61, when the first computer room accesses data in the second computer room, determining a delay of a first access mode and a delay of a second access mode, wherein the first access mode represents direct cross-computer room access to the database of the second computer room, and the second access mode represents indirect access to the database of the second computer room through the application layer of the second computer room;

[0094] The data access module 62 determines a target access method according to the latency of the first access method and the latency of the second access method, and accesses the data in the second computer room through the target access method.

[0095] Optionally, as an embodiment, the determining module 61 determines the delay of the first access mode and the delay of the second access mode, including:

[0096] Acquire a first parameter related to a delay of the first access mode and a second parameter related to a delay of the second access mode;

[0097] determining a delay of the first access mode according to the first parameter;

[0098] The delay of the second access mode is determined according to the second parameter.

[0099] Optionally, as an embodiment, the first parameter includes a first duration and a first number, the first duration is the duration of the first computer room directly accessing the database of the second computer room across computer rooms, and the first number is the number of database operations involved in the first computer room accessing the data in the second computer room across computer rooms;

[0100] The determining module 61 determines the delay of the first access mode according to the first parameter, including:

[0101] The product of the first duration and the first number of times is determined as the delay of the first access mode.

[0102] Optionally, as an embodiment, the second parameter includes a second duration, a third duration, and a second number of times, the second duration is the duration of the first computer room accessing the application layer of the second computer room across computer rooms, the third duration is the duration of the application layer of the second computer room accessing the database of the second computer room; the second number of times is the number of database operations involved in the application layer of the second computer room accessing the database of the second computer room;

[0103] The determining module 61 determines the delay of the second access mode according to the second parameter, including:

[0104] The sum of the product of the third duration and the second number of times and the second duration is determined as the delay of the second access mode.

[0105] Optionally, as an embodiment, the size of the first parameter and / or the size of the second parameter is dynamically adjustable, and the delay of the first access method is adjusted by adjusting the size of the first parameter, and the delay of the second access method is adjusted by adjusting the size of the second parameter.

[0106] Optionally, as an embodiment, the data access module 62 determines the target access mode according to the latency of the first access mode and the latency of the second access mode, including:

[0107] Determining whether a delay of the first access mode is less than a delay of the second access mode;

[0108] If yes, determining the first access mode as the target access mode;

[0109] If not, the second access mode is determined as the target access mode.

[0110] Optionally, as an embodiment, the data access module 62 further includes:

[0111] Determine whether the access method for data access across computer rooms has been pre-specified;

[0112] If yes, access the data in the second computer room according to a pre-specified access method.

[0113] The cross-machine room data access device 60 provided in the embodiment of the present application can also execute Figures 1 to 4 The method realizes the data access device across the computer room. Figures 1 to 4 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.

[0114] In short, the above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

[0115] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0116] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0117] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity 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, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0118] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

Claims

1. A data access method across computer rooms, characterized in that: include: In the case where the first computer room accesses data in the second computer room, determining a latency of a first access mode and a latency of a second access mode, wherein the first access mode represents direct cross-computer room access to the database of the second computer room, and the second access mode represents indirect access to the database of the second computer room through an application layer of the second computer room; A target access method is determined according to the time delay of the first access method and the time delay of the second access method, and the data in the second computer room is accessed through the target access method.

2. The method according to claim 1, characterized in that The determining of the time delay of the first access mode and the time delay of the second access mode includes: Acquire a first parameter related to a delay of the first access mode and a second parameter related to a delay of the second access mode; determining a delay of the first access mode according to the first parameter; The delay of the second access mode is determined according to the second parameter.

3. The method according to claim 2, characterized in that The first parameter includes a first duration and a first number, the first duration being the duration of the first computer room directly accessing the database of the second computer room across computer rooms, and the first number being the number of database operations involved in the first computer room accessing the data in the second computer room across computer rooms; The determining the delay of the first access mode according to the first parameter includes: The product of the first duration and the first number of times is determined as the delay of the first access mode.

4. The method according to claim 2, characterized in that The second parameter includes a second duration, a third duration, and a second number, wherein the second duration is the duration for the first computer room to access the application layer of the second computer room across computer rooms, and the third duration is the duration for the application layer of the second computer room to access the database of the second computer room; the second number is the number of database operations involved in the application layer of the second computer room accessing the database of the second computer room; The determining the delay of the second access mode according to the second parameter includes: The sum of the product of the third duration and the second number of times and the second duration is determined as the delay of the second access mode.

5. The method according to claim 2, characterized in that The size of the first parameter and / or the size of the second parameter is dynamically adjustable. The delay of the first access mode is adjusted by adjusting the size of the first parameter, and the delay of the second access mode is adjusted by adjusting the size of the second parameter.

6. The method according to claim 1, characterized in that The determining the target access mode according to the latency of the first access mode and the latency of the second access mode includes: Determining whether a delay of the first access mode is less than a delay of the second access mode; If yes, determining the first access mode as the target access mode; If not, the second access mode is determined as the target access mode.

7. The method according to claim 1, characterized in that The method further comprises: Determine whether the access method for data access across computer rooms has been pre-specified; If yes, access the data in the second computer room according to a pre-specified access method.

8. A data access device across computer rooms, characterized in that: include: A determination module, when the first computer room accesses data in the second computer room, determines a delay of a first access mode and a delay of a second access mode, wherein the first access mode represents direct cross-computer room access to the database of the second computer room, and the second access mode represents indirect access to the database of the second computer room through the application layer of the second computer room; The data access module determines a target access method according to the latency of the first access method and the latency of the second access method, and accesses the data in the second computer room through the target access method.

9. An electronic device, characterized in that: include: processor; as well as A memory arranged to store computer executable instructions which, when executed, cause the processor to: In the case where the first computer room accesses data in the second computer room, determining a latency of a first access mode and a latency of a second access mode, wherein the first access mode represents direct cross-computer room access to the database of the second computer room, and the second access mode represents indirect access to the database of the second computer room through an application layer of the second computer room; A target access method is determined according to the time delay of the first access method and the time delay of the second access method, and the data in the second computer room is accessed through the target access method.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, which, when executed by an electronic device including a plurality of application programs, cause the electronic device to perform the following method: In the case where the first computer room accesses data in the second computer room, determining a latency of a first access mode and a latency of a second access mode, wherein the first access mode represents direct cross-computer room access to the database of the second computer room, and the second access mode represents indirect access to the database of the second computer room through an application layer of the second computer room; A target access method is determined according to the time delay of the first access method and the time delay of the second access method, and the data in the second computer room is accessed through the target access method.

Citation Information

Patent Citations

  • Dynamic path selection and data flow forwarding

    US20220263708A1