Read-only database and write-in database switching control method, computer device and computer readable storage medium

By obtaining the database switching request information and the state of the read-write separation switch, the status and configuration information of multiple switches are determined in turn, and the switching request information is matched to perform database switching operations, the read-write conflict problem between read-only database and write database is solved, and database performance and data integrity are improved.

CN119513169APending Publication Date: 2025-02-25YGSOFT INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411534160.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

In medium and large data systems, read-write conflicts between read-only databases and write-to-data databases lead to database performance bottlenecks, data integrity risks and maintenance difficulties, and existing technologies are difficult to effectively solve these problems.

Method used

By obtaining the database switching request information and the state of the read-write separation switch, the status and configuration information of multiple switches are determined in turn, and the switching request information is matched to perform database switching operations, thereby realizing flexible switching between read-only database and write-to-database.

Benefits of technology

This method improves the efficiency and flexibility of database switching, avoids read and write conflicts, improves database performance and data integrity, and simplifies database maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119513169A_ABST
    Figure CN119513169A_ABST
Patent Text Reader

Abstract

The invention provides a read-only database and write-in database switching control method, a computer device and a computer readable storage medium. The method comprises the steps of obtaining switching request information of a database; obtaining state information of a read-write separation main switch, if the state of the read-write separation main switch is switching permission, sequentially obtaining the states of a plurality of switchers according to a preset sequence, and when the state of each switcher is the switching permission state, obtaining configuration information of the current switcher, whether the switching request information is matched with the configuration information of the current switcher or not is judged, and if yes, the switching operation of the database is executed according to the switching request information; and if the switching request information is not matched with the configuration information of the current switcher, performing judgment operation of the next switcher until the judgment operation of all the switchers is completed. The invention further provides a computer device and a computer readable storage medium for implementing the method. According to the invention, the switching operation of the read-only database and the write-in database can be flexibly realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of database switching, and in particular to a method for controlling switching between a read-only database and a write-in database, as well as a computer device and a computer-readable storage medium for implementing the method. Background Art

[0002] In medium and large data systems, the amount of data that needs to be stored is very large, and the number of rows of recorded data often exceeds 100 million. Retrieving data in the vast amount of data often takes a lot of time, resulting in users having to wait a long time for the search results to be returned after entering the search command. This leads to a poor user experience and cannot meet the user's demand for quick response to searches.

[0003] Different databases have different operation permissions. For example, some databases are read-only databases, which only allow users to retrieve and read data, but not edit data. Other databases are write databases, which allow users to edit data. Since different databases can be retrieved through the same storage engine, read and write operations will conflict, resulting in blocking of data query and retrieval operations. Since read-only databases and write databases are not separated from each other, a series of problems will arise, such as database performance bottlenecks, data integrity risks, maintenance difficulties, etc., which in turn leads to poor database maintenance performance.

[0004] If the read-only database and the write database are separated from each other, the read operations and write operations for different databases will be processed separately, and the advantages of the storage engine can be effectively used to improve its performance. Therefore, in order to achieve the separation of the read-only database and the write database, the existing method is to divide the database into the write database and the read-only database, and perform data synchronization processing, which is achieved by switching different operations for the read-only database and the write database.

[0005] One existing method is to optimize the database program, such as optimizing SQL statements and switching between read-only databases and write databases, but this method essentially cannot solve the read-write conflict problem. In addition, the database cluster method will increase the load and increase the implementation cost of the database, without fundamentally solving the problem of operational efficiency. In addition, the prior art implements the database switching operation through middleware, but it is inconvenient to perform database switching operations multiple times within the program. Summary of the invention

[0006] The first object of the present invention is to provide a read-only database and write-in database switching control method capable of collecting and analyzing link data of multiple databases.

[0007] The second object of the present invention is to provide a computer device for implementing the above-mentioned read-only database and write database switching control method.

[0008] A third object of the present invention is to provide a computer-readable storage medium for implementing the above-mentioned read-only database and write database switching control method.

