CN112243024B - Service control method, device, server and storage medium - Google Patents

Service control method, device, server and storage medium Download PDF

Info

Publication number
CN112243024B
CN112243024B CN202010980043.6A CN202010980043A CN112243024B CN 112243024 B CN112243024 B CN 112243024B CN 202010980043 A CN202010980043 A CN 202010980043A CN 112243024 B CN112243024 B CN 112243024B
Authority
CN
China
Prior art keywords
service
instances
user cluster
registered
total number
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
CN202010980043.6A
Other languages
Chinese (zh)
Other versions
CN112243024A (en
Inventor
胡孝林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202010980043.6A priority Critical patent/CN112243024B/en
Publication of CN112243024A publication Critical patent/CN112243024A/en
Application granted granted Critical
Publication of CN112243024B publication Critical patent/CN112243024B/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/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
    • 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

Abstract

The embodiment of the disclosure discloses a service control method, a service control device, a server and a storage medium, which are applied to a central cluster and relate to the field of cloud computing. The method comprises the following steps: acquiring the total number of registered instances of a user cluster, wherein the total number of the registered instances of the user cluster is the total number of service instances registered in a service registration center by the user cluster; acquiring a registration instance quantity threshold of the user cluster; determining a target service instance under the condition that the total number of the registered instances of the user cluster is greater than a threshold value of the number of the registered instances of the user cluster; and performing reverse registration processing on the target service instance.

Description

Service control method, device, server and storage medium
Technical Field
The present disclosure relates to the field of cloud computing, and in particular, to a service control method, apparatus, server, and storage medium.
Background
In a software system architecture, in order to reduce the complexity of commercial software, a system is generally split into a plurality of services according to requirements such as business requirements and technical environments, the plurality of services are cooperatively called to form a complex system, and meanwhile, in order to ensure high availability of the services, a plurality of service instances of the same service are generally deployed, so that the purposes of load balancing, elastic expansion and high availability are achieved.
In the related art, the micro service manufacturer directly shuts down an excessive number of service instances in order to control the number of service instances of the system, however, since it is uncertain whether the shut-down service instances are providing services, the service instances providing services may be selected and forced to shut down, resulting in data abnormality.
Disclosure of Invention
It is an object of the present disclosure to provide a new solution for service control.
According to a first aspect of the present disclosure, there is provided a service control method applied to a central cluster, including:
acquiring the total number of registered instances of a user cluster, wherein the total number of the registered instances of the user cluster is the total number of service instances registered in a service registration center by the user cluster;
acquiring a registration instance quantity threshold of the user cluster;
determining a target service instance under the condition that the total number of the registered instances of the user cluster is greater than a threshold value of the number of the registered instances of the user cluster;
and performing reverse registration processing on the target service instance.
Optionally, the obtaining the threshold of the number of registered instances of the user cluster includes:
acquiring the user level of the user cluster;
and determining the threshold value of the number of the registration instances according to the user level.
Optionally, the determining a target service instance in a case that the total number of registered instances of the user cluster is greater than the threshold number of registered instances of the user cluster includes:
and determining the service instance with the latest registration time as the target service instance under the condition that the total number of the registration instances of the user cluster is greater than the threshold value of the number of the registration instances of the user cluster.
Optionally, the determining a target service instance in a case that the total number of registered instances of the user cluster is greater than the threshold number of registered instances of the user cluster includes:
determining a difference value between the total number of the registered instances of the user cluster and the threshold value of the number of the registered instances of the user cluster under the condition that the total number of the registered instances of the user cluster is greater than the threshold value of the number of the registered instances of the user cluster;
and acquiring a target number of service instances as target service instances according to the sequence of the registration time from late to early, wherein the target number is equal to the difference.
Optionally, a plurality of services run in the user cluster;
the determining a target service instance when the total number of the registered instances of the user cluster is greater than the threshold number of the registered instances of the user cluster comprises:
acquiring the registration instance quantity of the service and a registration instance quantity threshold value of the service, wherein the registration instance quantity of the service is the quantity of the service instances registered in a service registration center by the service;
determining the service as a target service if the total number of registered instances of the service is greater than a threshold number of registered instances of the service;
determining the target service instance from the service instances of the target service.
Optionally, the obtaining the second service instance threshold of each of the current services includes:
acquiring the service level of each current service;
and determining the second service instance threshold according to the service level.
Optionally, the total number of registered instances of the user cluster is obtained;
and inquiring the total number of the registered instances of the user cluster from the service registration center in a timing task mode.
According to a second aspect of the present disclosure, there is provided a service control apparatus comprising:
a first obtaining module, configured to obtain a total number of registered instances of a user cluster, where the total number of registered instances of the user cluster is a total number of service instances registered by the user cluster in a service registration center;
a second obtaining module, configured to obtain a threshold of the number of registered instances of the user cluster;
the determining module is used for determining a target service instance under the condition that the total number of the registered instances of the user cluster is greater than the threshold value of the number of the registered instances of the user cluster;
and the reverse registration module is used for performing reverse registration processing on the target service instance.
According to a third aspect of the present disclosure, there is provided a server comprising:
the server includes:
a memory for storing executable instructions;
a processor configured to execute the server to perform the method according to the first aspect of the disclosure.
According to a fourth aspect of the present disclosure, there is provided a storage medium storing a computer program readable and executable by a computer, the computer program being adapted to perform the method according to the first aspect of the present disclosure when being read and executed by the computer.
According to the embodiment of the disclosure, the central cluster compares the total number of the acquired registration instances of the user cluster with the threshold value of the number of the registration instances of the user cluster, further determines the target service instance and performs the de-registration processing on the target service instance under the condition that the total number of the registration instances of the user cluster is greater than the threshold value of the number of the registration instances of the user cluster, that is, for any user cluster, the central cluster only needs to control the total number of the service instances registered by the service registration center of the user cluster, and performs the de-registration on the determined target service instance under the condition that the threshold value of the number of the registration instances is exceeded, so that the state of the actually-operated service instance does not need to be concerned, the implementation is simple and controllable, and meanwhile, the cost is reduced.
Other features of the present disclosure and advantages thereof will become apparent from the following detailed description of exemplary embodiments thereof, which proceeds with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the disclosure and together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a block diagram of a hardware configuration of a service control system that can be used to implement an embodiment of the present disclosure.
2 a-2 c are block diagrams of hardware configurations of a cluster of servers according to embodiments of the present disclosure;
FIG. 3 is a schematic flow chart diagram of a service control method according to an embodiment of the present disclosure;
FIG. 4 is a functional block diagram of a service control device according to an embodiment of the present disclosure;
fig. 5 is a functional block diagram of a server according to an embodiment of the present disclosure.
Detailed Description
Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that: the relative arrangement of the components and steps, the numerical expressions, and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses.
Techniques, methods, and apparatus known to one of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
In all examples shown and discussed herein, any particular value should be construed as merely illustrative, and not limiting. Thus, other examples of the exemplary embodiments may have different values.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
< hardware configuration >
Fig. 1 is a block diagram of a hardware configuration of a service control system provided according to an embodiment of the present disclosure.
As shown in fig. 1, the service control system 100 of this embodiment includes a central cluster 1000, a user cluster 2000 and a user cluster 3000, and of course, may also include other number of user clusters, which is not limited in this embodiment.
The central cluster 1000 may be a server cluster, and the server cluster includes at least one server, for example, as shown in fig. 2a, the central cluster 1000 may include a server 1100A, a server 1100B, and a server 1100C, and certainly, the central cluster may include other numbers of servers, which is not limited herein. The server may be, for example, a blade server, a rack server, or the like.
The server 1100 may be as shown in FIG. 1, including a processor 1110, a memory 1120, an interface device 1130, a communication device 1140, a display device 1150, and an input device 1160.
The processor 1110 may be, for example, a central processing unit CPU or the like. The memory 1120 includes, for example, a ROM (read only memory), a RAM (random access memory), a nonvolatile memory such as a hard disk, and the like. The interface device 1130 includes, for example, a USB interface, a serial interface, and the like. The communication device 1140 is capable of wired or wireless communication, for example. The display device 1150 is, for example, a liquid crystal display panel. Input devices 1160 may include, for example, a touch screen, a keyboard, and the like.
Although shown as multiple devices in fig. 1, server 1100 may also include only processor 1110, memory 1120, and communications device 1140.
The user cluster 2000 may be a server cluster, and the server cluster includes at least one server, for example, as shown in fig. 2B, the user cluster 2000 may include a server 2100A, a server 2100B, and a server 2100C, and of course, the central cluster may also include other numbers of servers, which is not limited herein. The server may be, for example, a blade server, a rack server, or the like.
The server 2100, which may be as shown in fig. 2b, includes a processor 2110, a memory 2120, an interface device 2130, a communication device 2140, a display device 2150, and an input device 2160.
The processor 2110 may be, for example, a central processing unit CPU or the like. The memory 2120 includes, for example, a ROM (read only memory), a RAM (random access memory), a nonvolatile memory such as a hard disk, and the like. The interface device 2130 includes, for example, a USB interface, a serial interface, and the like. The communication device 2140 is capable of wired or wireless communication, for example. The display device 2150 is, for example, a liquid crystal display panel. The input device 2160 may include, for example, a touch screen, a keyboard, and the like.
Although a number of devices of the server 2100 are shown in fig. 2b, the server may also include only the processor 2110, the memory 2120, and the communication device 2140.
The user cluster 3000 may be a server cluster, and the server cluster includes at least one server, for example, as shown in fig. 2C, the user cluster 3000 may include a server 3100A, a server 3100B, and a server 3100C, and of course, the central cluster may include other numbers of servers, which is not limited herein. The server may be, for example, a blade server, a rack server, or the like.
The server 3100 may, as shown in fig. 2c, include a processor 3110, a memory 3120, an interface device 3130, a communication device 3140, a display device 3150, and an input device 3160.
The processor 3110 may be, for example, a central processing unit CPU or the like. The memory 3120 includes, for example, a ROM (read only memory), a RAM (random access memory), a nonvolatile memory such as a hard disk, and the like. The interface device 3130 includes a USB interface, a serial interface, and the like. The communication device 3140 can perform wired or wireless communication, for example. The display device 3150 is, for example, a liquid crystal display. The input means 3160 may comprise, for example, a touch screen, a keyboard, etc.
Although a number of devices of the server 2100 are shown in fig. 2b, the server may also include only the processor 3110, the memory 3120, and the communication device 3140.
In this embodiment, the order service and the product service shown in fig. 1 are run in the user cluster 2000, and a delivery service and a payment service may also be run. The user cluster 3000 may run an order service, a product service, an account service, an evaluation service, and the like shown in fig. 1. One of the services corresponds to multiple service instances, and one service instance may run on one server, for example, the server 2100A, the server 2100B, and the server 2100C in fig. 2B are all used to run service instances of the payment service in the user cluster 2000; also for example, server 3100A, server 3100B, and server 3100C in fig. 2C are each used to run service instances of the evaluation services in the user cluster 3000.
In this embodiment, as shown in fig. 1, a micro service console is provided in a central cluster, each of the user cluster 2000 and the user cluster 3000 corresponds to a service registration center, and the service registration center is configured to register a service instance, and for any user cluster, the micro service console of the central cluster obtains, from the service registration center of the user cluster, the total number of service instances registered in the service registration center of the user cluster, compares the total number with a threshold value of the number of registered instances of the user cluster, and performs de-registration on a determined target service instance when the total number is greater than the threshold value of the number of registered instances of the user cluster.
< method examples >
Fig. 3 is a schematic flowchart of a service control method according to an embodiment of the present disclosure, which is applied to a central cluster and relates to the field of cloud computing.
As shown in fig. 3, the method may include the following steps S3100 to S3400:
step S3100, acquiring the total number of the registered instances of the user cluster.
The total number of registered instances for the user cluster may be the total number of service instances that the user cluster registered with the service registry.
In step S3100, the micro service console of the central cluster may obtain the total number of registered instances of the user cluster from the service registry by calling a service registry interface of the user cluster.
Taking the user cluster as the user cluster 2000 as an example, the total number of service instances registered in the corresponding service registration center in the user cluster 2000 may be 1001, 1003, or other numerical values, which is not limited herein.
In this embodiment, the obtaining of the total number of the registration instances of the user cluster in step S3100 may further include: and inquiring the total number of registered instances of the user cluster from the service registration center in a timed task mode.
Since the query speed of the microservice console of the central cluster can be in milliseconds, even in microseconds, etc., the timed task manner can be understood as querying the service registry for the total number of registered instances of the user cluster in a quasi-real-time manner.
Step S3200, obtain a threshold of the number of registered instances of the user cluster.
In an example, the micro service console of the central cluster may pre-store mapping data of mapping relationships between different user clusters and corresponding registration instance number thresholds, where the registration instance number thresholds corresponding to the user clusters may be directly obtained from the mapping data.
In one example, the microservice console of the central cluster may obtain the registered instance number threshold for the user cluster from the service registry by invoking a service registry interface of the user cluster.
In an embodiment, the obtaining of the threshold of the number of registered instances of the user cluster in step S3200 may further include the following steps S3210 to S3220:
step S3210 obtains a user rank of the user cluster.
In step S3210, the user ranks corresponding to different user clusters may be the same or different.
In one example, the micro service console of the central cluster may pre-store mapping data of mapping relationships between different user clusters and corresponding user ranks, where the user ranks of the corresponding user clusters may be directly obtained from the mapping data.
In one example, the microservice console of the central cluster may obtain the user rankings of the user clusters from the service registry by invoking a service registry interface of the user clusters.
The step S3210 of obtaining the user rank of the user cluster may further include: acquiring identification information of a user cluster; and determining the user grade of the user cluster according to the identification information.
The identification information of the user cluster is used for uniquely identifying the user cluster, and the identification information may be, for example, a user id of the user cluster, or other identification codes having a mapping relationship with the user id. For example, the micro service console of the central cluster may obtain the identification information of the user cluster from the service registry by calling the service registry interface of the user cluster. Here, the user rank of the user cluster may be determined according to the identification information of the corresponding user cluster, where the obtained user rank of the user cluster 2000 is 1, and the obtained user rank of the user cluster 3000 is 2, where the smaller the numerical value is, the higher the user rank is.
Step S3220, determining a threshold value of the number of registered instances according to the user level.
The micro service console of the central cluster stores mapping data of mapping relations between different user levels and corresponding registration instance quantity thresholds in advance, and here, the registration instance quantity thresholds corresponding to the user levels can be directly obtained from the mapping data.
It is understood that the higher the user rank, the greater the corresponding threshold number of registered instances. For example, the user level of the user cluster 2000 is 1, and the threshold of the number of registration instances corresponding to the user level 1 is 1000; for another example, the user level of the user cluster 3000 is 2, and the threshold of the number of registered instances corresponding to the user level 2 is 500. It should be noted that the present embodiment does not limit how to set the corresponding registration instance number thresholds for different user levels.
In step S3200, it sets a corresponding threshold value for the number of registration instances for the user cluster according to the user level of the user cluster, for example, sets a larger threshold value for the number of registration instances for a user cluster with a high level, and sets a smaller threshold value for the number of registration instances for a user cluster with a low level, thereby implementing customized service.
And step S3300, determining the target service instance when the total number of the registered instances of the user cluster is greater than the threshold value of the number of the registered instances of the user cluster.
The target service instance is the service instance that needs to be subject to the counterregistration process.
In one embodiment, in this step S3300, in a case that the total number of registered instances of the user cluster is greater than the threshold number of registered instances of the user cluster, determining the target service instance may further include: and determining the service instance with the latest registration time as the target service instance under the condition that the total number of the registration instances of the user cluster is greater than the threshold value of the number of the registration instances of the user cluster.
Taking a user cluster as the user cluster 2000 as an example, the total number of registered instances of the user cluster 2000 may be 1001, and the threshold value of the number of registered instances of the user cluster 2000 may be 1000, where the total number of registered instances of the user cluster 1001 is greater than the threshold value of the number of registered instances of the user cluster a 1000, and the service instance with the latest registration time is directly determined as the target service instance, that is, the 1001 st service instance with the latest registration time is determined as the target service instance, and the target service instance is subjected to the anti-registration processing according to the subsequent step S3400, so that the total number of registered instances of the user cluster 2000 is always kept within 1000.
In this embodiment, as can be seen from the above analysis, the central cluster may query the service registry for the total number of the registered instances of the user cluster in a quasi-real-time manner, and then, in the quasi-real-time case, as long as after the service instance is newly registered by the service registry of the user cluster, the total number of the registered instances of the user cluster is greater than the threshold value of the number of the registered instances of the user cluster, the central cluster may directly use the newly registered service instance as the target service instance, so as to perform the anti-registration processing on the target service instance according to the subsequent steps, thereby ensuring that the total number of the registered instances of the user cluster is always lower than the threshold value of the number of the registered instances of the user cluster.
In one embodiment, in the case that the total number of registered instances of the user cluster is greater than the threshold number of registered instances of the user cluster in the step S3300, determining the target service instance may further include the following steps S3310a to S3330 a:
step S3310a, in a case that the total number of registered instances of the user cluster is greater than the threshold value of the number of registered instances of the user cluster, determining a difference value between the total number of registered instances of the user cluster and the threshold value of the number of registered instances of the user cluster.
Continuing with the example of the user cluster being the user cluster 2000, the total number of registered instances of the user cluster 2000 may be 1003, and the threshold value of the number of registered instances of the user cluster 2000 may be 1000, where the total number of registered instances 1003 of the user cluster 2000 is greater than the threshold value of the number of registered instances 1000 of the user cluster 2000, then a difference between the total number of registered instances 1003 of the user cluster 2000 and the threshold value of the number of registered instances 1000 of the user cluster 2000 is further determined, and the difference is 3.
Step S3320a, acquiring the target number of service instances as the target service instance in the order from late to early of the registration time.
The target number is equal to the above difference.
Continuing with the example of step S3310a described above, according to this step S3320a, the 3 service instances with the latest registration time are obtained in the order from the late to the early of the registration time of the 1003 service instances operated by the user cluster 2000, the 3 service instances with the latest registration time are taken as the target service instances, and the target service instances are subjected to the anti-registration processing according to the subsequent step S3400, so that the total number of the registered instances of the user cluster 2000 is kept to be within 1000.
In this embodiment, generally, the service instance with the late registration time does not start the service, and here, since the target number is a difference between the total number of the registration instances of the user cluster and the threshold value of the number of the registration instances of the user cluster, the service instance with the late registration time is directly deregistered, so that normal operation of the service is not affected, and it is also ensured that the total number of the registration instances of the user cluster is always lower than the threshold value of the number of the registration instances of the user cluster.
And step S3400, performing reverse registration processing on the target service instance.
The deregistration processing of the target service instance may be that the registration information of the target service instance is deregistered in the service registration center of the user cluster.
In step S3400, after the target service instance is obtained according to step S3300, the target service instance may be subjected to the reverse registration process according to step S3400.
According to the method of the embodiment of the disclosure, the central cluster compares the total number of the acquired registration instances of the user cluster with the threshold value of the number of the registration instances of the user cluster, further determines the target service instance and performs the anti-registration processing on the target service instance under the condition that the total number of the registration instances of the user cluster is greater than the threshold value of the number of the registration instances of the user cluster, that is, for any user cluster, the central cluster only needs to control the total number of the service instances registered by the service registration center of the user cluster, and performs the anti-registration on the determined target service instance under the condition that the threshold value of the number of the registration instances is exceeded, so that the state of the service instance which is actually operated does not need to be concerned, the method is simple and controllable, and meanwhile, the cost is reduced.
Moreover, the single service registration center node can more simply implement a constraint mechanism on the price scheme, and the purpose that the user cannot cheat the number of the registration instances is achieved.
In one embodiment, a plurality of services are operated in the user cluster, and still taking the user cluster as the user cluster 2000 as an example, the services operated in the user cluster 2000 include order service, product service, delivery service, payment service, and the like. Here, as can be known from the foregoing embodiment, the total number of registered instances of the user cluster 2000 may be 1003, the threshold value of the number of registered instances of the user cluster 2000 may be 1000, and the total number of registered instances 1003 of the user cluster 2000 is greater than the threshold value of the number of registered instances 1000 of the user cluster 2000, where, in the case that the total number of registered instances of the user cluster is greater than the threshold value of the number of registered instances of the user cluster in the above step S3200, determining the target service instance may further include the following steps S3210b to S3230 b:
in step S3210b, the number of registered instances of the service and the threshold number of registered instances of the service are obtained.
The registered number of instances of the service is the number of service instances that the service is registered with the service registry.
Continuing with the above example, since the user cluster 2000 is running order services, product services, shipping services, and payment services, here the micro service console of the central cluster may obtain from the service registry the total number of registered instances of order services, product services, shipping services, and payment services in the user cluster 2000 as 303, 200, 300, and 200, respectively, by invoking the service registry interface of the user cluster 2000.
In one example, the micro service console of the central cluster may store mapping data of mapping relationships between the respective services of different user clusters and the corresponding registration instance number thresholds in advance, and here, the registration instance number thresholds of the services of the corresponding user clusters may be directly obtained from the mapping data.
In one example, a microservice console of a central cluster can obtain a threshold number of registered instances of a service of a user cluster from a service registry by invoking a service registry interface of the user cluster.
In an embodiment, the step S3210b of obtaining the threshold of the number of registered instances of the service may further include the following steps S3211 to S3212:
step S3211, obtains a service level of the service.
In step S3211, the service levels corresponding to different services may be the same or different.
In one example, the micro service console of the central cluster may store mapping data of a mapping relationship between a service operated by the user cluster and a corresponding service class in advance, and here, the service class of the service may be directly obtained from the mapping data.
In one example, a microservice console of a central cluster may obtain a service level of a service from a service registry by invoking a service registry interface of a user cluster.
Continuing with the above example, since the user cluster 2000 runs the order service, the product service, the shipping service, and the payment service, here, the obtained service level of the order service and the payment service in the user cluster 2000 is 1, and the corresponding registration case threshold is 300; the service level of the product service and the delivery service is 2, and the corresponding registration case threshold value is 200, wherein the smaller the numerical value, the higher the service level.
Step S3212, determining a threshold of the number of registered instances of the service according to the service level.
The micro service console of the central cluster stores mapping data of mapping relations between different service levels and the registration instance quantity threshold values of the corresponding services in advance, and here, the registration instance quantity threshold values of the corresponding service levels can be directly obtained from the mapping data.
It is understood that the higher the service level, the larger the corresponding registration instance quantity threshold. For example, the service level of the order service and the payment service is 1, and the threshold value of the number of registered instances corresponding to the service level 1 is 300; for another example, the service level of the product service and the shipping service is 2, and the threshold value of the number of registered instances corresponding to the user level 2 is 200. It should be noted that the present embodiment does not limit how to set the corresponding registration instance number thresholds for different service levels.
In the above steps S3211 to S3212, according to the service level of the service, the corresponding registration instance number threshold is set for the service, for example, a larger registration instance number threshold is set for a service with a higher level, and a smaller registration instance number threshold is set for a service with a lower level, so as to implement customized service.
In step S3220b, in the case that the total number of registered instances of the service is greater than the threshold number of registered instances of the service, the service is determined as the target service.
Continuing with the above example, since the total number of registered instances 303 for the order service is greater than the threshold number of registered instances 300 for the order service, the order service is determined to be the target service.
Step S3230b, determine a target service instance from the service instances of the target service.
Continuing with the above example, the target service determined in step S3230b above is an order service, and here, the target service instance may be determined from the order service, for example, the difference value 3 between the total number 303 of registered instances of the order service and the threshold 300 of the number of registered instances of the order service may be determined, and then, in order from late to early of the registration time of the service instance of the order service, 3 service instances with late registration time are obtained as the target service instances, and then the 3 target service instances are subjected to the anti-registration processing.
According to the embodiment, a corresponding registration instance quantity threshold value is set for the service operated by the user cluster, when the total quantity of the registration instances of the user cluster is larger than the registration instance quantity threshold value of the user cluster, the total quantity of the registration instances of the service is further compared with the registration instance quantity threshold value of the service, and when the total quantity of the registration instances of the service is larger than the registration instance quantity threshold value of the service, a target service instance is determined from the service, so that customized service is realized.
In one embodiment, the service control method of the present disclosure may further include: providing an input interface in response to an operation of setting a user level; and acquiring the grade input through the input interface as the user grade of the user cluster.
The above input interface may be an input box, a drop-down list, a voice input, for example, a designer may input a user rating of "1" for the user cluster 2000 through the input box; as another example, the designer may select a user rating of "1" for user cluster 2000 via a drop down list; for another example, the meter personnel may voice input that the user rating of the user cluster 2000 is "1".
The disclosed example provides a man-machine interaction interface to support a designer to select a required user grade according to the current actual requirement to realize customized service
< apparatus embodiment >
In this embodiment, a service control apparatus is further provided, as shown in fig. 4, the apparatus 4000 may include a first obtaining module 4100, a second obtaining module 4200, a determining module 4300, and an anti-registration module 4400.
A first obtaining module 4100, configured to obtain a total number of registered instances of a user cluster, where the total number of registered instances of the user cluster is a total number of service instances registered by the user cluster in a service registry.
A second obtaining module 4200, configured to obtain a threshold of the number of registered instances of the user cluster.
A determining module 4300, configured to determine a target service instance if the total number of registered instances of the user cluster is greater than the threshold number of registered instances of the user cluster;
and the reverse registration module is used for performing reverse registration processing on the target service instance.
In an embodiment, the first obtaining module 4100 is further configured to obtain a user level of the user cluster; and determining the threshold value of the number of the registration instances according to the user level.
In one embodiment, the determining module 4300 is further configured to determine, as the target service instance, the service instance with the latest registration time if the total number of registration instances of the user cluster is greater than the threshold number of registration instances of the user cluster.
In an embodiment, the determining module 4300 is further configured to determine, when the total number of registered instances of the user cluster is greater than the threshold value of the number of registered instances of the user cluster, a difference between the total number of registered instances of the user cluster and the threshold value of the number of registered instances of the user cluster; and acquiring a target number of service instances as target service instances according to the sequence of the registration time from late to early, wherein the target number is equal to the difference.
In one embodiment, a plurality of services are running in the user cluster.
The second obtaining module 4200 is further configured to obtain the number of registered instances of the service and the threshold of the number of registered instances of the service, where the number of registered instances of the service is the number of service instances registered by the service in the service registry.
A determining module 4300, configured to determine the service as a target service if the total number of registered instances of the service is greater than the threshold number of registered instances of the service; determining the target service instance from the service instances of the target service.
In one embodiment, the second obtaining module 4200 is further configured to obtain a service level of the service; and determining a registration instance quantity threshold value of the service according to the service level.
In an embodiment, the first obtaining module 4100 is further configured to query the service registry for the total number of registration instances of the user cluster in a timing task manner.
< Server embodiment >
In this embodiment, there is also provided a server, which may include the service control apparatus 5000 according to any embodiment of the present disclosure, for implementing the service control method of any embodiment of the present disclosure.
As shown in fig. 5, the server 5000 may further include a processor 5200 and a memory 5100, the memory 5100 for storing executable instructions; the processor 5200 is configured to operate the server according to the control of the instructions to perform a service control method according to any embodiment of the present disclosure.
The various modules of the above apparatus 4000 may be implemented by the processor 5200 executing the instructions to perform a service control method according to any embodiment of the present disclosure.
The server may be the server shown in fig. 2a, 2b, 2 c.
< media examples >
In this embodiment, a computer-readable storage medium is further provided, which stores a computer program that can be read and executed by a computer, and when the computer program is read and executed by the computer, the computer program is configured to perform the method according to any of the above embodiments of the present disclosure.
The present disclosure may be systems, methods, and/or computer program products. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for causing a processor to implement various aspects of the present disclosure.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present disclosure may be assembler instructions, Instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, the electronic circuitry that can execute the computer-readable program instructions implements aspects of the present disclosure by utilizing the state information of the computer-readable program instructions to personalize the electronic circuitry, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA).
Various aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. It is well known to those skilled in the art that implementation by hardware, by software, and by a combination of software and hardware are equivalent.
Having described embodiments of the present disclosure, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein. The scope of the present disclosure is defined by the appended claims.

