CN111405061A - Micro-service shutdown method based on Dubbo frame and server - Google Patents

Micro-service shutdown method based on Dubbo frame and server Download PDF

Info

Publication number
CN111405061A
CN111405061A CN202010240377.XA CN202010240377A CN111405061A CN 111405061 A CN111405061 A CN 111405061A CN 202010240377 A CN202010240377 A CN 202010240377A CN 111405061 A CN111405061 A CN 111405061A
Authority
CN
China
Prior art keywords
node server
provider node
shutdown
service request
state
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.)
Granted
Application number
CN202010240377.XA
Other languages
Chinese (zh)
Other versions
CN111405061B (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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202010240377.XA priority Critical patent/CN111405061B/en
Publication of CN111405061A publication Critical patent/CN111405061A/en
Application granted granted Critical
Publication of CN111405061B publication Critical patent/CN111405061B/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/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web 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/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
    • 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)
  • Computer And Data Communications (AREA)

Abstract

The invention provides a micro-service shutdown method and a server based on a Dubbo frame, wherein the method comprises the following steps: receiving shutdown identification information transmitted by a provider node server, and setting a state identification of the provider node server as a shutdown state; receiving a service request transmitted by a client, and determining a target provider node server for processing the service request; checking the state identification of the target provider node server, and if the state identification is in a normal state, sending the service request to the provider node server for service processing; if the state identifier is in a shutdown state, the target provider node server is determined again, the state identifier is verified until the target provider node server with the normal state identifier is obtained, and the service request is sent to the target provider node server.

Description

