CN113190274A - Node processing method and system, node, medium and computing device - Google Patents

Node processing method and system, node, medium and computing device Download PDF

Info

Publication number
CN113190274A
CN113190274A CN202110501110.6A CN202110501110A CN113190274A CN 113190274 A CN113190274 A CN 113190274A CN 202110501110 A CN202110501110 A CN 202110501110A CN 113190274 A CN113190274 A CN 113190274A
Authority
CN
China
Prior art keywords
node
upstream
preheating
ith
candidate
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
CN202110501110.6A
Other languages
Chinese (zh)
Other versions
CN113190274B (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.)
Hangzhou Netease Cloud Music Technology Co Ltd
Original Assignee
Hangzhou Netease Cloud Music 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 Hangzhou Netease Cloud Music Technology Co Ltd filed Critical Hangzhou Netease Cloud Music Technology Co Ltd
Priority to CN202110501110.6A priority Critical patent/CN113190274B/en
Publication of CN113190274A publication Critical patent/CN113190274A/en
Application granted granted Critical
Publication of CN113190274B publication Critical patent/CN113190274B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • 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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0806Configuration setting for initial configuration or provisioning, e.g. plug-and-play

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present disclosure provides a node processing method and system, a node, a medium, and a computing device, the method including: under the condition that a first node is in the ith preheating stage of N preheating stages, the first node receives a health inquiry request sent by a second node; wherein N is an integer greater than or equal to 2, and i is an integer greater than or equal to 1 and less than or equal to N; the second node is one of the upstream nodes of the first node; under the condition that the candidate upstream node set corresponding to the ith preheating stage comprises the second node, the first node sends a first type status code to the second node; the first-class status code is used for indicating that the first node is in a state of being capable of processing the service request of the second node; wherein the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith warm-up stage is less than the number of upstream nodes of the first node.

Description

