CN108134766B - Service publishing method, device, system, server and client - Google Patents

Service publishing method, device, system, server and client Download PDF

Info

Publication number
CN108134766B
CN108134766B CN201611099694.4A CN201611099694A CN108134766B CN 108134766 B CN108134766 B CN 108134766B CN 201611099694 A CN201611099694 A CN 201611099694A CN 108134766 B CN108134766 B CN 108134766B
Authority
CN
China
Prior art keywords
service
services
rpc
issued
registration
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611099694.4A
Other languages
Chinese (zh)
Other versions
CN108134766A (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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201611099694.4A priority Critical patent/CN108134766B/en
Publication of CN108134766A publication Critical patent/CN108134766A/en
Application granted granted Critical
Publication of CN108134766B publication Critical patent/CN108134766B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1008Server selection for load balancing based on parameters of servers, e.g. available memory or workload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the application provides a method, a device, a system, a server and a client for service release, wherein when the method is applied to a registration center, the method comprises the steps of acquiring a plurality of Remote Procedure Call (RPC) services to be released by a current service provider in the starting process of an application program; grouping the RPC services to be issued to obtain N groups of RPC services, wherein N is a positive integer; when each group of RPC services is issued, acquiring a real-time system first load value of the service provider; if the first load value of the system is larger than a preset load threshold value, performing anti-registration on the RPC service currently issued by the service provider; and if the first load value of the system is less than or equal to the preset load threshold value, issuing the next group of RPC services. The embodiment of the application can realize dynamic packet service release and improve the correctness and stability of the service.

Description

Service publishing method, device, system, server and client
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method for service distribution, an apparatus for service distribution, a system for service distribution, a server for service distribution, a client for service distribution, and an apparatus and one or more computer readable media.
Background
When a web application just initiates an exposure service, an external request is received to execute the business logic. At this Time, many codes are repeatedly executed, and the codes are captured by a JVM (Java Virtual Machine) and compiled by a JIT (Just-In-Time Compiler).
In the prior art, after the application is started, all services are directly registered, which has the problem that after registration, traffic enters the service provider and is traffic of all interfaces. These services begin to execute in large numbers, causing JITs to compile just-in-time. Although the machine load of the application machine is maintained at a normal level when the external service is provided, at this time, the JIT compiling (compiler) thread performs a lot of compiling operations, which consumes CPU and seizes system resources, resulting in a rush of system load, and a long and even failed normal request execution time, which seriously affects service availability.
Therefore, one technical problem that needs to be urgently solved by those skilled in the art is: a service publishing mechanism is provided to reduce system load and improve the correctness and stability of services.
Disclosure of Invention
In view of the above problems, embodiments of the present application are proposed to provide a method of service distribution, an apparatus of service distribution, a system of service distribution, a server of service distribution, a client of service distribution, and an apparatus, one or more computer readable media that overcome or at least partially solve the above problems.
In order to solve the above problem, an embodiment of the present application discloses a service publishing system, which includes a registry, a service provider, and a service consumer;
the service provider determines a plurality of Remote Procedure Call (RPC) services to be issued and generates registration requests aiming at the RPC services;
the registration center generates a service list based on a registration request sent by the server, groups the RPC services to be issued to obtain N groups of RPC services, and acquires a real-time system first load value of the service provider when each group of RPC services is issued; if the first load value of the system is larger than a preset load threshold value, performing anti-registration on the RPC service currently issued by the service provider; if the first load value of the system is smaller than or equal to a preset load threshold value, issuing the next group of RPC services; updating the service list;
and the service consumer receives the service list and the updated service list sent by the registry and replaces the service list with the updated service list.
The embodiment of the application also discloses a service publishing method, which is applied to a registration center, and the method comprises the following steps:
in the starting process of an application program, acquiring a plurality of Remote Procedure Call (RPC) services to be issued by a current service provider;
grouping the RPC services to be issued to obtain N groups of RPC services, wherein N is a positive integer;
when each group of RPC services is issued, acquiring a real-time system first load value of the service provider;
if the first load value of the system is larger than a preset load threshold value, performing anti-registration on the RPC service currently issued by the service provider;
and if the first load value of the system is less than or equal to the preset load threshold value, issuing the next group of RPC services.
The embodiment of the application also discloses a service publishing method, which is applied to a service provider and comprises the following steps:
in the application starting process, determining a plurality of Remote Procedure Call (RPC) services to be issued;
aiming at the RPC services, sending registration requests to a registration center, wherein the registration center is used for grouping the RPC services to be issued based on the registration requests to obtain N groups of RPC services, and N is a positive integer;
acquiring a real-time first load value of the system when each group of RPC services is issued;
if the first load value of the system is larger than a preset load threshold value, sending a reverse registration request to a registration center, wherein the registration center is used for performing reverse registration on the RPC service currently issued by the service provider based on the reverse registration request;
and if the first load value of the system is smaller than or equal to the preset load threshold value, sending a next group of RPC service issuing request to the registration center, wherein the registration center is used for issuing the next group of RPC service based on the issuing request.
The embodiment of the application also discloses a service updating method, which is applied to a service consumer and comprises the following steps:
receiving a service list sent by a registry, wherein the service list comprises identifications of one or more services provided by one or more service providers;
receiving an updated service list sent by a registry, wherein the updated service list is a list obtained by grouping a plurality of Remote Procedure Call (RPC) services to be issued by a current service provider after the registry acquires the RPC services to be issued in the application starting process, so as to obtain N groups of RPC services, acquiring a real-time system first load value of the service provider when each group of RPC services is issued, and performing reverse registration on the RPC services currently issued by the service provider when the system first load value is greater than a preset load threshold value;
replacing the service list with the updated service list.
The embodiment of the application also discloses a device for service release, which comprises:
the system comprises a to-be-issued service acquisition module, a Remote Procedure Call (RPC) service acquisition module and a Remote Procedure Call (RPC) service release module, wherein the to-be-issued service acquisition module is used for acquiring a plurality of RPC services to be issued by a current service provider in the starting process of an application program;
the service grouping module is used for grouping the RPC service to be issued to obtain N groups of RPC services, wherein N is a positive integer;
the system load acquisition module is used for acquiring a real-time system first load value of the service provider when each group of RPC services is issued;
the reverse registration module is used for performing reverse registration on the RPC service currently issued by the service provider when the first load value of the system is greater than a preset load threshold value;
and the layer-by-layer issuing module is used for issuing the next group of RPC services when the first load value of the system is less than or equal to a preset load threshold value.
The embodiment of the application also discloses a device for service release, which comprises:
the device comprises a to-be-issued service determining module, a Remote Procedure Call (RPC) service issuing module and a Remote Procedure Call (RPC) service issuing module, wherein the to-be-issued service determining module is used for determining a plurality of RPC services to be issued in the application starting process;
a registration request sending module, configured to send a registration request to a registration center for the plurality of RPC services, where the registration center is configured to group the RPC services to be issued based on the registration request to obtain N groups of RPC services, where N is a positive integer;
the system load determining module is used for acquiring a real-time first load value of the system when each group of RPC services is issued;
the system comprises a reverse registration request sending module, a registration center and a service provider, wherein the reverse registration request sending module is used for sending a reverse registration request to the registration center when a first load value of the system is larger than a preset load threshold value, and the registration center is used for performing reverse registration on the RPC service currently issued by the service provider based on the reverse registration request;
and the issuing request sending module is used for sending the issuing request of the next group of RPC services to the registration center when the first load value of the system is less than or equal to the preset load threshold value, and the registration center is used for issuing the next group of RPC services based on the issuing request.
The embodiment of the present application further discloses a device for updating service, including:
the service list receiving module is used for receiving a service list sent by the registration center, wherein the service list comprises identifications of one or more services provided by one or more service providers;
the system comprises an update list receiving module, an update list receiving module and a list sending module, wherein the update list receiving module is used for receiving an updated service list sent by a registration center, the updated service list is obtained by grouping a plurality of Remote Procedure Call (RPC) services to be issued by a current service provider in the process of starting an application by the registration center to obtain N groups of RPC services, when each group of RPC services are issued, a real-time system first load value of the service provider is obtained, and when the system first load value is larger than a preset load threshold value, the RPC services currently issued by the service provider are subjected to reverse registration;
a list update module for replacing the service list with the updated service list.
The embodiment of the application also discloses a system for service release, which comprises:
one or more processors;
a memory; and
one or more modules stored in the memory and configured to be executed by the one or more processors, the one or more modules having the functionality to:
in the starting process of an application program, acquiring a plurality of Remote Procedure Call (RPC) services to be issued by a current service provider;
grouping the RPC services to be issued to obtain N groups of RPC services, wherein N is a positive integer;
when each group of RPC services is issued, acquiring a real-time system first load value of the service provider;
if the first load value of the system is larger than a preset load threshold value, performing anti-registration on the RPC service currently issued by the service provider;
and if the first load value of the system is less than or equal to the preset load threshold value, issuing the next group of RPC services.
The embodiment of the present application further discloses a server for service distribution, where the server includes:
one or more processors;
a memory; and
one or more modules stored in the memory and configured to be executed by the one or more processors, the one or more modules having the functionality to:
in the application starting process, determining a plurality of Remote Procedure Call (RPC) services to be issued;
aiming at the RPC services, sending registration requests to a registration center, wherein the registration center is used for grouping the RPC services to be issued based on the registration requests to obtain N groups of RPC services, and N is a positive integer;
acquiring a real-time first load value of the system when each group of RPC services is issued;
if the first load value of the system is larger than a preset load threshold value, sending a reverse registration request to a registration center, wherein the registration center is used for performing reverse registration on the RPC service currently issued by the service provider based on the reverse registration request;
and if the first load value of the system is smaller than or equal to the preset load threshold value, sending a next group of RPC service issuing request to the registration center, wherein the registration center is used for issuing the next group of RPC service based on the issuing request.
The embodiment of the present application further discloses a client for service publishing, where the client includes:
one or more processors;
a memory; and
one or more modules stored in the memory and configured to be executed by the one or more processors, the one or more modules having the functionality to:
receiving a service list sent by a registry, wherein the service list comprises identifications of one or more services provided by one or more service providers;
receiving an updated service list sent by a registry, wherein the updated service list is a list obtained by grouping a plurality of Remote Procedure Call (RPC) services to be issued by a current service provider after the registry acquires the RPC services to be issued in the application starting process, so as to obtain N groups of RPC services, acquiring a real-time system first load value of the service provider when each group of RPC services is issued, and performing reverse registration on the RPC services currently issued by the service provider when the system first load value is greater than a preset load threshold value;
replacing the service list with the updated service list.
The embodiment of the application also discloses a device, including:
one or more processors; and
instructions in one or more computer-readable media stored thereon, which when executed by the one or more processors, cause the apparatus to perform the above-described method.
One or more computer-readable media having instructions stored thereon, which, when executed by one or more processors, cause a terminal device to perform the above-described methods are also disclosed.
Compared with the background art, the embodiment of the application has the following advantages:
the embodiment of the application realizes dynamic packet service release based on system load, exposes the services one by one, calculates the load of the operating system when exposing a group of services, and judges whether the registered services need to be unregistered. If the load of the system exceeds a preset load threshold (meaning the system is busy), the registered services are unregistered. JIT compilation of class files ensures that after JIT for each service, there is no more traffic entering for that service, on the one hand, ensures that the request is routed back to the non-rebooted machine, and on the other hand, all system load is used for JIT and other services are performed, thereby improving the accuracy and stability of the traffic.
Drawings
Fig. 1 is a flowchart of the steps of embodiment 1 of a method for service delivery according to the present application;
FIG. 2 is a schematic illustration of service release of the present application;
FIG. 3 is a flow chart of the steps of method embodiment 2 of a service publishing of the present application;
FIG. 4 is a flowchart of the steps of embodiment 3 of a service publishing method of the present application
Fig. 5 is a block diagram of the structure of an embodiment 1 of a service distribution apparatus of the present application;
fig. 6 is a block diagram of the structure of an embodiment 2 of a service distribution apparatus of the present application;
fig. 7 is a block diagram of a service distribution apparatus embodiment 3 according to the present application;
FIG. 8 is a block diagram of a service delivery system embodiment of the present application;
fig. 9 is a schematic structural diagram of an embodiment of a service distribution system of the present application.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, the present application is described in further detail with reference to the accompanying drawings and the detailed description.
While the concepts of the present application are susceptible to various modifications and alternative forms, specific embodiments thereof have been shown by way of example in the drawings and will herein be described in detail. It should be understood, however, that the description above is not intended to limit the application to the particular forms disclosed, but on the contrary, the intention is to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the application.
Reference in the specification to "one embodiment," "an embodiment," "a particular embodiment," or the like, means that the embodiment described may include a particular feature, structure, or characteristic, but every embodiment may or may not necessarily include the particular feature, structure, or characteristic. Moreover, such phrases are not necessarily referring to the same embodiment. Further, where a particular feature, structure, or characteristic is described in connection with an embodiment, it is submitted that it is within the knowledge of one skilled in the art to affect such feature, structure, or characteristic in connection with other embodiments whether or not explicitly described. In addition, it should be understood that items in the list included in the form "at least one of a, B, and C" may include the following possible items: (A) (ii) a (B) (ii) a (C) (ii) a (A and B); (A and C); (B and C); or (A, B and C). Likewise, a listing of items in the form of "at least one of a, B, or C" may mean (a); (B) (ii) a (C) (ii) a (A and B); (A and C); (B and C); or (A, B and C).
In some cases, the disclosed embodiments may be implemented as hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored on one or more transitory or non-transitory machine-readable (e.g., computer-readable) storage media, which may be executed by one or more processors. A machine-readable storage medium may be implemented as a storage device, mechanism, or other physical structure (e.g., a volatile or non-volatile memory, a media disk, or other media other physical structure device) for storing or transmitting information in a form readable by a machine.
In the drawings, some structural or methodical features may be shown in a particular arrangement and/or ordering. Preferably, however, such specific arrangement and/or ordering is not necessary. Rather, in some embodiments, such features may be arranged in different ways and/or orders than as shown in the figures. Moreover, the inclusion of structural or methodical features in particular figures is not meant to imply that such features are required in all embodiments and that, in some embodiments, such features may not be included or may be combined with other features.
Referring to fig. 1, a flowchart of steps of embodiment 1 of a service publishing method of the present application is shown, which may specifically include the following steps:
step 101, in the process of starting an application program, acquiring a plurality of RPC services to be issued by a current service provider;
specifically, the RPC service is a service based on RPC (Remote Procedure Call Protocol) provided by a service provider (provider).
RPC is a protocol that requests services from a remote computer program over a network without knowledge of the underlying network technology. RPC employs a client (i.e., service consumer)/server (i.e., service provider) mode. The requesting program is a client and the service providing program is a server. First, the client calling process sends a calling message with process parameters to the service process and then waits for a response message. On the server side, the process remains in a sleep state until the arrival of the call information. When a calling message arrives, the server obtains the process parameters, calculates the result, sends the reply message, then waits for the next calling message, and finally, the client calls the process to receive the reply message, obtain the process result, and then calls execution to continue.
The service release in the embodiment of the application can be carried out based on the RPC framework, the RPC framework provides a programming framework for a user to transparently use the RPC capability, and after the user uses the RPC framework, the RPC behavior is completely hidden, like local call.
In a specific implementation, a registry may be included in the RPC framework, and the registry maintains information of all services exposed by the service provider, for example, the information of the services may include IP addresses, port numbers, and the like.
The responsibilities of the registry are well defined and may include the following functions:
1) the service provider sends some basic information of the service it provides to it;
2) a service consumer subscribes to a service;
3) and when the service provider instance is offline, notifying the service consumer that a certain service is offline in real time.
In addition, the registry also includes some service governance functions, such as:
1) service auditing, which is the simplest operation of service governance, because a certain service provider needs to be audited after being online, if the certain service provider is not audited, a lot of unnecessary troubles may be caused, for example, the service of a development environment is carelessly registered to the online service, and if the service passes through directly without auditing, an embarrassing situation that the online interface calls the offline service is caused;
2) a record of load policies, such as a random weighted policy by default, if the administrator wishes to change to a weighted polling policy, the service consumer needs to be notified of the change in access policy;
3) manually changing the access weight of a certain service, for example, when the default load of a certain service is 50, (maximum 100), but the machine pressure of the service instance is not high, and when the pressure of other service instances is high, the access weight of the service can be appropriately increased, but the weight of the service is not required to be changed by taking the service offline, so that the load of the service can be changed in a registry, and then a service consumer is notified, so that the load can be dynamically changed;
4) persistent operations, because the registry is stateless, if some previous audit information disappears after a certain registry instance is restarted, it is troublesome for the user to review one by one, and therefore it is necessary to log on the hard disk, and then read the information each time the registry instance is restarted.
The RPC framework can be a distributed service framework and can be used for application program communication in distributed deployment. That is, in step 101, the application is a distributed application, which may correspond to multiple machines, including multiple service providers and multiple service consumers.
During the starting process of the application program, many resources are in a constructed process (most typically, a local cache), and at this time, the performance of the application program is relatively poor. Therefore, in the embodiment of the application, in the starting process of the application, step 101 may be executed to obtain a plurality of RPC services to be issued by the current service provider, and then step 102 is executed to perform packet issuing on the RPC services to be issued.
In a specific implementation, when a SERVICE provider needs to PUBLISH a SERVICE, the SERVICE provider may send a registration request to a registry, as an example, the registration request may be represented as PUBLISH _ SERVICE, and then the registry may learn, from the PUBLISH _ SERVICE pushed by the SERVICE provider, that the SERVICE provider is to PUBLISH an RPC SERVICE.
In practice, one service provider may provide one or more services, for example, one machine may provide a plurality of services such as storage, query, and the like.
102, grouping the RPC services to be issued to obtain N groups of RPC services;
in the embodiment of the application, after the registry obtains a plurality of RPC services to be issued by each service provider, the plurality of RPC services may be divided into N groups, where N is a positive integer.
In a preferred embodiment of the present application, the step 102 may further include the following sub-steps:
substep S11, reading a service grouping policy preset in the configuration file;
and the substep S12, grouping the RPC service to be issued according to the service grouping strategy to obtain the corresponding N groups of services.
In a specific implementation, a user may set one or more service grouping policies in a configuration file through JVM parameter configuration, for example, the service grouping policies may include fixing the number of services (i.e., RPC services) configuring each group; and according to the total number of the services to be issued, carrying out halving according to a preset M group, and the like.
For example, assuming that M is the total number of services to be published, 1/4M may be taken as a group.
The registry can read the service grouping strategy set in the configuration file, if one service grouping strategy exists, the RPC service to be issued is grouped according to the service grouping strategy, and the corresponding N groups of services are obtained. Or, the registry can also show the service grouping strategy to the user, and after the user selects the service grouping strategy, the RPC service to be issued is grouped according to the service grouping strategy to obtain the corresponding N groups of services.
If the service grouping strategies are multiple, the multiple service grouping strategies can be displayed to the user, after the user selects a certain service grouping strategy, RPC services to be issued are grouped according to the selected service grouping strategy to obtain corresponding N groups of services, and the grouping condition is informed to the service provider.
It should be noted that the N groups of services may be services ordered in sequence, and the ordering in sequence may include: the services within a group are ordered in sequence, and the services between groups are ordered in sequence to ensure the order in which the services are published. For example, a service side publishes 6 services, which are a1, a2, A3, a4, a5 and A6, wherein each 2 services are divided into one group and three groups, which are C1(a1, a2), C2(A3, a4) and C3(a5 and A6), and the publishing sequence between the groups can be C1-C2-C3; the distribution order within the group may be A1-A2, A3-A4, A5-A6.
103, acquiring a real-time system first load value of the service provider when each group of RPC services is issued;
in the embodiment of the application, after N groups of services are obtained, the services can be exposed group by group, so that the purpose of dynamic grouping and publishing is achieved.
It should be noted that, each time a group of services is exposed, a plurality of services in the group are also exposed one by one.
In a preferred embodiment of the present application, step 103 may further be: and when each group of RPC services is issued, reading the specified file to acquire a first load value of the real-time system of the current service provider.
Specifically, the system Load is defined as an Average process tree running in a queue in a specific time interval, and the system Load can be generally represented by Load Average, where Load Average is positively correlated with the busy degree of the system, and a higher Load indicates that the system is busy.
The system first load value may be a CPU utilization in the system of the service provider. In an implementation, a service provider may calculate CPU utilization with a specified file.
As an example, the designated file may include a/proc/stat file that contains information about all CPU activities, all values in the file being accumulated from system startup to the current time.
After the service provider obtains the system first load value, the system first load value may be sent to the registry.
Of course, the registry may also calculate the system first load value in other ways, for example, the system load value of the current service provider may be calculated by the open source library oshi on github. The embodiments of the present application do not limit this.
104, if the first load value of the system is larger than a preset load threshold value, performing reverse registration on the RPC service currently issued by the service provider;
in the embodiment of the application, after the first load value of the system of a certain service provider which provides service currently is obtained by the registry, whether the first load value of the system is larger than a preset load threshold value is judged, if yes, the CPU of the service provider is occupied in a large amount, and the system is busy.
In practice, each server's machine has the ability to register or de-register itself with the registry to register or de-register its own services and expose the registered services. The JIT compiling of the class file is triggered after the registration center is registered, and the compiler thread occupied by the JIT compiler uses a large amount of CPU, so that in the embodiment of the application, when the first load value of the system of the service provider is larger than the preset load threshold value, the registered service can be subjected to de-registration after receiving the flow preheating.
In a preferred embodiment of the present application, step 104 may include the following sub-steps:
step S21, if the first load value of the system is larger than a preset load threshold value, receiving a reverse registration request for the service provider to perform reverse registration on the currently issued RPC service;
and a substep S22 of deregistering the corresponding RPC service based on the deregistration request.
In an embodiment of the present application, when the machine of the service provider determines that the system first load value of the current system is greater than the preset load threshold, a counterregistration request may be made to the registry to counterregister a currently published service, where the counterregistration request may include an identification of the service that requires counterregistration.
As an example, the anti-registration request may be described as PUBLISH _ CANCEL _ SERVICE.
And after receiving the PUBLISH _ CANCEL _ SERVICE pushed by the SERVICE provider, the registry performs de-registration on the corresponding SERVICE.
In practice, the registry may maintain a list of services for the registered services, and after the service provider registers one or more services with the registry, the registry may add the registered one or more services to the list of services and send the list of services to a service consumer (consumer), and each time an RPC call is made, the service consumer may select a service provider's machine from the list of services to make the call.
Accordingly, the registry may update the service list when a service provider deregisters a service.
In one embodiment, the updating may include deleting the service corresponding to the counterregistration from the service list.
Of course, the embodiment of the present application may also have other updating manners, for example, a preset anti-registration identifier is added to the service performing the anti-registration, and the embodiment of the present application does not limit this.
And after the service center updates the service list, the updated service list is sent to the service consumer so as to update the service list of the service consumer side.
In the updated service list received by the service consumer, the counterregistered service is not present or available, so that after JIT for each service, the counterregistered service is not exposed to the outside, so that no requests come in, i.e. no more traffic comes in, on the one hand, it is guaranteed that the request loop is routed to the non-restarted machine, on the other hand, all system load is used for JIT and performing other services, thereby improving the correctness and stability of the service.
It should be noted that, in order to ensure normal processing of the service, the service that is unregistered may be re-registered later.
And 105, if the first load value of the system is less than or equal to a preset load threshold value, issuing the next group of RPC services.
In a preferred embodiment of the present application, step 105 may comprise the following sub-steps:
substep S31, if the first load value of the system is less than or equal to a preset load threshold value, receiving a release request for the next group of RPC services sent by a service provider;
and a substep S32 of issuing a next set of RPC services based on the issuance request.
Specifically, after a group of services is published, the service provider calculates a current system first load value, and if the system first load value is less than or equal to a preset load threshold value, it indicates that the current system is not overloaded, at this time, the service provider may send a publication request to the registry to request the registry to publish a next group of services, and the registry continues to publish the next group of services based on the publication request.
After the next group of services are released, the service provider continues to calculate the load of the current system, if the load is greater than a preset load threshold value, the service provider registers the previously exposed service with the registry, if the load is less than or equal to the preset load threshold value, the provider requests the registry to expose the next group of services, and so on until all the services are released.
After all the services are released, the embodiment of the present application may further include the following steps:
after all services are released, acquiring a second system load value of the service provider; and if the second load value of the system is larger than a preset load threshold value, performing anti-registration on all issued services in the service provider.
In a specific implementation, a data structure may be set in the RPC framework to store all services, and the states issued by the services may be marked, so that the registry may know how many services have been issued and how many services have not been issued according to the marked states.
After all the services are released, the service provider can calculate the system load again to obtain a second load value of the system, if the second load value of the system is higher than the preset load threshold value, the load of the current system is still high, and at the moment, the service provider can request the registration center to register all the services again.
In a preferred embodiment of the present application, the method may further include the following steps:
after the preset silent time period, acquiring a third system load value of the service provider; and when the third load value of the system is smaller than or equal to a preset load threshold value, re-registering the service subjected to the de-registration.
In the embodiment of the application, after all the services are unregistered and after a period of silence, if the system load value of the service provider is less than or equal to the preset load threshold, the unregistered services are unregistered again.
When all RPC services are subjected to JIT preheating, the RPC service framework registers all the services, and the system starts to receive the request and work.
The embodiment of the application realizes dynamic packet service release based on system load, exposes the services one by one, calculates the load of the operating system when exposing a group of services, and judges whether the registered services need to be unregistered. If the load of the system exceeds a preset load threshold (meaning the system is busy), the registered services are unregistered. JIT compilation of class files ensures that after JIT for each service, there is no more traffic entering for that service, on the one hand, ensures that the request is routed back to the non-rebooted machine, and on the other hand, all system load is used for JIT and other services are performed, thereby improving the accuracy and stability of the traffic.
In order to enable those skilled in the art to better understand the embodiments of the present application, the following description is provided with a specific example.
As shown in the service publishing diagram of fig. 2, it is assumed that a certain web application has an ordering function, and the services related to the ordering function include a plurality of services such as opening a product detail page, joining a shopping cart, opening a shopping cart, selecting a product, and settling accounts. The service hierarchical publishing is carried out by adopting the following steps:
1. when the web application is just started, for a plurality of services to be published, the services are cut into N layers for publishing, and the number of the services in each layer is determined.
2. After each layer of service is issued, entering a quiet period, calculating the system Load of the current machine, and if the system Load is higher than a preset threshold value, performing anti-registration on the service issued before; in step 2, let the JVM preheat the code of these services, log off the published services so that they are not exposed and thus no request comes in; continuing to execute the step 4;
3. if the system load is lower than the preset threshold value, continuously judging whether hierarchical release is needed, if so, returning to the step 2, but if not, executing the step 4;
4. judging whether the current system load is still higher than a threshold value; if yes, logging off all services, and after a period of silence, reissuing all services; if not, the hierarchical distribution is finished, and the system starts to receive the request and work.
In this example, the RPC service framework may make a decision when the application starts the exposed service, induce JIT with different codes through registration/de-registration of different services, de-register the registered service after receiving flow preheating, ensure that machine resources are preferentially used for JIT, and also ensure the success rate of the service.
Referring to fig. 3, a flowchart of steps of a method embodiment 2 for service publishing in the present application is shown, where the embodiment of the present application may be described from the perspective of a service provider, and specifically may include the following steps:
step 301, in the process of starting an application, determining a plurality of Remote Procedure Call (RPC) services to be issued;
the application is a distributed application, which may correspond to multiple machines, including multiple service providers and multiple service consumers.
During the startup of the application program, the service provider can determine the number of services it provides for the application as the plurality of RPC services to be published.
Step 302, aiming at the RPC services, sending a registration request to a registration center;
after the service provider determines a plurality of RPC services to be published, the service provider may request the registry to register the plurality of RPC services by sending a registration request to the registry.
As an example, the registration request may be denoted as PUBLISH _ SERVICE.
The registration center is used for grouping the RPC services to be issued based on the registration request to obtain N groups of RPC services, wherein N is a positive integer.
Specifically, the registry may learn, from the PUBLISH _ SERVICE pushed by the SERVICE provider, that the SERVICE provider wants to PUBLISH the RPC SERVICE, and then, the registry may read a SERVICE grouping policy set in a preset configuration file, group the RPC SERVICEs to be published, obtain N groups of corresponding SERVICEs, and notify the SERVICE provider of the grouping condition.
303, acquiring a real-time first load value of the system when each group of RPC services is issued;
in the embodiment of the application, after obtaining N groups of services, the registry can expose the services group by group, so as to achieve the purpose of dynamic group distribution.
It should be noted that, each time a group of services is exposed, a plurality of services in the group are also exposed one by one.
When the registry exposes a set of services, the service provider is informed that the service provider can calculate a first load value for the system with the specified file.
Step 304, if the first load value of the system is greater than a preset load threshold value, sending a reverse registration request to the registration center;
when the service provider determines that the first system load value of the current system is greater than the preset load threshold value, a counterregistration request can be made to the registration center to counterregister the currently issued service, and the counterregistration request can include the identification of the service requiring counterregistration.
As an example, the anti-registration request may be described as PUBLISH _ CANCEL _ SERVICE.
The registration center is used for performing anti-registration on the RPC service currently issued by the service provider based on the anti-registration request.
In practice, the registry may maintain a list of services registered for the service provider, and after the service provider registers one or more services with the registry, the registry may add the registered one or more services to the list of services and send the list of services to a service consumer (consumer), and each time an RPC call is made, the client may select a service provider's machine from the list of services to make the call.
Accordingly, the registry may update the service list when a service provider deregisters a service.
And 305, if the first load value of the system is less than or equal to a preset load threshold value, sending a next group of RPC service issuing requests to the registry.
The registry is configured to publish the next set of RPC services based on the publication request.
Specifically, after a group of services is published, the service provider calculates a current system first load value, and if the system first load value is less than or equal to a preset load threshold value, it indicates that the current system is not overloaded, at this time, the service provider may send a publication request to the registry to request the registry to publish a next group of services, and the registry continues to publish the next group of services based on the publication request.
After the next group of services are released, the service provider continues to calculate the load of the current system, if the load is greater than a preset load threshold value, the service provider registers the previously exposed service with the registry, if the load is less than or equal to the preset load threshold value, the provider requests the registry to expose the next group of services, and so on until all the services are released.
After all the services are released, the embodiment of the present application may further include the following steps:
when all services are released, acquiring a second load value of the system; and if the second load value of the system is greater than the preset load threshold value, sending a logout request for deregistering all services to a registration center.
The registry is configured to deregister all published services in the service provider based on the deregistration request.
In a specific implementation, a data structure may be set in the RPC framework to store all services, and the states issued by the services may be marked, so that the registry may know how many services have been issued and how many services have not been issued according to the marked states. And after all the services are released, sending release completion information to the service provider, and after the service provider receives the release completion information, determining that all the services are released completely.
After all services are released, the service provider can calculate the system load again to obtain a second load value of the system, if the second load value of the system is higher than a preset load threshold value, the load of the current system is still high, and at this time, the service provider can generate a logout request which is used for requesting a registration center to reversely register all services of the service provider.
After receiving the logout request, the registry performs a reverse registration on all the services of the service provider, updates the service list and sends the service list to the service consumer.
In a preferred embodiment of the present application, the method may further include the following steps:
after the preset silent time period, acquiring a third system load value of the service provider; and when the third load value of the system is smaller than or equal to the preset load threshold value, sending a re-registration request to the registration center to request the registration center to re-register the service for performing the de-registration.
In the embodiment of the application, after all the services are unregistered and after a period of silence, if the system load value of the service provider is less than or equal to the preset load threshold, the unregistered services are unregistered again.
When all RPC services are subjected to JIT preheating, the RPC service framework registers all the services, and the system starts to receive the request and work.
In the embodiment of the application, dynamic packet service distribution is realized based on the system load of a service provider, services are exposed one by one, and the load of an operating system is calculated when each group of services are exposed to judge whether registered services need to be unregistered. If the load of the system exceeds a preset load threshold (meaning the system is busy), the registered services are unregistered. JIT compilation of class files ensures that after JIT for each service, there is no more traffic entering for that service, on the one hand, ensures that the request is routed back to the non-rebooted machine, and on the other hand, all system load is used for JIT and other services are performed, thereby improving the accuracy and stability of the traffic.
Referring to fig. 4, a flowchart of steps of embodiment 3 of a service publishing method according to the present application is shown, which may specifically include the following steps:
step 401, receiving a service list sent by a registration center;
in practice, each server's machine has the ability to register or de-register itself with the registry to register or de-register its own services. The registry may maintain a service list for registered services, which may include an identification of one or more services offered by one or more service providers.
After the service provider registers one or more services with the registry, the registry may add the registered one or more services to a service list and send the service list to a service consumer (consumer), and each time an RPC call is made, the service consumer may select a service provider's machine from the service list to make the call.
Step 402, receiving an updated service list sent by a registration center;
in the embodiment of the application, the updated service list can be obtained by grouping the RPC services to be issued by the current service provider after the current RPC services to be issued are acquired by the registration center in the process of application starting, so that N groups of RPC services are obtained, and when each group of RPC services are issued, the first real-time system load value of the service provider is acquired, and when the first system load value is greater than the preset load threshold value, the list is obtained after the RPC services currently issued by the service provider are subjected to reverse registration.
The registry may update the list of services when the service provider proposes to de-register the service.
In one embodiment, the updating may include deleting the service corresponding to the counterregistration from the service list.
Of course, the embodiment of the present application may also have other updating manners, for example, a preset anti-registration identifier is added to the service performing the anti-registration, and the embodiment of the present application does not limit this.
And after the service center updates the service list, sending the updated service list to the service consumer.
Step 403, replacing the service list with the updated service list.
After obtaining the updated list, the service consumer replaces the service list with the updated service list, and updates the service list on the client side are performed.
In the updated service list received by the service consumer, the counterregistered service is not present or available, so that after JIT for each service, the counterregistered service is not exposed to the outside, so that no requests come in, i.e. no more traffic comes in, on the one hand, it is guaranteed that the request loop is routed to the non-restarted machine, on the other hand, all system load is used for JIT and performing other services, thereby improving the correctness and stability of the service.
In a preferred embodiment of the present application, after all services are released, the service provider may calculate the system load again to obtain a second load value of the system, and if the second load value of the system is higher than the preset load threshold, it indicates that the load of the current system is still high, at this time, the service provider may generate a logout request, where the logout request is used to request the registry to deregister all services of the service provider.
When the registration center logs out all the services of the service provider, the service list is updated, the records of the logged-out services are deleted, the updated service list is sent to the service consumer, and the latest received service list is replaced by the previous service list at the service consumer side so as to update the service list.
In a preferred embodiment of the present application, after a period of time elapses after all the services are unregistered, if the system load value of the service provider is less than or equal to the preset load threshold, the service provider may request the registration center to re-register the unregistered services.
When the registration center re-registers the service of the de-registration, the service list is updated, the record of the service of the re-registration is added, the updated service list is sent to the service consumer, and the latest received service list is replaced by the previous service list at the service consumer side so as to update the service list.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the embodiments are not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the embodiments. Further, those skilled in the art will also appreciate that the embodiments described in the specification are presently preferred and that no particular act is required of the embodiments of the application.
Referring to fig. 5, a block diagram of a device embodiment 1 for service distribution according to the present application is shown, which may include the following modules:
a to-be-issued service obtaining module 501, configured to obtain, in a process of starting an application program, multiple Remote Procedure Call (RPC) services to be issued by a current service provider;
a service grouping module 502, configured to group the RPC services to be issued to obtain N groups of RPC services, where N is a positive integer;
the system load obtaining module 503 is configured to obtain a real-time system first load value of the service provider each time a group of RPC services is issued;
a deregistration module 504, configured to deregister the RPC service currently issued by the service provider when the first load value of the system is greater than a preset load threshold;
and a layer-by-layer issuing module 505, configured to issue the next group of RPC services when the first load value of the system is less than or equal to a preset load threshold value.
In a preferred embodiment of the embodiments of the present application, the apparatus further comprises:
the second load value calculation module is used for acquiring a second load value of the system of the service provider after all services are released;
and the logout module is used for performing reverse registration on all the issued services in the service provider when the second load value of the system is greater than a preset load threshold value.
In a preferred embodiment of the embodiments of the present application, the apparatus further comprises:
the third load value calculating module is used for acquiring a third load value of the system of the service provider after the preset silent time period;
and the re-registration module is used for re-registering the service subjected to the de-registration when the third load value of the system is smaller than or equal to a preset load threshold value.
In a preferred embodiment of the embodiments of the present application, the method further includes:
the service list adding module is used for adding the registered one or more services into a preset service list after the service provider registers the one or more services;
and the service list sending module is used for sending the service list to the service consumer.
In a preferred embodiment of the present application, the anti-registration module 504 includes:
the reverse registration request receiving submodule is used for receiving a reverse registration request of the service provider for performing reverse registration on the currently issued RPC service if the first load value of the system is greater than a preset load threshold value;
and the service anti-registration submodule is used for carrying out anti-registration on the corresponding RPC service based on the anti-registration request.
In a preferred embodiment of the embodiments of the present application, the apparatus further comprises:
the list updating module is used for updating the service list when the service provider performs service de-registration, wherein the updating comprises deleting the service corresponding to the de-registration;
and the update list sending module is used for sending the updated service list to the service consumer so as to update the service list at the service consumer side.
In a preferred embodiment of the present application, the layer-by-layer issuing module 505 includes:
the release request receiving submodule is used for receiving a release request which is sent by a service provider and aims at the next group of RPC services if the first load value of the system is smaller than or equal to a preset load threshold value;
and the service issuing submodule is used for issuing the next group of RPC services based on the issuing request.
In a preferred embodiment of the present application, the service grouping module 502 includes:
the grouping strategy acquisition submodule is used for reading a service grouping strategy preset in the configuration file;
and the grouping submodule is used for grouping the RPC service to be issued according to the service grouping strategy to obtain the corresponding N groups of services.
In a preferred embodiment of the present application, the system load obtaining module 503 is further configured to:
and when each group of RPC services is issued, reading the specified file to acquire a first load value of the real-time system of the current service provider.
For the apparatus embodiment of fig. 5, since it is basically similar to the method embodiment of fig. 1, the description is simple, and for the relevant points, reference may be made to partial description of the method embodiment.
Referring to fig. 6, a block diagram of a device embodiment 2 for service distribution according to the present application is shown, which may include the following modules:
a to-be-issued service determining module 601, configured to determine, in an application starting process, a plurality of remote procedure call RPC services to be issued;
a registration request sending module 602, configured to send a registration request to a registration center for the plurality of RPC services, where the registration center is configured to group the RPC services to be issued based on the registration request to obtain N groups of RPC services, where N is a positive integer;
the system load determining module 603 is configured to obtain a real-time first load value of the system when each group of RPC services is issued;
a reverse registration request sending module 604, configured to send a reverse registration request to the registration center when the first load value of the system is greater than a preset load threshold, where the registration center is configured to perform reverse registration on an RPC service currently issued by the service provider based on the reverse registration request;
and the issuing request sending module 605 is configured to send, to the registry, an issuing request of the next set of RPC services when the first load value of the system is less than or equal to the preset load threshold value, where the registry is configured to issue the next set of RPC services based on the issuing request.
In a preferred embodiment of the embodiments of the present application, the apparatus further comprises:
the second load value calculation module is used for acquiring a second load value of the system after all services are released;
and the logout request sending module is used for sending a logout request for deregistering all services to a registration center if the second load value of the system is greater than a preset load threshold value, and the registration center is used for performing the deregistration on all issued services in the service provider based on the logout request.
In a preferred embodiment of the embodiments of the present application, the apparatus further comprises:
the third load value calculating module is used for acquiring a third load value of the system of the service provider after the preset silent time period;
and a re-registration request sending module, configured to send a re-registration request to the registration center when the third load value of the system is less than or equal to a preset load threshold value, so as to request the registration center to re-register the service subjected to de-registration.
For the apparatus embodiment of fig. 6, since it is basically similar to the method embodiment described above, the description is simple, and for the relevant points, reference may be made to part of the description of the method embodiment.
Referring to fig. 7, a block diagram of a device embodiment 3 for service distribution according to the present application is shown, which may include the following modules:
a service list receiving module 701, configured to receive a service list sent by a registry, where the service list includes identifiers of one or more services provided by one or more service providers;
an update list receiving module 702, configured to receive an updated service list sent by a registry, where the updated service list is a list obtained by grouping a plurality of remote procedure call RPC services to be issued by a current service provider in an application starting process of the registry, and obtaining N groups of RPC services, and when each group of RPC services is issued, obtaining a real-time system first load value of the service provider, and when the system first load value is greater than a preset load threshold, performing reverse registration on the RPC service currently issued by the service provider;
a list updating module 703, configured to replace the service list with the updated service list.
For the apparatus embodiment of fig. 7, since it is basically similar to the method embodiment described above, the description is simple, and for the relevant points, reference may be made to part of the description of the method embodiment.
An embodiment of the present application further provides a system for service distribution, where the system includes:
one or more processors;
a memory; and
one or more modules stored in the memory and configured to be executed by the one or more processors, the one or more modules having the functionality to:
in the starting process of an application program, acquiring a plurality of Remote Procedure Call (RPC) services to be issued by a current service provider;
grouping the RPC services to be issued to obtain N groups of RPC services, wherein N is a positive integer;
when each group of RPC services is issued, acquiring a real-time system first load value of the service provider;
if the first load value of the system is larger than a preset load threshold value, performing anti-registration on the RPC service currently issued by the service provider;
and if the first load value of the system is less than or equal to the preset load threshold value, issuing the next group of RPC services.
Optionally, the one or more modules may have the following functions:
after all services are released, acquiring a second system load value of the service provider;
and if the second load value of the system is larger than a preset load threshold value, performing anti-registration on all issued services in the service provider.
Optionally, the one or more modules may have the following functions:
after the preset silent time period, acquiring a third system load value of the service provider;
and when the third load value of the system is smaller than or equal to a preset load threshold value, re-registering the service subjected to the de-registration.
Optionally, the one or more modules may have the following functions:
after the service provider registers one or more services, adding the registered one or more services to a preset service list;
and sending the service list to a service consumer.
Optionally, the one or more modules may have the following functions:
if the first load value of the system is larger than a preset load threshold value, receiving a reverse registration request for the service provider to perform reverse registration on the currently issued RPC service;
and performing anti-registration on the corresponding RPC service based on the anti-registration request.
Optionally, the one or more modules may have the following functions:
when the service provider performs service deregistration, updating the service list, wherein the updating comprises deleting the service corresponding to the deregistration;
and sending the updated service list to the service consumer to update the service list of the service consumer side.
Optionally, the one or more modules may have the following functions:
if the first load value of the system is smaller than or equal to the preset load threshold value, receiving a release request aiming at the next group of RPC services sent by a service provider;
and issuing the next group of RPC services based on the issuing request.
Optionally, the one or more modules may have the following functions:
reading a service grouping strategy preset in a configuration file;
and grouping the RPC service to be issued according to the service grouping strategy to obtain a corresponding N group of services.
Optionally, the one or more modules may have the following functions:
and when each group of RPC services is issued, reading the specified file to acquire a first load value of the real-time system of the current service provider.
An embodiment of the present application further provides a server for service distribution, where the server includes:
one or more processors;
a memory; and
one or more modules stored in the memory and configured to be executed by the one or more processors, the one or more modules having the functionality to:
in the application starting process, determining a plurality of Remote Procedure Call (RPC) services to be issued;
aiming at the RPC services, sending registration requests to a registration center, wherein the registration center is used for grouping the RPC services to be issued based on the registration requests to obtain N groups of RPC services, and N is a positive integer;
acquiring a real-time first load value of the system when each group of RPC services is issued;
if the first load value of the system is larger than a preset load threshold value, sending a reverse registration request to a registration center, wherein the registration center is used for performing reverse registration on the RPC service currently issued by the service provider based on the reverse registration request;
and if the first load value of the system is smaller than or equal to the preset load threshold value, sending a next group of RPC service issuing request to the registration center, wherein the registration center is used for issuing the next group of RPC service based on the issuing request.
Optionally, the one or more modules may have the following functions:
when all services are released, acquiring a second load value of the system; and if the second load value of the system is greater than the preset load threshold value, sending a logout request for deregistering all services to a registration center, wherein the registration center is used for deregistering all published services in the service provider based on the logout request.
Optionally, the one or more modules may have the following functions:
after the preset silent time period, acquiring a third system load value of the service provider;
and when the third load value of the system is smaller than or equal to the preset load threshold value, sending a re-registration request to the registration center to request the registration center to re-register the service for performing the de-registration.
An embodiment of the present application further provides a client for service publishing, where the client includes:
one or more processors;
a memory; and
one or more modules stored in the memory and configured to be executed by the one or more processors, the one or more modules having the functionality to:
receiving a service list sent by a registry, wherein the service list comprises identifications of one or more services provided by one or more service providers;
receiving an updated service list sent by a registry, wherein the updated service list is a list obtained by grouping a plurality of Remote Procedure Call (RPC) services to be issued by a current service provider after the registry acquires the RPC services to be issued in the application starting process, so as to obtain N groups of RPC services, acquiring a real-time system first load value of the service provider when each group of RPC services is issued, and performing reverse registration on the RPC services currently issued by the service provider when the system first load value is greater than a preset load threshold value;
replacing the service list with the updated service list.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
Embodiments of the present disclosure may be implemented as a system using any suitable hardware and/or software for the desired configuration. Fig. 8 schematically illustrates an exemplary system 800 that can be used to implement various embodiments described in this disclosure.
For one embodiment, fig. 8 illustrates an exemplary system 800 having one or more processors 802, a system control module (chipset) 804 coupled to at least one of the processor(s) 802, a system memory 806 coupled to the system control module 804, a non-volatile memory (NVM)/storage 808 coupled to the system control module 804, one or more input/output devices 810 coupled to the system control module 804, and a network interface 812 coupled to the system control module 806.
The processor 802 may include one or more single-core or multi-core processors, and the processor 802 may include any combination of general-purpose or special-purpose processors (e.g., graphics processors, application processors, baseband processors, etc.). In some embodiments, the system 800 can be used as an RPC service framework as described in embodiments herein. In other embodiments, the system 800 can function as a registry as described in the embodiment shown in FIG. 1 or any of the other described embodiments. In other embodiments, the system 800 can act as a service provider or a service consumer.
In some embodiments, system 800 may include one or more computer-readable media (e.g., system memory 806 or NVM/storage 808) having instructions and one or more processors 802 that, in conjunction with the one or more computer-readable media, are configured to execute the instructions to implement modules to perform the actions described in this disclosure.
For one embodiment, the system control module 804 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 802 and/or any suitable device or component in communication with the system control module 804.
The system control module 804 may include a memory controller module to provide an interface to the system memory 806. The memory controller module may be a hardware module, a software module, and/or a firmware module.
System memory 806 may be used, for example, to load and store data and/or instructions for system 800. For one embodiment, system memory 806 may include any suitable volatile memory, such as suitable DRAM. In some embodiments, the system memory 806 may include a double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).
For one embodiment, the system control module 804 may include one or more input/output controllers to provide an interface to the NVM/storage 808 and input/output device(s) 810.
For example, NVM/storage 808 may be used to store data and/or instructions. NVM/storage 808 may include any suitable non-volatile memory (e.g., flash memory) and/or may include any suitable non-volatile storage device(s) (e.g., one or more Hard Disk Drives (HDDs), one or more Compact Disc (CD) drives, and/or one or more Digital Versatile Disc (DVD) drives).
NVM/storage 808 may include storage resources that are physically part of the device on which system 800 is installed, or it may be accessible by the device and need not be part of the device. For example, the NVM/storage 808 may be accessible over a network via the input/output device(s) 810.
Input/output device(s) 810 may provide an interface for system 800 to communicate with any other suitable device, input/output device(s) 810 may include communication components, audio components, sensor components, and so forth. Network interface 812 may provide an interface for system 800 to communicate over one or more networks, and system 800 may communicate wirelessly with one or more components of a wireless network according to any of one or more wireless network standards and/or protocols, such as to access a wireless network based on a communication standard, such as WiFi, 2G, or 3G, or a combination thereof.
For one embodiment, at least one of the processor(s) 802 may be packaged together with logic for one or more controller(s) (e.g., memory controller module) of the system control module 804. For one embodiment, at least one of the processor(s) 802 may be packaged together with logic for one or more controller(s) of the system control module 804 to form a System In Package (SiP). For one embodiment, at least one of the processor(s) 802 may be integrated on the same die with logic for one or more controller(s) of the system control module 804. For one embodiment, at least one of the processor(s) 802 may be integrated on the same die with logic of one or more controllers of the system control module 804 to form a system on a chip (SoC).
In various embodiments, system 800 may be, but is not limited to being: a distributed system, a server, a client, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet, a netbook, etc.). In various embodiments, system 800 may have more or fewer components and/or different architectures. For example, in some embodiments, system 800 includes one or more cameras, a keyboard, a Liquid Crystal Display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an Application Specific Integrated Circuit (ASIC), and speakers.
Wherein, if the display includes a touch panel, the display screen may be implemented as a touch screen display to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
The present application further provides a non-volatile readable storage medium, where one or more modules (programs) are stored in the storage medium, and when the one or more modules are applied to a terminal device, the one or more modules may cause the terminal device to execute instructions (instructions) of method steps in the present application.
Referring to fig. 9, a schematic structural diagram of an embodiment of a service publishing system of the present application is shown, which may include a registry 901, a service provider 902, and a service consumer 903;
the service provider 902 determines a plurality of Remote Procedure Call (RPC) services to be issued, and generates registration requests for the plurality of RPC services;
the registration center 901 generates a service list based on a registration request sent by the server, groups the RPC services to be issued to obtain N groups of RPC services, and acquires a real-time system first load value of the service provider when each group of RPC services is issued; if the first load value of the system is larger than a preset load threshold value, performing anti-registration on the RPC service currently issued by the service provider; if the first load value of the system is smaller than or equal to a preset load threshold value, issuing the next group of RPC services; updating the service list;
the service consumer 903 receives the service list and the updated service list sent by the registry, and replaces the service list with the updated service list.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one of skill in the art, embodiments of the present application may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program operating instructions. These computer program operating instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the operating instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program operational instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the operational instructions stored in the computer-readable memory produce an article of manufacture including operational instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program operational instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the operational instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present application have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the true scope of the embodiments of the application.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The method, the device, the system, the server and the client for service release provided by the present application are introduced in detail, and a specific example is applied in the present application to explain the principle and the implementation of the present application, and the description of the above embodiment is only used to help understanding the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (22)