Micro-service shutdown method based on Dubbo frame and server
Technical Field
The invention relates to the technical field of micro-services, in particular to a micro-service shutdown method and a server based on a Dubbo frame.
Background
With the popularity of distributed microservices, the frequency of microservice version update iterations is more frequent, and the elegance of ensuring that a provider node providing a transactional service is down becomes more and more important. Graceful shutdown of a provider node needs to ensure that transactions in transit can be executed and returned correctly, avoiding loss of transactions during shutdown. In the Dubbo micro-service framework, the halt of a provider node mainly depends on a registration center to inform a consumer node, and the consumer node does not distribute a request to the halted provider node after receiving the notification of the registration center and waits for the return of the in-transit request. However, this mechanism provides a strong coupling between the provider and consumer nodes and the registry. Under the scene of being applied to online and offline of large-scale nodes, the push of the registry has large delay, which can cause the following problems: 1. the newly added consumer node can still obtain the address information of the provider node from the registration center during the delay period, so that the connection with the shutdown node can be established. 2. The inventory consumer node still distributes traffic to the shutdown node during this time, resulting in failed in-transit transactions or longer downtime. 3. If the transaction exception fails, the bottom-layer framework has no supplement mechanism and needs to use the self-captured exception type for compensation.
Disclosure of Invention
In order to solve at least one of the above problems, an object of the present invention is to provide a micro-service shutdown method based on a Dubbo framework, which eliminates strong dependence of a micro-service node shutdown message notification on a registry, and avoids problems of transaction failure and time-consuming shutdown increase caused by a push delay of the registry. It is another object of the present invention to provide a provider node server. It is yet another object of the present invention to provide a consumer node server. It is a further object of the present invention to provide a computer apparatus. It is a further object of this invention to provide such a readable medium.
In order to achieve the above object, the present invention discloses a micro-service shutdown method based on a Dubbo frame, including:
receiving shutdown identification information transmitted by a provider node server, and setting a state identification of the provider node server as a shutdown state;
receiving a service request transmitted by a client, and determining a target provider node server for processing the service request;
checking the state identification of the target provider node server, and if the state identification is in a normal state, sending the service request to the provider node server for service processing; and if the state identifier is in a shutdown state, re-determining the target provider node server, checking the state identifier until the target provider node server with the normal state identifier is obtained, and sending the service request to the target provider node server.
Preferably, the receiving a service request transmitted by a client, and determining a target provider node server for processing the service request specifically includes:
receiving a service request transmitted by a client;
and determining the target provider node server in a provider node server list in a normal state provided by the registration center.
Preferably, the method further comprises the following steps:
receiving a shutdown notice sent by a registration center;
determining a shutdown provider node server corresponding to the shutdown notification;
and deleting the stopped provider node server in a provider node server list in a normal state.
Preferably, the method further comprises, after receiving the outage identification information transmitted by the provider node server:
determining whether a forwarded and unprocessed completed forwarded service request exists in a provider node server which sends the halt identification information;
if yes, determining whether the transferred service request is an idempotent transaction;
and if so, re-determining a target provider node server and sending the converted service request to the target provider node server.
The invention also discloses a micro-service shutdown method based on the Dubbo frame, which comprises the following steps:
forming shutdown identification information according to the received shutdown signal;
and transmitting the stop identification information to a consumer node server to enable the consumer node server to set a state identification of a provider node server as a stop state, when receiving a service request transmitted by a client, determining a target provider node server for processing the service request, checking the state identification of the target provider node server, if the state identification is in a normal state, transmitting the service request to the provider node server for service processing, if the state identification is in a stop state, re-determining the target provider node server, checking the state identification until the target provider node server with the state identification in the normal state is obtained, and transmitting the service request to the target provider node server.
The invention also discloses a consumer node server, comprising:
the system comprises a halt information receiving unit, a state identification setting unit and a state identification sending unit, wherein the halt information receiving unit is used for receiving halt identification information transmitted by a provider node server and setting the state identification of the provider node server to be a halt state;
the service request processing unit is used for receiving a service request transmitted by a client and determining a target provider node server for processing the service request;
the provider node checking unit is used for checking the state identifier of the target provider node server, and if the state identifier is in a normal state, sending the service request to the provider node server for service processing; and if the state identifier is in a shutdown state, re-determining the target provider node server, checking the state identifier until the target provider node server with the normal state identifier is obtained, and sending the service request to the target provider node server.
Preferably, the service request processing unit specifically includes:
the request receiving module is used for receiving the service request transmitted by the client;
and the provider node determining module is used for determining a target provider node server in a provider node server list in a normal state provided by the registration center.
Preferably, the system further includes a shutdown processing unit, configured to receive a shutdown notification sent by a registry, determine a shutdown provider node server corresponding to the shutdown notification, and delete the shutdown provider node server in a normal provider node server list.
Preferably, the transaction compensation unit is further configured to, after receiving the shutdown identification information transmitted by the provider node server, determine whether a forwarded and unprocessed forwarded service request exists in the provider node server that transmits the shutdown identification information, if so, determine whether the forwarded service request is an idempotent transaction, and if so, re-determine a target provider node server and transmit the forwarded service request to the target provider node server.
The invention also discloses a provider node server, comprising:
the instruction receiving unit is used for forming stop identification information according to the received stop signal;
and the shutdown information sending unit is used for transmitting the shutdown identification information to a consumer node server so that the consumer node server sets the state identification of the provider node server as a shutdown state, determining a target provider node server for processing the service request when receiving the service request transmitted by the client, checking the state identification of the target provider node server, sending the service request to the provider node server for service processing if the state identification is a normal state, re-determining the target provider node server and checking the state identification until the target provider node server with the normal state is obtained if the state identification is a shutdown state, and sending the service request to the target provider node server.
The invention also discloses a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor,
the processor, when executing the program, implements the method as described above.
The invention also discloses a computer-readable medium, having stored thereon a computer program,
which when executed by a processor implements the method as described above.
The method and the system set the state identifier for the provider node server, can directly receive the shutdown identifier information transmitted by the provider node server, and set the state identifier of the provider node server corresponding to the shutdown identifier information as a shutdown state. When a service request transmitted by a client is received, firstly, an available provider node server is determined, then whether the provider node server is stopped is determined according to the state identifier of the provider node server, if the provider node server is stopped, other available provider node servers are selected, and the situation that a consumer node server still establishes connection with the stopped provider node server to cause that a task cannot be executed in the information delay stage that the provider node server informs the stop through a registration center is avoided. The shutdown identification information is directly sent by the shutdown provider node server, so that the timeliness is stronger compared with the existing method that the shutdown information of the provider node server is transmitted through the registration center, various problems caused by sending a shutdown notification through the registration center can be avoided, and the reliability of the micro-service is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flow chart of one embodiment of a Dubbo frame-based micro-service shutdown method according to the present invention;
FIG. 2 is a flowchart illustrating a second exemplary embodiment of a method for suspending a micro-service based on a Dubbo frame according to the present invention;
FIG. 3 is a third flowchart illustrating a method for suspending a micro-service based on a Dubbo frame according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a fourth embodiment of a micro-service shutdown method based on a Dubbo frame according to the present invention;
FIG. 5 is a flow chart of another embodiment of a Dubbo frame based micro-service shutdown method according to the present invention;
FIG. 6 is one of the block diagrams of one embodiment of a consumer node server of the present invention;
FIG. 7 illustrates a second block diagram of an embodiment of a consumer node server of the present invention;
FIG. 8 is a third block diagram of an embodiment of a consumer node server of the present invention;
FIG. 9 is a fourth block diagram of one embodiment of a consumer node server of the present invention;
FIG. 10 is a block diagram illustrating one embodiment of a provider node server of the present invention;
FIG. 11 illustrates a schematic block diagram of a computer device suitable for use in implementing embodiments of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the 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.
In the invention, the Dubbo framework service is adopted, and Dubbo is the core framework of the Alaba SOA service treatment scheme, provides 3,000,000,000+ visit volume support for 2,000+ services every day, and is widely applied to each member site of the Alaba group. Dubbo is a distributed service framework that is dedicated to providing high performance and transparent RPC remote service invocation schemes, as well as SOA service governance schemes. The core part comprises: remote communication: a variety of long connection-based NIO framework abstraction encapsulations are provided, including a variety of threading models, serialization, and "request-response" modes of information exchange. Cluster fault tolerance: the transparent remote procedure call based on the interface method is provided, and comprises multi-protocol support, soft load balancing, failure fault tolerance, address routing, dynamic configuration and other cluster support. Automatic discovery: based on the registry directory service, the service consumer can dynamically search the service provider, the address is transparent, and the service provider can smoothly increase or decrease machines.
In a particular embodiment of the present invention, the Dubbo framework includes a plurality of provider node servers, a registry, and a plurality of consumer node servers. The registry is an important role in a service framework, provides service discovery (registration and subscription) functions, and has long connection with a provider node server and a consumer node server. In the prior art, a consumer node server may receive a high-frequency service request from a client, and may obtain server information, connection information, and the like of all available provider node servers through a registry. The consumer node server can select one of the available provider node servers provided by the registry as a target provider node server, and further forward the service request to the target provider node server for processing the service request.
However, when the provider node server version is upgraded or restarted, a shutdown process is required. The provider node server shutdown is divided into forced shutdown and graceful shutdown. Forced shutdown refers to forced killing of a process by means of a kill-9 process number and the like, and in such a stopping manner, at the moment of stopping, a service request being processed in an application can be interrupted, and related cleaning can not be triggered. Compared with the method of forcing the kill process, the graceful shutdown means that the application process on the provider node server is actively stopped after waiting for the in-transit service request to return and the resource cleaning is completed. The existing shutdown mode is to give certain elegant shutdown time, and if the application program does not normally exit within overtime time, forced shutdown is carried out, which cannot completely ensure the return of all in-transit service requests and stop the consumer node server from sending new service requests.
Specifically, after receiving a manually input shutdown instruction, the provider node server may set the state flag of the provider node server as a flag corresponding to "shutdown", and reject all newly added connection requests. When the registration center detects the 'stop' mark of the provider node server, the provider node server can be determined to be stopped and cannot be used, and then the consumer node server is informed that the provider node server is stopped and cannot provide service processing service, so that the provider node server is offline, and the consumer node server does not forward the service request to the offline provider node server any more.
After the registration center acquires the 'halt' indication of the provider node server, in the process of notifying the consumer node server of the halt after the provider node server is offline, the provider node server is already in a halt state, and the consumer node server does not receive the offline notification of the provider node server, so that the time delay of the halt notification reaching the consumer node server occurs. In the time delay process, the consumer node server can still establish connection with the stopped provider node server, and normally forwards the service request, and at the moment, the provider node server cannot process the forwarded service request, which may cause service request processing failure, transaction failure or long transaction time and other consequences, and poor customer experience. Further, when the service processing fails due to the time delay of the stop notification of the provider node server, the consumer node server cannot take measures such as troubleshooting and emergency processing for the failed service request, and the consumer node server only returns the result of the failure of the service request processing to the client application and can only perform compensation processing through the client application itself. Therefore, the invention provides a micro-service shutdown scheme based on a Dubbo frame, which enables a provider node server to directly send a shutdown notification to a consumer node server, eliminates the strong dependence of the shutdown notification of the provider node server on a registration center, greatly reduces the shutdown delay time of the provider node server, and avoids the problems of transaction failure, shutdown time consumption increase and the like caused by push delay.
According to one aspect of the invention, the embodiment discloses a micro-service shutdown method based on a Dubbo framework. As shown in fig. 1, in this embodiment, the method includes:
s100: and receiving shutdown identification information transmitted by the provider node server, and setting the state identification of the provider node server as a shutdown state.
S200: receiving a service request transmitted by a client, and determining a target provider node server for processing the service request.
S300: checking the state identification of the target provider node server, and if the state identification is in a normal state, sending the service request to the provider node server for service processing; and if the state identifier is in a shutdown state, re-determining the target provider node server, checking the state identifier until the target provider node server with the normal state identifier is obtained, and sending the service request to the target provider node server.
The method and the system set the state identifier for the provider node server, can directly receive the shutdown identifier information transmitted by the provider node server, and set the state identifier of the provider node server corresponding to the shutdown identifier information as a shutdown state. When a service request transmitted by a client is received, firstly, an available provider node server is determined, then whether the provider node server is stopped is determined according to the state identifier of the provider node server, if the provider node server is stopped, other available provider node servers are selected, and the situation that a consumer node server still establishes connection with the stopped provider node server to cause that a task cannot be executed in the information delay stage that the provider node server informs the stop through a registration center is avoided. The shutdown identification information is directly sent by the shutdown provider node server, so that the timeliness is stronger compared with the existing method that the shutdown information of the provider node server is transmitted through the registration center, various problems caused by sending a shutdown notification through the registration center can be avoided, and the reliability of the micro-service is improved.
During the normal operation of each server, the provider node server and the consumer node server both communicate via long connections, and all connection information is stored in the provider node server. When the provider node server sends the shutdown identification information to the consumer node server, the shutdown identification information is directly sent to the consumer node server according to the connection information, and new connection is not needed.
In a preferred embodiment, as shown in fig. 2, the S200 may specifically include:
s210: and receiving a service request transmitted by the client.
S220: and determining the target provider node server in a provider node server list in a normal state provided by the registration center.
It is to be understood that, in this embodiment, the registry may determine the server information and connection information of all the provider node servers in advance, and form the server information and connection information of the provider node servers in a normal state into a provider node server list. The registration center sends the provider node server list to the consumer node servers, and the consumer node servers can conveniently screen available provider node servers from the list.
In a preferred embodiment, as shown in fig. 3, the method further comprises:
s310: and receiving a shutdown notice sent by the registration center.
S320: and determining the shutdown provider node server corresponding to the shutdown notification.
S330: and deleting the stopped provider node server in a provider node server list in a normal state.
It can be understood that the consumer node server may receive the shutdown notification sent by the registry at the same time, and delete the shutdown provider node server notified by the registry in the normal provider node server list, so that the consumer node server does not select the shutdown provider node server when determining the target provider node server for processing the service request, thereby improving the accuracy and efficiency of service request processing.
In a preferred embodiment, as shown in fig. 4, the method further comprises, after receiving the outage identification information transmitted by the provider node server:
s410: and determining whether the provider node server sending the halt identification information has a forwarded and unprocessed completed forwarded service request.
S420: if so, determining whether the forwarded service request is an idempotent transaction.
S430: and if so, re-determining a target provider node server and sending the converted service request to the target provider node server.
It can be understood that, in the preferred embodiment, a compensation mechanism is added to the consumer node server, and after receiving the shutdown notification identification information of the provider node server, if the shutdown notification identification information has been forwarded to the shutdown provider node server but the completed service request has not been processed, the shutdown provider node server is not able to perform service request processing. If the service request is an idempotent transaction, the idempotent transaction indicates that the processing results of the corresponding service requests are the same after a plurality of service requests are initiated. Therefore, the service request is sent to different provider node servers without influencing the processing result of the service request. The consumer node server can re-establish an available target provider node server, and forwards the service request to the re-determined target provider node server so as to realize the compensation processing of the service request and reduce the influence of the shutdown of the provider node server on the service request processing.
In a preferred embodiment, after receiving a manually input shutdown instruction, the provider node server sets its own status flag to a flag corresponding to "shutdown". And simultaneously, determining the service request processed by the server and refusing to receive a new service request, and after the service request processed currently is processed, disconnecting the communication connection with the consumer node server and the registration center, namely closing links with other servers.
In one specific example, the provider node server first sets its status indicator to "down", i.e., notifies the registry to logoff the provider node server's services, and closes the connection with the registry. Further, the provider node Server needs to close the thread pool, close the Server, close the connection on the Server, and clear the cache. Specifically, the provider node server logs out the service information of the registry and disconnects the service information from the registry. And then informing each connected consumer node server of the stop identification information, wherein each consumer node server can set the long connecting channel of the provider node server to be in a read-only state after receiving the stop identification information, and identifying the state of the stopped provider node server to be in a stop state. And after the service request being processed is completely processed, the provider node Server closes the monitoring Server, closes the client connection which is not closed yet, and clears the service-related bean objects to realize elegant shutdown.
Based on the same principle, the embodiment also discloses a micro-service shutdown method based on the Dubbo frame. As shown in fig. 5, in this embodiment, the method includes:
s500: and forming shutdown identification information according to the received shutdown signal.
S600: and transmitting the stop identification information to a consumer node server to enable the consumer node server to set a state identification of the provider node server as a stop state, when receiving a service request transmitted by a client, determining a target provider node server for processing the service request, checking the state identification of the target provider node server, if the state identification is in a normal state, transmitting the service request to the provider node server for service processing, if the state identification is in a stop state, re-determining the target provider node server, checking the state identification until the target provider node server with the state identification in the normal state is obtained, and transmitting the service request to the target provider node server.
Because the principle of solving the problems by the method is similar to that of the method, the implementation of the method can be referred to the implementation of the method, and details are not repeated herein.
Based on the same principle, the embodiment also discloses a consumer node server. As shown in fig. 6, in the present embodiment, the consumer node server includes a shutdown information receiving unit 11, a service request processing unit 12, and a provider node checking unit 13.
The shutdown information receiving unit 11 is configured to receive shutdown identification information transmitted by a provider node server, and set a status identification of the provider node server as a shutdown status.
The service request processing unit 12 is configured to receive a service request transmitted by a client, and determine a target provider node server for processing the service request.
The provider node checking unit 13 is configured to check a state identifier of the target provider node server, and send the service request to the provider node server for service processing if the state identifier is in a normal state; and if the state identifier is in a shutdown state, re-determining the target provider node server, checking the state identifier until the target provider node server with the normal state identifier is obtained, and sending the service request to the target provider node server.
In a preferred embodiment, as shown in fig. 7, the service request processing unit specifically includes a request receiving module 121 and a provider node determining module 122.
The request receiving module 121 is configured to receive a service request transmitted by a client.
The provider node determining module 122 is configured to determine a target provider node server from a list of provider node servers in a normal state provided by the registry.
In a preferred embodiment, as shown in FIG. 8, the server further comprises an outage handling unit 14. The shutdown processing unit 14 is configured to receive a shutdown notification sent by the registry, determine a shutdown provider node server corresponding to the shutdown notification, and delete the shutdown provider node server from the list of normal provider node servers.
In a preferred embodiment, the server further may comprise a transaction compensation unit 15, as shown in fig. 9. The transaction compensation unit 15 is configured to determine, after receiving shutdown identification information transmitted by a provider node server, whether a forwarded and unprocessed transferred service request exists in the provider node server that transmits the shutdown identification information, determine, if the transferred service request is an idempotent transaction, and if the transferred service request is an idempotent transaction, re-determine a target provider node server and transmit the transferred service request to the target provider node server.
Since the principle of solving the problem by the server is similar to the above method, the implementation of the server may refer to the implementation of the method, and is not described herein again.
Based on the same principle, the embodiment also discloses a provider node server. As shown in fig. 10, in the present embodiment, the server includes an instruction receiving unit 21 and a stop information transmitting unit 22.
Wherein the instruction receiving unit 21 is configured to form shutdown identification information according to the received shutdown signal.
The shutdown information sending unit 22 is configured to transmit the shutdown identification information to a consumer node server, so that the consumer node server sets a state identifier of the provider node server to be a shutdown state, determine a target provider node server for processing the service request when receiving the service request transmitted by the client, check the state identifier of the target provider node server, send the service request to the provider node server for service processing if the state identifier is a normal state, and re-determine the target provider node server and perform state identifier check until a target provider node server with a normal state identifier is obtained, and send the service request to the target provider node server if the state identifier is a shutdown state.
Since the principle of solving the problem by the server is similar to the above method, the implementation of the server may refer to the implementation of the method, and is not described herein again.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer device, which may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
In a typical example, the computer device comprises in particular a memory, a processor and a computer program stored on the memory and executable on the processor, which when executing the program implements the method performed by the server as described above.
Referring now to FIG. 11, shown is a schematic diagram of a computer device 600 suitable for use in implementing embodiments of the present application.
As shown in fig. 11, the computer apparatus 600 includes a Central Processing Unit (CPU)601 which can perform various appropriate works and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM)) 603. In the RAM603, various programs and data necessary for the operation of the system 600 are also stored. The CPU601, ROM602, and RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
To the I/O interface 605, AN input section 606 including a keyboard, a mouse, and the like, AN output section 607 including a network interface card such as a Cathode Ray Tube (CRT), a liquid crystal feedback (L CD), and the like, a speaker, and the like, a storage section 608 including a hard disk, and the like, and a communication section 609 including a network interface card such as a L AN card, a modem, and the like, the communication section 609 performs communication processing via a network such as the internet, a drive 610 is also connected to the I/O interface 605 as necessary, a removable medium 611 such as a magnetic disk, AN optical disk, a magneto-optical disk, a semiconductor memory, and the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted as necessary as the storage section 608.
In particular, according to an embodiment of the present invention, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the invention include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (12)