[0009] To achieve the first purpose of the present invention, the read-only database and write database switching control method provided by the present invention includes obtaining the switching request information of the database; obtaining the status information of the read-write separation main switch, if the status of the read-write separation main switch is to allow switching, then obtaining the status of multiple switches in sequence according to a preset order, and when the status of the switch is to allow switching, obtaining the configuration information of the current switch, and judging whether the switching request information matches the configuration information of the current switch, if they match, executing the switching operation of the database according to the switching request information; if the switching request information does not match the configuration information of the current switch, performing the judgment operation of the next switch until the judgment operation of all switches is completed.

[0010] It can be seen from the above scheme that after obtaining the switching request information of the database, when the state of the read-write separation main switch is to allow switching, by reading the states of multiple switches and identifying the configuration information of the switches, when the current switching request information matches the configuration data of a certain switch, the switching operation between the read-only database and the write database is automatically performed, making the database switching operation very convenient and can be implemented through lightweight code. Since the user can freely set the switching conditions of the database, multiple switches can be freely implemented, improving the switching efficiency of the database.

[0011] A preferred solution is that after the switching request information matches the configuration information of the current switch and the switching operation of the database is executed according to the switching request information, the judgment operation for the subsequent switch is no longer executed.

[0012] It can be seen that each switching operation is only implemented for one switch, which can avoid different switches responding to the same switching request information and causing confusion in the database switching logic.

[0013] A further solution is that if the state of the currently determined switch is a state that does not allow switching, a determination operation for the next switch is performed.

[0014] It can be seen that by performing judgment operations on multiple switches in sequence according to a preset order, on the one hand, it is possible to avoid missing an operation on a certain switch, and on the other hand, it is possible to ensure the efficiency of database switching.

[0015] A further solution is that the switch includes an annotation database read-write switch; when judging the annotation database read-write switch, query whether the function call information is marked with an annotation. If it is marked with an annotation, switch to the read-only database or the write database according to the attribute value of the annotation.

[0016] It can be seen that for the annotation database read-write switch, by identifying whether the function call information is marked with annotations and performing subsequent processing, database switching processing can be performed for special types of data.

[0017] A further solution is that the switch includes a request parameter database read-write switch; when judging the request parameter database read-write switch, it is determined whether the switching request information contains instruction information for data operation, and switches to the read-only database or the write database according to the instruction information for data operation.

[0018] It can be seen that for the request parameter database read-write switch, the database switching operation is performed by judging whether the instruction information of the data operation is included, which can facilitate the user to switch the database through simple settings.

[0019] A further solution is that the switch includes a service API database read-write switch; when judging the service API database read-write switch, the request path information in the switching request information is obtained to determine whether the request path information matches the information in the configuration list. If so, it is determined whether the configuration parameters of the switching request information match the configuration parameters of the service API database read-write switch. If so, a switching operation of reading only the database or writing to the database is performed.

[0020] It can be seen that specific database switching operations can be implemented for different service APIs, which can provide users with more and more flexible database switching options.

[0021] A further solution is that the switch includes a function prefix database read-write switch; when judging the function prefix database read-write switch, the current function name information in the switching request information is obtained, and it is determined whether the prefix of the current function name matches the function name prefix recorded by the function prefix database read-write switch. If it matches, switch to the read-only database.

[0022] It can be seen that, for functions with different prefixes, the database switching can also be achieved by making corresponding settings in the switching request information, so it is convenient for users to perform switching operations on specific databases.

[0023] A further solution is that the method further includes: obtaining request information for increasing or decreasing the read-only database, and sending a broadcast message through a background program to notify each application program to perform the increase or decrease operation of the read-only database.

[0024] It can be seen from this that once the read-only database needs to be increased or decreased, the background program can notify each application program by broadcasting, so that the increase or decrease operation of the read-only database can be quickly implemented.

[0025] To achieve the second objective, the computer device provided by the present invention includes a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, each step of the above-mentioned read-only database and write database switching control method is implemented.