1. A service publishing system, comprising a registry, a service provider, and a service consumer;
the service provider determines a plurality of Remote Procedure Call (RPC) services to be issued and generates registration requests aiming at the RPC services;
the registration center generates a service list based on a registration request sent by the server, groups the RPC services to be issued to obtain N groups of RPC services, and acquires a real-time system first load value of the service provider when each group of RPC services is issued; if the first load value of the system is larger than a preset load threshold value, performing anti-registration on the RPC service currently issued by the service provider; if the first load value of the system is smaller than or equal to a preset load threshold value, issuing the next group of RPC services; updating the service list;
and the service consumer receives the service list and the updated service list sent by the registry and replaces the service list with the updated service list.
2. A method for service publishing, applied to a registry, the method comprising:
in the starting process of an application program, acquiring a plurality of Remote Procedure Call (RPC) services to be issued by a current service provider;
grouping the RPC services to be issued to obtain N groups of RPC services, wherein N is a positive integer;
when each group of RPC services is issued, acquiring a real-time system first load value of the service provider;
if the first load value of the system is larger than a preset load threshold value, performing anti-registration on the RPC service currently issued by the service provider;
and if the first load value of the system is less than or equal to the preset load threshold value, issuing the next group of RPC services.
3. The method of claim 2, further comprising:
after all services are released, acquiring a second system load value of the service provider;
and if the second load value of the system is larger than a preset load threshold value, performing anti-registration on all issued services in the service provider.
4. The method of claim 3, further comprising:
after the preset silent time period, acquiring a third system load value of the service provider;
and when the third load value of the system is smaller than or equal to a preset load threshold value, re-registering the service subjected to the de-registration.
5. The method according to any of claims 2-4, wherein after the step of obtaining the real-time system first load value of the service provider every time a group of RPC services is published, the method further comprises:
after the service provider registers one or more services, adding the registered one or more services to a preset service list;
and sending the service list to a service consumer.
6. The method of claim 5, wherein the step of deregistering the RPC service currently issued by the service provider if the system first load value is greater than a preset load threshold comprises:
if the first load value of the system is larger than a preset load threshold value, receiving a reverse registration request for the service provider to perform reverse registration on the currently issued RPC service;
and performing anti-registration on the corresponding RPC service based on the anti-registration request.
7. The method of claim 6, further comprising:
when the service provider performs service deregistration, updating the service list, wherein the updating comprises deleting the service corresponding to the deregistration;
and sending the updated service list to the service consumer to update the service list of the service consumer side.
8. The method of claim 2, wherein the step of issuing the next set of RPC services if the system first load value is less than or equal to a preset load threshold comprises:
if the first load value of the system is smaller than or equal to the preset load threshold value, receiving a release request aiming at the next group of RPC services sent by a service provider;
and issuing the next group of RPC services based on the issuing request.
9. The method of claim 2, wherein the step of grouping the RPC services to be published to obtain N groups of RPC services comprises:
reading a service grouping strategy preset in a configuration file;
and grouping the RPC service to be issued according to the service grouping strategy to obtain a corresponding N group of services.
10. The method of claim 2, wherein the step of obtaining the real-time system first load value of the service provider each time a set of RPC services is published comprises:
and when each group of RPC services is issued, reading the specified file to acquire a first load value of the real-time system of the current service provider.
11. A method for service publishing is applied to a service provider, and is characterized in that the method comprises the following steps:
in the application starting process, determining a plurality of Remote Procedure Call (RPC) services to be issued;
aiming at the RPC services, sending registration requests to a registration center, wherein the registration center is used for grouping the RPC services to be issued based on the registration requests to obtain N groups of RPC services, and N is a positive integer;
acquiring a real-time first load value of the system when each group of RPC services is issued;
if the first load value of the system is larger than a preset load threshold value, sending a reverse registration request to a registration center, wherein the registration center is used for performing reverse registration on the RPC service currently issued by the service provider based on the reverse registration request;
and if the first load value of the system is smaller than or equal to the preset load threshold value, sending a next group of RPC service issuing request to the registration center, wherein the registration center is used for issuing the next group of RPC service based on the issuing request.
12. The method of claim 11, further comprising:
when all services are released, acquiring a second load value of the system; and if the second load value of the system is greater than the preset load threshold value, sending a logout request for deregistering all services to a registration center, wherein the registration center is used for deregistering all published services in the service provider based on the logout request.
13. The method of claim 12, further comprising:
after the preset silent time period, acquiring a third system load value of the service provider;
and when the third load value of the system is smaller than or equal to the preset load threshold value, sending a re-registration request to the registration center to request the registration center to re-register the service for performing the de-registration.
14. A method for service update is applied to a service consumer, and is characterized by comprising the following steps:
receiving a service list sent by a registry, wherein the service list comprises identifications of one or more services provided by one or more service providers;
receiving an updated service list sent by a registry, wherein the updated service list is a list obtained by grouping a plurality of Remote Procedure Call (RPC) services to be issued by a current service provider after the registry acquires the RPC services to be issued in the application starting process, so as to obtain N groups of RPC services, acquiring a real-time system first load value of the service provider when each group of RPC services is issued, and performing reverse registration on the RPC services currently issued by the service provider when the system first load value is greater than a preset load threshold value;
replacing the service list with the updated service list.
15. An apparatus for service publishing, the apparatus comprising:
the system comprises a to-be-issued service acquisition module, a Remote Procedure Call (RPC) service acquisition module and a Remote Procedure Call (RPC) service release module, wherein the to-be-issued service acquisition module is used for acquiring a plurality of RPC services to be issued by a current service provider in the starting process of an application program;
the service grouping module is used for grouping the RPC service to be issued to obtain N groups of RPC services, wherein N is a positive integer;
the system load acquisition module is used for acquiring a real-time system first load value of the service provider when each group of RPC services is issued;
the reverse registration module is used for performing reverse registration on the RPC service currently issued by the service provider when the first load value of the system is greater than a preset load threshold value;
and the layer-by-layer issuing module is used for issuing the next group of RPC services when the first load value of the system is less than or equal to a preset load threshold value.
16. An apparatus for service publishing, the apparatus comprising:
the device comprises a to-be-issued service determining module, a Remote Procedure Call (RPC) service issuing module and a Remote Procedure Call (RPC) service issuing module, wherein the to-be-issued service determining module is used for determining a plurality of RPC services to be issued in the application starting process;
a registration request sending module, configured to send a registration request to a registration center for the plurality of RPC services, where the registration center is configured to group the RPC services to be issued based on the registration request to obtain N groups of RPC services, where N is a positive integer;
the system load determining module is used for acquiring a real-time first load value of the system when each group of RPC services is issued;
the system comprises a reverse registration request sending module, a registration center and a service provider, wherein the reverse registration request sending module is used for sending a reverse registration request to the registration center when a first load value of the system is larger than a preset load threshold value, and the registration center is used for performing reverse registration on the RPC service currently issued by the service provider based on the reverse registration request;
and the issuing request sending module is used for sending the issuing request of the next group of RPC services to the registration center when the first load value of the system is less than or equal to the preset load threshold value, and the registration center is used for issuing the next group of RPC services based on the issuing request.
17. An apparatus for service update, comprising:
the service list receiving module is used for receiving a service list sent by the registration center, wherein the service list comprises identifications of one or more services provided by one or more service providers;
the system comprises an update list receiving module, an update list receiving module and a list sending module, wherein the update list receiving module is used for receiving an updated service list sent by a registration center, the updated service list is obtained by grouping a plurality of Remote Procedure Call (RPC) services to be issued by a current service provider in the process of starting an application by the registration center to obtain N groups of RPC services, when each group of RPC services are issued, a real-time system first load value of the service provider is obtained, and when the system first load value is larger than a preset load threshold value, the RPC services currently issued by the service provider are subjected to reverse registration;
a list update module for replacing the service list with the updated service list.
18. A system for service publishing, the system comprising:
one or more processors;
a memory; and
one or more modules stored in the memory and configured to be executed by the one or more processors, the one or more modules having the functionality to:
in the starting process of an application program, acquiring a plurality of Remote Procedure Call (RPC) services to be issued by a current service provider;
grouping the RPC services to be issued to obtain N groups of RPC services, wherein N is a positive integer;
when each group of RPC services is issued, acquiring a real-time system first load value of the service provider;
if the first load value of the system is larger than a preset load threshold value, performing anti-registration on the RPC service currently issued by the service provider;
and if the first load value of the system is less than or equal to the preset load threshold value, issuing the next group of RPC services.
19. A server for service publishing, the server comprising:
one or more processors;
a memory; and
one or more modules stored in the memory and configured to be executed by the one or more processors, the one or more modules having the functionality to:
in the application starting process, determining a plurality of Remote Procedure Call (RPC) services to be issued;
aiming at the RPC services, sending registration requests to a registration center, wherein the registration center is used for grouping the RPC services to be issued based on the registration requests to obtain N groups of RPC services, and N is a positive integer;
acquiring a real-time first load value of the system when each group of RPC services is issued;
if the first load value of the system is larger than a preset load threshold value, sending a reverse registration request to a registration center, wherein the registration center is used for performing reverse registration on the RPC service currently issued by the service provider based on the reverse registration request;
and if the first load value of the system is smaller than or equal to the preset load threshold value, sending a next group of RPC service issuing request to the registration center, wherein the registration center is used for issuing the next group of RPC service based on the issuing request.
20. A client for service publishing, the client comprising:
one or more processors;
a memory; and
one or more modules stored in the memory and configured to be executed by the one or more processors, the one or more modules having the functionality to:
receiving a service list sent by a registry, wherein the service list comprises identifications of one or more services provided by one or more service providers;
receiving an updated service list sent by a registry, wherein the updated service list is a list obtained by grouping a plurality of Remote Procedure Call (RPC) services to be issued by a current service provider after the registry acquires the RPC services to be issued in the application starting process, so as to obtain N groups of RPC services, acquiring a real-time system first load value of the service provider when each group of RPC services is issued, and performing reverse registration on the RPC services currently issued by the service provider when the system first load value is greater than a preset load threshold value;
replacing the service list with the updated service list.
21. An apparatus for service publishing, comprising:
one or more processors; and
instructions in one or more computer-readable media stored thereon that, when executed by the one or more processors, cause the apparatus to perform the methods of claims 1-9, 10-12, 13.
22. One or more computer-readable media having instructions stored thereon that, when executed by one or more processors, cause a terminal device to perform the methods of claims 1-9, 10-12, 13.
CN201611099694.4A 2016-12-01 2016-12-01 Service publishing method, device, system, server and client Active CN108134766B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611099694.4A CN108134766B (en) 2016-12-01 2016-12-01 Service publishing method, device, system, server and client

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611099694.4A CN108134766B (en) 2016-12-01 2016-12-01 Service publishing method, device, system, server and client