Node processing method and system, node, medium and computing device
Technical Field
Embodiments of the present disclosure relate to the field of information processing, and more particularly, to a node processing method and system, a node, a medium, and a computing device.
Background
This section is intended to provide a background or context to the embodiments of the disclosure recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
For the server, the release is generally divided into hot deployment and cold deployment. For cold deployment, although a restart process can clean up resources of a previous process more thoroughly, due to various reasons, there are performance problems when the process is just started, which causes a failure in processing a part of requests or an excessively long response time, and affects user experience. However, the related art pre-heating process usually has problems of additional burden on the system, data pollution, and high cost of storage resources.
Disclosure of Invention
The present disclosure is intended to provide a node processing method and system, a node, a medium, and a computing device, so as to at least solve the above technical problems.
A first aspect of the embodiments of the present disclosure provides a node processing method, where the method includes:
under the condition that a first node is in the ith preheating stage of N preheating stages, the first node receives a health inquiry request sent by a second node; wherein N is an integer greater than or equal to 2, and i is an integer greater than or equal to 1 and less than or equal to N; the second node is one of the upstream nodes of the first node;
under the condition that the candidate upstream node set corresponding to the ith preheating stage comprises the second node, the first node sends a first type status code to the second node; the first-class status code is used for indicating that the first node is in a state of being capable of processing the service request of the second node; wherein the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith warm-up stage is less than the number of upstream nodes of the first node.
In one embodiment of the present disclosure, the method further comprises:
under the condition that the candidate upstream node set corresponding to the ith preheating stage does not contain the second node, the first node sends a second type state code to the second node; wherein the second type status code is used to indicate that the first node is in a state of not processing a service request.
In an embodiment of the present disclosure, in a case that the second node is not included in the candidate upstream node set corresponding to the ith warm-up stage, the sending, by the first node, the second-class status code to the second node includes:
and under the condition that the candidate upstream node set corresponding to the ith preheating stage does not contain the second node, if the first node meets a first preset condition, the first node adds the address related information of the second node to the first set, and feeds back the second type of state code to the second node.
In one embodiment of the present disclosure, the first preset condition includes:
preheating according to the percentage of the upstream quantity is started, the upstream nodes which are allowed to pass through are determined according to the access quantity sequence of the upstream nodes, and the current preheating used time length is smaller than the waiting time length for performing upstream flow statistics;
or, preheating according to the percentage of the upstream quantity, enabling the second set to be empty, and enabling the used time length of the current preheating to be smaller than the waiting time length for performing upstream flow statistics; wherein the second set is an upstream node set of the first node read by the first node and sorted according to a preset access quantity sequence
In one embodiment of the present disclosure, the method further comprises:
under the condition that the candidate upstream node set corresponding to the ith preheating stage does not contain the second node, if the upstream nodes which are determined to be allowed to pass through according to the access quantity sequence of the upstream nodes are closed, and the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is smaller than the maximum number of the upstream nodes which are allowed to pass through by the ith preheating stage, the first node updates the candidate upstream node set corresponding to the ith preheating stage based on the address related information of the second node to obtain the updated candidate upstream node set corresponding to the ith preheating stage, and feeds back the first-class status code to the second node.
In one embodiment of the present disclosure, the method further comprises:
under the condition that the candidate upstream node set corresponding to the ith preheating stage does not contain the second node, if the upstream nodes which are determined to be allowed to pass through according to the access quantity sequence of the upstream nodes are started, and the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is smaller than the maximum number of the upstream nodes allowed to pass through by the ith preheating stage, the first node updates the candidate upstream node set corresponding to the ith preheating stage on the basis of at least one upstream node in the second set to obtain an updated candidate upstream node set corresponding to the ith preheating stage;
the second set is an upstream node set of the first node read by the first node and sorted according to a preset access quantity sequence.
In one embodiment of the disclosure, the method further comprises one of:
under the condition that the updated candidate upstream node set corresponding to the ith preheating stage contains the second node, the first node feeds back a first-class state code to the second node;
under the condition that the updated candidate upstream node set corresponding to the ith preheating stage does not contain the second node, the first node feeds back a second-class state code to the second node; wherein the second type status code is used to indicate that the first node is in a state of not processing a service request.
In one embodiment of the present disclosure, the method further comprises:
under the condition that the first node determines to enter the ith preheating stage of the N preheating stages based on the current preheating used time, the first node determines a candidate upstream node set corresponding to the ith preheating stage based on a preheating strategy;
the preheating strategy comprises preheating duration corresponding to the N preheating stages and information related to the number of candidate upstream nodes.
In one embodiment of the present disclosure, the determining, by the first node, a candidate upstream node set corresponding to the ith warm-up stage based on a warm-up policy includes:
the first node determines the number to be added of the candidate upstream nodes corresponding to the ith preheating stage based on the number related information of the candidate upstream nodes corresponding to the ith preheating stage in the preheating strategy;
the first node determines a candidate upstream node corresponding to the ith preheating stage based on the number to be added of the candidate upstream nodes;
and the first node determines a candidate upstream node set corresponding to the ith preheating stage based on the candidate upstream node corresponding to the ith preheating stage.
In one embodiment of the present disclosure, the method further comprises:
the first node determines candidate upstream node sets respectively corresponding to the N preheating stages based on a preheating strategy under the condition that the first node determines to enter the first preheating stage in the N preheating stages;
the preheating strategy comprises preheating duration corresponding to the N preheating stages and information related to the number of candidate upstream nodes.
In one embodiment of the present disclosure, the method further comprises:
the first node determines a first numerical value corresponding to the ith preheating stage based on the current preheating used time and the preheating time respectively corresponding to the N preheating stages contained in the preheating strategy and the quantity related information of the candidate upstream nodes;
based on the first value, a maximum number of upstream nodes allowed to pass by the ith warm-up phase is determined.
In one embodiment of the present disclosure, the determining the maximum number of upstream nodes allowed to pass through by the ith warm-up phase based on the first value comprises one of:
taking said first value as the maximum number of upstream nodes allowed to pass by said ith warm-up phase, in case warm-up according to a percentage of the upstream number is switched off;
and under the condition that the preheating according to the percentage of the upstream quantity is started, determining the percentage corresponding to the ith preheating stage based on the first numerical value, and determining the maximum quantity of the upstream nodes allowed to pass through by the ith preheating stage based on the percentage and the quantity of the upstream nodes corresponding to the first nodes.
In one embodiment of the present disclosure, the method further comprises:
under the condition that the first node determines to be offline, if the first node receives a health inquiry request sent by a third node, the first node sends a second type status code to the third node; wherein the second type status code is used for indicating that the first node is in a state of not processing a service request; the third node is one of the nodes upstream of the first node.
In one embodiment of the present disclosure, the method further comprises:
the first node receives an online request sent by a deployment node;
under the condition that the first node meets a second preset condition, the first node feeds back an online success status code to the deployment node;
wherein the second preset condition comprises: the first node preheating function is started and preheating is completed; or the first node preheating function is closed.
A second aspect of the embodiments of the present disclosure provides a node processing method, including:
the second node sends a health inquiry request to the first node; wherein the second node is one of the upstream nodes of the first node;
the second node receives the status code fed back by the first node;
and under the condition that the status code fed back by the first node is the first type of status code, the second node determines that the first node is in a state capable of processing the service request of the second node.
In one embodiment of the present disclosure, the second node sending a health query request to the first node, comprising: the second node sends a jth health query request to the first node at a jth query time interval corresponding to the first node; wherein j is an integer greater than or equal to 1;
the second node receives the status code fed back by the first node, and the method comprises the following steps: the second node receives a status code fed back by the first node for the jth health query request.
In an embodiment of the present disclosure, in a case that the status code fed back by the first node is a first type status code, the determining, by the second node, that the first node is in a state capable of processing a service request of the second node includes:
determining that the first node is in a state capable of processing the service request of the second node when the status codes fed back by the first node for the continuous L health inquiry requests are the first type of status codes; wherein the L health query requests comprise the jth health query request; l is an integer of 2 or more.
In one embodiment of the present disclosure, the method comprises:
under the condition that the status codes fed back by the first node for the R continuous health inquiry requests are the second type status codes, the second node sends the j +1 health inquiry request to the first node in the j +1 inquiry time interval; wherein, the R health inquiry requests comprise the jth health inquiry request; r is an integer of 2 or more.
A third aspect of the embodiments of the present disclosure provides a node processing system, including: a first node and a second node; wherein the content of the first and second substances,
the first node is used for receiving a health inquiry request sent by the second node under the condition of the ith preheating stage in the N preheating stages; wherein N is an integer greater than or equal to 2, and i is an integer greater than or equal to 1 and less than or equal to N; the second node is one of the upstream nodes of the first node; under the condition that the candidate upstream node set corresponding to the ith preheating stage comprises the second node, sending a first-class status code to the second node; the first-class status code is used for indicating that the first node is in a state of being capable of processing the service request of the second node; the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is less than that of the upstream nodes of the first node;
the second node is used for sending a health inquiry request to the first node; wherein the second node is one of M upstream nodes of the first node; m is an integer greater than or equal to 1; receiving a state code fed back by the first node; and under the condition that the status code fed back by the first node is the first type of status code, determining that the first node is in a state capable of processing the service request of the second node.
In one embodiment of the present disclosure, the system further comprises: deploying the nodes; wherein the content of the first and second substances,
the deployment node is used for sending an online request to a first node and determining that the first node is successfully online under the condition of receiving an online success status code fed back by the first node;
the first node is used for receiving an online request sent by the deployment node and feeding back an online success status code to the deployment node under the condition that a second preset condition is met; wherein the second preset condition comprises: the first node preheating function is started and preheating is completed; or the first node preheating function is closed.
In an embodiment of the present disclosure, the deployment node is further configured to determine a node to be deployed included in a next deployment batch when it is determined that all nodes to be deployed included in a current deployment batch are online successfully; wherein the node to be deployed contained in the current deployment batch comprises the first node.
A fourth aspect of the embodiments of the present disclosure provides a first node, including:
the first interface unit is used for receiving a health inquiry request sent by the second node under the condition of the ith preheating stage in the N preheating stages; wherein N is an integer greater than or equal to 2, and i is an integer greater than or equal to 1 and less than or equal to N; the second node is one of the upstream nodes of the first node;
a first processing unit, configured to control, when the candidate upstream node set corresponding to the ith warm-up stage includes the second node, to send a first type status code to the second node through the first interface unit; the first-class status code is used for indicating that the first node is in a state of being capable of processing the service request of the second node; wherein the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith warm-up stage is less than the number of upstream nodes of the first node.
In an embodiment of the present disclosure, the first processing unit is configured to control, when the candidate upstream node set corresponding to the ith warm-up stage does not include the second node, to send a second-class status code to the second node through the first interface unit; wherein the second type status code is used to indicate that the first node is in a state of not processing a service request.
In an embodiment of the disclosure, the first processing unit is configured to, when the candidate upstream node set corresponding to the ith warm-up stage does not include the second node, add address-related information of the second node to the first set if the first node meets a first preset condition, and control to feed back the second-class status code to the second node through the first interface unit.
In one embodiment of the present disclosure, the first preset condition includes:
preheating according to the percentage of the upstream quantity is started, the upstream nodes which are allowed to pass through are determined according to the access quantity sequence of the upstream nodes, and the current preheating used time length is smaller than the waiting time length for performing upstream flow statistics;
or, preheating according to the percentage of the upstream quantity, enabling the second set to be empty, and enabling the used time length of the current preheating to be smaller than the waiting time length for performing upstream flow statistics; the second set is an upstream node set of the first node read by the first node and sorted according to a preset access quantity sequence.
In an embodiment of the disclosure, the first processing unit is configured to, when the candidate upstream node set corresponding to the ith warm-up stage does not include the second node, if the upstream nodes that are determined to be allowed to pass through according to the access quantity ranking of the upstream nodes are turned off, and the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith warm-up stage is smaller than the maximum number of upstream nodes that are allowed to pass through by the ith warm-up stage, update, by the first node, the candidate upstream node set corresponding to the ith warm-up stage based on the address-related information of the second node to obtain an updated candidate upstream node set corresponding to the ith warm-up stage, and control to feed back the first-class status code to the second node through the first interface unit.
In an embodiment of the present disclosure, the first processing unit is configured to, when the candidate upstream node set corresponding to the ith warm-up stage does not include the second node, if the upstream nodes that are determined to be allowed to pass through according to the access quantity ranking of the upstream nodes are started, and the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith warm-up stage is smaller than the maximum number of upstream nodes that are allowed to pass through by the ith warm-up stage, update, by the first node, the candidate upstream node set corresponding to the ith warm-up stage based on at least one upstream node in the second set, so as to obtain an updated candidate upstream node set corresponding to the ith warm-up stage;
the second set is an upstream node set of the first node read by the first node and sorted according to a preset access quantity sequence.
In one embodiment of the disclosure, the first processing unit is configured to perform one of:
controlling to feed back a first type of status code to the second node through the first interface unit under the condition that the updated candidate upstream node set corresponding to the ith preheating stage contains the second node;
controlling to feed back a second type of status code to the second node through the first interface unit under the condition that the updated candidate upstream node set corresponding to the ith preheating stage does not contain the second node; wherein the second type status code is used to indicate that the first node is in a state of not processing a service request.
In an embodiment of the present disclosure, the first processing unit is configured to, in a case that the first node determines to enter the ith warm-up stage of the N warm-up stages based on a current warm-up elapsed time, determine, based on a warm-up policy, a candidate upstream node set corresponding to the ith warm-up stage;
the preheating strategy comprises preheating duration corresponding to the N preheating stages and information related to the number of candidate upstream nodes.
In an embodiment of the present disclosure, the first processing unit is configured to determine, based on information related to the number of candidate upstream nodes corresponding to the ith preheating stage in the preheating policy, the number to be added of the candidate upstream nodes corresponding to the ith preheating stage; determining candidate upstream nodes corresponding to the ith preheating stage based on the number to be added of the candidate upstream nodes; and determining a candidate upstream node set corresponding to the ith preheating stage based on the candidate upstream node corresponding to the ith preheating stage.
In an embodiment of the present disclosure, the first processing unit is configured to, when it is determined that a first warm-up stage of the N warm-up stages is entered, determine, based on a warm-up policy, a candidate upstream node set corresponding to each of the N warm-up stages;
the preheating strategy comprises preheating duration corresponding to the N preheating stages and information related to the number of candidate upstream nodes.
In an embodiment of the present disclosure, the first processing unit is configured to determine a first numerical value corresponding to the ith preheating stage based on a current preheating used time and preheating time lengths respectively corresponding to the N preheating stages included in a preheating strategy and information related to the number of candidate upstream nodes; based on the first value, a maximum number of upstream nodes allowed to pass by the ith warm-up phase is determined.
In one embodiment of the disclosure, the first processing unit is configured to perform one of:
taking said first value as the maximum number of upstream nodes allowed to pass by said ith warm-up phase, in case warm-up according to a percentage of the upstream number is switched off;
and under the condition that the preheating according to the percentage of the upstream quantity is started, determining the percentage corresponding to the ith preheating stage based on the first numerical value, and determining the maximum quantity of the upstream nodes allowed to pass through by the ith preheating stage based on the percentage and the quantity of the upstream nodes corresponding to the first nodes.
In an embodiment of the present disclosure, the first processing unit is configured to, when the first node determines that the node is offline, if a health query request sent by a third node is received through a first interface unit, control to send a second type status code to the third node through the first interface unit; wherein the second type status code is used for indicating that the first node is in a state of not processing a service request; the third node is one of the nodes upstream of the first node.
In one embodiment of the present disclosure, the first node further comprises:
the second interface unit is used for receiving an online request sent by the deployment node;
the first processing unit is further configured to control to feed back an online success status code to the deployment node through the second interface unit when the first node meets a second preset condition;
wherein the second preset condition comprises: the first node preheating function is started and preheating is completed; or the first node preheating function is closed.
A fifth aspect of the embodiments of the present disclosure provides a second node, including:
a third interface unit, configured to send a health query request to the first node; wherein the second node is one of the upstream nodes of the first node; receiving a state code fed back by the first node;
and the second processing unit is used for determining that the first node is in a state capable of processing the service request of the second node under the condition that the status code fed back by the first node is the first type of status code.
In an embodiment of the present disclosure, the third interface unit is configured to send a jth health query request to the first node at a jth query time interval corresponding to the first node; wherein j is an integer greater than or equal to 1;
and receiving a status code fed back by the first node for the jth health query request.
In an embodiment of the present disclosure, the second processing unit is configured to determine that the first node is in a state capable of processing a service request of the second node, if a status code fed back by the first node for consecutive L health query requests is a first type status code; wherein the L health query requests comprise the jth health query request; l is an integer of 2 or more.
In an embodiment of the present disclosure, the second processing unit is configured to control, if the status code fed back by the first node for the R consecutive health query requests is a second type status code, to send, through the third interface unit, a j +1 th health query request to the first node at a j +1 th query time interval; wherein, the R health inquiry requests comprise the jth health inquiry request; r is an integer of 2 or more.
A sixth aspect of the embodiments of the present disclosure provides a medium storing a computer program, characterized in that the program, when executed by a processor, implements the method as in the previous embodiments.
A seventh aspect of embodiments of the present application provides a computing device, including:
one or more processors;
storage means for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the methods as in the previous embodiments.
According to the embodiment of the present disclosure, when a first node is in an ith warm-up stage of N warm-up stages, according to a candidate upstream node set corresponding to the ith warm-up stage, it is determined whether to feed back a first type status code to a second node, that is, any one upstream node, which sends a health query request, so as to indicate that the first node is currently in a state where the first node can process a service request of the upstream node, and then warm-up may be performed based on real service requests of the part of upstream nodes. Therefore, the problems of poor preheating effect caused by adopting virtual flow for preheating, extra burden such as flow impact caused by depending on services such as a database or a cache and the like, high expenditure of storage resources caused by virtual flow storage and the like in the prior art can be avoided; in addition, the scheme provided by the embodiment can enable the first node to preheat by adopting the real service request of the upstream node, so that the problems of data pollution and the like do not need to be considered, and the preheating effect is ensured; in addition, because the number of the upstream nodes allowed to pass through currently is limited in the preheating stage, the change of the upstream nodes does not influence the preheating effect of the first node, and the preheating effect is further ensured.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present disclosure will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the present disclosure are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
FIG. 1 schematically shows a first flow chart of a node processing method according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a processing scenario in which a first node is in different warm-up phases according to an embodiment of the present disclosure;
FIG. 3 schematically shows a schematic view of an interaction scenario between a first node and a deployment node and an upstream node according to an embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow chart diagram two of a node processing method according to an embodiment of the present disclosure;
FIG. 5 schematically illustrates a node processing system component structure diagram according to an embodiment of the present disclosure;
FIG. 6 schematically shows a media schematic according to an embodiment of the present disclosure;
FIG. 7 schematically illustrates a schematic structural diagram of a first node according to an embodiment of the present disclosure;
FIG. 8 schematically illustrates a schematic structural diagram of a second node according to an embodiment of the present disclosure;
FIG. 9 schematically shows a computing device architecture diagram according to an embodiment of the disclosure.
In the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
Detailed Description
The principles and spirit of the present disclosure will be described with reference to a number of exemplary embodiments. It is understood that these embodiments are given solely for the purpose of enabling those skilled in the art to better understand and to practice the present disclosure, and are not intended to limit the scope of the present disclosure in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
As will be appreciated by one skilled in the art, embodiments of the present disclosure may be embodied as a system, apparatus, device, method, or computer program product. Accordingly, the present disclosure may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), or a combination of hardware and software.
According to the embodiment of the disclosure, a node processing method and system, a node, a medium and a computing device are provided.
In this document, any number of elements in the drawings is by way of example and not by way of limitation, and any nomenclature is used solely for differentiation and not by way of limitation.
The principles and spirit of the present disclosure are explained in detail below with reference to several representative embodiments of the present disclosure.
Summary of The Invention
The applicant has found that for the server, the release is generally divided into hot and cold deployments. For cold deployment, although a restart process can clean up resources of a previous process more thoroughly, due to various reasons, there are performance problems when the process is just started, which causes a failure in processing a part of requests or an excessively long response time, and affects user experience. However, in the related art, virtual traffic is usually adopted for preheating, so that problems of extra burden on a system, data pollution, high storage resource overhead and the like can occur.
In view of the above, the present disclosure provides a node processing method and system, a node, a medium, and a computing device, wherein the method includes:
under the condition that a first node is in the ith preheating stage of N preheating stages, the first node receives a health inquiry request sent by a second node; wherein N is an integer greater than or equal to 2, and i is an integer greater than or equal to 1 and less than or equal to N; the second node is one of the upstream nodes of the first node;
under the condition that the candidate upstream node set corresponding to the ith preheating stage comprises the second node, the first node sends a first type status code to the second node; the first-class status code is used for indicating that the first node is in a state of being capable of processing the service request of the second node; wherein the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith warm-up stage is less than the number of upstream nodes of the first node.
And the number of the first and second groups,
the second node sends a health inquiry request to the first node; wherein the second node is one of the upstream nodes of the first node;
the second node receives the status code fed back by the first node;
and under the condition that the status code fed back by the first node is the first type of status code, the second node determines that the first node is in a state capable of processing the service request of the second node.
Therefore, the problems of poor preheating effect caused by adopting virtual flow for preheating, extra burden such as flow impact caused by depending on services such as a database or a cache and the like, high expenditure of storage resources caused by virtual flow storage and the like in the prior art can be avoided; in addition, the scheme provided by the embodiment can enable the first node to preheat by adopting the real service request of the upstream node, so that the problems of data pollution and the like do not need to be considered, and the preheating effect is ensured; in addition, because the number of the upstream nodes allowed to pass through currently is limited in the preheating stage, the change of the upstream nodes does not influence the preheating effect of the first node, and the preheating effect is further ensured.
Having described the general principles of the present disclosure, various non-limiting embodiments of the present disclosure are described in detail below.
Exemplary method
A first aspect of the present disclosure provides a node processing method, as shown in fig. 1, including:
s101: under the condition that a first node is in the ith preheating stage of N preheating stages, the first node receives a health inquiry request sent by a second node; wherein N is an integer greater than or equal to 2, and i is an integer greater than or equal to 1 and less than or equal to N; the second node is one of the upstream nodes of the first node;
s102: under the condition that the candidate upstream node set corresponding to the ith preheating stage comprises the second node, the first node sends a first type status code to the second node; the first-class status code is used for indicating that the first node is in a state of being capable of processing the service request of the second node; wherein the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith warm-up stage is less than the number of upstream nodes of the first node.
The scheme provided by this embodiment is executed by a first node, where the first node may be any node to be online in a system or any service node, and for example, the first node may be an Nginx server. The first node may have one or more upstream nodes, and the number of upstream nodes of the first node is not limited in this embodiment.
In this embodiment, the upstream node that currently sends the health query request to the first node is referred to as a second node, and the second node may be any one of the upstream nodes of the first node. For example, the first node corresponds to 5 upstream nodes, which are node 1, node 2 to node 5, respectively, and the current node 2 sends the health query request to the first node, where the node 2 may be a second node in this embodiment.
Before executing the foregoing S101, the method may include: the first node performs initialization processing.
The initialization processing of the first node may be determined according to actual configuration, for example, the initialization processing may include reading configuration parameters, initialization time, initializing a log function, creating a memory pool, binding a corresponding TCP port, and the like.
In the process of performing initialization processing by the first node, the processing by the first node may further include: receiving a health inquiry request sent by a second node, and sending a second type of status code to the second node; wherein the second type of status code is used for representing that the first node is in a state of not processing a service request. That is to say, in the process of initialization processing by the first node, the first node feeds back the second type status code to any upstream node that sends a health query request.
In this embodiment, the second type status code may be configured in advance, for example, a "4 xx" status code may be configured in advance as the second type status code, where "4 xx" indicates that any status code beginning with 4 is the second type status code; for another example, the "403" status code may be pre-configured as the second type of status code.
After the initialization process is completed, the first node performs S101, that is, in the case that the first node is in the ith warm-up stage of the N warm-up stages, the first node receives the health query request from the second node. Wherein, the ith preheating stage is any one of the N preheating stages.
Here, the value of i in the ith warm-up phase, that is, the determination manner of the first node in the several warm-up phases in the N warm-up phases may be: and the first node determines the ith preheating stage of the N preheating stages based on the current preheating used time and the preheating time corresponding to the N preheating stages contained in the preheating strategy.
Wherein the warm-up strategy at least comprises: and the N preheating stages respectively correspond to preheating duration and the quantity related information of the candidate upstream nodes.
For example, the preheating time periods corresponding to the 3 preheating stages are respectively configured to be "0-20 seconds", "20-40 seconds" and "40-60 seconds" in the preheating strategy, and the current preheating used time period is 10 seconds, and then it is determined that the current preheating stage is the 1 st preheating stage of the 3 preheating stages.
In addition, it should be further noted that, regarding the information related to the number of candidate upstream nodes corresponding to the N preheating stages in the preheating policy, a difference between the numbers of candidate upstream nodes corresponding to two adjacent preheating stages is not set too large, that is, the difference between the numbers of candidate upstream nodes corresponding to two adjacent preheating stages may be set to be smaller than a preset number threshold, for example, the number difference is smaller than 10, or the percentage difference is smaller than 15%. This is to prevent performance problems caused by insufficient warm-up due to the fact that a large number of inactive upstream nodes are provided in the previous stage and a warm-up effect is not achieved, and a large number of active upstream nodes are provided in the next stage.
The health query request sent by the second node may be periodically sent based on a query time interval for the second node; the duration of the query time interval may be set according to practical situations, for example, it may be set to 1 second, and may be longer or shorter, which is not exhaustive. Correspondingly, in this embodiment, the receiving, by the first node, the health query request sent by the second node may refer to the receiving, by the first node, the health query request sent by the second node at any query time interval.
After the first node receives the health query request sent by the second node, the method may further include: the first node determines whether the second node is included in the candidate upstream node set corresponding to the ith warm-up stage, and if so, S102 is executed, that is, the first node sends a first-class status code to the second node when the second node is included in the candidate upstream node set corresponding to the ith warm-up stage.
The first type status code may be preconfigured, for example, a "2 xx" or "3 xx" status code may be preconfigured as the first type status code, that is, any status code beginning with 3 or 2 is the first type status code; for another example, a "200" status code may be preconfigured as the first type of status code.
The first type status code is used for indicating that the first node is in a state capable of processing the service request of the second node. That is, if the first node feeds back the first type status code to the second node, it indicates that the first node can process the service request sent by the second node.
It should be noted that, no matter which warm-up stage of the N warm-up stages the current i-th warm-up stage is, the number of candidate upstream nodes in the candidate upstream node set corresponding to the i-th warm-up stage is smaller than the number of upstream nodes of the first node.
The number of candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is greater than the number of candidate upstream nodes in the candidate upstream node set corresponding to the (i-1) th preheating stage, and/or the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is less than the number of candidate upstream nodes in the candidate upstream node set corresponding to the (i + 1) th preheating stage. For example, when N is 3 and i is 1, the number of candidate upstream nodes in the candidate upstream node set corresponding to the 1 st warm-up stage is less than the number of candidate upstream nodes in the candidate upstream node set corresponding to the 2 nd warm-up stage; n is 3, and i is 2, the number of candidate upstream nodes in the candidate upstream node set corresponding to the 2 nd warm-up stage is greater than the number of candidate upstream nodes in the candidate upstream node set corresponding to the 1 st warm-up stage, and the number of candidate upstream nodes in the candidate upstream node set corresponding to the 2 nd warm-up stage is less than the number of candidate upstream nodes in the candidate upstream node set corresponding to the 3 rd warm-up stage; when N is 3 and i is 3, the number of candidate upstream nodes in the candidate upstream node set corresponding to the 3 rd warm-up stage is greater than the number of candidate upstream nodes in the candidate upstream node set corresponding to the 2 nd warm-up stage.
The candidate upstream node set corresponding to the ith warm-up stage may include address related information corresponding to at least one candidate upstream node. The address-related information may be an IP (Internet Protocol) address of the candidate upstream node. For example, i is equal to 1, and the candidate upstream node set corresponding to the 1 st warm-up stage includes the IP address 1 of the candidate upstream node 1 and the IP address 2 of the candidate upstream node 2.
In a case that the candidate upstream node set corresponding to the ith warm-up stage does not include the second node, there may be a plurality of processing manners to determine the status code sent to the second node, which are described below:
the first treatment method,
And under the condition that the candidate upstream node set corresponding to the ith preheating stage does not contain the second node, the first node sends a second-class state code to the second node.
That is to say, when receiving a health query request sent by any upstream node, i.e. a second node, a first node determines, based on address-related information of the second node, whether an address-related information of the second node is included in a candidate upstream node set corresponding to a current stage; if yes, the first type status code can be sent to the second node; if not, a second type of status code may be sent to the second node.
The second treatment method,
And under the condition that the candidate upstream node set corresponding to the ith preheating stage does not contain the second node, if the first node meets a first preset condition, the first node adds the address related information of the second node to the first set, and feeds back the second type of state code to the second node.
The first preset condition comprises:
preheating according to the percentage of the upstream quantity is started, the upstream nodes which are allowed to pass through are determined according to the access quantity sequence of the upstream nodes, and the current preheating used time length is smaller than the waiting time length for performing upstream flow statistics;
or, preheating according to the percentage of the upstream quantity, enabling the second set to be empty, and enabling the used time length of the current preheating to be smaller than the waiting time length for performing upstream flow statistics; the second set is an upstream node set of the first node read by the first node and sorted according to a preset access quantity sequence.
The first set and the second set are obtained in different manners, and the number of upstream nodes included in the first set and the number of upstream nodes included in the second set may be the same or different. The first set may be a set of upstream nodes that the first node statistically issues health query requests for latency in making upstream traffic statistics. The second set is an upstream node set of the first node read by the first node and sorted according to a preset access quantity sequence, where the preset access quantity sequence may be a sequence from large to small in access quantity; that is, the second set may be a set of upstream nodes that the first node reads at the time of the initialization process, and the upstream nodes included in the second set are sorted from large to small according to the access amount.
It should be further noted that the second set may be generated for the first node before the present online processing, for example, the first node may start in a preset time period, aggregate request amounts according to address-related information (i.e., IP addresses) of upstream nodes, and sequentially generate or update the second set, and store the second set in a local hard disk; and searching whether a second set is stored in a local hard disk when the first node needs to be online to execute initialization processing, and reading the second set if the second set is stored. The preset time period may be set according to actual conditions, for example, may be a certain time period of each day, and may be, for example, 11 pm to 12 pm.
The reason for obtaining or using the second set in this embodiment is that the upstream nodes may be divided into multiple clusters facing different scenarios because the upstream traffic distribution may be complex. For example, some of the nodes may be used by only an administrator facing a management and control end, and some of the nodes may bear millions or even hundreds of millions of daily traffic facing a user side, so that the traffic of the upstream nodes is not necessarily balanced, and if the upstream nodes selected during the preheating are nodes with little traffic, the preheating effect may be affected.
It should be noted that, whether to warm up according to the percentage of the upstream quantity may be preset at the first node, for example, the configuration field may be percentage. Turning on or off the preheating according to the percentage of the upstream quantity can be realized by setting different values to the configuration field, for example, 1 may represent turning on, and 0 may represent turning off; alternatively still, future represents open, false represents closed, and so forth. If the preheating according to the percentage of the upstream number is started, the first node may determine the maximum number of upstream nodes allowed to pass through by the currently-located preheating stage (i-th preheating stage) based on the total number of the upstream nodes and a percentage corresponding to the currently-located preheating stage (i-th preheating stage) included in the preheating policy; if the preheating according to the percentage of the upstream number is turned off, the first node may use the absolute number corresponding to the currently-located preheating stage (i-th preheating stage) included in the preheating policy as the maximum number of upstream nodes allowed to pass through by the currently-located preheating stage (i-th preheating stage).
Whether the upstream node allowed to pass through is determined according to the access quantity sequence of the upstream node can also be preset at the first node, for example, the configuration field can be a 'sort' field. Regarding the determination of the opening or closing of the permitted upstream nodes according to the access quantity sequence of the upstream nodes, the determination may be implemented by setting different values to the above configuration fields, for example, 1 may represent opening, and 0 may represent closing; alternatively still, future represents open, false represents closed, and so forth. If the upstream nodes which pass through the upstream node according to the access quantity sequence of the upstream nodes are started, the first node can determine the upstream nodes which pass through the current preheating stage based on the sequence from the large to the small of the access quantity sequence of the upstream nodes; if the upstream nodes which pass through the upstream node according to the access quantity sequence of the upstream nodes are closed, the first node needs to perform statistics of the first set within the waiting time for performing upstream traffic statistics.
The waiting time for performing upstream traffic statistics may also be preset at the first node, and may be denoted as "percentWait". The specific length of the waiting time period can be set according to actual conditions, and for example, the specific length can be 10 seconds.
It has been described above that the second node may be any upstream node of the first node, that is, when the first node receives a health query request from any upstream node, if the upstream node does not include the candidate upstream node set corresponding to the ith warm-up stage, the first node starts warm-up according to a percentage of the upstream number, turns off the upstream nodes allowed to be passed according to the access quantity sorting of the upstream nodes, and the current warm-up used time length is less than the waiting time length for performing upstream traffic statistics, the first node adds the address-related information of the upstream node to the first set; and until the current preheating used time is not less than the waiting time for carrying out upstream flow statistics.
Or, when the first node receives a health query request sent by any upstream node, if the upstream node does not include the candidate upstream node set corresponding to the ith preheating stage, and the first node starts preheating according to the percentage of the upstream number, the second set is empty, and the current preheating used time length is less than the waiting time length for performing upstream traffic statistics, the first node adds the address-related information of the upstream node sending the health query request to the first set; and until the current preheating used time is not less than the waiting time for carrying out upstream flow statistics.
The address-related information of the second node may be an IP address of the second node.
That is to say, when it is determined that the candidate upstream node set corresponding to the ith warm-up stage does not include the second node, the determination is further performed in combination with a first preset condition, and when the first preset condition is satisfied, the second type of status code is fed back to the second node, and meanwhile, address related information of the second node is added to the first set; and when the first preset condition is not met, directly feeding back the second type of state codes to the second node.
The third treatment mode,
Under the condition that the candidate upstream node set corresponding to the ith preheating stage does not contain the second node, if the upstream nodes which are determined to be allowed to pass through according to the access quantity sequence of the upstream nodes are closed, and the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is smaller than the maximum number of the upstream nodes which are allowed to pass through by the ith preheating stage, the first node updates the candidate upstream node set corresponding to the ith preheating stage based on the address related information of the second node to obtain the updated candidate upstream node set corresponding to the ith preheating stage, and feeds back the first-class status code to the second node.
In this processing manner, when the candidate upstream node set corresponding to the ith warm-up stage does not include the second node, whether the upstream nodes that are determined to be allowed to pass through according to the access quantity ordering of the upstream nodes are closed or not is judged through a configuration field, and whether the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith warm-up stage is smaller than the maximum number of the upstream nodes that are allowed to pass through by the ith warm-up stage or not is judged;
if the upstream nodes allowed to pass through are determined to be closed according to the access quantity sequence of the upstream nodes and the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is smaller than the maximum number of the upstream nodes allowed to pass through by the ith preheating stage, the first-class state codes can be fed back to the second node, and meanwhile, the related information of the second node can be added to the candidate upstream node set corresponding to the ith preheating stage, so that the updated candidate upstream node set corresponding to the ith preheating stage is obtained.
For example, i is 2, the number of candidate upstream nodes included in the candidate upstream node set corresponding to the 2 nd warm-up stage is 3, and the maximum number of upstream nodes allowed to pass through by the 2 nd warm-up stage is 5; the first node receives a health inquiry request sent by a second node, the second node is not included in the candidate upstream node set corresponding to the currently located 2 nd preheating stage, but because the first node closes the upstream nodes determined to be allowed to pass through according to the access quantity sequence of the upstream nodes, and the number of the candidate upstream nodes included in the candidate upstream node set corresponding to the 2 nd preheating stage is 3 and does not reach the maximum number of the upstream nodes allowed to pass through by the 2 nd preheating stage, namely 5, the first node sends a 200 state code to the second node, and the IP address of the second node is added to the candidate upstream node set corresponding to the 2 nd preheating stage.
In addition, the method can also comprise the following steps: and under the condition that the candidate upstream node set corresponding to the ith preheating stage does not contain the second node, if the upstream nodes which are determined to be allowed to pass through according to the access quantity sequence of the upstream nodes are closed, and the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is not less than the maximum number of the upstream nodes which are allowed to pass through in the ith preheating stage, the first node feeds back a second-class status code to the second node.
It should be further noted that the third processing method and the second processing method may be used simultaneously, for example, in a case that the candidate upstream node set corresponding to the ith warm-up stage does not include the second node, it is determined whether the first node meets a first preset condition;
if the first node meets a first preset condition, the first node adds address related information of the second node to a first set, and feeds back the second type of state codes to the second node;
if the first node does not meet a first preset condition, judging whether the first node closes the upstream nodes which are determined to be allowed to pass according to the access quantity sequence of the upstream nodes, and judging that the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is smaller than the maximum number of the upstream nodes allowed to pass by the ith preheating stage;
if the upstream nodes which are allowed to pass through according to the access quantity sequence of the upstream nodes are closed, and the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is smaller than the maximum number of the upstream nodes which are allowed to pass through in the ith preheating stage, the first node updates the candidate upstream node set corresponding to the ith preheating stage based on the address related information of the second node to obtain an updated candidate upstream node set corresponding to the ith preheating stage, and feeds back the first-class status code to the second node;
and if the upstream nodes which are allowed to pass through according to the access quantity sequence of the upstream nodes are closed, and the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is not less than the maximum number of the upstream nodes which are allowed to pass through in the ith preheating stage, the first node feeds back the second-class state codes to the second node.
The fourth treatment mode,
Under the condition that the candidate upstream node set corresponding to the ith preheating stage does not contain the second node, if the upstream nodes which are determined to be allowed to pass through according to the access quantity sequence of the upstream nodes are started, and the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is smaller than the maximum number of the upstream nodes which are allowed to pass through by the ith preheating stage, the first node updates the candidate upstream node set corresponding to the ith preheating stage on the basis of at least one upstream node in the second set, so as to obtain the updated candidate upstream node set corresponding to the ith preheating stage.
The difference between this processing method and the second processing method and the third processing method is that this processing method opens a method of determining the upstream nodes that are allowed to pass through according to the access quantity sequence of the upstream nodes, that is, the upstream nodes that are allowed to pass through need to be selected based on the access quantity sequence of the upstream nodes.
In addition, the method can also comprise the following steps: and under the condition that the candidate upstream node set corresponding to the ith preheating stage does not contain the second node, if the upstream nodes which are determined to be allowed to pass through according to the access quantity sequence of the upstream nodes are started, and the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is not less than the maximum number of the upstream nodes which are allowed to pass through in the ith preheating stage, the first node feeds back a second-class status code to the second node.
The updating, by the first node, the candidate upstream node set corresponding to the ith warm-up stage based on at least one upstream node in the second set to obtain an updated candidate upstream node set corresponding to the ith warm-up stage may include:
the first node selects an upstream node which has the highest current rank and is not included in the candidate upstream node set corresponding to the ith preheating stage as a candidate upstream node to be added based on the rank of the upstream node in the second set, and adds the candidate upstream node to be added to the candidate upstream node set corresponding to the ith preheating stage to obtain an updated candidate upstream node set corresponding to the ith preheating stage; then, judging whether the number of candidate upstream nodes in the updated candidate upstream node set corresponding to the ith preheating stage is smaller than the maximum number of upstream nodes allowed to pass through by the ith preheating stage, if not, taking the updated candidate upstream node set corresponding to the current ith preheating stage as the finally determined updated candidate upstream node set corresponding to the ith preheating stage; if the current sequence is less than the preset sequence, continuing to select one upstream node which is highest in current sequence and is not included in the candidate upstream node set corresponding to the ith preheating stage as a candidate upstream node to be added on the basis of the sequence of the upstream nodes in the second set, and adding the candidate upstream node to be added to the updated candidate upstream node set corresponding to the ith preheating stage. And circulating in this way until the number of candidate upstream nodes in the updated candidate upstream node set corresponding to the ith preheating stage is not less than the maximum number of upstream nodes allowed to pass through by the ith preheating stage.
The foregoing embodiment has described that the upstream nodes included in the second set are the upstream nodes sorted in the order from large to small based on the access amount, and therefore, after the candidate upstream node set corresponding to the ith warm-up stage is updated based on the upstream nodes in the second set, it can also be ensured that the candidate upstream nodes included in the updated candidate upstream node set corresponding to the ith warm-up stage are also the upstream nodes with relatively high access amounts.
After obtaining the updated candidate upstream node set corresponding to the ith warm-up stage, the method may further include:
under the condition that the updated candidate upstream node set corresponding to the ith preheating stage contains the second node, the first node feeds back a first-class state code to the second node;
under the condition that the updated candidate upstream node set corresponding to the ith preheating stage does not contain the second node, the first node feeds back a second-class state code to the second node; wherein the second type status code is used to indicate that the first node is in a state of not processing a service request.
It should be further noted that the second processing method, the third processing method, and the fourth processing method may also be used in combination, for example:
under the condition that the candidate upstream node set corresponding to the ith preheating stage does not contain the second node, judging whether the first node meets a first preset condition or not;
if the first node meets a first preset condition, the first node adds address related information of the second node to a first set, and feeds back the second type of state codes to the second node;
if the first node does not meet a first preset condition, judging whether the first node closes the upstream nodes which are determined to be allowed to pass according to the access quantity sequence of the upstream nodes, and judging that the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is smaller than the maximum number of the upstream nodes allowed to pass by the ith preheating stage;
if the upstream nodes which are allowed to pass through according to the access quantity sequence of the upstream nodes are closed, and the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is smaller than the maximum number of the upstream nodes which are allowed to pass through in the ith preheating stage, the first node updates the candidate upstream node set corresponding to the ith preheating stage based on the address related information of the second node to obtain an updated candidate upstream node set corresponding to the ith preheating stage, and feeds back the first-class status code to the second node;
if the upstream nodes which are allowed to pass through are determined according to the access quantity sequence of the upstream nodes and the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is not less than the maximum number of the upstream nodes which are allowed to pass through in the ith preheating stage, the first node feeds back the second-class state codes to the second node;
if the upstream nodes which are allowed to pass through according to the access quantity sequence of the upstream nodes are started, and the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is smaller than the maximum number of the upstream nodes which are allowed to pass through in the ith preheating stage, the first node updates the candidate upstream node set corresponding to the ith preheating stage on the basis of at least one upstream node in the second set to obtain an updated candidate upstream node set corresponding to the ith preheating stage, judges whether the updated candidate upstream node set corresponding to the ith preheating stage contains the second node or not, if yes, the first node feeds back a first-type state code to the second node, and if not, the first node feeds back a second-type state code to the second node;
and if the upstream nodes which are allowed to pass through according to the access quantity sequence of the upstream nodes are started, and the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is not less than the maximum number of the upstream nodes which are allowed to pass through in the ith preheating stage, the first node feeds back the second-class state codes to the second node.
In the above embodiments, regarding the candidate upstream node set corresponding to the ith warm-up stage and the maximum number of upstream nodes allowed to pass through by the ith warm-up stage, the determination manners of these two parameters are further described in the following embodiments.
With respect to the manner of determining the candidate upstream node set corresponding to the ith warm-up stage, the following two manners may be included:
mode 1, when the first node determines to enter the ith preheating stage of the N preheating stages based on the current preheating used time, the first node determines a candidate upstream node set corresponding to the ith preheating stage based on a preheating strategy;
the preheating strategy comprises preheating duration corresponding to the N preheating stages and information related to the number of candidate upstream nodes.
In this way, each time a new warm-up phase is started, the first node determines a candidate upstream node set corresponding to the new warm-up phase.
After the first node enters the warm-up state, the currently located warm-up stage can be determined to be the second warm-up stage based on the warm-up strategy and on the currently used warm-up duration. Specifically, if the current preheating elapsed time is j seconds and j is equal to the minimum preheating time of the ith preheating stage in the preheating strategy, determining to enter the ith preheating stage of the N preheating stages, and determining a candidate upstream node set corresponding to the ith preheating stage based on the preheating strategy; wherein j is a positive number equal to or greater than 0. For example, it is assumed that the preheating strategy includes 3 preheating stages and a preheating time duration corresponding to each of the 3 preheating stages, for example, the preheating time duration of the 1 st preheating stage is 0 to 20 seconds, the preheating time duration of the 2 nd preheating stage is 20 to 40 seconds, and the preheating time duration of the 3 rd preheating stage is 40 to 60 seconds; correspondingly, if the current preheating elapsed time is 0 second, it may be determined that the 1 st preheating stage of the N preheating stages is entered, and at this time, the candidate upstream node set corresponding to the 1 st preheating stage is determined based on the preheating policy.
The first node determines a candidate upstream node set corresponding to the ith preheating stage based on a preheating strategy, and the candidate upstream node set comprises:
the first node determines the number to be added of the candidate upstream nodes corresponding to the ith preheating stage based on the number related information of the candidate upstream nodes corresponding to the ith preheating stage in the preheating strategy;
the first node determines a candidate upstream node corresponding to the ith preheating stage based on the number to be added of the candidate upstream nodes;
and the first node determines a candidate upstream node set corresponding to the ith preheating stage based on the candidate upstream node corresponding to the ith preheating stage.
The determining, based on information related to the number of candidate upstream nodes corresponding to the ith preheating stage in the preheating policy, the number to be added of the candidate upstream nodes corresponding to the ith preheating stage may include:
if the quantity related information of the candidate upstream nodes corresponding to the ith preheating stage in the preheating strategy is a numerical value, taking the numerical value as the quantity to be added of the candidate upstream nodes corresponding to the ith preheating stage;
if the information related to the number of the candidate upstream nodes corresponding to the ith preheating stage in the preheating strategy is a percentage, calculating to obtain the number to be added of the candidate upstream nodes corresponding to the ith preheating stage based on the percentage and the number of the upstream nodes included in the pre-acquired first set.
The determining, by the first node, a candidate upstream node corresponding to the ith warm-up stage based on the number of candidate upstream nodes to be added may include:
under the condition that the upstream nodes allowed to pass through are determined according to the access quantity sequence of the upstream nodes, the first node selects the upstream nodes with the quantity to be added from the first set according to the sequence from high to low on the basis of the quantity to be added of the candidate upstream nodes, and the upstream nodes are used as the candidate upstream nodes corresponding to the ith preheating stage;
and under the condition that the upstream nodes allowed to pass through according to the access quantity sequence of the upstream nodes are closed, the first node randomly selects the upstream nodes with the quantity to be added from the upstream nodes of the first node as the candidate upstream nodes corresponding to the ith preheating stage on the basis of the quantity to be added of the candidate upstream nodes.
The determining, by the first node, a candidate upstream node set corresponding to the ith warm-up stage based on the candidate upstream node corresponding to the ith warm-up stage may include:
when i is equal to 1, the first node takes the candidate upstream node corresponding to the 1 st preheating stage as a candidate upstream node set corresponding to the 1 st preheating stage;
and under the condition that i is larger than 1, the first node adds the candidate upstream node corresponding to the ith preheating stage to the candidate upstream node set corresponding to the (i-1) th preheating stage to obtain the candidate upstream node set corresponding to the ith preheating stage.
That is, if the current warm-up stage is the 1 st warm-up stage, the currently determined candidate upstream node is taken as all candidate upstream nodes of the candidate upstream node set of the 1 st warm-up stage. And if the current preheating stage is other preheating stages, adding the candidate upstream node determined in the current stage on the basis of the candidate upstream node set corresponding to the previous preheating stage to obtain the candidate upstream node set corresponding to the current stage. In other words, the candidate upstream nodes included in the candidate upstream node set corresponding to the warm-up stage are accumulated.
In the mode 2, when the first node determines to enter the first preheating stage of the N preheating stages, the first node determines candidate upstream node sets corresponding to the N preheating stages respectively based on a preheating strategy; the preheating strategy comprises preheating duration corresponding to the N preheating stages and information related to the number of candidate upstream nodes.
The difference from the method 1 is that, in the method 2, when determining that the first warm-up stage is entered, the first node determines a candidate upstream node set corresponding to each of all the N warm-up stages. Thus, compared with the method 1, the method 2 can reduce the processing content required to be executed when each preheating stage is started, and improve the processing efficiency of each preheating stage.
Specifically, the method may include:
under the condition that the preheating according to the percentage of the upstream number is started and the upstream nodes which are allowed to pass through according to the access quantity sequencing of the upstream nodes are started, the first node determines the percentage corresponding to the N preheating stages respectively based on the quantity related information of the candidate upstream nodes corresponding to the N preheating stages respectively contained in the preheating strategy, and determines the quantity of the candidate upstream nodes corresponding to the N preheating stages respectively based on the percentage corresponding to the N preheating stages respectively and a pre-acquired second set; and determining a candidate upstream node set corresponding to the N preheating stages respectively from the first set based on the number of the candidate upstream nodes corresponding to the N preheating stages respectively.
Under the condition that the preheating according to the percentage of the upstream number is closed and the upstream nodes which are allowed to pass through according to the access quantity sequencing of the upstream nodes are opened, the first node determines the number of the candidate upstream nodes corresponding to the N preheating stages respectively based on the number related information of the candidate upstream nodes corresponding to the N preheating stages respectively contained in the preheating strategy; and determining a candidate upstream node set corresponding to the N preheating stages respectively from the first set based on the number of the candidate upstream nodes corresponding to the N preheating stages respectively.
Under the condition that the preheating according to the percentage of the upstream number is started and the upstream nodes which are allowed to pass through according to the access quantity sequencing of the upstream nodes are closed, the first node determines the percentage corresponding to the N preheating stages respectively based on the quantity related information of the candidate upstream nodes corresponding to the N preheating stages respectively contained in the preheating strategy, and determines the quantity of the candidate upstream nodes corresponding to the N preheating stages respectively based on the percentage corresponding to the N preheating stages respectively and the total quantity of the upstream nodes of the first node; and determining a candidate upstream node set corresponding to the N preheating stages respectively based on the number of the candidate upstream nodes corresponding to the N preheating stages respectively. The total number of upstream nodes of the first node may be the total number of upstream nodes included in the first set counted in the waiting time for performing the upstream traffic statistics.
Under the condition that the preheating according to the percentage of the upstream number is closed and the upstream nodes which are allowed to pass through according to the access quantity sequencing of the upstream nodes are closed, the first node determines the number of the candidate upstream nodes corresponding to the N preheating stages respectively based on the number related information of the candidate upstream nodes corresponding to the N preheating stages respectively contained in the preheating strategy; and based on the number of the candidate upstream nodes respectively corresponding to the N preheating stages, randomly selecting a candidate upstream node set respectively corresponding to the N preheating stages from the upstream nodes of the first node.
It should be noted that, the information related to the number of candidate upstream nodes respectively corresponding to the N warm-up stages included in the warm-up policy may be as follows:
in the first case, the information related to the allowed number of the candidate upstream nodes corresponding to the N warm-up stages respectively included in the warm-up policy, for example, the allowed maximum number or maximum percentage of the candidate upstream nodes corresponding to each warm-up stage.
In this case, the maximum number of candidate upstream nodes corresponding to each warm-up stage in the warm-up policy may include the number of candidate upstream nodes corresponding to the previous warm-up stage. For example, the maximum number of candidate upstream nodes corresponding to the 1 st pre-heating stage is 2, and the maximum number of candidate upstream nodes corresponding to the 2 nd pre-heating stage is 10, then the candidate upstream nodes corresponding to the 2 nd pre-heating stage include the candidate upstream nodes corresponding to the 1 st pre-heating stage, that is, compared with the 1 st pre-heating stage, the 2 nd pre-heating stage is added with 8 new candidate upstream nodes.
In the second case, the information related to the allowable number of the candidate upstream nodes corresponding to the N preheating stages included in the preheating strategy, for example, the allowable new number or new percentage of the candidate upstream nodes corresponding to each preheating stage.
In this case, the newly added number of candidate upstream nodes corresponding to each warm-up stage in the warm-up strategy does not include the number of candidate upstream nodes corresponding to the previous warm-up stage. For example, the maximum number of candidate upstream nodes corresponding to the 1 st pre-heating stage is 2, and the newly-increased number of candidate upstream nodes corresponding to the 2 nd pre-heating stage is 8, then the 2 nd pre-heating stage is increased by 8 new candidate upstream nodes compared with the 1 st pre-heating stage, and the total number of candidate upstream nodes corresponding to the 2 nd pre-heating stage is 10.
Regarding the manner of determining the maximum number of upstream nodes allowed to pass through by the ith warm-up phase, the method may include:
the first node determines a first numerical value corresponding to the ith preheating stage based on the current preheating used time and the preheating time respectively corresponding to the N preheating stages contained in the preheating strategy and the quantity related information of the candidate upstream nodes;
based on the first value, a maximum number of upstream nodes allowed to pass by the ith warm-up phase is determined.
The determining, by the first node, a first numerical value corresponding to the ith preheating stage based on the current preheating used time and the preheating time corresponding to each of the N preheating stages included in the preheating policy and the information related to the number of candidate upstream nodes may include:
the first node determines the ith preheating stage based on the current preheating used time and the preheating time corresponding to the N preheating stages contained in the preheating strategy; and acquiring quantity related information of the candidate upstream nodes corresponding to the ith preheating stage from the preheating strategy, and taking the quantity related information as a first numerical value corresponding to the ith preheating stage.
Here, the preheating time lengths corresponding to the N preheating stages included in the preheating strategy may be maximum preheating time lengths corresponding to the N preheating stages. For example, N is 3, and the preheating strategy includes "20 seconds", "40 seconds", and "60 seconds" as maximum preheating durations corresponding to the 3 preheating stages respectively; correspondingly, if the current preheating used time is 30 seconds, the preheating stage corresponding to the preheating time which is longer than 30 seconds and has the minimum time difference is selected as the current preheating stage in the preheating strategy, and further the quantity related information corresponding to the preheating stage is used as a first numerical value. Or, the preheating time lengths respectively corresponding to the N preheating stages included in the preheating strategy may be preheating time length intervals respectively corresponding to the N preheating stages. For example, N is 3, and the preheating strategy includes "greater than or equal to 0 second and less than or equal to 20 seconds", "greater than 20 seconds and less than or equal to 40 seconds", and "greater than 40 seconds and less than or equal to 60 seconds" as preheating time intervals corresponding to the 3 preheating stages respectively; correspondingly, if the current preheating used time is 30 seconds, the preheating stage corresponding to the preheating time interval of more than 20 seconds and less than or equal to 40 seconds in the preheating strategy is taken as the current preheating stage, and further the quantity related information corresponding to the preheating stage is taken as a first numerical value.
Said determining, based on said first value, a maximum number of upstream nodes allowed to pass by said ith warm-up phase comprises one of:
taking said first value as the maximum number of upstream nodes allowed to pass by said ith warm-up phase, in case warm-up according to a percentage of the upstream number is switched off;
and under the condition that the preheating according to the percentage of the upstream quantity is started, determining the percentage corresponding to the ith preheating stage based on the first numerical value, and determining the maximum quantity of the upstream nodes allowed to pass through by the ith preheating stage based on the percentage and the quantity of the upstream nodes corresponding to the first nodes.
Wherein, when the preheating according to the percentage of the upstream number is started, determining the percentage corresponding to the ith preheating stage based on the first numerical value, and determining the maximum number of upstream nodes allowed to pass through by the ith preheating stage based on the percentage and the number of upstream nodes corresponding to the first node may refer to: under the condition that the preheating is started according to the percentage of the upstream quantity, dividing the first numerical value by 100 to obtain the percentage corresponding to the ith preheating stage;
judging whether the upstream nodes which are determined to be allowed to pass through according to the access quantity sequence of the upstream nodes are opened currently or not and judging whether the second set is not empty or not;
if the upstream nodes which are determined to be allowed to pass through according to the access quantity sequence of the upstream nodes are started and the second set is not empty, the maximum number of the upstream nodes which are allowed to pass through in the ith preheating stage is obtained on the basis of the multiplication of the percentage and the number of the upstream nodes contained in the second set;
if the upstream nodes allowed to pass through and/or the second set is determined to be empty according to the access quantity sequence of the upstream nodes, the maximum number of the upstream nodes allowed to pass through in the ith preheating stage is obtained based on the multiplication of the percentage and the number of the upstream nodes contained in the first set.
Here, the obtaining manner and content of the first set and the second set are already described in the foregoing embodiments, and are not described herein again.
In the foregoing embodiment, it is mentioned that the preheating policy of the first node is preconfigured and stored, and the first node may preconfigured a waiting time period for performing upstream traffic statistics, determine, according to the access volume ranking of the upstream nodes, to turn on or off the upstream nodes allowed to pass through, perform preheating on or off according to the percentage of the upstream quantity, and perform related configuration of statistics of the second set. The following is an exemplary illustration of the relevant configuration fields or configuration files that the first node pre-configures or maintains (such as may be stored in TreeMap (tree graph)) as follows:
Figure BDA0003056317270000311
the nginxpressreatactive configuration field is used for indicating a switch of the preheating function, and if the configuration field is set to false, that is, the preheating function is turned off, the first node does not execute the preheating process.
The percent configuration field is used to indicate whether to warm up as a percentage of the upstream quantity. The configuration field is set in consideration of the situation that the upstream node may expand the capacity, if the upstream node is configured according to the absolute number, when the upstream node has a large capacity, the preheating effect may be affected, and after the percentage configuration field is set to true, the total upstream information needs to be counted, so whether the percentage configuration field is set to true or not is set to start preheating according to the percentage of the upstream number according to the actual situation.
The percentWait configuration field is used for representing the waiting time for carrying out upstream traffic statistics; when the percentage configuration field is set to true, that is, the preheating according to the percentage of the upstream quantity is started, and the local disk has no upstream traffic record, that is, the second set, when the first node enters the preheating stage, the quantity statistics is performed on the upstream nodes that send the health query requests according to the waiting time for performing the upstream traffic statistics to obtain the total number of the upstream nodes (that is, the first set). When the health check state of the upstream nodes is released finally, determining the maximum number of the upstream nodes allowed to pass through in each preheating stage according to the absolute number of the upstream nodes contained in the first set; if only the preheating according to the percentage of the upstream number is configured and started but the total number of the upstream nodes is not available, the maximum number of the upstream nodes allowed to pass through each preheating stage cannot be calculated, so that in this embodiment, the configuration field is set to ensure that the number of the upstream nodes can still be obtained through statistics under the condition that the second set is not acquired, so as to execute the processing of the subsequent preheating stage.
The sort configuration field is used for indicating whether the upstream nodes allowed to pass through are determined according to the access quantity sequence of the upstream nodes; when the sort configuration field is true (i.e. the upstream nodes which are determined to be allowed to pass through according to the access quantity sequence of the upstream nodes are opened) and the local disk has the upstream node traffic record (second set), the health check is released according to the upstream node traffic from large to small in any warm-up stage.
The recordActive configuration field is used for indicating whether an upstream node traffic recording function is started or not; if the configuration field is set to be tube or 1, that is, the upstream node traffic recording function is started, the first node will count the second set in advance and store the second set in the local hard disk.
The recordCron configuration field is used to indicate the trigger time of the timing task for recording the traffic, and this configuration field can be represented by cron expression, where each digit from left to right in the cron expression represents the second, minute, hour, date, week, month and year, such as "0021? "indicates 21 dots per day 0 min 0 sec.
The recordDuration configuration field is used to indicate the duration of the timing task of recording traffic, such as "60" in the above example, which may be in units of seconds.
The recordddir configuration field is used to indicate that the file stored by the upstream traffic record, i.e. the path of the file recording or holding the second set, may be "/home/appops/gateway/nginx.
the timeConfig configuration field is used for representing a preheating strategy; "20", "40" and "60" in the preheating strategy respectively represent the preheating time length corresponding to each preheating phase, and in this example, may be specifically the maximum preheating time length (or called highherentry) corresponding to each preheating phase; "3", "10" and "20" are quantity related information respectively corresponding to each preheating stage, and the value of the quantity related information is percentage when the percentage configuration field is true (i.e. preheating according to the percentage of the upstream quantity is started), otherwise, the value is absolute quantity. The first node may determine, according to the current warm-up elapsed time length, a maximum warm-up time length (i.e., highherentry) corresponding to the first node from the above warm-up policy, and further determine a maximum number of upstream nodes allowed to pass through in the current warm-up phase. If the maximum preheating time length corresponding to the current preheating used time length is determined to be empty from the preheating strategy according to the current preheating used time length, the first node can determine that the current preheating is completed.
For example, in this embodiment, when the first node is in the ith warm-up stage of the N warm-up stages and receives a health query request from any upstream node, that is, the second node, the first node performs processing, and first defines related fields included in a code:
the servalive field indicates whether the initialization process of the first node is completed, "! servalive' indicates that the initialization processing of the first node is not completed;
the nginxpresseactive field indicates whether the preheating function of the first node is closed;
the preheatComplete field indicates whether the warm-up of the first node is complete;
the config field indicates a preheating strategy configured by the first node;
a whiteFrontendSet field indicates a candidate upstream node set corresponding to the current ith preheating stage of the first node;
the sortedIps field represents an upstream node set, namely a second set, which is read in during the initialization processing of the first node, and the second set is sorted according to the sequence of the access volume of the upstream node from large to small;
the tmpIps field represents all upstream ip sets of the first node, i.e. the first set.
Based on the description of the relevant fields contained in the above code, a further exemplary description is given below of the code that the first node performs processing when receiving the health query request sent by any upstream node, i.e., the second node, when the first node is in the ith warm-up stage of the N warm-up stages in this embodiment:
Figure BDA0003056317270000341
Figure BDA0003056317270000351
Figure BDA0003056317270000361
Figure BDA0003056317270000371
in this embodiment, the first node is processed in any one of the N preheating stages in the above manner, and the first node is on-line after the first node completes processing of all the N preheating stages. Referring to fig. 2, for an exemplary description of the processing of a newly started service node, i.e., a first node, in an ith warm-up stage of N warm-up stages in a system, a plurality of upstream nodes are located upstream of the first node, for example, 4 Nginx nodes (respectively, Nginx1 to Nginx 4) illustrated in the upper and lower parts of fig. 2 are upstream nodes of the first node. In the ith warm-up stage of the N warm-up stages, the first node feeds back the first type of status code (e.g., 200 status codes) only to the health inquiry requests (also referred to as health check) sent by some of the upstream nodes, and feeds back the second type of status codes (e.g., 403 status codes) to the health inquiry requests of the other upstream nodes. For example, N is 3, the upper and lower sides in fig. 2 respectively show the processing of two warm-up stages, i is 1 and i is 2, i is 1 in the upper part of fig. 2, that is, in the first warm-up stage, the first node only allows 1 upstream node (i.e., the upper part of fig. 2, Nginx 1) to pass through, so when the first node in the upper part of fig. 2 receives the health query request from the upper part of fig. 2, 200 is returned, and the first nodes all feed back 403 for the health query requests of other Ngnix. The second warm-up phase is shown below fig. 2, where the first node allows the first node to pass through 2 upstream nodes, which are Nginx1 and Nginx3, respectively, in the lower part of fig. 2, so that when the first node receives health query requests from Nginx1 and Nginx3 in the lower schematic of fig. 2, the first node returns to 200, and the first node requests feedback 403 for health queries of other Ngnix. The process is carried out until the first node is on line after the process of 3 preheating stages is completed.
After the first node is on line, the first node can still receive the health inquiry request sent by the upstream node at any time, and the first type status code is fed back to the upstream node when the first node receives the health inquiry request sent by any one upstream node. It should be further noted that, after the first node successfully comes online, the service request sent by any upstream node may be received and subsequently processed, and a detailed description of a manner of processing the service request by the first node is omitted here.
In addition, when the first node determines to be offline, the method may further include: under the condition that the first node determines to be offline, if the first node receives a health inquiry request sent by a third node, the first node sends a second type status code to the third node; wherein the second type status code is used for indicating that the first node is in a state of not processing a service request; the third node is one of the nodes upstream of the first node.
The third node may be the same as or different from the second node in the foregoing embodiment.
Whether the first node determines to be offline or not may be determined according to actual situations, for example, the first node may be manually set to be offline, or the first node may be notified to be offline by a deployment node, and so on, which are not exhaustive here. In this embodiment, only the processing after the first node determines that the node is offline is focused, that is, after the first node determines that the node is offline, the second type status code is fed back to all the upstream nodes sending the health query request, so as to notify the upstream nodes that no processing of any service request is currently performed. It should be further understood that when the first node confirms the logout, there may be some incomplete processed historical service requests, and the first node completes the logout after completing the processing of all historical service requests.
Therefore, the upstream node sends the health inquiry request to the downstream node, namely the first node, so as to carry out health check, so that the upstream node can find the downstream node with problems or offline in time and eliminate the downstream node in time, and the damage time of the server is greatly reduced. And the health examination can also help the server to realize elegant up-and-down line. And before the first node finally goes offline, the first node feeds back the second type of state codes to the upstream nodes sending the health inquiry requests to set the state of the first node as offline so that the upstream nodes do not continue to send the requests any more, and then the first node processes the current accumulated historical service requests and then destroys resources and ends the process, thereby realizing lossless release.
In addition, the above description is only about the interaction between the first node and the upstream node (i.e. the second node or the third node) in the initialization process, the warm-up stage, the online process and the offline process, and in the actual process, the first node may interact with the deployment node in addition to the upstream node, and the specific description is as follows:
the first node receives an online request sent by a deployment node;
under the condition that the first node meets a second preset condition, the first node feeds back an online success status code to the deployment node;
wherein the second preset condition comprises: the first node preheating function is started and preheating is completed; or the first node preheating function is closed.
Wherein, the determination manner of completion of preheating may include: determining that the preheating is completed under the condition that the maximum number of the upstream nodes allowed to pass through in the ith preheating stage is empty; alternatively, it may be that the current warm-up elapsed time length exceeds the maximum warm-up time length in the warm-up strategy.
During the initialization process of the first node, the interaction between the first node and the deployment node may include: and in the process of initialization processing by the first node, if a request for accessing the check interface sent by the deployment node is received, sending connection rejection information to the deployment node. That is to say, in the process of performing initialization processing on the first node, binding of the corresponding TCP interface is not completed, and therefore connection rejection information is fed back to all requests for accessing the check interface sent by the deployment node.
And under the condition that the first node completes initialization processing, if the first node receives a request for accessing a check interface sent by the deployment node, feeding back information of successful connection to the deployment node.
Further, the deployment node may start to send an online request to the first node when receiving information of successful connection fed back by the first node for a request of accessing the inspection interface; correspondingly, the first node determines to enter a preheating stage when the first node determines that initialization is completed and receives an online request sent by the deployment node for the first time.
It should be understood that, a deployment node sends an online request to a first node, and when the first node is in a preheating state, the first node feeds back an online unsuccessful status code (or an online failure status code) to the deployment node.
The on-line success status code and the on-line failure status code may be set according to an actual situation, for example, the on-line success status code may be a 2xx status code or a 203 status code; the on-line fail status code may be the 403 status code or the 4xx status code.
For example, to describe the processing logic of the first node after receiving the online request sent by the deployment node, it should be understood that the definition of the relevant field in the following code is the same as the definition of the relevant code of the first node for processing the health query request sent by the second node in the foregoing embodiment, which is not described again, and the specific description is as follows:
Figure BDA0003056317270000401
finally, referring to fig. 3, the interaction between the upstream nodes (e.g., Nginx in fig. 3 represents all the upstream nodes of the first node) and the deployment node during the initialization process and the warm-up process of the first node in the present embodiment is exemplarily described:
the deployment node will continuously access the check interface of the first node during the check phase of the first node, that is, as shown in fig. 3, the deployment node sends a request for accessing the check interface (or referred to as accessing the check interface) to the first node; at this time, since the first node is in the initialization process, that is, the initialization is not completed, and the corresponding TCP port is not bound, the first node feeds back connection rejection information (or called connection returned) to all the deployment nodes at this time.
After the first node is initialized, that is, after the TCP port corresponding to the first node bind is received, if a request for accessing the check interface is received from the deployment node, the connection success information (or success) is fed back to the deployment node. Before the first node completes initialization and enters a warm-up stage, the first node feeds back the second type of status code to all the health inquiry requests of the upstream node nginx, namely, the health check fails (or indicates that the health inquiry requests are in a state of not processing service requests), and correspondingly, no upstream node sends the service requests to the first node.
And the deployment node enters an online (online) stage of the first node after receiving the connection success information sent by the first node. Accordingly, the deployment node sends an online request (or called a request for accessing an online interface) to the first node, the first node enters a preheating phase (i.e. the aforementioned N preheating phases), and because the first node does not finish preheating, the first node feeds back an online failure status code (i.e. the 403 status code shown in fig. 3) to the deployment node. After the first node enters the warm-up phase, the first type status code 200 may be fed back to a health inquiry request sent from a part of Nginx nodes (i.e. the health check is successful, or the state indicates that the health inquiry request is in a state capable of processing a service request corresponding to an upstream node).
After the first node is preheated, the first node feeds back the first type of state codes to all the upstream nodes nginx so as to represent that the health check of the first node is successful, namely the first node is in a state capable of processing the service request, and the first node normally provides service. In addition, after the first node is preheated, if an online request sent by the deployment node is received, an online success status code (for example, 203 or success shown in fig. 3) is fed back to the deployment node, and accordingly, the deployment node considers that the first node completes publishing and can continue to publish the next batch of nodes. It should be noted that, when the deployment nodes issue in batches, the last batch of service nodes must be successfully issued before entering the next batch of service nodes. Otherwise, multiple batches of nodes may be in a distribution or warm-up state, such that nodes not in the distribution state are subject to excessive traffic.
As can be seen, in this embodiment, when a first node is in an ith warm-up stage of N warm-up stages, according to a candidate upstream node set corresponding to the ith warm-up stage, it is determined whether to feed back a first type status code to a second node, that is, any one upstream node, which sends a health query request, so as to indicate that the first node is currently in a state capable of processing a service request of the upstream node; since the number of candidate upstream nodes included in the candidate upstream node set of the ith warm-up stage is smaller than the number of upstream nodes of the first node, the first node only feeds back the first type of status code to a part of upstream nodes in any warm-up stage, and further warm-up can be performed based on real service requests of the part of upstream nodes. Therefore, the problems of poor preheating effect caused by adopting virtual flow for preheating, extra burden such as flow impact caused by depending on services such as a database or a cache and the like, high expenditure of storage resources caused by virtual flow storage and the like in the prior art can be avoided; in addition, the scheme provided by the embodiment can enable the first node to preheat by adopting the real service request of the upstream node, so that the problems of data pollution and the like do not need to be considered, and the preheating effect is ensured; in addition, because the number of the upstream nodes allowed to pass through currently is limited in the preheating stage, the change of the upstream nodes does not influence the preheating effect of the first node, and the preheating effect is further ensured.
A second aspect of the present disclosure provides a node processing method, as shown in fig. 4, including:
s401: the second node sends a health inquiry request to the first node; wherein the second node is one of the upstream nodes of the first node;
s402: the second node receives the status code fed back by the first node;
s403: and under the condition that the status code fed back by the first node is the first type of status code, the second node determines that the first node is in a state capable of processing the service request of the second node.
The present embodiment may be applied to a second node, which may be any one of upstream nodes of the first node.
In the above S401, the sending, by the second node, the health query request to the first node may include: the second node sends a jth health query request to the first node at a jth query time interval corresponding to the first node; wherein j is an integer of 1 or more.
That is, the second node may periodically send a health query request to the first node; the query time interval may be set according to actual conditions, and may be 1 second(s), for example.
Correspondingly, in S402, the receiving, by the second node, the status code fed back by the first node may include: the second node receives a status code fed back by the first node for the jth health query request.
That is, each time the second node sends a health query request to the first node, the second node receives the status code fed back by the first node for the health query request sent this time.
In S403, when the status code fed back by the first node is a first type of status code, the determining, by the second node, that the first node is in a state capable of processing the service request of the second node includes:
determining that the first node is in a state capable of processing the service request of the second node when the status codes fed back by the first node for the continuous L health inquiry requests are the first type of status codes; wherein the L health query requests comprise the jth health query request; l is an integer of 2 or more.
The status codes fed back by the first node for the consecutive L health query requests are first-class status codes, which means that the status codes fed back by the first node for the consecutive L health query requests are all first-class status codes. Here, the definition of the first type status code is the same as that described in the foregoing first aspect embodiment, and may be set according to practical situations, for example, 2xx or 203.
L may be set according to actual conditions, for example, L may be set to 2, or may be 3.
For example, in the case that the second node sends health query requests to the first node at 2 consecutive query time intervals, and the first node feeds back the 2 consecutive health query requests all as the first type status code, the second node may confirm that the health check of the first node is successful, that is, the first node may receive the service request sent by the second node.
It should be noted that after completing the above S403, the second node may send the service request to the first node when the service request needs to be sent to the first node, so that the first node performs warming up based on the actual service request sent by the second node.
In addition, the method can also comprise the following steps: under the condition that the status codes fed back by the first node for the R continuous health inquiry requests are the second type status codes, the second node sends the j +1 health inquiry request to the first node in the j +1 inquiry time interval; wherein, the R health inquiry requests comprise the jth health inquiry request; r is an integer of 2 or more.
The state codes fed back by the first node for the R consecutive health query requests are second-class state codes, which means that the state codes fed back by the first node for the R consecutive health query requests are all the second-class state codes. Here, the definition of the second type status code is the same as that described in the foregoing first aspect embodiment, and may be set according to practical situations, for example, 4xx or 400 may be used.
R can be set according to practical situations, for example, R can be set to be 3, or can be 4, or more or less, and is not exhaustive here.
For example, when the second node sends health query requests to the first node in 3 consecutive query time intervals, and the first node feeds back all the feedback about the 3 consecutive health query requests as the second type status code, the second node may confirm that the first node fails to perform health check, that is, the first node does not receive the service request sent by the second node, and the second node does not send the service request to the first node, but continues to send the health query request to the first node again in the next query time interval.
That is to say, the second node determines whether the status codes fed back by the first node for the consecutive L health query requests are all the first type status codes, if yes, S403 is executed;
otherwise, the second node judges whether the status codes fed back by the first node for the R continuous health inquiry requests are the second type status codes or not; under the condition that the status codes fed back by the first node for the R continuous health inquiry requests are the second type status codes, the second node sends the j +1 health inquiry request to the first node in the j +1 inquiry time interval; wherein, the R health inquiry requests comprise the jth health inquiry request; r is an integer of 2 or more.
For example, the relevant code in the second node for performing the above processing may include:
“check interval=1000rise=2fall=3timeout=1000type=http default_down=false;
check_http_send"HEAD/health/status HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;”
wherein "interval" is 1000 "and indicates that the query time interval of the second node (for example, nginx) polling (or periodically querying) the downstream health status is 1000 milliseconds, that is, 1 second; "rise is 2" indicates that the first-class status code is fed back twice continuously to indicate that the health check is successful, that is, a service request can be sent to the first node; "fall-3" indicates that the second-type status code is fed back 3 times continuously, and indicates that the health check fails and a service request cannot be sent to the first node; "timeout 1000" means that the maximum duration of the feedback timeout is 1 second; "type" http indicates that the request type is http request; "default _ down ═ false" indicates that the default state is a failure (i.e., a health check failure cannot send a service request to the first node); "check _ HTTP _ send" HEAD/health/status HTTP/1.0\ r \ n \ r \ n "" represents the specific content of the health query request; "check _ http _ expect _ alive http _2xx http _3 xx" indicates that the returned status code is 2xx or 3xx, and the health check is considered to be successful, that is, other status codes are returned or the health check is considered to be failed due to timeout or connection rejection.
It can be seen that, by the first node being in the warm-up phase, the present embodiment may send a service request to the first node only if the upstream node receives a first type status code fed back by the first node for a health query request. Therefore, the problems of poor preheating effect caused by not adopting real flow for preheating, flow impact caused by depending on services such as a database or a cache and the like, high expenditure of storage resources caused by flow recording and the like in the prior art can be avoided; in addition, the scheme provided by the embodiment can enable the first node to preheat by adopting the real service request of the upstream node, so that the problems of data pollution and the like do not need to be considered, and the preheating effect is ensured; in addition, because the number of the upstream nodes allowed to pass through currently is limited in the preheating stage, the change of the upstream nodes does not influence the preheating effect of the first node, and the preheating effect is further ensured.
Exemplary System
Having described the method of the exemplary embodiment of the present disclosure, the node processing system of the exemplary embodiment of the present disclosure will be explained next.
A third aspect of the present disclosure provides a node processing system, referring to fig. 5, including: a node processing system, comprising: a first node 51, a second node 52; wherein the content of the first and second substances,
the first node 51 is configured to receive a health query request sent by a second node in an ith warm-up phase of the N warm-up phases; wherein N is an integer greater than or equal to 2, and i is an integer greater than or equal to 1 and less than or equal to N; the second node is one of the upstream nodes of the first node; under the condition that the candidate upstream node set corresponding to the ith preheating stage comprises the second node, sending a first-class status code to the second node; the first-class status code is used for indicating that the first node is in a state of being capable of processing the service request of the second node; the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is less than that of the upstream nodes of the first node;
the second node 52, configured to send a health query request to the first node; wherein the second node is one of M upstream nodes of the first node; m is an integer greater than or equal to 1; receiving a state code fed back by the first node; and under the condition that the status code fed back by the first node is the first type of status code, determining that the first node is in a state capable of processing the service request of the second node.
The system further comprises: a deployment node 53; wherein the content of the first and second substances,
the deployment node 53 is configured to send an online request to a first node, and determine that the first node is online successfully when receiving an online success status code fed back by the first node;
the first node 51 is configured to receive an online request sent by the deployment node, and feed back an online success status code to the deployment node when a second preset condition is met; wherein the second preset condition comprises: the first node preheating function is started and preheating is completed; or the first node preheating function is closed.
The deployment node 53 is further configured to send a request for accessing the check interface to the first node; the first node 51 is specifically configured to, in the process of performing initialization processing, send connection rejection information to the deployment node if a request for accessing the check interface is received from the deployment node.
The first node 51 is specifically configured to, when the initialization processing is completed, feed back information of successful connection to the deployment node if a request for accessing the check interface is received from the deployment node. The deployment node 53 is further configured to, when receiving information that the connection of the first node for the request feedback of the access check interface is successful, start sending an online request to the first node.
The on-line success status code and the on-line failure status code may be set according to an actual situation, for example, the on-line success status code may be a 2xx status code or a 203 status code; the on-line fail status code may be the 403 status code or the 4xx status code.
The deployment node 53 is further configured to determine a node to be deployed included in a next deployment batch under the condition that it is determined that all nodes to be deployed included in a current deployment batch are successfully online; wherein the node to be deployed contained in the current deployment batch comprises the first node.
That is, the deployment node may distribute the nodes in batches, and the deployment node must wait for the last service node to be successfully distributed before entering the next service node.
The specific processing of the first node, the second node, and the deployment node in this embodiment is the same as that in the foregoing embodiments of the first aspect and the second aspect, and therefore, a repeated description is not made.
As can be seen, in this embodiment, when a first node is in an ith warm-up stage of N warm-up stages, according to a candidate upstream node set corresponding to the ith warm-up stage, it is determined whether to feed back a first type status code to a second node, that is, any one upstream node, which sends a health query request, so as to indicate that the first node is currently in a state capable of processing a service request of the upstream node; since the number of candidate upstream nodes included in the candidate upstream node set of the ith warm-up stage is smaller than the number of upstream nodes of the first node, the first node only feeds back the first type of status code to a part of upstream nodes in any warm-up stage, and further warm-up can be performed based on real service requests of the part of upstream nodes. Therefore, the problems of poor preheating effect caused by not adopting real flow for preheating, flow impact caused by depending on services such as a database or a cache and the like, high expenditure of storage resources caused by flow recording and the like in the prior art can be avoided; in addition, the scheme provided by the embodiment can enable the first node to preheat by adopting the real service request of the upstream node, so that the problems of data pollution and the like do not need to be considered, and the preheating effect is ensured; in addition, because the number of the upstream nodes allowed to pass through currently is limited in the preheating stage, the change of the upstream nodes does not influence the preheating effect of the first node, and the preheating effect is further ensured.
Exemplary Medium
Having described the method of the exemplary embodiment of the present disclosure, the medium of the exemplary embodiment of the present disclosure is explained next with reference to fig. 6.
In some possible embodiments, various aspects of the present disclosure may also be implemented as a computer-readable medium on which a program is stored, the program, when executed by a processor, being for implementing steps in a node processing method according to various exemplary embodiments of the present disclosure described in the above-mentioned "exemplary methods" section of this specification.
Specifically, the processor is configured to implement the following steps when executing the program:
under the condition that a first node is in the ith preheating stage of N preheating stages, the first node receives a health inquiry request sent by a second node; wherein N is an integer greater than or equal to 2, and i is an integer greater than or equal to 1 and less than or equal to N; the second node is one of the upstream nodes of the first node;
under the condition that the candidate upstream node set corresponding to the ith preheating stage comprises the second node, the first node sends a first type status code to the second node; the first-class status code is used for indicating that the first node is in a state of being capable of processing the service request of the second node; wherein the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith warm-up stage is less than the number of upstream nodes of the first node.
And the number of the first and second groups,
the second node sends a health inquiry request to the first node; wherein the second node is one of the upstream nodes of the first node;
the second node receives the status code fed back by the first node;
and under the condition that the status code fed back by the first node is the first type of status code, the second node determines that the first node is in a state capable of processing the service request of the second node.
It should be noted that: the above-mentioned medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
As shown in fig. 6, a medium 600 that can employ a portable compact disc read only memory (CD-ROM) and include a program and can be run on a device according to an embodiment of the present disclosure is described. However, the disclosure is not so limited, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take a variety of forms, including, but not limited to: an electromagnetic signal, an optical signal, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN).
Exemplary devices
Having described the method of the exemplary embodiments of the present disclosure, the apparatus of the exemplary embodiments of the present disclosure will now be described.
A fourth aspect of the present disclosure provides a first node, as shown in fig. 7, comprising:
a first interface unit 71, configured to receive a health query request sent by the second node in an ith warm-up phase of the N warm-up phases; wherein N is an integer greater than or equal to 2, and i is an integer greater than or equal to 1 and less than or equal to N; the second node is one of the upstream nodes of the first node;
a first processing unit 72, configured to control, when the candidate upstream node set corresponding to the ith warm-up stage includes the second node, to send a first type status code to the second node through the first interface unit; the first-class status code is used for indicating that the first node is in a state of being capable of processing the service request of the second node; wherein the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith warm-up stage is less than the number of upstream nodes of the first node.
In an embodiment of the present disclosure, the first processing unit 71 is configured to control, when the candidate upstream node set corresponding to the ith warm-up stage does not include the second node, to send a second class status code to the second node through the first interface unit; wherein the second type status code is used to indicate that the first node is in a state of not processing a service request.
In an embodiment of the present disclosure, the first processing unit 71 is configured to, when the candidate upstream node set corresponding to the ith warm-up stage does not include the second node, add address-related information of the second node to the first set if the first node meets a first preset condition, and control to feed back the second-class status code to the second node through the first interface unit 72.
In one embodiment of the present disclosure, the first preset condition includes:
preheating according to the percentage of the upstream quantity is started, the upstream nodes which are allowed to pass through are determined according to the access quantity sequence of the upstream nodes, and the current preheating used time length is smaller than the waiting time length for performing upstream flow statistics;
or, preheating according to the percentage of the upstream quantity, enabling the second set to be empty, and enabling the used time length of the current preheating to be smaller than the waiting time length for performing upstream flow statistics; the second set is an upstream node set of the first node read by the first node and sorted according to a preset access quantity sequence.
In an embodiment of the present disclosure, the first processing unit 71 is configured to, when the candidate upstream node set corresponding to the ith warm-up stage does not include the second node, if the upstream nodes that are determined to be allowed to pass through according to the access quantity ranking of the upstream nodes are turned off, and the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith warm-up stage is smaller than the maximum number of upstream nodes that are allowed to pass through by the ith warm-up stage, update, by the first node, the candidate upstream node set corresponding to the ith warm-up stage based on the address-related information of the second node to obtain an updated candidate upstream node set corresponding to the ith warm-up stage, and control to feed back the first-class status code to the second node through the first interface unit 72.
In an embodiment of the present disclosure, the first processing unit 71 is configured to, when the candidate upstream node set corresponding to the ith warm-up stage does not include the second node, if the upstream nodes that are determined to be allowed to pass through according to the access quantity ranking of the upstream nodes are started, and the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith warm-up stage is smaller than the maximum number of upstream nodes that are allowed to pass through by the ith warm-up stage, update, by the first node, the candidate upstream node set corresponding to the ith warm-up stage based on at least one upstream node in the second set, so as to obtain an updated candidate upstream node set corresponding to the ith warm-up stage;
the second set is an upstream node set of the first node read by the first node and sorted according to a preset access quantity sequence.
In an embodiment of the present disclosure, the first processing unit 71 is configured to perform one of:
controlling to feed back a first type of status code to the second node through the first interface unit under the condition that the updated candidate upstream node set corresponding to the ith preheating stage contains the second node;
controlling to feed back a second type of status code to the second node through the first interface unit under the condition that the updated candidate upstream node set corresponding to the ith preheating stage does not contain the second node; wherein the second type status code is used to indicate that the first node is in a state of not processing a service request.
In an embodiment of the present disclosure, the first processing unit 71 is configured to, in a case that the first node determines to enter the ith warm-up stage of the N warm-up stages based on a current warm-up elapsed time, determine, based on a warm-up policy, a candidate upstream node set corresponding to the ith warm-up stage;
the preheating strategy comprises preheating duration corresponding to the N preheating stages and information related to the number of candidate upstream nodes.
In an embodiment of the present disclosure, the first processing unit 71 is configured to determine, based on information related to the number of candidate upstream nodes corresponding to the ith preheating stage in the preheating policy, the number to be added of the candidate upstream nodes corresponding to the ith preheating stage; determining candidate upstream nodes corresponding to the ith preheating stage based on the number to be added of the candidate upstream nodes; and determining a candidate upstream node set corresponding to the ith preheating stage based on the candidate upstream node corresponding to the ith preheating stage.
In an embodiment of the present disclosure, the first processing unit 71 is configured to, in a case that it is determined that a first warm-up stage of the N warm-up stages is entered, determine, based on a warm-up policy, a candidate upstream node set corresponding to each of the N warm-up stages;
the preheating strategy comprises preheating duration corresponding to the N preheating stages and information related to the number of candidate upstream nodes.
In an embodiment of the present disclosure, the first processing unit 71 is configured to determine a first value corresponding to the ith preheating stage based on a current preheating used time and preheating time lengths respectively corresponding to the N preheating stages included in the preheating strategy and information related to the number of candidate upstream nodes; based on the first value, a maximum number of upstream nodes allowed to pass by the ith warm-up phase is determined.
In an embodiment of the present disclosure, the first processing unit 71 is configured to perform one of:
taking said first value as the maximum number of upstream nodes allowed to pass by said ith warm-up phase, in case warm-up according to a percentage of the upstream number is switched off;
and under the condition that the preheating according to the percentage of the upstream quantity is started, determining the percentage corresponding to the ith preheating stage based on the first numerical value, and determining the maximum quantity of the upstream nodes allowed to pass through by the ith preheating stage based on the percentage and the quantity of the upstream nodes corresponding to the first nodes.
In an embodiment of the present disclosure, the first processing unit 71 is configured to, if the first node determines that the node is offline, if a health query request sent by a third node is received through the first interface unit, control to send a second type status code to the third node through the first interface unit 72; wherein the second type status code is used for indicating that the first node is in a state of not processing a service request; the third node is one of the nodes upstream of the first node.
In one embodiment of the present disclosure, the first node further comprises:
a second interface unit 73, configured to receive an online request sent by a deployment node;
the first processing unit 71 is further configured to control to feed back an online success status code to the deployment node through the second interface unit when the first node meets a second preset condition;
wherein the second preset condition comprises: the first node preheating function is started and preheating is completed; or the first node preheating function is closed.
A fifth aspect of the embodiments of the present disclosure provides a second node, as shown in fig. 8, including:
a third interface unit 81, configured to send a health query request to the first node; wherein the second node is one of the upstream nodes of the first node; receiving a state code fed back by the first node;
a second processing unit 82, configured to determine that the first node is in a state capable of processing the service request of the second node when the status code fed back by the first node is the first type of status code.
In an embodiment of the present disclosure, the third interface unit 81 is configured to send a jth health query request to the first node at a jth query time interval corresponding to the first node; wherein j is an integer greater than or equal to 1;
and receiving a status code fed back by the first node for the jth health query request.
In an embodiment of the present disclosure, the second processing unit 82 is configured to determine that the first node is in a state capable of processing a service request of the second node, if a status code fed back by the first node for consecutive L health query requests is a first type status code; wherein the L health query requests comprise the jth health query request; l is an integer of 2 or more.
In an embodiment of the present disclosure, the second processing unit 82 is configured to, in a case that the status code fed back by the first node for the consecutive R health query requests is a second type status code, control to send, through the third interface unit, a j +1 th health query request to the first node at a j +1 th query time interval; wherein, the R health inquiry requests comprise the jth health inquiry request; r is an integer of 2 or more.
According to the embodiment of the disclosure, the problems of poor preheating effect caused by adopting virtual flow for preheating, extra burden such as flow impact caused by depending on services such as a database or a cache and the like, high cost of storage resources caused by virtual flow storage and the like in the prior art can be avoided; in addition, the scheme provided by the embodiment can enable the first node to preheat by adopting the real service request of the upstream node, so that the problems of data pollution and the like do not need to be considered, and the preheating effect is ensured; in addition, because the number of the upstream nodes allowed to pass through currently is limited in the preheating stage, the change of the upstream nodes does not influence the preheating effect of the first node, and the preheating effect is further ensured.
Exemplary computing device
Having described the methods, media, and apparatus of the exemplary embodiments of the present disclosure, a computing device of the exemplary embodiments of the present disclosure is described next with reference to fig. 9.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
In some possible implementations, a computing device according to embodiments of the present disclosure may include at least one processing unit and at least one memory unit. Wherein the storage unit stores program code which, when executed by the processing unit, causes the processing unit to perform the steps in the node processing method according to various exemplary embodiments of the present disclosure described in the above section "exemplary method" of this specification.
A computing device 900 according to such an embodiment of the present disclosure is described below with reference to fig. 9. The computing device 900 shown in fig. 9 is only one example and should not impose any limitations on the functionality or scope of use of embodiments of the disclosure.
As shown in fig. 9, computing device 900 is embodied in a general purpose computing device. Components of computing device 900 may include, but are not limited to: the at least one processing unit 901 and the at least one storage unit 902 are connected to a bus 903 of various system components (including the processing unit 901 and the storage unit 902).
The bus 903 includes a data bus, a control bus, and an address bus.
The storage unit 902 may include readable media in the form of volatile memory, such as a Random Access Memory (RAM)9021 and/or a cache memory 9022, and may further include readable media in the form of non-volatile memory, such as a Read Only Memory (ROM) 9023.
Storage unit 902 may also include a program/utility 9025 having a set (at least one) of program modules 9024, such program modules 9024 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Computing device 900 may also communicate with one or more external devices 904, such as a keyboard, pointing device, etc. Such communication may occur via input/output (I/O) interfaces 905. Moreover, computing device 900 may also communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the internet) via network adapter 906. As shown in fig. 9, the network adapter 906 communicates with the other modules of the computing device 900 over the bus 903. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with computing device 900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
It should be noted that although in the above detailed description several units/modules or sub-units/sub-modules of the first node or the second node are mentioned, such a division is merely exemplary and not mandatory. Indeed, the features and functionality of two or more of the units/modules described above may be embodied in one unit/module, in accordance with embodiments of the present disclosure. Conversely, the features and functions of one unit/module described above may be further divided into embodiments by a plurality of units/modules.
Further, while the operations of the disclosed methods are depicted in the drawings in a particular order, this does not require or imply that these operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
While the spirit and principles of the present disclosure have been described with reference to several particular embodiments, it is to be understood that the present disclosure is not limited to the particular embodiments disclosed, nor is the division of aspects, which is for convenience only as the features in such aspects may not be combined to benefit. The disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (10)