[0026] To achieve the third objective, the present invention provides a computer readable storage medium storing a computer program, which implements the steps of the above-mentioned read-only database and write-database switching control method when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 It is a structural block diagram of a first implementation method of a system applying an embodiment of the read-only database and write-in database switching control method of the present invention.

[0028] Figure 2 It is a structural block diagram of a second implementation method of a system applying the read-only database and write database switching control method embodiment of the present invention.

[0029] Figure 3 It is a flow chart of an embodiment of a method for controlling switching between a read-only database and a write database of the present invention.

[0030] The present invention is further described below in conjunction with the accompanying drawings and embodiments. DETAILED DESCRIPTION

[0031] The read-only database and write-in database switching control method of the present invention can flexibly implement the switching operation of the read-only database and the write-in database. The read-only database and write-in database switching control method of the present invention can be implemented on a computer device, the computer device is provided with a processor and a memory, the memory stores a computer program, and the processor implements the above-mentioned read-only database and write-in database switching control method by executing the computer program.

[0032] Read-only database and write database switching control method embodiment: This embodiment mainly uses a lightweight program to efficiently switch between a read-only database and a write database. For example, when it is necessary to switch to the write database, a switching operation is performed, and the user is allowed to write data to the write database. When it is necessary to switch to the read-only database, the read-only database is switched to perform a read-only operation.

[0033] The system using this embodiment can be deployed independently, and can be deployed in a star topology. The system provides functions to other programs as a service, such as RPC (remote procedure call) services. Figure 1 As shown, the switching component 11 can provide services to one or more business systems 12, such as using RPC services to improve performance and provide interface monitoring-management functions. Another implementation method is to embed it in an application in a pluggable manner to form a system to provide services, such as Figure 2 As shown, a switching component 16 is provided in the switching library service module 15 , and services are output externally through the switching component 16 .

[0034] To apply the solution of this embodiment, a read-write separation master switch needs to be set in the switching component to control the switching of the database when the read-write separation capability is temporarily started and stopped online, that is, to switch to a read-only database or a write database. Specifically, the switch state of the read-write separation master switch can be controlled. Only when the switch state of the read-write separation master switch is to allow the switching operation, the database switching operation can be performed. If the switch state of the read-write separation master switch is not to allow the switching operation, the database switching operation is not allowed, and the application can only continue to run according to the original operation logic.

[0035] In addition, the present embodiment is provided with a plurality of switches, for example, 10 switches are provided, including a closure database read-write switch, an annotation database read-write switch, a request parameter database read-write switch, a service API database read-write switch, a request header parameter database read-write switch, a function database read-write switch, a function prefix database read-write switch, a multi-threaded database read-write switch, a function inheritance database read-write switch, and an upstream and downstream service transparent transmission database read-write switch, each of which meets the database switching operation requirements in a specific scenario. The usage scenarios of each switch will be introduced in detail later. In addition, each switch is provided with a corresponding switch switch, and only when the switch of the switch is in the on state, that is, the state of running the database switching, the switch is allowed to be used, that is, the switch can perform the database switching operation.

[0036] Combine the following Figure 3 The solution of this embodiment is described in detail. First, step S11 is executed to obtain database switching request information, for example, the switching component obtains database switching request information sent by an external application, and the request information includes configuration information of the database to be switched, for example, switching only for a specific type of database, or switching for databases that meet specific conditions.

[0037] After the switching request information is obtained, step S12 is executed to obtain the state of the read-write separation main switch, and determine whether the state of the read-write separation main switch is a state that allows switching. Preferably, the state of the read-write separation main switch is recorded in the switching component, and the state of the read-write separation main switch has only two states, namely, switching is allowed and switching is not allowed. If the state of the read-write separation main switch is to allow switching, the switching operation of the database is allowed to be executed, and step S13 is executed. If the state of the read-write separation main switch is not to allow switching, the switching operation of the database is not allowed to be executed, and step S20 is executed, and the application continues to execute the original operation, for example, continues to run according to the originally set operation logic.