1. A micro-service shutdown method based on a Dubbo frame is characterized by comprising the following steps:
receiving shutdown identification information transmitted by a provider node server, and setting a state identification of the provider node server as a shutdown state;
receiving a service request transmitted by a client, and determining a target provider node server for processing the service request;
checking the state identification of the target provider node server, and if the state identification is in a normal state, sending the service request to the provider node server for service processing; and if the state identifier is in a shutdown state, re-determining the target provider node server, checking the state identifier until the target provider node server with the normal state identifier is obtained, and sending the service request to the target provider node server.
2. The method for micro-service shutdown based on Dubbo framework of claim 1, wherein the receiving the service request transmitted by the client, and the determining the target provider node server for processing the service request specifically comprises:
receiving a service request transmitted by a client;
and determining the target provider node server in a provider node server list in a normal state provided by the registration center.
3. The Dubbo frame-based microservice shutdown method of claim 2, further comprising:
receiving a shutdown notice sent by a registration center;
determining a shutdown provider node server corresponding to the shutdown notification;
and deleting the stopped provider node server in a provider node server list in a normal state.
4. The Dubbo framework-based micro-service shutdown method according to claim 1, further comprising, after receiving shutdown identification information transmitted by a provider node server:
determining whether a forwarded and unprocessed completed forwarded service request exists in a provider node server which sends the halt identification information;
if yes, determining whether the transferred service request is an idempotent transaction;
and if so, re-determining a target provider node server and sending the converted service request to the target provider node server.
5. A micro-service shutdown method based on a Dubbo frame is characterized by comprising the following steps:
forming shutdown identification information according to the received shutdown signal;
and transmitting the stop identification information to a consumer node server to enable the consumer node server to set a state identification of a provider node server as a stop state, when receiving a service request transmitted by a client, determining a target provider node server for processing the service request, checking the state identification of the target provider node server, if the state identification is in a normal state, transmitting the service request to the provider node server for service processing, if the state identification is in a stop state, re-determining the target provider node server, checking the state identification until the target provider node server with the state identification in the normal state is obtained, and transmitting the service request to the target provider node server.
6. A consumer node server, comprising:
the system comprises a halt information receiving unit, a state identification setting unit and a state identification sending unit, wherein the halt information receiving unit is used for receiving halt identification information transmitted by a provider node server and setting the state identification of the provider node server to be a halt state;
the service request processing unit is used for receiving a service request transmitted by a client and determining a target provider node server for processing the service request;
the provider node checking unit is used for checking the state identifier of the target provider node server, and if the state identifier is in a normal state, sending the service request to the provider node server for service processing; and if the state identifier is in a shutdown state, re-determining the target provider node server, checking the state identifier until the target provider node server with the normal state identifier is obtained, and sending the service request to the target provider node server.
7. The consumer node server of claim 6, wherein the service request processing unit specifically comprises:
the request receiving module is used for receiving the service request transmitted by the client;
and the provider node determining module is used for determining a target provider node server in a provider node server list in a normal state provided by the registration center.
8. The consumer node server of claim 7, further comprising a shutdown processing unit, configured to receive a shutdown notification sent by a registry, determine a shutdown provider node server corresponding to the shutdown notification, and delete the shutdown provider node server from a normal provider node server list.
9. The consumer node server of claim 6, further comprising a transaction compensation unit, configured to determine whether a forwarded and unprocessed forwarded service request exists in the provider node server that sent the shutdown identification information after receiving the shutdown identification information transmitted by the provider node server, determine whether the forwarded service request is an idempotent transaction if the forwarded service request exists, and if the forwarded service request is an idempotent transaction if the forwarded service request exists, re-determine a target provider node server and send the forwarded service request to the target provider node server.
10. A provider node server, comprising:
the instruction receiving unit is used for forming stop identification information according to the received stop signal;
and the shutdown information sending unit is used for transmitting the shutdown identification information to a consumer node server so that the consumer node server sets the state identification of the provider node server as a shutdown state, determining a target provider node server for processing the service request when receiving the service request transmitted by the client, checking the state identification of the target provider node server, sending the service request to the provider node server for service processing if the state identification is a normal state, re-determining the target provider node server and checking the state identification until the target provider node server with the normal state is obtained if the state identification is a shutdown state, and sending the service request to the target provider node server.
11. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor,
the processor, when executing the program, implements the method of any of claims 1-5.
12. A computer-readable medium, having stored thereon a computer program,
the program when executed by a processor implementing the method according to any one of claims 1-5.
CN202010240377.XA 2020-03-31 2020-03-31 Micro-service shutdown method based on Dubbo frame and server Active CN111405061B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010240377.XA CN111405061B (en) 2020-03-31 2020-03-31 Micro-service shutdown method based on Dubbo frame and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010240377.XA CN111405061B (en) 2020-03-31 2020-03-31 Micro-service shutdown method based on Dubbo frame and server