1. A node processing method, comprising:
under the condition that a first node is in the ith preheating stage of N preheating stages, the first node receives a health inquiry request sent by a second node; wherein N is an integer greater than or equal to 2, and i is an integer greater than or equal to 1 and less than or equal to N; the second node is one of the upstream nodes of the first node;
under the condition that the candidate upstream node set corresponding to the ith preheating stage comprises the second node, the first node sends a first type status code to the second node; the first-class status code is used for indicating that the first node is in a state of being capable of processing the service request of the second node; wherein the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith warm-up stage is less than the number of upstream nodes of the first node.
2. The method of claim 1, further comprising:
under the condition that the candidate upstream node set corresponding to the ith preheating stage does not contain the second node, the first node sends a second type state code to the second node; wherein the second type status code is used to indicate that the first node is in a state of not processing a service request.
3. The method according to claim 2, wherein in a case that the second node is not included in the candidate upstream node set corresponding to the ith warm-up phase, the first node sends a second type status code to the second node, including:
and under the condition that the candidate upstream node set corresponding to the ith preheating stage does not contain the second node, if the first node meets a first preset condition, the first node adds the address related information of the second node to the first set, and feeds back the second type of state code to the second node.
4. The method of claim 1, further comprising:
under the condition that the candidate upstream node set corresponding to the ith preheating stage does not contain the second node, if the upstream nodes which are determined to be allowed to pass through according to the access quantity sequence of the upstream nodes are closed, and the number of the candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is smaller than the maximum number of the upstream nodes which are allowed to pass through by the ith preheating stage, the first node updates the candidate upstream node set corresponding to the ith preheating stage based on the address related information of the second node to obtain the updated candidate upstream node set corresponding to the ith preheating stage, and feeds back the first-class status code to the second node.
5. A node processing method, comprising:
the second node sends a health inquiry request to the first node; wherein the second node is one of the upstream nodes of the first node;
the second node receives the status code fed back by the first node;
and under the condition that the status code fed back by the first node is the first type of status code, the second node determines that the first node is in a state capable of processing the service request of the second node.
6. A node processing system, comprising: a first node and a second node; wherein the content of the first and second substances,
the first node is used for receiving a health inquiry request sent by the second node under the condition of the ith preheating stage in the N preheating stages; wherein N is an integer greater than or equal to 2, and i is an integer greater than or equal to 1 and less than or equal to N; the second node is one of the upstream nodes of the first node; under the condition that the candidate upstream node set corresponding to the ith preheating stage comprises the second node, sending a first-class status code to the second node; the first-class status code is used for indicating that the first node is in a state of being capable of processing the service request of the second node; the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith preheating stage is less than that of the upstream nodes of the first node;
the second node is used for sending a health inquiry request to the first node; wherein the second node is one of M upstream nodes of the first node; m is an integer greater than or equal to 1; receiving a state code fed back by the first node; and under the condition that the status code fed back by the first node is the first type of status code, determining that the first node is in a state capable of processing the service request of the second node.
7. A first node, comprising:
the first interface unit is used for receiving a health inquiry request sent by the second node under the condition of the ith preheating stage in the N preheating stages; wherein N is an integer greater than or equal to 2, and i is an integer greater than or equal to 1 and less than or equal to N; the second node is one of the upstream nodes of the first node;
a first processing unit, configured to control, when the candidate upstream node set corresponding to the ith warm-up stage includes the second node, to send a first type status code to the second node through the first interface unit; the first-class status code is used for indicating that the first node is in a state of being capable of processing the service request of the second node; wherein the number of candidate upstream nodes in the candidate upstream node set corresponding to the ith warm-up stage is less than the number of upstream nodes of the first node.
8. A second node, comprising:
a third interface unit, configured to send a health query request to the first node; wherein the second node is one of the upstream nodes of the first node; receiving a state code fed back by the first node;
and the second processing unit is used for determining that the first node is in a state capable of processing the service request of the second node under the condition that the status code fed back by the first node is the first type of status code.
9. A medium storing a computer program, characterized in that the program, when being executed by a processor, carries out the method according to any one of claims 1-5.
10. A computing device, comprising:
one or more processors;
storage means for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method recited in any of claims 1-5.
CN202110501110.6A 2021-05-08 2021-05-08 Node processing method and system, node, medium and computing device Active CN113190274B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110501110.6A CN113190274B (en) 2021-05-08 2021-05-08 Node processing method and system, node, medium and computing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110501110.6A CN113190274B (en) 2021-05-08 2021-05-08 Node processing method and system, node, medium and computing device