[0038] If the state of the read-write separation main switch is to allow switching, it is necessary to judge each switch in turn according to the pre-set order, that is, to judge the state of each switch in turn, and to judge whether the configuration information of the current switching request information matches the configuration information of the switch. Specifically, in step S13, first obtain a switch, such as obtaining a closure database read-write switch, and then execute step S14 to obtain the switch state of the current switch, that is, to determine whether the current switch is running to perform the switching operation. If allowed, execute step S16; if not allowed, execute step S15 to determine whether the current switch is the last switch. If it is the last switch, end the process; if it is not the last switch, execute step S19 to obtain the next switch, and continue to execute step S14 for the next switch.

[0039] In step S16, read the coordination information of the current switch, and execute step S17 to determine whether the configuration information of the current switch matches the configuration information in the current switching request information. If it matches, execute step S18 to perform the corresponding database switching operation according to the switching request information. Otherwise, execute step S15 to determine whether the current switch is the last switch.

[0040] It can be seen that this embodiment judges each switch in turn, and if it is judged that the current switch does not allow the database switching operation, or the configuration information does not match, the next switch is obtained and judged. If the database switching operation is performed on a certain switch, the subsequent other switches will not be judged. In this way, one switching request information can only be operated on one switch, and there will be no situation where multiple switches execute one switching request information.

[0041] The following is a detailed description of the judgment and implementation functions of each switch. The closure database read-write switch is a code-level database switching control switch. Through the closure database read-write switch, the target database that needs to be switched can be directed to achieve the database switching function. Therefore, through the closure database read-write switch, it is possible to implement switching operations for specific databases, and the target database of the operation can only be a read-only database, making the switched data clearer and the operation simpler.

[0042] The annotation database read-write switch processes functions with specific annotations, where an annotation is a code tag that is usually predefined. When judging the annotation database read-write switch, it is necessary to detect whether the object-oriented class has been annotated. If so, its subordinate functions can be switched to the corresponding database. Preferably, it is detected that the function has been annotated and switched to the corresponding database.

[0043] In actual use, query whether the annotation is identified based on the function call information. If the annotation is identified, then determine whether it is possible to switch to a read-only database based on the attribute value of the annotation. For example, if the attribute value is true, switch to a read-only database. If the attribute value is equal to false, switch to a write database. When in use, it is necessary to obtain the class path and function name based on the function call information, and find out whether the configuration list corresponding to the annotation database read-write switch contains the function called in the current switch request, such as by querying the configuration list from the JSON configuration file above. If it is included, continue to check whether the database switching function of the function has been disabled. If it is disabled, continue to judge the next switch. If it is enabled, the corresponding switching operation can be performed for the switch request information. Among them, the start and stop of the annotation database read-write switch can be controlled by operation on the configuration management interface.

[0044] When judging the request parameter database read-write switch, it is necessary to check whether the parameters of the switch request information contain instruction information for data operation, such as whether DataAction is included. If it contains instruction information for data operation, switch to read-only database or write database according to the instruction information for data operation. Specifically, if DataAction=read, switch to read-only database; if DataAction=read0, switch to read-only database, and if delay is not allowed, switch to write database; if DataAction=edit, switch to write database.

[0045] When judging the service API database read-write switch, you first need to make an API match judgment, first obtain the request path in the current switch request information, and query the configuration list to determine whether the request path in the current switch request information matches the request path in the configuration list. If they match, the first step of matching is successful. Then, check the JSON configuration parameters and the current request parameters to determine whether the two match. If the configuration parameters exist in the current request parameters, the match is confirmed to be successful. Parameter matching is performed because certain parameters can be selected to switch the read-write library, and then the configuration details are taken out from the configuration list to check the specific parameters of the instruction information DataAction of the configuration, such as read, read0 or edit, and then determine whether to switch to a read-only database or write to the database based on the instruction information DataAction. If the match is successful according to the matching operation described above, the configuration details are read from the configuration list to check the start and stop properties recorded in the details. If it is disabled, continue to judge the next switch. If it is enabled, execute the database switching operation.

