CN114785859B - Service registration method, device, equipment and storage medium - Google Patents

Service registration method, device, equipment and storage medium Download PDF

Info

Publication number
CN114785859B
CN114785859B CN202210415134.4A CN202210415134A CN114785859B CN 114785859 B CN114785859 B CN 114785859B CN 202210415134 A CN202210415134 A CN 202210415134A CN 114785859 B CN114785859 B CN 114785859B
Authority
CN
China
Prior art keywords
resource
target
resource detection
loading
detection interface
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
CN202210415134.4A
Other languages
Chinese (zh)
Other versions
CN114785859A (en
Inventor
李剑
关海超
颜高飞
韩越
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202210415134.4A priority Critical patent/CN114785859B/en
Publication of CN114785859A publication Critical patent/CN114785859A/en
Application granted granted Critical
Publication of CN114785859B publication Critical patent/CN114785859B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44568Immediately runnable code
    • G06F9/44578Preparing or optimising for loading
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a service registration method, device, equipment and storage medium, and relates to the technical field of cloud computing. The method comprises the following steps: receiving a target application starting instruction sent by control terminal equipment, and starting a target application; after the target application is started, a first resource detection interface which is pre-configured is called according to a first preset period so as to detect whether the loading of the target resource is completed; receiving a resource detection instruction sent by the control terminal equipment according to a second preset period, and calling a second resource detection interface after receiving the resource detection instruction so as to detect whether loading of the target resource is completed; the calling time of the first resource detection interface is different from the calling time of the second resource detection interface; and after receiving the successful resource loading identification returned by the first resource detection interface or the second resource detection interface for the first time, registering the target service with the registration center. The method can avoid overtime or failure of calling the service by the consumer terminal equipment, and avoid resource waste of the provider terminal equipment.

Description

Service registration method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of cloud computing technologies, and in particular, to a service registration method, device, equipment, and storage medium.
Background
In a Dubbo-based distributed system, registration and discovery of services is performed between application service providers and application service consumers through a registry. The application service provider registers the service which the application service provider can provide with the registry, and reports the communication address of the provider device where the application service provider is located to the registry. Application service consumers subscribe to the registry for the services they need to use. The registry sends the communication address of the provider equipment of the application service provider registered with the service to the consumer equipment of the application service consumer according to the service subscribed by the application service consumer. The consumer terminal equipment establishes communication connection with the provider terminal equipment through the communication address of the provider terminal equipment so as to realize remote calling of the service processing business provided by the application service provider. Currently, an application service provider may register a service with a registry immediately after a service-providing application is started, or may delay a fixed time after the service-providing application is started, and then register the service with the registry.
If the application service provider chooses to register the service with the registry immediately after the application is started, the resources required by the application to provide the service need to be loaded in time, so when the consumer device accesses the application providing device just started, the service processing service needs to be called after the loading of the resources required by the application to provide the service is completed, which may cause the problem that the calling service is overtime or the calling service fails. If the application service provider chooses to delay for a fixed time after the application is started, then register the service with the registry, the delay time is too short, and the resources required by the application to provide the service may still not be loaded; the delay time is too long, which causes resource waste of the provider device.
In summary, in the prior art, an application service provider cannot accurately register a service after loading of resources required by an application to provide the service is completed, so that a service timeout or a service failure of invoking the service occurs in a consumer device or resource waste of a provider device occurs.
Disclosure of Invention
The application provides a service registration method, device, equipment and storage medium, which are used for solving the problems that in the prior art, a providing end device cannot accurately register a service after the loading of resources required by an application for providing the service is completed, so that a consuming end device calls the service overtime or fails, or the providing end device wastes the resources.
According to a first aspect of the present application, there is provided a service registration method, including:
receiving a target application starting instruction sent by control terminal equipment, and starting a target application;
after the target application is started, a first resource detection interface which is pre-configured is called according to a first preset period so as to detect whether target resources required by the target application for providing the target service are loaded;
receiving a resource detection instruction sent by the control terminal equipment according to a second preset period, and calling a second resource detection interface after receiving the resource detection instruction so as to detect whether the loading of the target resource is completed; the calling time of the first resource detection interface is different from the calling time of the second resource detection interface;
And after receiving the successful resource loading identification returned by the first resource detection interface or the second resource detection interface for the first time, registering the target service with a registration center.
According to a second aspect of the present application, there is provided a service registration method, comprising:
sending a target application starting instruction to a providing end device; the target application starting instruction is used for indicating the providing end equipment to start the target application, and calling a first resource detection interface which is pre-configured according to a first preset period so as to detect whether the loading of target resources required by the target application for providing the target service is completed or not;
if it is determined that the target application is started, a resource detection instruction is sent to the providing end device according to a second preset period, wherein the resource detection instruction is used for indicating the providing end device to call a second resource detection interface so as to detect whether the target resource is loaded, and the calling time of the first resource detection interface is different from the calling time of the second resource detection interface.
According to a third aspect of the present application, there is provided a service registration apparatus comprising:
the receiving module is used for receiving a target application starting instruction sent by the control terminal equipment and starting the target application;
the first detection module is used for calling a first resource detection interface which is pre-configured according to a first preset period after the target application is started so as to detect whether target resources required by the target application for providing the target service are loaded;
The second detection module is used for receiving a resource detection instruction sent by the control terminal equipment according to a second preset period, and calling a second resource detection interface after receiving the resource detection instruction so as to detect whether the loading of the target resource is completed; the calling time of the first resource detection interface is different from the calling time of the second resource detection interface;
and the registration module is used for registering the target service to a registration center after receiving the successful resource loading identifier returned by the first resource detection interface or the second resource detection interface for the first time.
According to a fourth aspect of the present application, there is provided a service registration apparatus comprising:
the first sending module is used for sending a target application starting instruction to the providing end equipment; the target application starting instruction is used for indicating the providing end equipment to start the target application, and calling a first resource detection interface which is pre-configured according to a first preset period so as to detect whether the loading of target resources required by the target application for providing the target service is completed or not;
and the second sending module is used for sending a resource detection instruction to the providing end equipment according to a second preset period if the target application is determined to be started, wherein the resource detection instruction is used for indicating the providing end equipment to call a second resource detection interface so as to detect whether the target resource is completely loaded or not, and the calling time of the first resource detection interface is different from that of the second resource detection interface.
According to a fifth aspect of the present application, there is provided a provider device, including: memory, processor, and transceiver;
the memory, the processor, and the transceiver circuitry are interconnected;
the memory stores computer-executable instructions;
the transceiver is used for receiving and transmitting data;
the processor executes computer-executable instructions stored in the memory to implement the method as described in the first aspect.
According to a sixth aspect of the present application, there is provided a control end device, including: memory, processor, and transceiver;
the memory, the processor, and the transceiver circuitry are interconnected;
the memory stores computer-executable instructions;
the transceiver is used for receiving and transmitting data;
the processor executes computer-executable instructions stored by the memory to implement the method as described in the second aspect.
According to a seventh aspect of the present application there is provided a computer readable storage medium having stored therein computer executable instructions which when executed by a processor are adapted to carry out the method as described in the first or second aspect.
The service registration method, the device, the equipment and the storage medium provided by the application are used for receiving a target application starting instruction sent by the control terminal equipment and starting the target application; after the target application is started, a first resource detection interface which is pre-configured is called according to a first preset period so as to detect whether target resources required by the target application for providing the target service are loaded; receiving a resource detection instruction sent by the control terminal equipment according to a second preset period, and calling a second resource detection interface after receiving the resource detection instruction so as to detect whether the loading of the target resource is completed; the calling time of the first resource detection interface is different from the calling time of the second resource detection interface; and after receiving the successful resource loading identification returned by the first resource detection interface or the second resource detection interface for the first time, registering the target service with a registration center. After the target application is started, the providing end equipment invokes a first resource detection interface which is pre-configured according to a first preset period to detect whether the target resource is loaded, so that for the application with the faster resource loading speed, whether the target resource is loaded can be detected to be completed in the first time after the target application is started. And the providing end equipment receives the resource detection instruction sent by the control end equipment according to the second preset period while calling the first resource detection interface which is preset according to the first preset period, and calls the second resource detection interface to detect whether the loading of the target resource is completed after receiving the resource detection instruction, wherein the calling time of the first resource detection interface is different from the calling time of the second resource detection interface. Meanwhile, after the providing terminal equipment receives the successful resource loading identifier returned by the first resource detection interface or the second resource detection interface for the first time, registering the target service with the registration center, so that the service can be accurately registered with the registration center after the target resource loading is completed, the providing terminal equipment can register immediately after the target resource loading is completed without waiting for the loading of the target resource when the consuming terminal calls the service, the resource loading completed but the target service is not registered, and resource waste caused by using the target service by the providing terminal equipment is avoided.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
Fig. 1 is a network architecture diagram corresponding to a service registration method provided according to an embodiment of the present application;
fig. 2 is a flowchart of a service registration method according to a first embodiment of the present application;
fig. 3 is a flowchart of a service registration method according to a second embodiment of the present application;
fig. 4 is a flowchart of a service registration method according to a third embodiment of the present application;
fig. 5 is a flowchart of a service registration method according to a fifth embodiment of the present application;
fig. 6 is a schematic structural diagram of a service registration device provided according to a sixth embodiment of the present application;
fig. 7 is a schematic structural diagram of a service registration device provided according to a seventh embodiment of the present application;
FIG. 8 is a block diagram of a provider device according to an eighth embodiment of the present application;
fig. 9 is a block diagram of a control end device according to a ninth embodiment of the present application.
Specific embodiments thereof have been shown by way of example in the drawings and will herein be described in more detail. These drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments.
Detailed Description
The terms referred to in this application are explained first.
Duboo, a distributed framework for remote service invocation. In the Dubbo framework, a registry, an application service provider, and an application service consumer are included, and registration and discovery of services are performed between the application service provider and the application service consumer through the registry. The application service provider provides a service that can be remotely invoked through the provider device in which it is located, and registers the service that it can provide with the registry, for example, sends the communication address (e.g., IP address or uniform resource locator) of the provider device and the name of the service that it can provide to the registry. The application service consumer subscribes the service which the application service consumer needs to use to the registry through the consumer terminal equipment where the application service consumer is located, and the application service consumer can remotely call the service which the application service consumer needs to use to process the service. The registry sends the communication address of the provider device capable of providing the service to the consumer device according to the service subscribed by the application service consumer. After receiving the communication address of the provider device sent by the registry, the consumer device may establish a communication connection, such as a TCP connection, with the provider device to enable remote invocation of the service provided by the application service provider.
Service registration, also referred to as service exposure, refers to the operation of an application service provider registering a service that it can provide at a registry and sending the communication address of the provider device to the registry. Service registration is a precondition for the registry to be able to send the communication address of the providing end device to the consumer end device where the application service consumer requiring the service is located.
PaaS (Platform-as-a-Service), which is a cloud computing Service mode that provides the running and development environment of an application as a Service, in a typical hierarchy of cloud computing, a Platform-as-Service layer is interposed between software-as-a-Service (SaaS) and infrastructure-as-a-Service (IaaS), solving the software environment on which the application is running, including middleware, application frameworks, etc., which greatly simplifies the development and operation mode. In the PaaS cloud platform, the PaaS cloud platform comprises a provider device and a controller device, the controller device can control the provider device, and a program of an application service can be instantiated and assembled into a container and is installed in the provider device.
Spring framework (Spring for short) refers to an open source framework created to address the complexity of enterprise application development, which can be used to develop any Java application. The core of the Spring framework is a Spring IoC (Inversion of Control, control inversion) container. IoC containers are used to create, instantiate, locate, configure objects in an application, and establish dependencies between objects.
A Spring Bean is an object that is instantiated and assembled and managed by a Spring IoC container.
The prior art of the present application is described in detail and analyzed below.
In the prior art, only after the service providing device registers with the registry, the consumer device can use the service provided by the service providing device, and the service providing device can select to register with the registry immediately after the service providing application is started, or select to delay for a fixed time after the service providing application is started, and then register with the registry. If the provider device selects to register the service with the registry immediately after the application is started, after the service is registered, the registry will send the communication address of the provider device to the consumer device where the application service consumer is located as long as there is an application service consumer subscribed to the service. The consumer device may, upon receiving the communication address of the provider device, establish a connection, such as a TCP connection, with the provider device to communicate and invoke the service processing service provided by the provider device. However, since the providing end device needs to load resources required by the application to provide services after the application is started, for example, obtaining configuration data from a configuration center, creating a database connection pool, loading data on which the application itself depends, and the like, loading the resources is a continuous process that requires a time. If the consumer device wants to use the service provided by the application that has just been started, it needs to wait for the loading of the resources required for providing the service to be completed, which makes it possible for the consumer device to have problems of calling the service timeout or calling the service failure, for example, in the case of a transaction timeout or transaction failure of a financial service. If the providing end equipment chooses to delay for a fixed time after the application is started, registering the service with the registration center, and if the delay time is too short, the resources required by the application for providing the service still possibly cannot be loaded; if the delay time is too long, the target service is not registered with the registry after the target resource is loaded, so that the target service is not used by the consumer terminal equipment, and the resource waste of the provider terminal equipment is caused.
Therefore, in facing the problems in the prior art, the inventor proposes the technical solution of the present application through creative research, and aims to solve the above technical problems in the prior art. In order to avoid the problem that the calling service of the consumer terminal device is overtime or fails, the service needs to be registered with the registry after the target resource required by the service is provided by the target application is loaded, and meanwhile, in order to avoid the resource waste of the provider terminal device, the service needs to be registered with the registry at the first time when the loading of the target resource is completed, so that the target resource needs to be accurately determined to be loaded at the first time when the loading of the target resource is completed. For applications with faster resource loading, it is necessary to determine whether the target resource is loaded immediately after the application is started, and for applications with slower resource loading, it is necessary to determine whether the target resource is loaded in real time during the process of resource loading, so as to determine that the target resource is loaded at the first time. Thus, the inventors have realized that at a first time, it is determined whether the target resource has been loaded to completion by: receiving a target application starting instruction sent by control terminal equipment, and starting a target application; after the target application is started, a first resource detection interface which is pre-configured is called according to a first preset period so as to detect whether target resources required by the target application for providing the target service are loaded; receiving a resource detection instruction sent by the control terminal equipment according to a second preset period, and calling a second resource detection interface after receiving the resource detection instruction so as to detect whether loading of the target resource is completed; the calling time of the first resource detection interface is different from the calling time of the second resource detection interface; and after receiving the successful resource loading identification returned by the first resource detection interface or the second resource detection interface for the first time, registering the target service with the registration center. After the target application is started, the providing end equipment invokes a first resource detection interface which is pre-configured according to a first preset period to detect whether the target resource is loaded, so that for the application with the faster resource loading speed, whether the target resource is loaded can be detected to be completed in the first time after the target application is started. And the providing end equipment receives the resource detection instruction sent by the control end equipment according to the second preset period while calling the first resource detection interface which is preset according to the first preset period, and calls the second resource detection interface to detect whether the loading of the target resource is completed after receiving the resource detection instruction, wherein the calling time of the first resource detection interface is different from the calling time of the second resource detection interface. Meanwhile, after the providing terminal equipment receives the successful resource loading identifier returned by the first resource detection interface or the second resource detection interface for the first time, registering the target service with the registration center, so that the service can be accurately registered with the registration center after the target resource loading is completed, the consuming terminal does not need to wait for loading of the target resource when the service is called, the providing terminal equipment can register immediately after the target resource loading is completed, the resource waste caused by that the resource is loaded but the target service is not registered, and the providing terminal equipment does not use the target service is further avoided.
The following describes the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
The network architecture and application scenario of the service registration method provided in the embodiments of the present application will be described below. When the following description refers to the accompanying drawings, the same data in different drawings represents the same or similar elements, unless otherwise indicated.
Fig. 1 is a network architecture diagram corresponding to a service registration method provided according to an embodiment of the present application, as shown in fig. 1, where the network architecture corresponding to an application scenario provided by the embodiment of the present application includes: the cloud platform 10, the registry 12 and at least one consumer end device 14, the cloud platform 10 comprises a control end device 11 and at least one provider end device 13, and the provider end device 13 is in communication connection with the control end device 11. The providing end device 13 is communicatively connected to the registry 12 and the consumer end device 14 is communicatively connected to the registry 12.
The providing end device 13 receives a target application starting instruction sent by the control end device 11, and starts a target application, and after the target application is started, the providing end device 13 calls a first resource detection interface which is pre-configured according to a first preset period to detect whether target resources required by the target application for providing the target service are loaded.
After determining that the target application is started, the control end device 11 sends a resource detection instruction to the providing end device 13 according to a second preset period, where the resource detection instruction is used to instruct the providing end device 13 to call a second resource detection interface to detect whether the target resource is loaded completely. The first resource probe interface and the second resource probe interface are invoked by the providing end device 13 at different times.
The providing end device 13 receives the resource detection instruction sent by the control end device 11, and after receiving the resource detection instruction, invokes the second resource detection interface to detect whether the loading of the target resource is completed.
The first resource detection interface and the second resource detection interface can return a resource loading result identifier after being called, and the resource loading result identifier is a resource loading success identifier or a resource loading failure identifier.
After receiving the resource loading success identifier returned by the first resource detection interface or the second resource detection interface for the first time, the provider device 13 registers the target service with the registry 12.
Consumer device 14 subscribes to its desired target service with registry 12.
The registry 12 transmits the communication address of the provider device 13 registered with the target service to the consumer device 14 according to the target service subscribed to by the consumer device 14.
The consumer device 14, upon receiving the communication address of the provider device 13 sent by the registry 12, establishes a communication connection with the provider device 13 and invokes the target service provided by the provider device 13 to process the traffic.
Embodiments of the present application will be described below with reference to the accompanying drawings. The embodiments described in the examples below do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
It should be noted that the service registration method, device, equipment and storage medium provided by the application can be used in the technical field of cloud computing. And can be used in any field except the technical field of cloud computing. The service registration method, device, equipment and storage medium provided by the application are not limited to the application field.
Example 1
Fig. 2 is a schematic flowchart of a service registration method according to a first embodiment of the present application, and as shown in fig. 2, an execution subject of the present application is a service registration device, where the service registration device is located in a provider device. The service registration method provided in this embodiment includes steps 201 to 204.
Step 201, receiving a target application starting instruction sent by the control end device, and starting the target application.
In this embodiment, the target application may be an application developed based on Spring. The target application may run in a Spring IoC container. The target application may include at least one Spring bean object that is instantiated and assembled. The providing terminal equipment can be used for carrying a target application and also can be used for carrying a Spring IoC container in which the target application is located. In this embodiment, the starting target application may be a Spring IoC container where the starting target application is located.
Step 202, after the target application is started, a first resource detection interface which is pre-configured is called according to a first preset period, so as to detect whether the target resource required by the target application for providing the target service is loaded.
In this embodiment, the number of target services provided by the target application is at least one, and the number of target resources required by each target service is at least one. The first resource probe interface may be pre-configured on the providing end device and may be configured to trigger invocation of the first resource probe interface by launching of the target application. The first resource detection interface corresponds to a first resource detection program, and the first resource detection program can be an application program pre-configured on the providing end device, or an application program pre-configured on a resource detection device capable of communicating with the providing end device, and the providing end device can access the corresponding first resource detection program by calling the first resource detection interface. The first resource probing program can determine whether loading of the target resource is complete by actually using the target resource, for example, accessing the database to determine whether the database is successfully connected, looking up the local configuration data to determine whether the configuration data is loaded locally, using the target service to determine whether the target service is ready, and the like. And the first resource detection program returns a resource loading success identifier after the target resources required by each target service provided by the target application are loaded. For most target applications, the loading of the target resources does not need excessive time, so that whether the target resources are loaded can be determined more quickly by calling the first resource detection interface which is pre-configured after the target application is started.
Specifically, the Java class implementing the first resource detection interface may be put in advance as a Spring bean object into a Spring IoC container where the target application is located, for example, the Java class implementing the first resource detection interface is hosted for Spring to manage in a manner of annotation (@ component, @ Service) or XML configuration (< bean id= "class="/>). And the method is configured to trigger the call of the first resource detection interface through an event after the Spring bean object of the target application is loaded, so as to call the first resource detection interface after the target application is started.
Step 203, receiving a resource detection instruction sent by the control terminal device according to a second preset period, and calling a second resource detection interface after receiving the resource detection instruction to detect whether loading of the target resource is completed; the call time of the first resource detection interface is different from the call time of the second resource detection interface.
In this embodiment, the second preset period may be the same as the first preset period or may be different from the first preset period. Illustratively, the first preset period may be 2 seconds and the second preset period may be 5 seconds. The control end device may carry the communication address of the second resource detection interface in the resource detection instruction when the resource detection instruction is sent each time, or may carry the communication address of the second resource detection interface in the resource detection instruction only when the resource detection instruction is sent for the first time. The second resource detection interface corresponds to a second resource detection program, and the second resource detection program and the first resource detection program can be the same application program or different application programs; so long as it is able to detect whether the loading of the target resource is complete. The first resource detection program and the second resource detection program may be configured in the same resource detection device or may be configured in different resource detection devices. The second resource probing program can determine whether the loading of the target resource is completed by actually using the target resource.
The resource detection instruction is used for indicating the providing end equipment to call the second resource detection interface so as to detect whether the loading of the target resource is completed. In this embodiment, the first resource detection interface is called after the target application is started, the second resource detection interface is called after a resource detection instruction sent by the control end device is received, and the calling time of the first resource detection interface is different from the calling time of the second resource detection interface, where the first time of the first resource detection interface is before the calling time of the second resource detection interface.
Step 204, after receiving the successful resource loading identifier returned by the first resource detection interface or the second resource detection interface for the first time, registering the target service with the registry.
In this embodiment, when the target application is started, the providing end device may determine, by scanning a process of the target application, a target service provided by the target application, and place the target service in the target queue. After the providing terminal equipment receives the resource loading success identification returned by the first resource detection interface or the second resource detection interface for the first time, the target service which is required to be provided by the target can be obtained from the target queue, and the name of the target service and the communication address of the providing terminal equipment are sent to the registry so as to register the target service with the registry. Because the providing terminal equipment receives the resource loading success identification returned by the first resource detection interface or the second resource detection interface for the first time, the target resource is loaded completely, and the providing terminal equipment can immediately register the target service with the registration center, so that the time that the target resource is loaded completely but the target service is not called by the consuming terminal equipment can be reduced, the time occupied by a thread pool of the providing terminal equipment is reduced, and the throughput of the providing terminal equipment is further improved. Furthermore, for a cloud platform comprising a plurality of providing end devices, throughput of the whole platform can be improved, and service stability of a large-scale cluster is guaranteed.
According to the service registration method provided by the embodiment, a target application starting instruction sent by the control terminal equipment is received, and the target application is started; after the target application is started, a first resource detection interface which is pre-configured is called according to a first preset period so as to detect whether target resources required by the target application for providing the target service are loaded; receiving a resource detection instruction sent by the control terminal equipment according to a second preset period, and calling a second resource detection interface after receiving the resource detection instruction so as to detect whether loading of the target resource is completed; the calling time of the first resource detection interface is different from the calling time of the second resource detection interface; and after receiving the successful resource loading identification returned by the first resource detection interface or the second resource detection interface for the first time, registering the target service with the registration center. After the target application is started, the providing end equipment invokes a first resource detection interface which is pre-configured according to a first preset period to detect whether the target resource is loaded, so that for the application with the faster resource loading speed, whether the target resource is loaded can be detected to be completed in the first time after the target application is started. And the providing end equipment receives the resource detection instruction sent by the control end equipment according to the second preset period while calling the first resource detection interface which is preset according to the first preset period, and calls the second resource detection interface to detect whether the loading of the target resource is completed after receiving the resource detection instruction, wherein the calling time of the first resource detection interface is different from the calling time of the second resource detection interface. Meanwhile, after the providing terminal equipment receives the successful resource loading identifier returned by the first resource detection interface or the second resource detection interface for the first time, the target service is registered in the registration center, so that the target service can be accurately registered in the registration center after the target resource loading is completed, the consuming terminal does not need to wait for loading of the target resource when the service is called, the providing terminal equipment can register immediately after the target resource loading is completed, the resource loading is completed but the target service is not registered, and further, resource waste caused by using the target service by the providing terminal equipment is avoided.
Example two
Fig. 3 is a flowchart of a service registration method according to a second embodiment of the present application, as shown in fig. 3, where, based on the first embodiment, the refinement of "invoking a first resource detection interface configured in advance according to a first preset period to detect whether loading of a target resource required by a target application to provide a target service is completed" in step 202 is performed, and then the refinement includes steps 301 to 304.
Step 301, a first resource detection interface is called in a current first preset period, and a corresponding first resource detection program is accessed through the first resource detection interface, so as to detect whether loading of a target resource is completed or not through the first resource detection program.
In this embodiment, after the target application is started, the providing end device invokes the resource detection interface once, and may start recording the time, and before the time reaches the next first preset period, the first resource detection interface is not invoked. And when the time reaches the next first preset period, calling the first resource detection interface again. When the first resource detection interface is called each time by the providing end equipment, a first resource detection program corresponding to the first resource detection interface is accessed, whether the target resource is loaded is completed can be determined after the first resource detection program is accessed, and after the first resource detection program determines whether the target resource is loaded, a resource loading result identifier can be returned to the providing end equipment through the first resource detection interface. And after the first resource detection interface returns the resource loading result identifier, the calling operation of the first resource detection interface is ended.
Step 302, receiving a resource loading result identifier returned through the first resource detection interface, where the resource loading result identifier is a resource loading success identifier or a resource loading failure identifier.
In this embodiment, after the providing end device invokes the first resource detection interface and accesses the first resource detection program, the resource loading result identifier returned by the first resource detection program through the first resource invocation interface is received, where the resource loading result identifier is a resource loading success identifier or a resource loading failure identifier. Here, since the number of the target resources is at least one, the first resource detecting program returns a resource loading success identifier after determining that all the target resources are loaded, and if any target resource fails to be loaded, the first resource detecting program returns a resource loading failure identifier.
Step 303, if it is determined that the resource loading result identifier is a resource loading success identifier, the first resource detection interface is stopped being invoked in the next first preset period.
In this embodiment, in the process that the providing end device calls the first resource detection interface according to the first preset period, once the process that the resource loading success identifier returned by the first resource call interface is received, the target resource is already loaded, and at this time, the providing end device may stop calling the first resource detection interface in the next first preset period.
Step 304, if it is determined that the resource loading result identifier is a resource loading failure identifier and the resource loading success identifier returned by the second resource detection interface is not received when the time reaches the next first preset period, the first resource detection interface is continuously called until the resource loading success identifier is received or the number of times of calling the first resource detection interface reaches the first preset number of times.
In this embodiment, the providing end device may record the number of times of calling the first resource detection interface when calling the first resource detection interface each time. And in the process that the providing end equipment calls the first resource detection interface according to the first preset period and receives the resource loading result identifier returned by the first resource call interface, the providing end equipment also receives a resource detection instruction sent by the control end equipment and calls the second resource detection interface according to the instruction of the resource detection instruction. Therefore, the providing end equipment can receive the resource loading result identifier returned by the first resource detection interface and also can receive the resource loading result identifier returned by the providing end calling the second resource detection interface. If all the resource loading result identifiers received by the providing end equipment are resource loading failure identifiers and the time reaches the next first preset period, the providing end equipment calls the first resource detection interface again and adds one to the number of times of calling the first resource detection interface until the providing end equipment receives the resource loading success identifier or the number of times of calling the first resource detection interface reaches the first preset number of times. For the application with longer resource loading time or the resource always in a loading state due to the occurrence of errors in resource loading, the setting of the first preset times can avoid the continuous detection of whether the target resource loading is successful or not in the target resource loading process, and reduce the resource waste of the providing end equipment.
According to the service registration method provided by the embodiment, the first resource detection interface is called in the current first preset period, and the corresponding first resource detection program is accessed through the first resource detection interface so as to detect whether the loading of the target resource is completed or not through the first resource detection program; receiving a resource loading result identifier returned by the first resource detection interface, wherein the resource loading result identifier is a resource loading success identifier or a resource loading failure identifier; if the resource loading result mark is determined to be the resource loading success mark, stopping calling the first resource detection interface in the next first preset period; if the resource loading result mark is determined to be the resource loading failure mark and the resource loading success mark returned by the second resource detection interface is not received when the time reaches the next first preset period, the first resource detection interface is continuously called until the resource loading success mark is received or the frequency of calling the first resource detection interface reaches the first preset frequency. When the resource loading result mark is determined to be the resource loading success mark, the first resource detection interface is stopped to be called in the next first preset period, so that the resource detection interface can be stopped to be called immediately after the resource loading is successful, and the times of calling the interface by the providing terminal equipment are reduced. Meanwhile, when the resource loading result mark is determined to be a resource loading failure mark and the resource loading success mark returned by the second resource detection interface is not received when the time reaches the next first preset period, the first resource detection interface is continuously called, when the target resource is not loaded successfully, whether the target resource is loaded successfully or not can be continuously determined, the latest state in the acquired target resource loading process can be further determined accurately at the first time, and the target resource can be loaded completely. And stopping calling the first resource detection interface after receiving the resource loading success identification, so that the number of times of calling the interface by the provider equipment can be reduced. After the number of times of calling the first resource detection interface reaches the first preset number of times, stopping calling the first resource detection interface in the next first preset period, so that resource waste of the providing end equipment caused by continuous resource detection of the application with the resource always in the loading state due to long resource loading time or error of resource loading can be avoided.
Example III
Fig. 4 is a schematic flow chart of a service registration method according to a third embodiment of the present application, as shown in fig. 4, in the service registration method according to the present embodiment, on the basis of the first embodiment or the second embodiment, the refinement is performed by "calling the second resource probe interface after receiving the resource probe instruction to probe whether the loading of the target resource is completed" in step 203, and then the refinement includes steps 401 to 404.
Step 401, after receiving the resource detection instruction in the current second preset period, invoking a second resource detection interface, and accessing a corresponding second resource detection program through the second resource detection interface, so as to detect whether loading of the target resource is completed through the second resource detection program.
In this embodiment, after the target application is started, the control end device sends a resource detection instruction to the providing end device according to the second preset period. After receiving the resource detection instruction, the provider device may call the second resource detection interface according to the communication address of the second resource detection interface in the resource detection instruction, for example, the URL, and access the corresponding second resource detection program through the second resource detection interface. The second resource probe program, when accessed, can determine whether the loading of the target resource is complete. After the second resource detection program determines whether the target resource is loaded, a resource loading result identifier can be returned to the providing end equipment through the second resource detection interface. And after the second resource detection interface returns the resource loading result identifier, the calling operation of the second resource detection interface is ended.
Step 402, receiving a resource loading result identifier returned by the second resource detection interface, where the resource loading result identifier is a resource loading success identifier or a resource loading failure identifier.
In this embodiment, after the providing end device invokes the second resource detection interface and accesses the second resource detection program, the resource loading result identifier returned by the second resource detection program through the second resource invocation interface is received, where the resource loading result identifier is a resource loading success identifier or a resource loading failure identifier.
Step 403, if it is determined that the resource loading result identifier is a resource loading success identifier, stopping calling the second resource detection interface after receiving the resource detection instruction in the next second preset period.
In this embodiment, in the process that the providing end device calls the second resource detection interface according to the second preset period, once the process that the resource loading success identifier returned by the second resource call interface is received, the target resource is already loaded, and at this time, because the time when the control end device determines whether the target resource is successfully loaded may lag behind the providing end device, the control end device may not update the target resource and already load successfully, and a resource detection instruction has been sent out, the providing end device may stop calling the second resource detection interface after receiving the resource detection instruction in the next second preset period.
Step 404, if it is determined that the resource loading result identifier is a resource loading failure identifier and the resource loading success identifier returned by the first resource detection interface is not received when the time reaches the next second preset period, continuing to call the second resource detection interface until the resource loading success identifier is received or the number of times of calling the second resource detection interface reaches the second preset number of times.
In this embodiment, the providing end device may record the number of times of calling the second resource detection interface when calling the second resource detection interface each time. And in the process that the providing end equipment calls the second resource detection interface according to the second preset period and receives the resource loading result identifier returned by the second resource call interface, the providing end equipment also calls the first resource detection interface according to the first preset period. Therefore, the providing end equipment can receive the resource loading result identifier returned by the first resource detection interface and also can receive the resource loading result identifier returned by the providing end calling the second resource detection interface. If all the resource loading result identifiers received by the providing end equipment are resource loading failure identifiers and the time reaches the next second preset period, the providing end equipment calls the first resource detection interface again and adds one to the number of times of calling the second resource detection interface until the providing end equipment receives the resource loading success identifier or the number of times of calling the second resource detection interface reaches the second preset number of times. The second preset period may be the same as the first preset period, and since the time of calling the first resource detection interface for the first time and the time of calling the second resource detection interface for the first time are not stopped, when the first preset period and the second preset period are the same, the first resource detection interface and the second resource detection interface can be alternatively called to detect whether loading of the target resource is completed, and the target resource is determined to be completed at the first time when loading of the target resource is completed. The second preset number of times may be greater than the first preset number of times to still determine that the target resource has been loaded at the first time on the premise of reducing the number of times that the target resource is detected to be loaded successfully.
According to the service registration method provided by the embodiment, after a resource detection instruction is received in a current second preset period, a second resource detection interface is called, and a corresponding second resource detection program is accessed through the second resource detection interface, so that whether loading of target resources is completed or not is detected through the second resource detection program; receiving a resource loading result identifier returned by the second resource detection interface, wherein the resource loading result identifier is a resource loading success identifier or a resource loading failure identifier; if the resource loading result mark is determined to be the resource loading success mark, stopping calling the second resource detection interface after receiving the resource detection instruction in the next second preset period; if the resource loading result mark is determined to be the resource loading failure mark and the resource loading success mark returned by the first resource detection interface is not received when the time reaches the next second preset period, the second resource detection interface is continuously called until the resource loading success mark is received or the frequency of calling the second resource detection interface reaches the second preset frequency. When the resource loading result mark is determined to be the resource loading success mark, the second resource detection interface is stopped to be called after the resource detection instruction is received in the next second preset period, so that the resource detection interface can be immediately stopped to be called after the resource loading is successful, the situation that the successfully loaded target resource is detected again due to the fact that the control end equipment information is updated later is avoided, and the number of times of calling the interface by the providing end equipment is reduced. Meanwhile, when the resource loading result mark is determined to be a resource loading failure mark and the resource loading success mark returned by the first resource detection interface is not received when the time reaches the next second preset period, the second resource detection interface is continuously called, whether the target resource is successfully loaded or not can be continuously determined when the target resource is not successfully loaded, the latest state in the obtained target resource loading process can be further determined accurately at the first time, and the target resource is loaded. And stopping calling the second resource detection interface after receiving the resource loading success identification, so that the number of times of calling the interface by the provider equipment can be reduced. After the number of times of calling the second resource detection interface reaches the second preset number of times, stopping calling the second resource detection interface in the next second preset period, so that resource waste of the providing end equipment caused by continuous resource detection of the application with the resources in the loading state due to longer resource loading time or error of resource loading can be avoided.
Example IV
The service registration method provided in this embodiment further includes step 501 if a successful resource loading identifier returned by the first resource detection interface or the second resource detection interface is received for the first time on the basis of any one of the first to third embodiments.
Step 501, resource loading success information is sent to the control end device, where the resource loading success information is used to instruct the control end device to stop sending the resource detection instruction.
In this embodiment, if the providing end device receives the resource loading success flag, it represents that the target resource has been loaded successfully, so as to avoid that the control end device always sends a resource detection instruction, the providing end device may send resource loading success information to the control end device, so as to update the loading state of the target resource to the control end device, and instruct the control end device to stop sending the resource detection instruction.
According to the service registration method provided by the embodiment, the resource loading success information is sent to the control end equipment, and the resource loading success information is used for indicating the control end equipment to stop sending the resource detection instruction. Because the successful resource loading information is sent to the control end equipment, the target resource loading state on the control end equipment can be updated, the control end equipment is prevented from always sending a resource detection instruction, and the resource waste of the control end equipment is reduced.
As an optional implementation manner, on the basis of the fourth embodiment, if the number of times of calling the second resource detection interface reaches the second preset number of times, no resource loading success information is yet sent to the control end device, then step 502 is further included.
Step 502, receiving a target application restarting instruction sent by the control end device, and restarting the target application.
In this embodiment, the second preset times and the second preset period may be set according to experience, so that the target resources required by the common target application to provide services are loaded before the times of calling the second resource detection interface reach the second preset times. For the providing end device, if the resource loading success information is not sent to the control end device after the number of times of calling the second resource detection interface reaches the second preset number of times, the target resource is not loaded successfully, and then an error may occur in the loading process of the target resource. For the control end device, the number of times of sending the resource detection instruction can be recorded after each time of sending the resource detection instruction, after the number of times of sending the resource detection instruction reaches the second preset number of times, the successful resource loading information sent by the providing end device is not received yet, and if an error occurs in the process of loading the target resource, the control end device sends a target application restarting instruction to the control end device, so that the providing end device is instructed to restart the target application and reload the target resource. It can be understood that after the target should be restarted, the control end device adopts the same method to determine whether the loading of the target resource is completed, and registers the target service with the registry after receiving the successful resource loading identifier returned by the first resource detection interface or the second resource detection interface for the first time.
According to the service registration method provided by the embodiment, the target application restarting instruction sent by the control terminal equipment is received, and the target application is restarted. Because the target application is restarted, the situation that the target resource is not loaded all the time due to the error in the loading process of the target resource can be avoided, and whether the target resource is loaded or not can still be determined at the first time.
Example five
Fig. 5 is a flowchart of a service registration method according to a fifth embodiment of the present application, and as shown in fig. 5, an execution subject of the present application is a service registration device, where the service registration device is located in a control end device. The service registration method provided in this embodiment includes steps 601 to 602.
Step 601, sending a target application starting instruction to a providing end device; the target application starting instruction is used for indicating the providing end equipment to start the target application, and calling a first resource detection interface which is pre-configured according to a first preset period so as to detect whether the loading of target resources required by the target application for providing the target service is completed.
In this embodiment, the provider device may monitor the service processing pressure of the provider device where the application service provider is located, for example, by looking at the thread pool resource occupancy of the provider device to determine the service processing pressure of the provider device. In a scenario where transactions are frequent, more consumer devices need to use services provided by the provider device, and the thread pool resource occupancy rate of the provider device may be higher, so as to improve the throughput of the system, avoid that the thread resource pool of the provider device is full, and generally, the controller device will start more target applications. To reduce the pressure of each application service provider to handle traffic. The control end device may send a target application start instruction to the provider end device where the application service provider is located.
Step 602, if it is determined that the target application is started, sending a resource detection instruction to the providing end device according to a second preset period, where the resource detection instruction is used to instruct the providing end device to call a second resource detection interface to detect whether loading of the target resource is completed, and call times of the first resource detection interface and the second resource detection interface are different.
In this embodiment, the control end device may monitor the process of the target application through a communication interface preconfigured with the providing end device, so as to determine whether the target application is started and completed, for example, the control end device may call the preconfigured communication interface between the control end device and the providing end device according to a preset period, and receive a target application starting state returned by the communication interface, where the target application starting state is that the target application is started and completed or is that the target application is not completed. After the target application is determined to be started, the control end device can send a resource detection instruction to the providing end device according to a second preset period so as to ensure that the target application is started when the control end device receives the resource detection instruction, and a second resource detection interface can be called so as to detect whether the target resource is loaded completely. The second preset period may be set on the control side device. Here, since the control end device cannot determine that the target application is started at the first time when the target application is started, when the providing end device receives the resource detection instruction, the first resource detection interface is already called, and the calling time of the first resource detection interface is different from the calling time of the second resource detection interface. In the PaaS cloud platform, the second resource detection interface may be a readiness interface, which is capable of checking whether the target resource is already loaded, whether the application is ready, and whether the service can be provided after being called.
According to the service registration method provided by the embodiment, a target application starting instruction is sent to the providing end equipment; the target application starting instruction is used for indicating the providing end equipment to start the target application, and calling a first resource detection interface which is pre-configured according to a first preset period so as to detect whether the loading of target resources required by the target application for providing the target service is completed or not; if the target application is determined to be started, a resource detection instruction is sent to the providing end equipment according to a second preset period, wherein the resource detection instruction is used for indicating the providing end equipment to call a second resource detection interface so as to detect whether the target resource is loaded, and the calling time of the first resource detection interface is different from the calling time of the second resource detection interface. The first resource detection interface and the second resource detection interface have different calling time, so that the providing end equipment can determine whether the target resource is loaded for more times, and the target resource can be determined to be loaded at the first time when the target resource is loaded.
As an optional implementation manner, on the basis of the fifth embodiment, the refinement of "sending the resource probe instruction to the providing end device according to the second preset period" in step 602 includes steps 701 to 702.
In step 701, a resource detection instruction is sent to the providing end device in the current second preset period, where the resource detection instruction is used to instruct the providing end device to call the second resource detection interface to detect whether loading of the target resource required by the target application to provide the target service is completed.
In this embodiment, the second resource detection interface corresponds to a second resource detection program, and the second resource detection program may be configured in the control end device or may be configured in the resource detection device. Since the first resource probe interface needs to be invoked after the target should be started, the first resource probe interface needs to be configured on the provider device when the target application is deployed. The second resource detection interface can be configured on the control end device after the target application is deployed, so that the flexibility is higher. Meanwhile, the control end equipment sends a resource detection instruction to the providing end equipment, and the control end equipment can directly record the times of sending the resource detection instruction, so as to further determine the times of calling the second resource detection interface by the providing end equipment.
Step 702, if the resource loading success information sent by the providing end device is not received when the time reaches the next second preset period, sending a resource detection instruction to the providing end device again until the resource loading success information sent by the provider is received, or the number of times of sending the resource detection instruction to the providing end device reaches the second preset number of times.
In this embodiment, for the control end device, if the target resource has already been loaded, the control end device receives the resource loading success information sent by the providing end device, and then stops sending the resource probing instruction. If the time reaches the next second preset period, the successful resource loading information sent by the providing end device is not received, which may be that the target resource is not loaded, or the time of the second preset period is too short, the operation of the providing end device for calling the second resource detection interface is not executed, or the providing end device has sent the successful resource loading information, but the control end device has not received the successful resource loading information sent by the providing end device. Therefore, in order to ensure that whether the loading of the target resource is completed can be continuously determined in the process of loading the target resource, so as to accurately determine whether the loading of the target resource is completed, the control end device can send the resource detection instruction to the providing end device again until the successful information of resource loading sent by the providing end device is received, or the frequency of sending the resource detection instruction to the providing end device reaches a second preset frequency. The second preset times can be set on the control end device. In order to avoid the situation that the target resource cannot finish loading all the time due to the fact that the target resource is in error in loading, after the frequency of sending the resource detection instruction to the providing end equipment by the control end equipment reaches the second preset frequency, whether the resource loading success information is received or not, the control end equipment stops sending the resource detection instruction to the providing end equipment in the next second preset period.
According to the service registration method provided by the embodiment, a resource detection instruction is sent to the providing end equipment in the current second preset period, and the resource detection instruction is used for indicating the providing end equipment to call the second resource detection interface so as to detect whether target resources required by target application for providing target service are loaded or not; if the resource loading success information sent by the providing end equipment is not received when the time reaches the next second preset period, the resource detection instruction is sent to the providing end equipment again until the resource loading success information sent by the provider is received or the frequency of sending the resource detection instruction to the providing end equipment reaches the second preset frequency. Because the resource loading completion information sent by the providing end device is not received when the time reaches the next second preset period, the resource detection instruction is sent to the providing end device again, so that the control end device can continuously determine whether the target resource is loaded and completed, and after the resource loading success information sent by the provider is received or the number of times of sending the resource detection instruction to the providing end device reaches the second preset number of times, the resource detection instruction is stopped being sent, so that whether the target resource is loaded and completed can be determined at the first time, and whether the target resource is loaded and completed can be avoided from being determined invalidily when the target resource loading is wrong.
As an optional implementation manner, on the basis of the fifth embodiment, if the number of times of sending the resource probing instruction to the providing end device reaches the second preset number of times, no resource loading success information is received yet, then step 801 is further included.
In step 801, a target application restart instruction is sent to a provider device, where the target application restart instruction is used to instruct the provider device to restart a target application.
In this embodiment, if the time reaches the next second preset period and the number of times that the control end device sends the resource detection instruction to the providing end device reaches the second preset number of times, the control end device still does not receive the resource loading success information, at this time, the target resource may have an error in the loading process, and restarting the target application and reloading the target resource can solve most of the errors of the target resource in the loading process, so the control end device may send a target application restarting instruction to the providing end device, where the instruction is used to instruct the providing end device to restart the target application. In this embodiment, before the control end device sends the target application restart instruction to the providing end device, a preset time may be waited, where the preset time may be: the providing end equipment calls the resource detection interface once and receives the resource loading result identifier returned by the resource detection interface, and sends resource loading success information to the control end equipment, and the control end equipment can receive the time required by the resource loading success information.
According to the service registration method provided by the embodiment, the target application restarting instruction is sent to the provider equipment, and the target application restarting instruction is used for indicating the provider equipment to restart the target application. Since the restart instruction is sent to instruct the providing end device to restart the target application, the target application can be restarted when the target application loads the target resource and has an error or the program of the target application has an error, so that the target application is recovered to be normal.
Example six
Fig. 6 is a schematic structural diagram of a service registration device according to a sixth embodiment of the present application, and as shown in fig. 6, a service registration device 130 provided in the present embodiment is located in a provider device. The service registration device 130 includes a receiving module 131, a first detecting module 132, a second detecting module 133, and a registration module 134.
The receiving module 131 is configured to receive a target application start instruction sent by the control end device, and start a target application.
The first detection module 132 is configured to invoke a first resource detection interface configured in advance according to a first preset period after the target application is started, so as to detect whether loading of a target resource required by the target application to provide the target service is completed.
The second detection module 133 is configured to receive a resource detection instruction sent by the control end device according to a second preset period, and call a second resource detection interface after receiving the resource detection instruction, so as to detect whether loading of the target resource is completed; the call time of the first resource detection interface is different from the call time of the second resource detection interface.
The registration module 134 is configured to register the target service with the registry after receiving the resource loading success identifier returned by the first resource probing interface or the second resource probing interface for the first time.
As an optional implementation manner, the first detection module 132 is specifically configured to call the first resource detection interface in a current first preset period, access a corresponding first resource detection program through the first resource detection interface, and detect whether loading of the target resource is completed through the first resource detection program; receiving a resource loading result identifier returned by the first resource detection interface, wherein the resource loading result identifier is a resource loading success identifier or a resource loading failure identifier; if the resource loading result mark is determined to be the resource loading success mark, stopping calling the first resource detection interface in the next first preset period; if the resource loading result mark is determined to be the resource loading failure mark and the resource loading success mark returned by the second resource detection interface is not received when the time reaches the next first preset period, the first resource detection interface is continuously called until the resource loading success mark is received or the frequency of calling the first resource detection interface reaches the first preset frequency.
As an optional implementation manner, the second detection module 133 is specifically configured to call the second resource detection interface after receiving the resource detection instruction in the current second preset period, and access the corresponding second resource detection program through the second resource detection interface, so as to detect whether the loading of the target resource is completed through the second resource detection program; receiving a resource loading result identifier returned by the second resource detection interface, wherein the resource loading result identifier is a resource loading success identifier or a resource loading failure identifier; if the resource loading result mark is determined to be the resource loading success mark, stopping calling the second resource detection interface after receiving the resource detection instruction in the next second preset period; if the resource loading result mark is determined to be the resource loading failure mark and the resource loading success mark returned by the first resource detection interface is not received when the time reaches the next second preset period, the second resource detection interface is continuously called until the resource loading success mark is received or the frequency of calling the second resource detection interface reaches the second preset frequency.
As an alternative embodiment, the service registration device 130 further includes a transmitting module. If the resource loading success identification returned by the first resource detection interface or the second resource detection interface is received for the first time, the sending module is used for sending resource loading success information to the control end equipment, and the resource loading success information is used for indicating the control end equipment to stop sending the resource detection instruction.
As an optional implementation manner, if the number of times of calling the second resource detection interface reaches the second preset number of times and then the resource loading success information is not yet sent to the control end device, the receiving module 131 is further specifically configured to receive a target application restart instruction sent by the control end device, and restart the target application.
The service registration device provided in this embodiment may execute the service registration method provided in any one of the first to fourth embodiments, and the specific implementation manner is similar to the principle, and will not be repeated here.
Example seven
Fig. 7 is a schematic structural diagram of a service registration device according to a seventh embodiment of the present application, and as shown in fig. 7, a service registration device 110 provided in the present embodiment is located in a control end device. The service registration device 110 includes a first transmission module 111 and a second transmission module 112.
A first sending module 111, configured to send a target application start instruction to a provider device; the target application starting instruction is used for indicating the providing end equipment to start the target application, and calling a first resource detection interface which is pre-configured according to a first preset period so as to detect whether the loading of target resources required by the target application for providing the target service is completed.
And the second sending module 112 is configured to send a resource detection instruction to the providing end device according to a second preset period if it is determined that the target application is started, where the resource detection instruction is used to instruct the providing end device to call the second resource detection interface to detect whether the target resource is loaded, and call times of the first resource detection interface and the second resource detection interface are different.
As an optional implementation manner, the second sending module 112 is specifically configured to send, to the providing end device, a resource detection instruction in a current second preset period, where the resource detection instruction is used to instruct the providing end device to call the second resource detection interface to detect whether loading of a target resource required by the target application to provide the target service is completed; if the resource loading success information sent by the providing end equipment is not received when the time reaches the next second preset period, the resource detection instruction is sent to the providing end equipment again until the resource loading success information sent by the provider is received or the frequency of sending the resource detection instruction to the providing end equipment reaches the second preset frequency.
As an optional implementation manner, the service registration apparatus 110 further includes a third sending module, where if the number of times of sending the resource probing instruction to the providing end device reaches the second preset number of times, the third sending module is configured to send a target application restart instruction to the providing end device, where the target application restart instruction is used to instruct the providing end device to restart the target application.
The service registration device provided in this embodiment may execute the service registration method provided in the fifth embodiment, and the specific implementation manner and principle are similar, and are not repeated here.
Example eight
Fig. 8 is a block diagram of a provider device according to an eighth embodiment of the present application, and as shown in fig. 8, the provider device 13 provided in this embodiment includes a memory 81, a processor 82, and a transceiver 83.
The memory 81, the processor 82 and the transceiver 83 are electrically interconnected.
The memory 81 stores computer-executable instructions.
The transceiver 83 is used for transmitting and receiving data.
The processor 82 executes computer-executable instructions stored in the memory 81 to implement the service registration method as provided in any one of the first to fourth embodiments.
Example nine
Fig. 9 is a block diagram of a control-end device provided according to a ninth embodiment of the present application, and as shown in fig. 9, the control-end device 11 provided in this embodiment includes a memory 91, a processor 92, and a transceiver 93.
The memory 91, processor 92 and transceiver 93 are electrically interconnected.
The memory 91 stores computer-executable instructions.
The transceiver 93 is used to transmit and receive data.
The processor 92 executes computer-executable instructions stored in the memory 91 to implement the service registration method as provided in the fifth embodiment.
The embodiments of the present invention also provide a computer-readable storage medium having stored therein computer-executable instructions which, when executed by a processor, are configured to implement the service registration method as provided in any one of the first to fifth embodiments.
It should be understood that the above-described device embodiments are merely illustrative, and that the device of the present application may be implemented in other ways. For example, the division of the modules in the above embodiment is merely a logic function division, and there may be another division manner when actually implemented. For example, multiple modules may be combined, or may be integrated into another system, or some features may be omitted or not performed. In addition, each functional module in each embodiment of the present application may be integrated into one module, or each module may exist alone physically, or two or more modules may be integrated together, unless otherwise specified. The integrated single module may be implemented in hardware or in software program modules. The integrated modules, if implemented in hardware, may be digital circuits, analog circuits, and the like. Physical implementations of hardware structures include, but are not limited to, transistors, memristors, and the like. The integrated modules, if implemented in the form of software program modules and sold or used as a stand-alone product, may be stored in a computer readable memory.
In embodiments of the present application, the processor may be any suitable hardware processor, such as a Central Processing Unit (CPU), a Graphics Processor (GPU), a Field Programmable Gate Array (FPGA), a Digital Signal Processing (DSP), an Application Specific Integrated Chip (ASIC), and the like. The memory may be implemented by any type of volatile or nonvolatile memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
It should be noted that, for simplicity of description, the foregoing method embodiments are all expressed as a series of action combinations, but it should be understood by those skilled in the art that the present application is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all alternative embodiments, and that the acts and modules referred to are not necessarily required in the present application.
It should be further noted that, although the steps in the flowchart are sequentially shown as indicated by arrows, the steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least a portion of the steps in the flowcharts may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order in which the sub-steps or stages are performed is not necessarily sequential, and may be performed in turn or alternately with at least a portion of the sub-steps or stages of other steps or other steps.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the present application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (13)

1. A service registration method applied to a service registration device, the service registration device being located in a provider device, the method comprising:
receiving a target application starting instruction sent by control terminal equipment, and starting a target application;
after the target application is started, a first resource detection interface which is pre-configured is called according to a first preset period so as to detect whether target resources required by the target application for providing the target service are loaded;
receiving a resource detection instruction sent by the control terminal equipment according to a second preset period, and calling a second resource detection interface after receiving the resource detection instruction so as to detect whether the loading of the target resource is completed; the calling time of the first resource detection interface is different from the calling time of the second resource detection interface;
and after receiving the successful resource loading identification returned by the first resource detection interface or the second resource detection interface for the first time, registering the target service with a registration center.
2. The method of claim 1, wherein invoking the preconfigured first resource probing interface for probing whether loading of the target resource required by the target application to provide the target service is complete comprises:
calling a first resource detection interface in a current first preset period, and accessing a corresponding first resource detection program through the first resource detection interface so as to detect whether loading of target resources is completed or not through the first resource detection program;
receiving a resource loading result identifier returned through a first resource detection interface, wherein the resource loading result identifier is a resource loading success identifier or a resource loading failure identifier;
if the resource loading result mark is determined to be the resource loading success mark, stopping calling the first resource detection interface in the next first preset period;
if the resource loading result mark is determined to be the resource loading failure mark and the resource loading success mark returned by the second resource detection interface is not received when the time reaches the next first preset period, the first resource detection interface is continuously called until the resource loading success mark is received or the frequency of calling the first resource detection interface reaches the first preset frequency.
3. The method of claim 1, wherein the invoking the second resource probing interface after receiving the resource probing instruction to probe whether the loading of the target resource is complete comprises:
calling a second resource detection interface after receiving a resource detection instruction in a current second preset period, and accessing a corresponding second resource detection program through the second resource detection interface so as to detect whether loading of target resources is completed or not through the second resource detection program;
receiving a resource loading result identifier returned by the second resource detection interface, wherein the resource loading result identifier is a resource loading success identifier or a resource loading failure identifier;
if the resource loading result mark is determined to be the resource loading success mark, stopping calling the second resource detection interface after receiving the resource detection instruction in the next second preset period;
if the resource loading result mark is determined to be the resource loading failure mark and the resource loading success mark returned by the first resource detection interface is not received when the time reaches the next second preset period, the second resource detection interface is continuously called until the resource loading success mark is received or the frequency of calling the second resource detection interface reaches the second preset frequency.
4. A method according to any one of claims 1 to 3, further comprising, if the resource loading success identifier returned by the first resource probing interface or the second resource probing interface is received for the first time:
and sending resource loading success information to the control end equipment, wherein the resource loading success information is used for indicating the control end equipment to stop sending the resource detection instruction.
5. The method of claim 4, wherein if the resource loading success information is not yet sent to the control end device after the number of times of calling the second resource probing interface reaches the second preset number of times, further comprising:
and receiving a target application restarting instruction sent by the control terminal equipment, and restarting the target application.
6. A service registration method applied to a service registration device, wherein the service registration device is located in a control end device, and the method is characterized by comprising the following steps:
sending a target application starting instruction to a providing end device; the target application starting instruction is used for indicating the providing end equipment to start the target application, and calling a first resource detection interface which is pre-configured according to a first preset period so as to detect whether the loading of target resources required by the target application for providing the target service is completed or not;
If the target application is determined to be started, sending a resource detection instruction to the providing end equipment according to a second preset period, wherein the resource detection instruction is used for indicating the providing end equipment to call a second resource detection interface so as to detect whether the target resource is loaded completely or not, and the calling time of the first resource detection interface is different from the calling time of the second resource detection interface;
and the providing end equipment registers the target service to a registration center after receiving the resource loading success identification returned by the first resource detection interface or the second resource detection interface for the first time.
7. The method of claim 6, wherein the sending the resource probing command to the providing terminal device according to the second preset period includes:
transmitting a resource detection instruction to the providing end equipment in a current second preset period, wherein the resource detection instruction is used for indicating the providing end equipment to call a second resource detection interface so as to detect whether target resources required by target application for providing target service are loaded completely or not;
if the resource loading success information sent by the providing end equipment is not received when the time reaches the next second preset period, the resource detection instruction is sent to the providing end equipment again until the resource loading success information sent by the providing end equipment is received or the frequency of sending the resource detection instruction to the providing end equipment reaches the second preset frequency.
8. The method of claim 6, further comprising, if the resource loading success information is not received until the number of times the resource probing command is sent to the providing device reaches the second preset number of times:
and sending a target application restarting instruction to the providing end equipment, wherein the target application restarting instruction is used for indicating the providing end equipment to restart the target application.
9. A service registration apparatus, which is located in a provider device, comprising:
the receiving module is used for receiving a target application starting instruction sent by the control terminal equipment and starting the target application;
the first detection module is used for calling a first resource detection interface which is pre-configured according to a first preset period after the target application is started so as to detect whether target resources required by the target application for providing the target service are loaded;
the second detection module is used for receiving a resource detection instruction sent by the control terminal equipment according to a second preset period, and calling a second resource detection interface after receiving the resource detection instruction so as to detect whether the loading of the target resource is completed; the calling time of the first resource detection interface is different from the calling time of the second resource detection interface;
And the registration module is used for registering the target service to a registration center after receiving the successful resource loading identifier returned by the first resource detection interface or the second resource detection interface for the first time.
10. A service registration apparatus, which is located in a control-end device, comprising:
the first sending module is used for sending a target application starting instruction to the providing end equipment; the target application starting instruction is used for indicating the providing end equipment to start the target application, and calling a first resource detection interface which is pre-configured according to a first preset period so as to detect whether the loading of target resources required by the target application for providing the target service is completed or not;
the second sending module is used for sending a resource detection instruction to the providing terminal equipment according to a second preset period if the target application is determined to be started, wherein the resource detection instruction is used for indicating the providing terminal equipment to call a second resource detection interface so as to detect whether the target resource is completely loaded, and the calling time of the first resource detection interface is different from the calling time of the second resource detection interface; and the providing end equipment registers the target service to a registration center after receiving the resource loading success identification returned by the first resource detection interface or the second resource detection interface for the first time.
11. A provider device, comprising: memory, processor, and transceiver;
the memory, the processor, and the transceiver circuitry are interconnected;
the memory stores computer-executable instructions;
the transceiver is used for receiving and transmitting data;
the processor executes computer-executable instructions stored in the memory to implement the method of any one of claims 1 to 5.
12. A control side device, characterized by comprising: memory, processor, and transceiver;
the memory, the processor, and the transceiver circuitry are interconnected;
the memory stores computer-executable instructions;
the transceiver is used for receiving and transmitting data;
the processor executes computer-executable instructions stored in the memory to implement the method of any one of claims 6 to 8.
13. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor are adapted to carry out the method of any one of claims 1 to 8.
CN202210415134.4A 2022-04-20 2022-04-20 Service registration method, device, equipment and storage medium Active CN114785859B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210415134.4A CN114785859B (en) 2022-04-20 2022-04-20 Service registration method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210415134.4A CN114785859B (en) 2022-04-20 2022-04-20 Service registration method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114785859A CN114785859A (en) 2022-07-22
CN114785859B true CN114785859B (en) 2024-01-09

Family

ID=82431969

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210415134.4A Active CN114785859B (en) 2022-04-20 2022-04-20 Service registration method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114785859B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104765622A (en) * 2014-01-03 2015-07-08 腾讯科技(深圳)有限公司 Page resource loading method and device
WO2015103850A1 (en) * 2014-01-09 2015-07-16 中兴通讯股份有限公司 Method, apparatus and terminal for controlling page loading progress
CN113992593A (en) * 2021-10-20 2022-01-28 京东科技信息技术有限公司 Service resource calling method and device, electronic equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104765622A (en) * 2014-01-03 2015-07-08 腾讯科技(深圳)有限公司 Page resource loading method and device
WO2015103850A1 (en) * 2014-01-09 2015-07-16 中兴通讯股份有限公司 Method, apparatus and terminal for controlling page loading progress
CN113992593A (en) * 2021-10-20 2022-01-28 京东科技信息技术有限公司 Service resource calling method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN114785859A (en) 2022-07-22

Similar Documents

Publication Publication Date Title
US9904585B1 (en) Error handling in executing workflow state machines
US8151277B2 (en) Method and system for dynamic remote injection of in-process agents into virtual machine based applications
US20130305097A1 (en) Computer program testing
US8904388B2 (en) Scripting language executor service for applications
CN107688502B (en) Inter-process communication method and device
CN107241315B (en) Access method and device of bank gateway interface and computer readable storage medium
US10726121B2 (en) Methods and apparatus for improving sandboxed code execution by caching container image templates
CN107220074B (en) Method and device for accessing and upgrading supporting layer software function
US11880694B2 (en) System and method for behavior injection in cloud computing platforms or applications
CA2904253A1 (en) Computer system using in-service software upgrade
US8484616B1 (en) Universal module model
CN112559461A (en) File transmission method and device, storage medium and electronic equipment
CN110659104B (en) Service monitoring method and related equipment
CN114785859B (en) Service registration method, device, equipment and storage medium
US11539612B2 (en) Testing virtualized network functions
CN112564956A (en) Remote upgrading method, equipment and device for client and storage medium
CN109495298B (en) Method and device for managing nodes in OpenStack system
CN113127089A (en) Starting control method of module of service architecture and computer equipment
CN106972963B (en) Service module starting control method and starting control method after crash restart
CN113296911B (en) Cluster calling method, cluster calling device, electronic equipment and readable storage medium
CN112130900B (en) User information management method, system, equipment and medium for BMC
US11425203B2 (en) Commissioning a virtualized network function
CN110109747B (en) Apache Spark-based data exchange method, system and server
CN115033251A (en) Software deployment method and device, electronic equipment and storage medium
CN112187753B (en) Data updating method, device, equipment 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