Publications (2)

Publication Number Publication Date
CN113190274A true CN113190274A (en) 2021-07-30
CN113190274B CN113190274B (en) 2022-09-27

Family

ID=76984465

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110501110.6A Active CN113190274B (en) 2021-05-08 2021-05-08 Node processing method and system, node, medium and computing device

Country Status (1)

Country Link
CN (1) CN113190274B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080133741A1 (en) * 2006-12-01 2008-06-05 Fujitsu Limited Computer program and apparatus for controlling computing resources, and distributed processing system
CN102883365A (en) * 2012-10-22 2013-01-16 无锡清华信息科学与技术国家实验室物联网技术中心 Data distribution method for wireless sensor network
CN103001809A (en) * 2012-12-25 2013-03-27 曙光信息产业(北京)有限公司 Service node state monitoring method for cloud storage system
US20150074672A1 (en) * 2013-09-10 2015-03-12 Robin Systems, Inc. Asynchronous scheduling informed by job characteristics and anticipatory provisioning of data for real-time, parallel processing
CN105934914A (en) * 2013-12-19 2016-09-07 谷歌公司 Systems, methods, and computer program products for service processing
CN107861825A (en) * 2017-10-16 2018-03-30 北京京东尚科信息技术有限公司 Request processing/conditional code querying method and device, lower/upper trip node, medium
CN108234319A (en) * 2017-12-29 2018-06-29 北京奇虎科技有限公司 The transmission method and device of a kind of data
CN108900379A (en) * 2018-07-09 2018-11-27 广东神马搜索科技有限公司 Distributed network business scheduling method, calculates equipment and storage medium at device
CN110647400A (en) * 2019-09-29 2020-01-03 成都安恒信息技术有限公司 Node preheating method based on positive feedback
CN111355664A (en) * 2020-02-19 2020-06-30 中国农业银行股份有限公司 Flow control method and device
CN111385328A (en) * 2018-12-29 2020-07-07 北京奇虎科技有限公司 Service request processing method and system and electronic equipment
CN112416581A (en) * 2020-11-13 2021-02-26 五八同城信息技术有限公司 Distributed calling system for timed tasks

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080133741A1 (en) * 2006-12-01 2008-06-05 Fujitsu Limited Computer program and apparatus for controlling computing resources, and distributed processing system
CN102883365A (en) * 2012-10-22 2013-01-16 无锡清华信息科学与技术国家实验室物联网技术中心 Data distribution method for wireless sensor network
CN103001809A (en) * 2012-12-25 2013-03-27 曙光信息产业(北京)有限公司 Service node state monitoring method for cloud storage system
US20150074672A1 (en) * 2013-09-10 2015-03-12 Robin Systems, Inc. Asynchronous scheduling informed by job characteristics and anticipatory provisioning of data for real-time, parallel processing
CN105934914A (en) * 2013-12-19 2016-09-07 谷歌公司 Systems, methods, and computer program products for service processing
CN107861825A (en) * 2017-10-16 2018-03-30 北京京东尚科信息技术有限公司 Request processing/conditional code querying method and device, lower/upper trip node, medium
CN108234319A (en) * 2017-12-29 2018-06-29 北京奇虎科技有限公司 The transmission method and device of a kind of data
CN108900379A (en) * 2018-07-09 2018-11-27 广东神马搜索科技有限公司 Distributed network business scheduling method, calculates equipment and storage medium at device
CN111385328A (en) * 2018-12-29 2020-07-07 北京奇虎科技有限公司 Service request processing method and system and electronic equipment
CN110647400A (en) * 2019-09-29 2020-01-03 成都安恒信息技术有限公司 Node preheating method based on positive feedback
CN111355664A (en) * 2020-02-19 2020-06-30 中国农业银行股份有限公司 Flow control method and device
CN112416581A (en) * 2020-11-13 2021-02-26 五八同城信息技术有限公司 Distributed calling system for timed tasks