[0046] For the judgment of the request header parameter database read-write switch, it checks whether the request header parameter in the switch request information contains the instruction information DataAction, and then performs the corresponding database switch operation according to the instruction information DataAction.

[0047] To judge the function database read-write switcher, you first need to obtain the reference information Referer in the current switching request information, determine the URL of the function page corresponding to the reference information Referer, and match the request path and parameters of the URL with the configuration list. The subsequent judgment logic is consistent with the judgment logic of the service API database read-write switcher and will not be repeated here.

[0048] For the judgment of the function prefix database read-write switch, first obtain the name of the current function in the switch request information. If the current function name prefix is ​​the same as the function name prefix in the configuration information of the function prefix database read-write switch, you can switch to the read-only database.

[0049] Regarding the multi-threaded database read-write switcher, since the read-only database state can be inherited by the child thread during multi-threaded programming, the operation within the child thread can be switched to the read-only database through the multi-threaded database read-write switcher, that is, the multi-threaded database read-write switcher can be used to perform operations within a specific child thread to implement database switching operations.

[0050] For the function inheritance database read-write switcher, if a downstream function does not have an independent database switching configuration, it can inherit the read-write status of the upstream function. Therefore, through the function inheritance database read-write switcher, the database switching can be achieved through inheritance.

[0051] For the upstream and downstream service transparent transmission database read-write switch, if the upstream service has switched to a read-only database, if the upstream service calls the downstream service API at this time, it will pass the instruction information DataAction or stack information through the request header parameter in the switching request information to control the database switching operation. If the upstream service has selected a read-only database, the downstream service can select a read-only database.

[0052] In addition, the present embodiment also provides a dynamic increase and decrease function of the read-only database. Specifically, the present embodiment provides an operation interface, and the background program can notify each application program by sending a broadcast message, and each application program performs the operation of increasing and decreasing the read-only database. In addition, the present embodiment can also adjust the load of the read-only database, for example, provide an interface for the user to operate, so as to dynamically adjust the load proportion of the read-only database, so as to solve the performance problem of the system. Further, the present embodiment can also dynamically enable and disable configuration items, for example, all configuration items can be enabled and disabled online, and can also temporarily increase the service API configuration for emergency problem processing, improve the response speed of the API, so that there is no need to restart the system, and reduce the system operation cost. Finally, the present embodiment can record the database read-write switch cache. If a function has executed the database switching logic, after receiving the same database switching request information again, the switching operation for the database will no longer be performed to avoid repeated operations. The switching result of the database is stored in the cache, and the corresponding result is read according to the current program call feature.

[0053] This embodiment also sets the priority of the database read / write switch, thereby improving the flexibility of the database switching operation. In addition, the user can also adjust the priority according to actual needs, for example, according to different services. Because the needs of each service may be different, it can be adjusted by configuring the service parameters, arranging the order of each switch in the service parameters, and overwriting the original default order.

[0054] This embodiment also sets an option for whether the database switching operation allows delay. Due to the master-slave database synchronization problem, when the data in the read-only database lags behind the write database, querying data from the read-only database may cause business problems. After setting the option of whether to allow delay processing, the user can adjust the service parameters. If the program can switch to the read-only database according to the configuration, and the delay parameter is false, that is, the read-only database delay is not accepted, it can automatically switch to the write database to avoid business problems.

[0055] This embodiment can support a variety of configuration methods, which can be combined to perform complex database switching operations multiple times within the program. Since this embodiment is a lightweight process, it eliminates complex middleware and inaccurate SQL statement judgments, and only implements efficient database switching operations within the program, which can improve database switching efficiency. In addition, this embodiment sets an option to allow delayed operations. When there is no need to switch to a read-only database, the service parameters can be adjusted online to direct traffic to write to the database, and it will take effect immediately. In addition, this embodiment can also realize the function of switching read-only databases across services.

[0056] Computer device embodiment: The computer device of this embodiment can be an independently operated electronic device, which has a processor, a memory, and a computer program stored in the memory and executable on the processor, such as an information processing program for implementing the above-mentioned information processing method. When the processor executes the computer program, each step of the above-mentioned read-only database and write database switching control method is implemented.