Claims (10)

1. A service control method is applied to a central cluster and comprises the following steps:
acquiring the total number of registered instances of a user cluster, wherein the total number of the registered instances of the user cluster is the total number of service instances registered in a service registration center by the user cluster;
acquiring a registration instance quantity threshold of the user cluster;
determining a target service instance under the condition that the total number of the registered instances of the user cluster is greater than a threshold value of the number of the registered instances of the user cluster;
and performing reverse registration processing on the target service instance.
2. The method of claim 1, wherein the obtaining the threshold number of registered instances for the user cluster comprises:
acquiring the user grade of the user cluster;
and determining the threshold value of the number of the registration instances according to the user level.
3. The method of claim 1, wherein the determining a target service instance in the case that the total number of registered instances of the user cluster is greater than the threshold number of registered instances of the user cluster comprises:
and determining the service instance with the latest registration time as the target service instance under the condition that the total number of the registration instances of the user cluster is greater than the threshold value of the number of the registration instances of the user cluster.
4. The method of claim 1, wherein the determining a target service instance in the case that the total number of registered instances of the user cluster is greater than the threshold number of registered instances of the user cluster comprises:
determining a difference value between the total number of the registered instances of the user cluster and the threshold value of the number of the registered instances of the user cluster under the condition that the total number of the registered instances of the user cluster is greater than the threshold value of the number of the registered instances of the user cluster;
and acquiring a target number of service instances as target service instances according to the sequence of the registration time from late to early, wherein the target number is equal to the difference.
5. The method of claim 1, wherein a plurality of services are running in the user cluster;
determining a target service instance when the total number of registered instances of the user cluster is greater than the threshold number of registered instances of the user cluster, including:
acquiring the number of registered instances of the service and a threshold value of the number of registered instances of the service, wherein the number of registered instances of the service is the number of service instances registered by the service in a service registration center;
determining the service as a target service if the total number of registered instances of the service is greater than a threshold number of registered instances of the service;
determining the target service instance from the service instances of the target service.
6. The method of claim 5, wherein the obtaining the threshold number of registered instances of the service comprises:
acquiring the service level of the service;
and determining a registration instance quantity threshold value of the service according to the service level.
7. The method of claim 1, wherein the obtaining of the total number of registered instances of the user cluster;
and inquiring the total number of the registered instances of the user cluster from the service registration center in a timing task mode.
8. A service control apparatus, comprising:
a first obtaining module, configured to obtain a total number of registered instances of a user cluster, where the total number of registered instances of the user cluster is a total number of service instances registered by the user cluster in a service registration center;
a second obtaining module, configured to obtain a threshold of the number of registered instances of the user cluster;
the determining module is used for determining a target service instance under the condition that the total number of the registered instances of the user cluster is greater than the threshold value of the number of the registered instances of the user cluster;
and the reverse registration module is used for performing reverse registration processing on the target service instance.
9. A server, comprising:
the server includes:
a memory for storing executable instructions;
a processor for operating the server to perform the method according to the control of the instruction, according to any one of claims 1 to 7.
10. A computer-readable storage medium, in which a computer program is stored which is readable and executable by a computer, and which, when read by the computer, is adapted to perform the method according to any one of claims 1 to 7.
CN202010980043.6A 2020-09-17 2020-09-17 Service control method, device, server and storage medium Active CN112243024B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010980043.6A CN112243024B (en) 2020-09-17 2020-09-17 Service control method, device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010980043.6A CN112243024B (en) 2020-09-17 2020-09-17 Service control method, device, server and storage medium