Publications (2)

Publication Number Publication Date
CN111405061A true CN111405061A (en) 2020-07-10
CN111405061B CN111405061B (en) 2022-10-21

Family

ID=71429342

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010240377.XA Active CN111405061B (en) 2020-03-31 2020-03-31 Micro-service shutdown method based on Dubbo frame and server

Country Status (1)

Country Link
CN (1) CN111405061B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112860328A (en) * 2021-02-08 2021-05-28 中国工商银行股份有限公司 Server control method, device, computing equipment and medium
CN112882883A (en) * 2021-02-25 2021-06-01 中国工商银行股份有限公司 Shutdown test method and apparatus, electronic device, and computer-readable storage medium
CN115866029A (en) * 2022-11-23 2023-03-28 中国工商银行股份有限公司 Micro-service offline processing method and device, computer equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160127199A1 (en) * 2014-11-04 2016-05-05 Futurewei Technologies, Inc. Adaptive Allocation of Server Resources
CN108965461A (en) * 2018-08-03 2018-12-07 华数传媒网络有限公司 Service administering method, device and dubbo service system
CN110311900A (en) * 2019-06-19 2019-10-08 微梦创科网络科技(中国)有限公司 A kind of service calling method, device, electronic equipment and storage medium
CN110708196A (en) * 2019-09-30 2020-01-17 中国工商银行股份有限公司 Data processing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160127199A1 (en) * 2014-11-04 2016-05-05 Futurewei Technologies, Inc. Adaptive Allocation of Server Resources
CN108965461A (en) * 2018-08-03 2018-12-07 华数传媒网络有限公司 Service administering method, device and dubbo service system
CN110311900A (en) * 2019-06-19 2019-10-08 微梦创科网络科技(中国)有限公司 A kind of service calling method, device, electronic equipment and storage medium
CN110708196A (en) * 2019-09-30 2020-01-17 中国工商银行股份有限公司 Data processing method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112860328A (en) * 2021-02-08 2021-05-28 中国工商银行股份有限公司 Server control method, device, computing equipment and medium
CN112860328B (en) * 2021-02-08 2024-04-30 中国工商银行股份有限公司 Control method, device, computing equipment and medium of server
CN112882883A (en) * 2021-02-25 2021-06-01 中国工商银行股份有限公司 Shutdown test method and apparatus, electronic device, and computer-readable storage medium
CN115866029A (en) * 2022-11-23 2023-03-28 中国工商银行股份有限公司 Micro-service offline processing method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN111405061B (en) 2022-10-21