Publications (2)

Publication Number Publication Date
CN108134766A CN108134766A (en) 2018-06-08
CN108134766B true CN108134766B (en) 2020-12-18

Family

ID=62387797

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611099694.4A Active CN108134766B (en) 2016-12-01 2016-12-01 Service publishing method, device, system, server and client

Country Status (1)

Country Link
CN (1) CN108134766B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111045833B (en) * 2018-10-15 2024-06-18 北京京东尚科信息技术有限公司 Interface calling method and device
CN109636304B (en) * 2018-10-29 2021-04-06 浙江口碑网络技术有限公司 Business system publishing method and device, storage medium and electronic device
CN111240760B (en) * 2020-01-08 2022-09-16 江苏满运软件科技有限公司 Application publishing method, system, storage medium and equipment based on registry
CN113765870B (en) * 2020-09-01 2023-09-05 北京沃东天骏信息技术有限公司 Remote service calling method, device and system
CN112243024B (en) * 2020-09-17 2022-05-06 北京金山云网络技术有限公司 Service control method, device, server and storage medium
CN112099921A (en) * 2020-09-27 2020-12-18 中国建设银行股份有限公司 Java application system preheating method and system based on JVM
CN112449005B (en) * 2020-11-11 2023-11-17 北京水滴科技集团有限公司 Request distribution method, request distribution device, electronic equipment and readable storage medium
CN112463408A (en) * 2020-11-26 2021-03-09 北京达佳互联信息技术有限公司 Method and device for starting remote procedure call service, server and storage medium
CN113064596B (en) * 2021-04-01 2024-04-19 广州虎牙科技有限公司 Event registration method, compiling method and device of application program, and electronic equipment
CN115002194A (en) * 2022-05-25 2022-09-02 中国工商银行股份有限公司 Management method and related device for microservice

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101094224A (en) * 2006-06-22 2007-12-26 华为技术有限公司 Method and system of providing services, access services, logging in and out services
CN102571550A (en) * 2010-12-30 2012-07-11 北京亿阳信通软件研究院有限公司 General information interaction platform and method
CN105141452A (en) * 2015-08-07 2015-12-09 北京思特奇信息技术股份有限公司 High-performance service system and method based on CXF
CN105573842A (en) * 2015-12-21 2016-05-11 北京奇虎科技有限公司 Method and device for achieving process recycling in application

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9141449B2 (en) * 2009-10-30 2015-09-22 Symantec Corporation Managing remote procedure calls when a server is unavailable

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101094224A (en) * 2006-06-22 2007-12-26 华为技术有限公司 Method and system of providing services, access services, logging in and out services
CN102571550A (en) * 2010-12-30 2012-07-11 北京亿阳信通软件研究院有限公司 General information interaction platform and method
CN105141452A (en) * 2015-08-07 2015-12-09 北京思特奇信息技术股份有限公司 High-performance service system and method based on CXF
CN105573842A (en) * 2015-12-21 2016-05-11 北京奇虎科技有限公司 Method and device for achieving process recycling in application