Publications (2)

Publication Number Publication Date
CN112243024A CN112243024A (en) 2021-01-19
CN112243024B true CN112243024B (en) 2022-05-06

Family

ID=74171517

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010980043.6A Active CN112243024B (en) 2020-09-17 2020-09-17 Service control method, device, server and storage medium

Country Status (1)

Country Link
CN (1) CN112243024B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277714B (en) * 2021-04-29 2023-08-15 中国移动通信集团浙江有限公司 Method, device, equipment and computer readable storage medium for repairing service registration abnormality
CN113645102B (en) * 2021-10-14 2022-02-08 腾讯科技(深圳)有限公司 Method and device for determining route convergence time

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103685569A (en) * 2013-12-31 2014-03-26 曙光云计算技术有限公司 Method and system for automatically adjusting resource pool
WO2016201161A1 (en) * 2015-06-11 2016-12-15 Microsoft Technology Licensing, Llc Computing resource management system
CN106375419A (en) * 2016-08-31 2017-02-01 东软集团股份有限公司 Deployment method and device of distributed cluster
CN106506605A (en) * 2016-10-14 2017-03-15 华南理工大学 A kind of SaaS application construction methods based on micro services framework
CN108134766A (en) * 2016-12-01 2018-06-08 阿里巴巴集团控股有限公司 A kind of method, apparatus, system, server and client for servicing publication
CN109104497A (en) * 2018-09-26 2018-12-28 郑州云海信息技术有限公司 A kind of method for processing business and device based on cloud platform
WO2020063206A1 (en) * 2018-09-28 2020-04-02 南京中兴软件有限责任公司 Flexible scaling method for microservice instances, device, and storage medium
CN111309483A (en) * 2020-02-24 2020-06-19 广州虎牙科技有限公司 Management method, device, equipment and storage medium of server cluster

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7734676B2 (en) * 2001-06-27 2010-06-08 International Business Machines Corporation Method for controlling the number of servers in a hierarchical resource environment

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103685569A (en) * 2013-12-31 2014-03-26 曙光云计算技术有限公司 Method and system for automatically adjusting resource pool
WO2016201161A1 (en) * 2015-06-11 2016-12-15 Microsoft Technology Licensing, Llc Computing resource management system
CN106375419A (en) * 2016-08-31 2017-02-01 东软集团股份有限公司 Deployment method and device of distributed cluster
CN106506605A (en) * 2016-10-14 2017-03-15 华南理工大学 A kind of SaaS application construction methods based on micro services framework
CN108134766A (en) * 2016-12-01 2018-06-08 阿里巴巴集团控股有限公司 A kind of method, apparatus, system, server and client for servicing publication
CN109104497A (en) * 2018-09-26 2018-12-28 郑州云海信息技术有限公司 A kind of method for processing business and device based on cloud platform
WO2020063206A1 (en) * 2018-09-28 2020-04-02 南京中兴软件有限责任公司 Flexible scaling method for microservice instances, device, and storage medium
CN111309483A (en) * 2020-02-24 2020-06-19 广州虎牙科技有限公司 Management method, device, equipment and storage medium of server cluster