Also Published As

Publication number Publication date
CN113190274B (en) 2022-09-27

Similar Documents

Publication Publication Date Title
US11099891B2 (en) Scheduling requests based on resource information
EP3602296A1 (en) Event-driven scheduling using directed acyclic graphs
US10264063B2 (en) Method and apparatus for scheduling cloud server
EP2454666B1 (en) Fault tolerant batch processing
US20080030764A1 (en) Server parallel aggregation
US8856368B2 (en) Method for distributing a plurality of data portions
US20220276904A1 (en) Job execution with managed compute environments
CN110224860B (en) Load balancing application creation method and device, computer equipment and storage medium
JP2013257903A (en) Saving program execution state
US10025630B2 (en) Operating programs on a computer cluster
US10877796B1 (en) Job execution with scheduled reserved compute instances
CN107079045A (en) Recognized using the node of cluster
JP6272190B2 (en) Computer system, computer, load balancing method and program thereof
US7882232B2 (en) Rapid resource provisioning with automated throttling
CN103491024A (en) Job scheduling method and device for streaming data
US20160139823A1 (en) Methods and systems for optimal snapshot distribution within a protection schedule
CN113190274B (en) Node processing method and system, node, medium and computing device
CN112860421B (en) Method, apparatus and computer program product for job processing
US11080092B1 (en) Correlated volume placement in a distributed block storage service
US11263184B1 (en) Partition splitting in a distributed database
CN113127191B (en) Resource updating method, storage medium and related device
US10193790B2 (en) Systems and methods for an intelligent, distributed, autonomous, and scalable resource discovery, management, and stitching
JP6273732B2 (en) Information processing takeover control device, information processing takeover control method, and information processing takeover control program
US9942314B2 (en) System and method for optimizing web service availability with a node group agreement protocol
CN108804214B (en) Asynchronous task scheduling method and device and electronic equipment

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