Also Published As

Publication number Publication date
CN108134766A (en) 2018-06-08

Similar Documents

Publication Publication Date Title
CN108134766B (en) Service publishing method, device, system, server and client
US11394625B2 (en) Service level agreement based storage access
US10437629B2 (en) Pre-triggers for code execution environments
JP7197574B2 (en) Service registration in communication networks
CN110768912A (en) API gateway current limiting method and device
US10432551B1 (en) Network request throttling
CN107888717B (en) Domain name determination method and device and electronic equipment
WO2017167121A1 (en) Method and device for determining and applying association relationship between application programs
US8935377B2 (en) Dynamic registration of listener resources for cloud services
CN109716735B (en) System and method for sharing application data between isolated applications executing on one or more application platforms
US9514162B2 (en) Smart polling frequency
JP2014523022A5 (en)
US20110185038A1 (en) Apparatus and method for providing a terminal web service
CN107528885B (en) Service request processing method and device
CN109117609B (en) Request intercepting method and device
JP2015528606A (en) Method and apparatus for responding to web page access request
CN107623702B (en) Data caching method, device and system
CN112433863A (en) Micro-service calling method and device, terminal equipment and storage medium
CN110764930B (en) Request or response processing method and device based on message mode
CN110875947A (en) Data processing method and edge node equipment
CN111625443B (en) Pressure testing method, device, equipment and storage medium
WO2015007183A1 (en) Methods for adapting a dual-sim terminal, dual-sim terminal, and server
US20160182605A1 (en) Dynamic Content Aggregation
US20140280965A1 (en) Software product instance placement
CN111221651B (en) Load balancing configuration method, device, server and readable storage medium

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