Also Published As

Publication number Publication date
CN112243024A (en) 2021-01-19

Similar Documents

Publication Publication Date Title
CN110765024B (en) Simulation test method, simulation test device, electronic equipment and computer readable storage medium
CN112243024B (en) Service control method, device, server and storage medium
US10956674B2 (en) Creating cost models using standard templates and key-value pair differential analysis
US10936753B2 (en) Securely transferring data over a computer network
CN111756779B (en) Data serialization processing method, device and computer system
US20190324784A1 (en) Method, device and computer-readable for managing virtual machines
CN109684008A (en) Card rendering method, device, terminal and computer readable storage medium
CN111708557A (en) Method, device and storage medium for updating configuration file
CN112269706A (en) Interface parameter checking method and device, electronic equipment and computer readable medium
CN110752968B (en) Performance benchmark test method and device, electronic equipment and storage medium
CN114528269A (en) Method, electronic device and computer program product for processing data
CN107665124B (en) Modular JavaScript file processing method, device and server
US20200279152A1 (en) Lexicographic deep reinforcement learning using state constraints and conditional policies
CN110580156A (en) Page processing method and device and electronic equipment
EP3374860B1 (en) Communicating information about an update of an application
CN112995254B (en) Method, equipment, system, device and component for transmitting heartbeat information
CN112069071B (en) Method and device for determining program suitability
CN111813407B (en) Game development method, game running device and electronic equipment
US11238100B2 (en) Adapting conversational agent communications to different stylistic models
CN112115134A (en) Data storage method and device, electronic equipment and storage medium
CN113312900A (en) Data verification method and device
CN112241278A (en) Method, apparatus and computer program product for updating software
CN110535669B (en) Content recommendation method and content recommendation device
CN111597112A (en) Automatic test method and device and electronic equipment
CN112381629B (en) Method, electronic device and storage medium for order scheduling

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