[0057] For example, a computer program may be divided into one or more modules, one or more modules are stored in a memory and executed by a processor to complete each module of the present invention. One or more modules may be a series of computer program instruction segments capable of completing a specific function, and the instruction segments are used to describe the execution process of the computer program in a terminal device.

[0058] It should be noted that the terminal device may be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that the schematic diagram of the present invention is only an example of a terminal device and does not constitute a limitation on the terminal device. The terminal device may include more or fewer components than shown in the figure, or may combine certain components, or different components. For example, the terminal device may also include an input / output device, a network access device, a bus, etc.

[0059] The processor referred to in the present invention may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire terminal device.

[0060] The memory can be used to store computer programs and / or modules. The processor realizes various functions of the terminal device by running or executing the computer programs and / or modules stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0061] Computer readable storage medium: If the computer program stored in the computer device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the various steps of the above-mentioned read-only database and write database switching control method can be implemented.

[0062] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. Computer readable media may include: any entity or device capable of carrying computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0063] Finally, it should be emphasized that the above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various changes and modifications. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for controlling switching between a read-only database and a write-in database, characterized in that: include: Get the switch request information of the database; Obtain the status information of the read-write separation main switch. If the status of the read-write separation main switch is to allow switching, obtain the status of multiple switches in sequence according to a preset order, and when the status of the switch is to allow switching, obtain the configuration information of the current switch, and determine whether the switching request information matches the configuration information of the current switch. If they match, execute the switching operation of the database according to the switching request information; if the switching request information does not match the configuration information of the current switch, perform the judgment operation of the next switch until the judgment operation of all switches is completed.

2. The method for controlling switching between a read-only database and a write-in database according to claim 1, characterized in that: After the switching request information matches the configuration information of the current switch and the switching operation of the database is performed according to the switching request information, the judgment operation for the subsequent switch is no longer performed.

3. The method for controlling switching between a read-only database and a write-in database according to claim 1 or 2, characterized in that: If the state of the switch currently determined is a state in which switching is not allowed, the determination operation of the next switch is performed.

4. The method for controlling switching between a read-only database and a write-in database according to claim 1 or 2, characterized in that: The switch includes an annotation database read-write switch; When judging the annotation database read-write switch, it queries whether the function call information is marked with annotations. If it is marked with annotations, it switches to the read-only database or the write database according to the attribute value of the annotation.

5. The method for controlling switching between a read-only database and a write-in database according to claim 1 or 2, characterized in that: The switch includes a request parameter database read and write switch; When judging the request parameter database read-write switch, it is judged whether the switch request information contains instruction information of data operation, and switches to the read-only database or the write database according to the instruction information of the data operation.

6. The method for controlling switching between a read-only database and a write-in database according to claim 1 or 2, characterized in that: The switch includes a service API database read-write switch; When judging the service API database read-write switch, obtain the request path information in the switching request information, and judge whether the request path information matches the information in the configuration list. If it matches, judge whether the configuration parameters of the switching request information match the configuration parameters of the service API database read-write switch. If so, perform a switching operation of reading only the database or writing the database.

7. The method for controlling switching between a read-only database and a write-in database according to claim 1 or 2, characterized in that: The switch includes a function prefix database read-write switch; When judging the function prefix database read-write switch, obtain the current function name information in the switching request information, and judge whether the prefix of the current function name matches the function name prefix recorded by the function prefix database read-write switch. If it matches, switch to the read-only database.

8. The method for controlling switching between a read-only database and a write-in database according to claim 1 or 2, characterized in that: The method also includes: obtaining request information for increasing or decreasing the read-only database, and sending a broadcast message through a background program to notify each application program to perform the increase or decrease operation of the read-only database.

9. A computer device, characterized in that The method comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, each step of the method for switching control between a read-only database and a write database as claimed in any one of claims 1 to 8 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, each step of the method for controlling switching between a read-only database and a write database as claimed in any one of claims 1 to 8 is implemented.