Similar Documents

Publication Publication Date Title
CN111405061B (en) Micro-service shutdown method based on Dubbo frame and server
CN110365502B (en) Service upgrade management method, device and storage medium
CN108874567B (en) Service processing method and system
US11432137B2 (en) Service notification method for mobile edge host and apparatus
CN114253748B (en) Message processing system and message processing method
CN107729176B (en) Disaster recovery method and disaster recovery system for configuration file management system
JP2019506764A (en) System and method for obtaining, processing and updating global information
CN112732491B (en) Data processing system and business data processing method based on data processing system
CN111652728B (en) Transaction processing method and device
WO2007081351A1 (en) System and method for conversation and callback based on web service addressing and asynchronous request response
CN108874531A (en) Method, apparatus, system and electronic equipment for the service of fusing
CN110109772A (en) A kind of method for restarting of CPU, communication equipment and readable storage medium storing program for executing
WO2022007908A1 (en) Method for service collaboration between network element devices, and network element device
CN111309691A (en) Data sharing exchange system and exchange method based on bus architecture
CN112099921B (en) Java application system preheating method and system based on JVM
CN112988800A (en) Data processing method and device based on distributed environment
CN110717756B (en) Payment data processing device and method based on contract
WO2023186154A1 (en) Data transmission system and method
CN112187916B (en) Cross-system data synchronization method and device
CN110336847B (en) Payment message transmission system and method
CN114968636A (en) Fault processing method and device
WO2017101045A1 (en) Network element selection method and network element selector
CN109992384B (en) Service registration discovery coordination system and method thereof
CN113542319A (en) Service providing entity change notification method, device and system used in Dubbo framework
CN112422598A (en) Resource scheduling method, intelligent front-end equipment, intelligent gateway and distributed system

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