CN108989390B - User request forwarding method and device, reverse proxy server and computer readable storage medium - Google Patents

User request forwarding method and device, reverse proxy server and computer readable storage medium Download PDF

Info

Publication number
CN108989390B
CN108989390B CN201810629964.0A CN201810629964A CN108989390B CN 108989390 B CN108989390 B CN 108989390B CN 201810629964 A CN201810629964 A CN 201810629964A CN 108989390 B CN108989390 B CN 108989390B
Authority
CN
China
Prior art keywords
end server
configuration parameters
user request
shared memory
mutual exclusion
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810629964.0A
Other languages
Chinese (zh)
Other versions
CN108989390A (en
Inventor
裴丰硕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ELEX Technology Co Ltd
Original Assignee
Beijing ELEX Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ELEX Technology Co Ltd filed Critical Beijing ELEX Technology Co Ltd
Priority to CN201810629964.0A priority Critical patent/CN108989390B/en
Publication of CN108989390A publication Critical patent/CN108989390A/en
Priority to PCT/CN2019/088538 priority patent/WO2019242455A1/en
Application granted granted Critical
Publication of CN108989390B publication Critical patent/CN108989390B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/524Deadlock detection or avoidance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/2895Intermediate processing functionally located close to the data provider application, e.g. reverse proxies
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a user request forwarding method and device, a reverse proxy server and a computer readable storage medium, wherein the user request forwarding method comprises the following steps: acquiring corresponding back-end server configuration parameters from a MySQL database according to a received user request; caching the configuration parameters of the back-end server into a shared memory, and simultaneously carrying out downtime on the MySQL database; and forwarding the user request to a back-end server corresponding to the back-end server configuration parameters. Through the technical scheme of the invention, the purpose of storing the configuration parameters of the back-end server through the MySQL database with higher practicability and more mainstream is realized, the storage cost and difficulty of the configuration parameters of the back-end server are reduced, and the influence of concurrent access on the performance of the reverse proxy server is reduced.

Description

User request forwarding method and device, reverse proxy server and computer readable storage medium
[ technical field ] A method for producing a semiconductor device
The present invention relates to the field of computer technologies, and in particular, to a user request forwarding method and apparatus, a reverse proxy server, and a computer-readable storage medium.
[ background of the invention ]
Currently, a reverse proxy server is one of the proxy servers, and is mainly used for receiving a user request, forwarding the user request to a different backend server according to a preconfigured rule, and handing over the user request to the backend server for processing. Usually, such forwarding rules are statically written to the reverse proxy server configuration file in advance, and such forwarding operations are called routing. After the back-end server processes the user request, the result data is sent to the reverse proxy server, and the reverse proxy server sends the result back to the client.
The reverse proxy server is an improvement of the reverse proxy server, the website address requested by the user does not know which back-end server needs to be forwarded in advance, at the moment, the reverse proxy server only executes a section of program, and the program determines and informs the reverse proxy server which back-end server the request needs to be forwarded to, so that the defects of rigid and simple rule configuration of the reverse proxy server are overcome, the trouble that the configuration file of the reverse proxy server needs to be frequently modified due to the change of the service is avoided due to the flexibility of the program, and a unified and easily managed entrance is provided for the service system.
Ceryx is a dynamic reverse proxy based on NGINX OpenResty, and a back-end server is obtained by querying Redis through a program, wherein Redis is a key-value storage system, however, when the concurrency of Ceryx is large, Redis needs to be frequently connected, so that Redis becomes a system bottleneck.
Therefore, how to avoid the system bottleneck when the concurrency is large becomes a technical problem to be solved urgently at present.
[ summary of the invention ]
The embodiment of the invention provides a user request forwarding method and device, a reverse proxy server and a computer readable storage medium, aims to solve the technical problem that system bottleneck is generated when Ceryx is greatly concurrency in the related technology, and can effectively control concurrent access to a MySQL database by replacing an original Redis storage system through the MySQL database.
In a first aspect, an embodiment of the present invention provides a user request forwarding method, including: acquiring corresponding back-end server configuration parameters from a MySQL database according to a received user request; caching the configuration parameters of the back-end server into a shared memory, and simultaneously carrying out downtime on the MySQL database; and forwarding the user request to a back-end server corresponding to the back-end server configuration parameters.
In the above embodiment of the present invention, optionally, the step of obtaining the corresponding back-end server configuration parameter from the MySQL database according to the received user request includes: inquiring whether the shared memory has corresponding back-end server configuration parameters or not according to the received user request; when the query result is that the configuration parameters of the back-end server are not available, acquiring a resource mutual exclusion lock; based on the resource mutual exclusion lock, inquiring whether the shared memory has the configuration parameters of the back-end server again; and when the re-query result shows that the configuration parameters of the back-end server do not exist, acquiring the configuration parameters of the back-end server from the MySQL database.
In the above embodiment of the present invention, optionally, when the number of the received user requests is multiple, the step of querying again whether the shared memory has the backend server configuration parameters includes: inquiring whether the shared memory has corresponding configuration parameters of a back-end server for a user request which firstly acquires the resource mutual exclusion lock; and updating the complete data in the MySQL database to the shared memory when the re-query result is that the back-end server configuration parameters corresponding to the user request which firstly acquires the resource mutual exclusion lock are not available.
In the above embodiment of the present invention, optionally, the method further includes: when a reverse proxy server is started, deriving a plurality of sub-processes for a main process; executing a first timing task in each subprocess, wherein the first timing task is as follows: monitoring whether other subprocesses acquire a resource mutual exclusion lock; and when no other sub-process is monitored to acquire the resource mutual exclusion lock, acquiring the resource mutual exclusion lock, wherein one sub-process acquires the resource mutual exclusion lock firstly.
In the foregoing embodiment of the present invention, optionally, after the step of acquiring the resource mutex first by the sub-process, the method further includes: monitoring whether other subprocesses execute a second timing task or not through the subprocess, wherein the second timing task is as follows: updating the complete data in the MySQL database to the shared memory; and when no other sub-process executes the second timing task, executing the second timing task.
In the above embodiment of the present invention, optionally, the method further includes: when any sub-process crashes, a new sub-process is spawned.
In a second aspect, an embodiment of the present invention provides a user request forwarding apparatus, including: the parameter configuration module is used for acquiring corresponding back-end server configuration parameters from the MySQL database according to the received user request; the execution module caches the configuration parameters of the back-end server in a shared memory, and simultaneously crashes the MySQL database; and the forwarding module is used for forwarding the user request to the back-end server corresponding to the back-end server configuration parameters.
In the above embodiment of the present invention, optionally, the parameter configuration module is configured to: inquiring whether the shared memory has corresponding back-end server configuration parameters or not according to the received user request, acquiring a resource mutual exclusion lock when the inquiry result is that the shared memory does not have the back-end server configuration parameters, inquiring whether the shared memory has the back-end server configuration parameters or not again based on the resource mutual exclusion lock, and acquiring the back-end server configuration parameters from the MySQL database when the inquiry result is that the shared memory does not have the back-end server configuration parameters.
In the above embodiment of the present invention, optionally, when the number of the received user requests is multiple, the parameter configuration module is further configured to: inquiring whether the shared memory has corresponding configuration parameters of a back-end server for a user request which firstly acquires the resource mutual exclusion lock; and updating the complete data in the MySQL database to the shared memory when the re-query result is that the back-end server configuration parameters corresponding to the user request which firstly acquires the resource mutual exclusion lock are not available.
In the above embodiment of the present invention, optionally, the method further includes: the sub-process deriving module is used for deriving a plurality of sub-processes for the main process when the reverse proxy server is started; a first timing task execution module, configured to execute a first timing task in each sub-process, where the first timing task is: monitoring whether other subprocesses acquire a resource mutual exclusion lock; and when no other sub-process is monitored to acquire the resource mutual exclusion lock, acquiring the resource mutual exclusion lock, wherein one sub-process acquires the resource mutual exclusion lock firstly.
In the above embodiment of the present invention, optionally, the method further includes: a second timed task monitoring module, configured to monitor whether another subprocess executes a second timed task after the subprocess first acquires the resource mutex, where the second timed task is: updating the complete data in the MySQL database to the shared memory; and when no other sub-process executes the second timing task, executing the second timing task.
In the above embodiment of the present invention, optionally, the child process derivation module is further configured to: when any sub-process crashes, a new sub-process is spawned.
In a third aspect, an embodiment of the present invention provides a reverse proxy server, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being arranged to perform the method of any of the first aspect embodiments described above.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where computer-executable instructions are stored, and the computer-executable instructions are configured to perform the method flow described in any one of the first aspect.
Through the technical scheme, the technical problem that system bottlenecks are generated when the Ceryx is greatly concurrent in the related technology can be solved, the original Redis storage system can be replaced by the MySQL database, and concurrent access to the MySQL database can be effectively controlled.
Specifically, the configuration parameters of the back-end server are stored in the MySQL database, the reverse proxy server can take out the required data from the MySQL database when receiving the user request, that is, the configuration parameters of the back-end server required by the user request are taken out, and then the user request is forwarded to the corresponding back-end server through the configuration parameters of the back-end server, and meanwhile, the MySQL database is down, that is, the database is dead locked, that is, the database is locked, so that only one sub-process can perform modification operation at the same time, the locking occurs when one sub-process obtains a mutual exclusion lock on the resource, and at this time, other sub-processes cannot modify the resource, and the mechanism is used for ensuring the data consistency. Therefore, concurrent access to MySQL is effectively controlled, so that the MySQL database can still maintain a deadlock state under an extremely high concurrency state of the reverse proxy server, and cannot become a performance bottleneck.
Wherein, the reverse proxy server is preferably a dynamic reverse proxy server.
Furthermore, the reverse proxy server can regularly take out complete data from the MySQL database and cache the data in the shared memory of the MySQL database, and meanwhile, the MySQL database is down, so that the reverse proxy server is not influenced to continuously work. And when the timer of the reverse proxy server finishes the last execution and before the timer finishes the next execution, newly adding data to the MySQL database, temporarily not storing the newly added data in the shared memory of the reverse proxy server, and when a user requests the data in the period, the reverse proxy server needs to go to the MySQL database in real time to obtain the data and control the concurrent access to the MySQL.
Through the technical scheme, the purpose of storing the configuration parameters of the back-end server through the MySQL database with higher practicability and more mainstream is achieved, the storage cost and the difficulty of the configuration parameters of the back-end server are reduced, the configuration parameters of the back-end server are cached in the shared memory of the reverse proxy server, so that the performance of the reverse proxy server cannot be influenced, the MySQL server is down, the configuration parameters of the back-end server can still work continuously by using the cached data, and the influence of concurrent access on the performance of the reverse proxy server is reduced.
[ description of the drawings ]
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flow diagram illustrating a user request forwarding method according to an embodiment of the invention;
FIG. 2 shows a flow diagram of a user request forwarding method of another embodiment of the invention;
FIG. 3 illustrates a flow diagram of a user request forwarding method of yet another embodiment of the present invention;
FIG. 4 shows a block diagram of a user request forwarding device of one embodiment of the present invention;
fig. 5 shows a block diagram of a reverse proxy server of one embodiment of the present invention.
[ detailed description ] embodiments
For better understanding of the technical solutions of the present invention, the following detailed descriptions of the embodiments of the present invention are provided with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
Fig. 1 shows a flowchart of a user request forwarding method according to an embodiment of the present invention.
As shown in fig. 1, a user request forwarding method according to an embodiment of the present invention includes:
and 102, acquiring corresponding configuration parameters of the back-end server from the MySQL database according to the received user request.
And 104, caching the configuration parameters of the back-end server into a shared memory, and simultaneously carrying out downtime on the MySQL database.
And 106, forwarding the user request to a back-end server corresponding to the back-end server configuration parameters.
The configuration parameters of the back-end server are stored in the MySQL database, the reverse proxy server can take out the required data from the MySQL database when receiving a user request, namely, the configuration parameters of the back-end server required by the user request are taken out, and then the user request is forwarded to the corresponding back-end server through the configuration parameters of the back-end server, and meanwhile, the MySQL database is down, the database is dead locked, namely, the database is locked, so that only one sub-process can carry out modification operation at the same time. Therefore, concurrent access to MySQL is effectively controlled, so that the MySQL database can still maintain a deadlock state under an extremely high concurrency state of the reverse proxy server, and cannot become a performance bottleneck.
Wherein, the reverse proxy server is preferably a dynamic reverse proxy server.
Through the technical scheme, the purpose of storing the configuration parameters of the back-end server through the MySQL database with higher practicability and more mainstream is achieved, the storage cost and the difficulty of the configuration parameters of the back-end server are reduced, the configuration parameters of the back-end server are cached in the shared memory of the reverse proxy server, so that the performance of the reverse proxy server cannot be influenced, the MySQL server is down, the configuration parameters of the back-end server can still work continuously by using the cached data, and the influence of concurrent access on the performance of the reverse proxy server is reduced.
In the technical scheme of the invention, the basic components are distributed as follows:
1. all functions of the dynamic reverse proxy are done based on OpenResty (a variation of Nginx).
2. The timed task is implemented using the timer interface provided by OpenResty.
3. MySQL extensions provided by OpenResty are used to connect MySQL databases.
4. Shared dit provided by OpenResty is used to share memory cache data.
5. The resource exclusive lock is implemented using the resource lock extension provided by OpenResty.
This base component distribution can be applied to any of the embodiments described above and below.
Fig. 2 shows a flowchart of a user request forwarding method according to another embodiment of the present invention.
Step 202, according to the received user request, querying whether the shared memory has corresponding backend server configuration parameters.
According to the access _ by _ Lua _ file configuration instruction, a section of Lua program is added to the openrestty, the Lua is a program used for executing the whole query and forwarding process, when the reverse proxy server receives a user request, a Uniform Resource Locator (URL) in the request is analyzed, and whether needed data exists in the shared memory is queried according to the analyzed URL, namely, a back-end server IP, namely, back-end server configuration parameters.
If yes, the reverse proxy server informs the back-end server to finish the execution after the IP, and forwards the user request to the back-end server to process the IP process. If no data is needed in the cache, step 204 is entered.
And step 204, when the query result is that the configuration parameters of the back-end server are not available, acquiring a resource mutual exclusion lock.
Step 206, based on the resource mutual exclusion lock, querying again whether the shared memory has the backend server configuration parameters.
And 208, when the re-query result shows that the configuration parameters of the back-end server do not exist, acquiring the configuration parameters of the back-end server from the MySQL database.
Under the condition that the number of the received user requests is multiple, inquiring whether the shared memory has corresponding back-end server configuration parameters or not for the user request which firstly acquires the resource mutual exclusion lock; and updating the complete data in the MySQL database to the shared memory when the re-query result is that the back-end server configuration parameters corresponding to the user request which firstly acquires the resource mutual exclusion lock are not available.
That is, the request of getting the lock first will check again whether there is needed data in the shared memory, if there is no needed data, then go to MySQL database to inquire needed data, and cache to the shared memory. The subsequent other user requests can directly use the data because the required data can be inquired from the shared memory, and the MySQL database query is not carried out any more.
Step 210, caching the configuration parameters of the back-end server into a shared memory, and simultaneously performing downtime on the MySQL database.
Step 212, forwarding the user request to the backend server corresponding to the backend server configuration parameter.
Furthermore, the reverse proxy server can regularly take out complete data from the MySQL database and cache the data in the shared memory of the MySQL database, and meanwhile, the MySQL database is down, so that the reverse proxy server is not influenced to continuously work. And when the timer of the reverse proxy server finishes the last execution and before the timer finishes the next execution, newly adding data to the MySQL database, temporarily not storing the newly added data in the shared memory of the reverse proxy server, and when a user requests the data in the period, the reverse proxy server needs to go to the MySQL database in real time to obtain the data and control the concurrent access to the MySQL. The present solution is described in detail below in terms of the bottom layer by the embodiment shown in fig. 3.
As shown in fig. 3, the user request forwarding method includes:
step 302, when the reverse proxy server is started, a plurality of sub-processes are derived for the main process.
At step 304, a first timing task is executed in each sub-process.
Wherein the first timing task is: monitoring whether other subprocesses acquire a resource mutual exclusion lock; and when no other sub-process is monitored to acquire the resource mutual exclusion lock, acquiring the resource mutual exclusion lock.
In step 306, a sub-process first obtains the resource mutual exclusion lock.
And step 308, monitoring whether other subprocesses execute the second timing task or not through the subprocess.
Wherein the second timing task is: and updating the complete data in the MySQL database to the shared memory.
And 310, when no other subprocess executes the second timing task, executing the second timing task.
The OpenResty derives a plurality of sub-processes (worker) from a main process (Master) when the OpenResty is started, the main process monitors the sub-processes, and a new sub-process is derived again after the sub-processes are crashed.
The timing task can be executed only in the Worker process, and only needs to be executed in one Worker process. There are a total of two timing tasks, check _ alive and periodic _ update. The check _ alive task (namely the first timing task) is executed in each worker process, and the periodic _ update task (namely the second timing task) only needs to be executed in one worker, so that data update conflict is avoided.
And (3) inputting a Lua program into the OpenResty value through an init _ worker _ by _ Lua _ file configuration instruction, executing the Lua program when the subprocesses are initialized, and creating a check _ alive timing task in each subprocess. The timing task checks and monitors whether a worker is responsible for executing the period _ update task at the moment, if not, the resource exclusive lock is acquired, the worker process of the lock is taken firstly, whether the period _ update task exists or not is checked again, and if not, the period _ update timing task is started. And the subsequent worker process abandons the execution of the timing task because the periodic _ update task is detected. And finally, the periodic _ update timing task is responsible for updating the complete data from MySQL to the shared memory of OpenResty.
In addition, when any sub-process crashes, a new sub-process is spawned.
In other words, there is only one Worker executing the periodic _ update task, and meanwhile, when the Worker process crashes, the check _ alive task is responsible for restarting the periodic _ update task on a certain Worker.
Fig. 4 shows a block diagram of a user request forwarding device of an embodiment of the present invention.
As shown in fig. 4, a user request forwarding apparatus 400 according to an embodiment of the present invention includes: a parameter configuration module 402, which obtains the corresponding configuration parameters of the back-end server from the MySQL database according to the received user request; the execution module 404 is configured to cache the configuration parameters of the backend server in a shared memory, and simultaneously perform downtime on the MySQL database; the forwarding module 406 forwards the user request to the backend server corresponding to the backend server configuration parameter.
The user request forwarding apparatus 400 uses the scheme described in any one of the embodiments shown in fig. 1 to fig. 3, and therefore, all the technical effects described above are achieved, and are not described again here. The user request forwarding apparatus 400 further has the following technical features:
in the above embodiment of the present invention, optionally, the parameter configuration module 402 is configured to: inquiring whether the shared memory has corresponding back-end server configuration parameters or not according to the received user request, acquiring a resource mutual exclusion lock when the inquiry result is that the shared memory does not have the back-end server configuration parameters, inquiring whether the shared memory has the back-end server configuration parameters or not again based on the resource mutual exclusion lock, and acquiring the back-end server configuration parameters from the MySQL database when the inquiry result is that the shared memory does not have the back-end server configuration parameters.
In the above embodiment of the present invention, optionally, when the number of the received user requests is multiple, the parameter configuration module 402 is further configured to: inquiring whether the shared memory has corresponding configuration parameters of a back-end server for a user request which firstly acquires the resource mutual exclusion lock; and updating the complete data in the MySQL database to the shared memory when the re-query result is that the back-end server configuration parameters corresponding to the user request which firstly acquires the resource mutual exclusion lock are not available.
In the above embodiment of the present invention, optionally, the method further includes: the sub-process deriving module is used for deriving a plurality of sub-processes for the main process when the reverse proxy server is started; a first timing task execution module, configured to execute a first timing task in each sub-process, where the first timing task is: monitoring whether other subprocesses acquire a resource mutual exclusion lock; and when no other sub-process is monitored to acquire the resource mutual exclusion lock, acquiring the resource mutual exclusion lock, wherein one sub-process acquires the resource mutual exclusion lock firstly.
In the above embodiment of the present invention, optionally, the method further includes: a second timed task monitoring module, configured to monitor whether another subprocess executes a second timed task after the subprocess first acquires the resource mutex, where the second timed task is: updating the complete data in the MySQL database to the shared memory; and when no other sub-process executes the second timing task, executing the second timing task.
In the above embodiment of the present invention, optionally, the child process derivation module is further configured to: when any sub-process crashes, a new sub-process is spawned.
Fig. 5 shows a block diagram of a reverse proxy server of one embodiment of the present invention.
As shown in fig. 5, a reverse proxy server 500 according to an embodiment of the present invention includes at least one memory 502; and a processor 504 communicatively coupled to the at least one memory 502; wherein the memory stores instructions executable by the at least one processor 504, the instructions being configured to perform the aspects of any of the embodiments of fig. 1-3 described above. Therefore, the reverse proxy server 500 has the same technical effect as any one of the embodiments in fig. 1 to 3, and is not described herein again.
An embodiment of the present invention provides a computer-readable storage medium, which is characterized by storing computer-executable instructions for executing the method flow described in any one of fig. 1 to 3.
The technical scheme of the invention is described in detail in the above with reference to the attached drawings, and by the technical scheme of the invention, the purpose of storing the configuration parameters of the back-end server through the more mainstream MySQL database with higher practicability is realized, the storage cost and difficulty of the configuration parameters of the back-end server are reduced, and the performance of the reverse proxy server is not influenced because the configuration parameters of the back-end server are cached in the shared memory of the reverse proxy server, and the configuration parameters of the back-end server can still continue to work by using the cached data when the MySQL server is down, so that the influence of concurrent access on the performance of the reverse proxy server is reduced.
The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical division, and other divisions may be realized in practice, for example, a plurality of modules or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware form, and can also be realized in a form of hardware and a software functional module.
The integrated module implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a Processor (Processor) to execute some steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (7)

1. A user request forwarding method is characterized by comprising the following steps:
acquiring corresponding back-end server configuration parameters from a MySQL database according to a received user request;
caching the configuration parameters of the back-end server into a shared memory, and simultaneously carrying out downtime on the MySQL database;
forwarding the user request to a back-end server corresponding to the back-end server configuration parameters;
the step of obtaining the corresponding configuration parameters of the back-end server from the MySQL database according to the received user request comprises the following steps:
inquiring whether the shared memory has corresponding back-end server configuration parameters or not according to the received user request;
when the query result is that the configuration parameters of the back-end server are not available, acquiring a resource mutual exclusion lock;
based on the resource mutual exclusion lock, inquiring whether the shared memory has the configuration parameters of the back-end server again;
when the re-query result shows that the back-end server configuration parameters do not exist, acquiring the back-end server configuration parameters from the MySQL database;
when the number of the received user requests is multiple, the step of inquiring again whether the shared memory has the configuration parameters of the back-end server includes:
inquiring whether the shared memory has corresponding configuration parameters of a back-end server for a user request which firstly acquires the resource mutual exclusion lock;
and when the re-query result is that the back-end server configuration parameters corresponding to the user request which firstly acquires the resource mutual exclusion lock are not available, updating the complete data in the MySQL database to the shared memory.
2. The method of claim 1, further comprising:
when a reverse proxy server is started, deriving a plurality of sub-processes for a main process;
executing a first timing task in each subprocess, wherein the first timing task is as follows:
monitoring whether other subprocesses acquire a resource mutual exclusion lock;
and when no other sub-process is monitored to acquire the resource mutual exclusion lock, acquiring the resource mutual exclusion lock, wherein one sub-process acquires the resource mutual exclusion lock firstly.
3. The method according to claim 2, further comprising, after the step of acquiring the resource mutual exclusion lock by the sub-process first, the step of:
monitoring whether other subprocesses execute a second timing task or not through the subprocess, wherein the second timing task is as follows: updating the complete data in the MySQL database to the shared memory;
and when no other sub-process executes the second timing task, executing the second timing task.
4. The method of claim 2 or 3, further comprising:
when any sub-process crashes, a new sub-process is spawned.
5. A user request forwarding apparatus, comprising:
the parameter configuration module is used for acquiring corresponding back-end server configuration parameters from the MySQL database according to the received user request;
the execution module caches the configuration parameters of the back-end server in a shared memory, and simultaneously crashes the MySQL database;
the forwarding module is used for forwarding the user request to a back-end server corresponding to the back-end server configuration parameters;
the parameter configuration module is used for:
inquiring whether the shared memory has corresponding back-end server configuration parameters or not according to the received user request, acquiring a resource mutual exclusion lock when the inquiry result is that the shared memory does not have the back-end server configuration parameters, inquiring whether the shared memory has the back-end server configuration parameters or not again based on the resource mutual exclusion lock, and acquiring the back-end server configuration parameters from the MySQL database when the inquiry result is that the shared memory does not have the back-end server configuration parameters;
wherein, when the number of the received user requests is multiple, the parameter configuration module is configured to:
inquiring whether the shared memory has corresponding configuration parameters of a back-end server for a user request which firstly acquires the resource mutual exclusion lock;
and when the re-query result is that the back-end server configuration parameters corresponding to the user request which firstly acquires the resource mutual exclusion lock are not available, updating the complete data in the MySQL database to the shared memory.
6. A reverse proxy server, comprising: at least one processor; and a memory communicatively coupled to the at least one processor;
wherein the memory stores instructions executable by the at least one processor, the instructions being arranged to perform the method of any of the preceding claims 1 to 4.
7. A computer-readable storage medium having stored thereon computer-executable instructions for performing the method flow of any of claims 1-4.
CN201810629964.0A 2018-06-19 2018-06-19 User request forwarding method and device, reverse proxy server and computer readable storage medium Active CN108989390B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201810629964.0A CN108989390B (en) 2018-06-19 2018-06-19 User request forwarding method and device, reverse proxy server and computer readable storage medium
PCT/CN2019/088538 WO2019242455A1 (en) 2018-06-19 2019-05-27 Method and apparatus for user request forwarding, reverse proxy and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810629964.0A CN108989390B (en) 2018-06-19 2018-06-19 User request forwarding method and device, reverse proxy server and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN108989390A CN108989390A (en) 2018-12-11
CN108989390B true CN108989390B (en) 2020-11-10

Family

ID=64540636

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810629964.0A Active CN108989390B (en) 2018-06-19 2018-06-19 User request forwarding method and device, reverse proxy server and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN108989390B (en)
WO (1) WO2019242455A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108989390B (en) * 2018-06-19 2020-11-10 北京智明星通科技股份有限公司 User request forwarding method and device, reverse proxy server and computer readable storage medium
CN112417330A (en) * 2019-08-23 2021-02-26 腾讯科技(深圳)有限公司 Page loading method, device, equipment and storage medium
CN112559560A (en) * 2019-09-10 2021-03-26 北京京东振世信息技术有限公司 Metadata reading method and device, metadata updating method and device, and storage device
CN110673943A (en) * 2019-09-29 2020-01-10 香港乐蜜有限公司 Method and device for realizing timing task, electronic equipment and storage medium
CN111814085A (en) * 2020-07-10 2020-10-23 四川长虹电器股份有限公司 Novel WEB online agent method based on JavaScript hook
CN114389900A (en) * 2022-03-23 2022-04-22 广东睿江云计算股份有限公司 OpenResty-based abnormal traffic capturing and intercepting method and system

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101383784A (en) * 2008-09-28 2009-03-11 腾讯科技(深圳)有限公司 Cross-region remote mail sending method and system
CN102201010A (en) * 2011-06-23 2011-09-28 清华大学 Distributed database system without sharing structure and realizing method thereof
CN103338233A (en) * 2013-06-05 2013-10-02 新浪网技术(中国)有限公司 Load balancing device, Web server, request information processing method and system
CN103607424A (en) * 2013-10-24 2014-02-26 北京奇虎科技有限公司 Server connection method and server system
CN105119986A (en) * 2015-08-12 2015-12-02 国家电网公司 Web reverse proxy method based on preconnect
CN105453083A (en) * 2013-05-17 2016-03-30 英赛特创新及性能私人有限公司 System and method for processing web-browsing information
CN106919654A (en) * 2017-01-24 2017-07-04 徐州医科大学 A kind of implementation method of the High Availabitity MySQL database based on Nginx
CN107329963A (en) * 2016-04-29 2017-11-07 北京京东尚科信息技术有限公司 Accelerate the method and apparatus of web page access
CN107645508A (en) * 2017-10-16 2018-01-30 深圳市买买提乐购金融服务有限公司 A kind of data handling system, method, client and server
CN107734004A (en) * 2017-09-26 2018-02-23 河海大学 A kind of high concurrent SiteServer LBS based on Nginx, Redis
CN107967270A (en) * 2016-10-19 2018-04-27 北京京东尚科信息技术有限公司 Realize the method and system of multi-functional caching

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020091712A1 (en) * 2000-10-28 2002-07-11 Martin Andrew Richard Data-base caching system and method of operation
EP2048857A1 (en) * 2007-10-12 2009-04-15 PacketFront Systems AB Method of configuring routers using external servers
CN108989390B (en) * 2018-06-19 2020-11-10 北京智明星通科技股份有限公司 User request forwarding method and device, reverse proxy server and computer readable storage medium

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101383784A (en) * 2008-09-28 2009-03-11 腾讯科技(深圳)有限公司 Cross-region remote mail sending method and system
CN102201010A (en) * 2011-06-23 2011-09-28 清华大学 Distributed database system without sharing structure and realizing method thereof
CN105453083A (en) * 2013-05-17 2016-03-30 英赛特创新及性能私人有限公司 System and method for processing web-browsing information
CN103338233A (en) * 2013-06-05 2013-10-02 新浪网技术(中国)有限公司 Load balancing device, Web server, request information processing method and system
CN103607424A (en) * 2013-10-24 2014-02-26 北京奇虎科技有限公司 Server connection method and server system
CN105119986A (en) * 2015-08-12 2015-12-02 国家电网公司 Web reverse proxy method based on preconnect
CN107329963A (en) * 2016-04-29 2017-11-07 北京京东尚科信息技术有限公司 Accelerate the method and apparatus of web page access
CN107967270A (en) * 2016-10-19 2018-04-27 北京京东尚科信息技术有限公司 Realize the method and system of multi-functional caching
CN106919654A (en) * 2017-01-24 2017-07-04 徐州医科大学 A kind of implementation method of the High Availabitity MySQL database based on Nginx
CN107734004A (en) * 2017-09-26 2018-02-23 河海大学 A kind of high concurrent SiteServer LBS based on Nginx, Redis
CN107645508A (en) * 2017-10-16 2018-01-30 深圳市买买提乐购金融服务有限公司 A kind of data handling system, method, client and server

Also Published As

Publication number Publication date
WO2019242455A1 (en) 2019-12-26
CN108989390A (en) 2018-12-11

Similar Documents

Publication Publication Date Title
CN108989390B (en) User request forwarding method and device, reverse proxy server and computer readable storage medium
US10482102B2 (en) Conditional master election in distributed databases
EP3667500B1 (en) Using a container orchestration service for dynamic routing
US8548945B2 (en) Database caching utilizing asynchronous log-based replication
US10116725B2 (en) Processing data retrieval requests in a graph projection of an application programming interfaces (API)
WO2020046441A1 (en) Split front end for flexible back end cluster processing
US6466965B1 (en) Centralized affinity maintenance in a workload managed client/server data processing system
WO2017204951A1 (en) Optimizing read and write operations in object schema-based application programming interfaces (apis)
EP3058690A1 (en) System and method for creating a distributed transaction manager supporting repeatable read isolation level in a mpp database
CA2442796A1 (en) Binding a workflow engine to a data model
JP6468499B2 (en) Distributed computing architecture
US20130318055A1 (en) Cache conflict detection
CA3055071C (en) Writing composite objects to a data store
US11500755B1 (en) Database performance degradation detection and prevention
JP5120451B2 (en) Arrangement method and arrangement system
CN113094430B (en) Data processing method, device, equipment and storage medium
CN112789606A (en) Data redistribution method, device and system
CN108139927B (en) Action-based routing of transactions in an online transaction processing system
CN111371585A (en) Configuration method and device for CDN node
CN113726546B (en) Configuration method, device, system, computing equipment and storage medium
CN114518970A (en) High availability of dynamic asset model information views
US8341368B2 (en) Automatic reallocation of structured external storage structures
US11138198B2 (en) Handling of unresponsive read only instances in a reader farm system
US20130318192A1 (en) Composite graph cache management
CN111367921A (en) Data object refreshing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant