CN115484162B - Component adaptation method, device, server side and storage medium of software system - Google Patents

Component adaptation method, device, server side and storage medium of software system Download PDF

Info

Publication number
CN115484162B
CN115484162B CN202211021226.0A CN202211021226A CN115484162B CN 115484162 B CN115484162 B CN 115484162B CN 202211021226 A CN202211021226 A CN 202211021226A CN 115484162 B CN115484162 B CN 115484162B
Authority
CN
China
Prior art keywords
component
service
copy
server
type
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
CN202211021226.0A
Other languages
Chinese (zh)
Other versions
CN115484162A (en
Inventor
邱炜伟
谭锦志
李伟
尚璇
戴唯威
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Qulian Technology Co Ltd
Original Assignee
Hangzhou Qulian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Qulian Technology Co Ltd filed Critical Hangzhou Qulian Technology Co Ltd
Priority to CN202211021226.0A priority Critical patent/CN115484162B/en
Publication of CN115484162A publication Critical patent/CN115484162A/en
Application granted granted Critical
Publication of CN115484162B publication Critical patent/CN115484162B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • H04L41/0816Configuration setting characterised by the conditions triggering a change of settings the condition being an adaptation, e.g. in response to network events
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0893Assignment of logical groups to network elements

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Hardware Redundancy (AREA)

Abstract

The application is applicable to the technical field of computers, and provides a component adaptation method, a device, a server and a computer readable storage medium of a software system, wherein the method comprises the following steps: acquiring a component to be adapted of a software system; determining the type of service provided by the component to be adapted; and carrying out adaptation processing on the component to be adapted according to a preset processing strategy corresponding to the type. By adopting the method, different adapting treatments can be carried out on the component to be adapted according to the types of different services provided by the component to be adapted, so that the flexibility and the practicability of the adapting treatment of the component are improved.

Description

Component adaptation method, device, server side and storage medium of software system
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for adapting components of a software system, a server, and a computer readable storage medium.
Background
High availability (High Availability, HA) generally refers to a software system that HAs been specifically designed to reduce downtime while maintaining a high availability of its services. Therefore, in order to improve the service efficiency of a software system, it is necessary to achieve high availability of the system.
However, in the prior art, an original software system which does not support high availability is modified into a software system which supports high availability of multiple component copies, and each component in the software system is simply set into a master-slave mode, that is, the component adaptation method of the existing software system generally adopts the same adaptation processing for all components, so that the flexibility and the practicability are low.
Disclosure of Invention
The embodiment of the application provides a component adaptation method, a device, a server and a computer readable storage medium of a software system, which can solve the problems of low flexibility and practicability in the prior art.
In a first aspect, an embodiment of the present application provides a method for adapting a component of a software system, where the method is applied to a server, and the method includes:
Acquiring a component to be adapted of a software system;
determining the type of service provided by the component to be adapted;
And carrying out adaptation processing on the component to be adapted according to a preset processing strategy corresponding to the type.
Optionally, the performing, according to a preset processing policy corresponding to the type, the adapting processing on the component to be adapted includes:
If the type is a stateless and storable service type, deploying a component copy which provides the same service as the component to be adapted; the stateless and non-storage means that the server does not cache information of the client when providing the service, and the related data of the component to be adapted is not stored in an external component.
Optionally, the performing, according to a preset processing policy corresponding to the type, the adapting processing on the component to be adapted includes:
If the type is a stateless and stored service type, deploying a component copy which provides the same service as the component to be adapted, and storing the data stored by the component to be adapted, the component copy and the external component into a shared memory; the stateless and stored information refers to that the server does not cache the client when providing the service, and the related data of the component to be adapted is stored in the external component.
Optionally, the performing, according to a preset processing policy corresponding to the type, the adapting processing on the component to be adapted includes:
If the type is a stateful and stored service type or a stateful and non-stored service type, deploying a plurality of component copies which provide the same service as the component to be adapted, and storing the component to be adapted, the plurality of component copies and data stored by an external component into a shared memory; each component copy carries a corresponding service address; the stateful storage means that the server caches information of the client when providing the service, and relevant data of the component to be adapted is stored in the external component; the stateless storage means that the server caches information of the client when providing the service, and the related data of the component to be adapted is not stored in the external component;
and selecting a target component copy from the multiple component copies, and finishing service registration at a service registration center through a service address carried by the target component copy.
Optionally, the selecting a target component copy from the plurality of component copies includes:
configuring a plurality of duplicate addresses which are equal to the duplicate number of the component in a configuration item of the service agent component; the plurality of duplicate addresses are in one-to-one correspondence with the plurality of component duplicate addresses; at least two service agent components are provided;
detecting whether component copies corresponding to the copy addresses respectively run normally or not;
and selecting the target component copy from the component copies which normally run.
Optionally, the service proxy component is a gateway service.
Optionally, after the service registration center completes service registration through the service address carried by the target component copy, the method further includes:
Detecting whether the target component copy normally operates or not at preset time intervals;
And if the target component copy does not normally operate, selecting one component copy except the target component copy from the multiple component copies, and finishing service registration at the service registration center through a service address carried by the one component copy.
Optionally, after the service registration center completes service registration through the service address carried by the target component copy, the method further includes:
And if the service registration center detects that the heartbeat packet corresponding to the target component copy, which is sent by the service proxy component, is not received after the preset time period, selecting one component copy except the target component copy from the multiple component copies, and finishing service registration at the service registration center through a service address carried by the one component copy.
In a second aspect, an embodiment of the present application provides a component adapting device of a software system, applied to a server, where the device includes:
the acquisition unit is used for acquiring the component to be adapted of the software system;
A determining unit, configured to determine a type of service provided by the component to be adapted;
And the processing unit is used for carrying out adaptation processing on the component to be adapted according to a preset processing strategy corresponding to the type.
In a third aspect, an embodiment of the present application provides a server, including: a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the method of adapting components of a software system according to any of the first aspects described above when the computer program is executed.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the method of adapting components of a software system as described in any of the first aspects above.
In a fifth aspect, embodiments of the present application provide a computer program product, which, when run on a server side, enables the server side to execute the component adaptation method of the software system according to any one of the first aspects.
Compared with the prior art, the embodiment of the application has the beneficial effects that:
The component adapting method of the software system provided by the embodiment of the application comprises the steps of obtaining a component to be adapted of the software system; determining the type of service provided by the component to be adapted; and carrying out adaptation processing on the component to be adapted according to a preset processing strategy corresponding to the type. Compared with the prior art that the same adaptation mode is adopted for all the components, the embodiment of the application combines the types of the services provided by the components to be adapted, and carries out different adaptation processing according to different types, namely, the components providing the services of different types can be respectively subjected to different adaptation processing, thereby improving the flexibility and the practicability of the component adaptation processing.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments or the description of the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an implementation of a method of component adaptation of a software system provided by an embodiment of the present application;
FIG. 2 is a flow chart of an implementation of a method of component adaptation of a software system provided by another embodiment of the present application;
FIG. 3 is a flow chart of an implementation of a method of component adaptation of a software system provided by a further embodiment of the present application;
FIG. 4 is a flow chart of an implementation of a method of component adaptation of a software system provided by a further embodiment of the present application;
FIG. 5 is a flow chart of an implementation of a method of component adaptation of a software system provided by a further embodiment of the present application;
FIG. 6 is a flow chart of an implementation of a method of component adaptation of a software system provided by a further embodiment of the present application;
FIG. 7 is a schematic diagram of a component adapting device of a software system according to an embodiment of the present application;
Fig. 8 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in the present description and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
Furthermore, the terms "first," "second," "third," and the like in the description of the present specification and in the appended claims, are used for distinguishing between descriptions and not necessarily for indicating or implying a relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
Referring to fig. 1, fig. 1 is a flowchart of an implementation method of a component adapting method of a software system according to an embodiment of the present application. In the embodiment of the application, the execution main body of the component adaptation method of the software system is a server. The server may be a desktop computer, a computer, or other devices.
As shown in fig. 1, the component adapting method of the software system according to an embodiment of the present application may include S101 to S103, which are described in detail as follows:
In S101, a component of the software system to be adapted is acquired.
In practical applications, in order to achieve high availability of a software system, a user may send a component adaptation request to a server configured with a certain software system.
In the embodiment of the present application, the detection of the component adaptation request by the server may be: the preset operation is detected. The preset operation may be set according to actual needs, which is not limited herein, and exemplary, the preset operation may be that the user clicks a preset control, that is, if the server detects that the user clicks the preset control on the server, or clicks a preset control in an Application (APP) related to the server, the user considers that the preset operation is detected, that is, the component adaptation request is detected.
Of course, the preset operation may also be a time triggering operation, and the server may be configured with a corresponding process flow when running, where the process flow includes triggering nodes of a plurality of key events, where the key events include an adaptation processing event for a component, in this case, if the server detects that the triggering node associated with the adaptation processing event reaches the component, the operations of S101 to S103 are performed, so as to perform the adaptation processing operation for the component of the software system.
After detecting the component adapting request, the terminal device may determine that a component in the software system is a component to be adapted. It should be noted that the component to be adapted may be any component in the software system.
In S102, a type of service provided by the component to be adapted is determined.
In practical applications, different components in a software system may provide different services due to their own characteristics and service functions, i.e. the types of services provided by different components may be different.
In an embodiment of the present application, the types of services provided by the components include, but are not limited to: stateful and stored service types, stateful and non-stored service types, stateless and stored service types, and stateless and non-stored service types.
The determination of the state refers to whether or not the requests from the same client have a context relationship at the server. If the request is stateful (i.e. there is a state), the server shall save the relevant information of the request, so that the request sent later can default to the previous request information. If the request is stateless (i.e., stateless), the processing information of the server is all from the information carried by the request and the common information that can be used by all requests.
The determination of whether or not there is a store refers to whether or not the component has data of a persisted state stored in the external component.
Based on this, the server may specifically determine the type of service provided by the component to be adapted according to the following steps, which are described in detail below:
If the server caches the information of the client when providing the service and the related data of the component to be adapted is stored in the external component, the type is determined to be a stateful and stored service type.
And if the server caches the information of the client when providing the service and the related data of the component to be adapted is not stored in the external component, determining that the type is a stateful and non-stored service type.
If the server side does not cache the information of the client side when providing the service and the related data of the component to be adapted is stored in the external component, determining that the type is a stateless and stored service type.
If the server side does not cache the information of the client side when providing the service and the related data of the component to be adapted is not stored in the external component, determining that the type is a stateless and storable service type.
In this embodiment, when the server detects that the server provides the service, the server needs to cache the information of the client, that is, the server needs to store the related information of the request sent by the client, that is, the requests from the same client have a context relationship at the server, and at this time, it can be determined that the component to be adapted is a stateful service. Meanwhile, when the server detects that the related data (namely the data in the persistence state) of the component to be adapted is stored in the external component, the server can determine that the component to be adapted has storage service. Thus, the server may determine that the component to be adapted is a stateful and stored service type.
When the server detects that the server provides the service, the server needs to cache the information of the client, namely the server needs to store the related information of the requests sent by the client, that is, the requests from the same client have a context relationship on the server, and at this time, the component to be adapted can be determined to be in a state service. Meanwhile, when the server detects that the related data (namely the data in the persistence state) of the component to be adapted is not stored in the external component, the server can determine that the component to be adapted is a storage-free service. Thus, the server may determine that the component to be adapted is a stateful and non-stored service type.
The server side does not need to cache the information of the client side when detecting that the server side provides the service, namely the server side does not need to save the related information of the request sent by the client side, the processing information of the server side is all from the information carried by the request at this time and the public information which can be used by all requests, that is, the requests from the same client side do not have a context relationship at the server side, and at the moment, the component to be adapted can be determined to be a stateless service. Meanwhile, when the server detects that the related data (namely the data in the persistence state) of the component to be adapted is stored in the external component, the server can determine that the component to be adapted has storage service. Thus, the server may determine that the component to be adapted is stateless and has a stored service type.
The server side does not need to cache the information of the client side when detecting that the server side provides the service, namely the server side does not need to save the related information of the request sent by the client side, the processing information of the server side is all from the information carried by the request at this time and the public information which can be used by all requests, that is, the requests from the same client side do not have a context relationship at the server side, and at the moment, the component to be adapted can be determined to be a stateless service. Meanwhile, when the server detects that the related data (namely the data in the persistence state) of the component to be adapted is not stored in the external component, the server can determine that the component to be adapted is a storage-free service. Thus, the server may determine that the component to be adapted is a stateless and storable service type.
In S103, according to a preset processing policy corresponding to the type, performing an adapting process on the component to be adapted.
In the embodiment of the application, the service end stores the corresponding relation between each service type and each processing strategy in advance, so that the service end can determine the processing strategy corresponding to the type of the service provided by the component to be adapted from the corresponding relation between each pre-stored service type and each processing strategy after determining the type of the service provided by the component to be adapted, and perform the adaptation processing on the component to be adapted according to the processing strategy.
The above can be seen that, according to the component adapting method of the software system provided by the embodiment of the application, the component to be adapted of the software system is obtained; determining the type of service provided by the component to be adapted; and carrying out adaptation processing on the component to be adapted according to a preset processing strategy corresponding to the type. Compared with the prior art that the same adaptation mode is adopted for all the components, the embodiment of the application combines the types of the services provided by the components to be adapted, and carries out different adaptation processing according to different types, namely, the components providing the services of different types can be respectively subjected to different adaptation processing, thereby improving the flexibility and the practicability of the component adaptation processing.
In another embodiment of the present application, when the type of service provided by the component to be adapted is a stateful and stored service type or a stateful and non-stored service type, please refer to fig. 2, fig. 2 is a component adapting method of a software system according to another embodiment of the present application. In contrast to the embodiment corresponding to fig. 1, S103 in this embodiment may specifically include S201 to S202, which are described in detail below:
In S201, if the type is a stateful and stored service type or a stateful and non-stored service type, deploying multiple component copies that provide the same service as the component to be adapted, and storing the data stored in the component to be adapted, the multiple component copies, and the external component into a shared memory; each component copy carries a corresponding service address; the stateful storage means that the server caches information of the client when providing the service, and relevant data of the component to be adapted is stored in the external component; the stateless storage means that the server caches information of the client when providing the service, and the related data of the component to be adapted is not stored in the external component.
In this embodiment, when the server detects that the type of the service provided by the component to be adapted is a stateful and stored service type or a stateful and non-stored service type, multiple component copies of the same service as the component to be adapted may be deployed, and in order to share data stored in the component to be adapted, the multiple component copies and the external component, the server may store the data stored in the component to be adapted, the multiple component copies and the external component into the shared memory.
It should be noted that each component copy carries a corresponding service address.
In S202, a target component copy is selected from the multiple component copies, and service registration is completed at a service registry through a service address carried by the target component copy.
In this embodiment, a service registry is disposed in the server.
In practical applications, the service registry service is used to store updated service provider information and real-time caller information for the service in real-time. Wherein the service registry may be ETCD. ETCD is an open-source, highly available distributed key-value storage system developed using Go language that can be used to configure registration and discovery of sharing and services. The service registry may also be a zookeeper, nacos, etc.
Because the state in the type of the component to be adapted provides the service indicates that the server can record the relevant information of the request sent by the client, the server can save the state of the client, the request sent by the client depends on the server, and multiple requests sent by the client must access the service address of the same component to be adapted, therefore, the server needs to select a target component copy from multiple component copies, and complete service registration in the service registration center through the service address carried by the target component copy.
In one embodiment of the present application, the server may specifically select the target component copy through S301 to S303 as shown in fig. 3, which is described in detail below:
In S301, a plurality of duplicate addresses equal to the number of duplicate copies of the component are configured in a configuration item of a service agent component; the plurality of duplicate addresses are in one-to-one correspondence with the plurality of component duplicate addresses; at least two service agent components are provided.
In S302, it is detected whether the component copies corresponding to the copy addresses respectively operate normally.
In S303, the target component copy is selected from the component copies that are operating normally.
In this embodiment, the service end is configured with a service proxy component. The service agent component is used for providing a service registration function and assisting the needed component in service registration.
It should be noted that, in order to ensure high availability of the software system, the service agent components may include at least two service agent components, so that when a problem occurs in a certain service agent component, other service agent components may be used in time to perform step S301.
In one embodiment of the present application, to improve component adaptation efficiency, a service proxy component deployed by a server may be a gateway service. Wherein the gateway service is a single access point and acts as a proxy for multiple services.
Taking a service proxy component as a gateway service as an example, in this embodiment, for the gateway service, a server may configure multiple copy addresses with the same number as the component copies in a configuration item of the gateway service, where the multiple copy addresses are in one-to-one correspondence with multiple component copies. Based on the information, the server side can control the gateway service to call a health check interface of the component copy corresponding to each copy address configured in the configuration item of the gateway service through a hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP) to check the component copy, and determine whether the component copy operates normally. That is, the service agent component can assist the server in health checking the service status of each component copy.
In practical applications, the health check interface is used to determine whether a service running on a component is available, and the load balancing or monitoring service will determine whether to distribute traffic or alarm by returning a result to the interface.
In this embodiment, since the type of the service provided by the component to be adapted is a stateful and stored service type or a stateful and non-stored service type, at this time, the server caches part of the data, so that the front-end request link needs to reach the service address of the same component copy in a stable way, however, if the server determines that at least one component copy that is normally operated is service registered in the service registration center, the server may cause the server to perform training adaptation to different component copies when performing component adaptation, that is, it cannot be guaranteed that the component copy that is subsequently used is the same copy, and therefore, after determining at least one component copy that is normally operated, the server needs to select a target component copy from the at least one component copy that is normally operated based on a preset condition, that is, perform a preemptive registration process, so that the same component copy can be used when performing component adaptation subsequently.
It should be noted that the preset condition may be set according to actual needs, and is not limited herein, and exemplary, the preset condition may be a random function. Wherein the random function may be rand ().
In this embodiment, in order to avoid that multiple component copies perform service registration in the service registration center (i.e. repeatedly implement the preemption registration function) at the same time, and facilitate subsequent iterative management of the preemption registration function, the server may determine the target component copy through the service proxy component, i.e. implement the preemption registration function through the service proxy component. Specifically, the service proxy component may determine, at random, a target component copy from at least one component that operates normally, based on the correspondence between multiple copy addresses and multiple component copies, where the number of copy addresses is equal to the number of component copies, configured in the configuration item of the service proxy component, and further determine a service address that needs to perform service registration in the service registry.
In this embodiment, after determining the target component copy, the service end may complete service registration at the service registry through the service address carried by the target component copy.
At this time, the target component copy is determined as the master copy, and the component copies of the component to be adapted other than the target component copy are determined as the slave copies.
In another embodiment of the present application, after the service registration center completes service registration through the service address carried by the target component copy, the service end may implement S401 to S402 shown in fig. 4, which is described in detail as follows:
In S401, it is detected whether the target component copy operates normally or not every preset time period.
In this embodiment, the server may check whether the target component copy operates normally by calling the health check interface every a preset period of time.
In one implementation manner of this embodiment, since the service proxy component may further detect the validity of the service address that has been registered in the service registry, that is, detect whether the target component copy operates normally, the server may call, through the service proxy component, the health check interface of the component copy corresponding to each copy address configured in the configuration item of the service proxy component every preset time period, to check the target component copy, and determine whether the target component copy operates normally.
The preset duration may be set according to actual needs, which is not limited herein, and exemplary, the preset duration may be 10 seconds.
In one embodiment of the present application, the server may execute step S402 when detecting that the target component copy does not function normally.
In another embodiment of the present application, when the server detects that the target component copy may operate normally, it indicates that the target component copy may continue to be accessed/used, so the server may detect, at a preset interval, whether the target component copy operates normally again, until it detects that the target component copy does not operate normally, and may execute step S402.
In S402, if the target component copy does not operate normally, one component copy other than the target component copy is selected from the multiple component copies, and service registration is completed at the service registry through a service address carried by the one component copy.
In this embodiment, when the server detects that the target component copy does not normally run, it indicates that the target component copy cannot be accessed/used, so that the server needs to select one component copy except for the target component copy from multiple component copies, and complete service registration at the service registry through a service address carried by the component copy, so as to replace the service address registered by the target component copy at the service registry, thereby ensuring that the component to be adapted can be accessed/used continuously, reducing the failure time of the software system, and improving the working efficiency of the software system.
In one implementation of this embodiment, the server may select, by the service proxy component, a component copy other than the target component copy from the multiple component copies. Specifically, the service proxy component may randomly select a component copy except for the target component copy from at least one component in normal operation based on the correspondence between multiple copy addresses and multiple component copies, which are configured in the configuration item and are equal to the component copy in number, and complete service registration in the service registry through a service address carried by the component copy, so as to replace the service address registered by the target component copy in the service registry, that is, implement addition and deletion of the service address of the service registry.
It should be noted that, at this time, one component copy corresponding to the service address where service registration is completed in the service registry is determined as a master copy, and other component copies except the component copy in the component to be adapted, including the target component copy, are all determined as slave copies.
In still another embodiment of the present application, after the service registration center completes service registration through the service address carried by the target component copy, the service end may further detect, at intervals of a preset duration, whether the service address in the service registration center exists.
In this embodiment, when the service end detects that the service address of the service registry exists, the service end may determine whether the service address of the service registry exists at a preset interval.
When the service end detects that the service address of the service registration center does not exist, the service end can select one component copy except the target component copy from the multiple component copies, and complete service registration at the service registration center through the service address carried by the one component copy so as to replace the service address registered by the target component copy at the service registration center, thereby ensuring that the component to be adapted can be accessed/used continuously, reducing the fault time of the software system and improving the working efficiency of the software system.
It should be noted that, at this time, one component copy corresponding to the service address where service registration is completed in the service registry is determined as a master copy, and other component copies except the component copy in the component to be adapted, including the target component copy, are all determined as slave copies.
As can be seen from the foregoing, in the component adapting method of the software system provided in this embodiment, when the service type of the component to be adapted is detected to be a stateful and stored service type or a stateful and non-stored service type, since the request sent by the client depends on the service end, multiple requests must access the service address of the same stateful service, multiple component copies that provide the same service as the component to be adapted can be deployed, and the component to be adapted, the multiple component copies, and the data stored by the external component are stored in the shared memory; each component copy carries a corresponding service address; the target component copy is selected from the multiple component copies, service registration is completed in the service registration center through the service address carried by the target component copy, so that high availability of the components to be adapted of stateful services (including stateful and stored service types and stateful and non-stored service types) is realized, single-point fault problems of the components to be adapted of the stateful services (including stateful and stored and stateful and non-stored) are avoided, and stability of a software system is improved.
In still another embodiment of the present application, when the type of service provided by the component to be adapted is stateless and there is a stored service type, please refer to fig. 5, fig. 5 is a component adapting method of a software system according to another embodiment of the present application. With respect to the corresponding embodiment of fig. 1, S103 in this embodiment may specifically include S501, which is described in detail below:
In S501, if the type is a stateless and stored service type, deploying a component copy that provides the same service as the component to be adapted, and storing the data stored by the component to be adapted, the component copy, and the external component to a shared memory; the stateless and stored information refers to that the server does not cache the client when providing the service, and the related data of the component to be adapted is stored in the external component.
In this embodiment, since each component in the software system is a single copy, each component in the software system may generate a problem of single point failure, so when the server detects that the type of service provided by the component to be adapted is stateless and has a stored service type, the server may deploy a component copy that provides the same service as the component to be adapted, and in order to share data stored in the component to be adapted, the component copy and the external component, the server may store the data stored in the component to be adapted, the component copy and the external component into the shared memory.
It should be noted that the component copies may be one or more.
As can be seen from the foregoing, in the component adapting method of the software system provided by the embodiment, when the service type of the component to be adapted is detected to be stateless and has a stored service type, since the request sent by the client does not depend on the processing information of the server, any multiple requests do not need to access the service address of the component to be adapted with the same stateless and has a storage service, but the related data of the component to be adapted is stored in the external component, so that the server can deploy a component copy that provides the same service as the component to be adapted, and store the component copy to be adapted, the component copy and the data stored in the external component into the shared memory, thereby realizing data sharing of the component copy to be adapted, the component copy and the data stored in the external component, ensuring that the request sent by the client can be successful in randomly accessing any component copy to be adapted, realizing high availability of the component to be adapted with the stateless and having the storage service, and avoiding the problem of single point failure of the component to be adapted with the stateless and having the storage service.
In yet another embodiment of the present application, when the type of service provided by the component to be adapted is a stateless and storable service type, referring to fig. 6, fig. 6 is a component adaptation method of a software system according to another embodiment of the present application. With respect to the corresponding embodiment of fig. 1, S103 in this embodiment may specifically include S601, which is described in detail below:
In S601, if the type is a stateless and storable service type, deploying a component copy that provides the same service as the component to be adapted; the stateless and non-storage means that the server does not cache information of the client when providing the service, and the related data of the component to be adapted is not stored in an external component.
In this embodiment, since each component in the software system is a single copy, each component in the software system may generate a problem of single point failure, so when detecting that the type of service provided by the component to be adapted is a stateless and storable service type, the server may deploy a component copy that provides the same service as the component to be adapted, so when detecting that a problem occurs in one component copy of the component to be adapted, the server may access other component copies that provide the same service, so as to avoid the problem of single point failure generated by the component to be adapted.
It should be noted that the component copies may be one or more.
As can be seen from the foregoing, when the component adapting method of the software system provided by the embodiment detects that the type of the service provided by the component to be adapted is a stateless and storable service type, the request sent by the client does not depend on the processing information of the server, and any multiple requests do not need to access the service address of the same stateless and storable service component to be adapted, so that a component copy of the same service as the component to be adapted can be deployed, thereby avoiding the problem that the component to be adapted generates a single point of failure, improving the processing efficiency of the software system, and realizing the high availability of the software system.
In another embodiment of the present application, after detecting that the service registration center completes service registration through the service address carried by the target component copy, the server needs to control the gateway copy corresponding to the target component copy to send a heartbeat packet for continuous contract to the service registration center every a preset period of time, so that the service address carried by the target component copy is continuously present in the service registration center, and the availability of the service address carried by the target component copy is ensured. The preset time period may be set according to actual needs, and is not limited herein.
It should be noted that, the preset time period is greater than the preset time period.
However, when the gateway copy corresponding to the target component copy is down due to other reasons (such as network failure), the gateway copy cannot send a heartbeat packet for follow-up to the service registry every preset time period, that is, the service registry detects that the service address carried by the target component copy has no normal follow-up period, so that the service registry can delete the service address carried by the target component copy.
Based on this, after S202, the server may perform the following steps, which are described in detail below:
And if the service registration center detects that the heartbeat packet corresponding to the target component copy, which is sent by the service proxy component, is not received after the preset time period, selecting one component copy except the target component copy from the multiple component copies, and finishing service registration at the service registration center through a service address carried by the one component copy.
In this embodiment, after a preset period of time, when the service end detects that the service registry does not receive the heartbeat packet corresponding to the target component copy sent by the service proxy component, it indicates that the service address carried by the target component copy has no normal continuous lease, that is, the service address carried by the target component copy has been deleted by the service registry, so that the service end needs to select one component copy except for the target component copy from multiple component copies, and complete service registration at the service registry through the service address carried by one component copy, so as to replace the service address of the target component copy registered at the service registry, thereby ensuring that the component to be adapted can continue to be accessed/used, reducing the failure time of the software system, and improving the working efficiency of the software system.
In one implementation of this embodiment, the server may select, by the service proxy component, a component copy other than the target component copy from the multiple component copies. Specifically, the service proxy component may randomly select a component copy except for the target component copy from at least one component in normal operation based on the correspondence between multiple copy addresses and multiple component copies, which are configured in the configuration item and are equal to the component copy in number, and complete service registration in the service registry through a service address carried by the component copy, so as to replace the service address registered by the target component copy in the service registry, that is, implement addition and deletion of the service address of the service registry.
It should be noted that, at this time, one component copy corresponding to the service address where service registration is completed in the service registry is determined as a master copy, and other component copies except the component copy in the component to be adapted, including the target component copy, are all determined as slave copies.
In yet another embodiment of the present application, the target component replica is still a slave replica after the gateway replica corresponding to the target component replica has recovered to normal after restart.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present application.
Fig. 8 shows a block diagram of a component adapting device of a software system according to an embodiment of the present application, and for convenience of explanation, only the parts related to the embodiment of the present application are shown. Referring to fig. 7, the component adapting device 700 of the software system includes: an acquisition unit 71, a determination unit 72, and a processing unit 73. Wherein:
The obtaining unit 71 is configured to obtain a component to be adapted of the software system.
The determining unit 72 is configured to determine a type of service provided by the component to be adapted.
The processing unit 73 is configured to perform an adapting process on the component to be adapted according to a preset processing policy corresponding to the type.
In one embodiment of the present application, the processing unit 73 specifically includes: a first deployment unit.
The first deployment unit is used for deploying the component copy which provides the same service with the component to be adapted if the type is a stateless and storable service type; the stateless and non-storage means that the server does not cache information of the client when providing the service, and the related data of the component to be adapted is not stored in an external component.
In one embodiment of the present application, the processing unit 73 specifically includes: a second deployment unit.
The second deployment unit is used for deploying the component copy which provides the same service with the component to be adapted if the type is a stateless and stored service type, and storing the component to be adapted, the component copy and data stored by an external component into a shared memory; the stateless and stored information refers to that the server does not cache the client when providing the service, and the related data of the component to be adapted is stored in the external component.
In one embodiment of the present application, the processing unit 73 specifically includes: a third deployment unit and a first pick unit. Wherein:
The third deployment unit is used for deploying a plurality of component copies which provide the same service with the component to be adapted if the type is a stateful and stored service type or a stateful and non-stored service type, and storing the component to be adapted, the plurality of component copies and data stored by an external component into a shared memory; each component copy carries a corresponding service address; the stateful storage means that the server caches information of the client when providing the service, and relevant data of the component to be adapted is stored in the external component; the stateless storage means that the server caches information of the client when providing the service, and the related data of the component to be adapted is not stored in the external component.
The selecting unit is used for selecting a target component copy from the multiple component copies, and completing service registration at the service registration center through the service address carried by the target component copy.
In one embodiment of the present application, the selecting unit specifically includes: the device comprises a fourth deployment unit, a first detection unit and a second selection unit. Wherein:
The fourth deployment unit is used for configuring a plurality of duplicate addresses which are equal to the duplicate number of the components in the configuration item of the service agent component; the plurality of duplicate addresses are in one-to-one correspondence with the plurality of component duplicate addresses; at least two service agent components are provided.
The first detection unit is used for detecting whether component copies corresponding to the copy addresses respectively operate normally or not.
The second selecting unit is used for selecting the target component copy from the component copies which normally run.
In one embodiment of the application, the service broker component is a gateway service.
In one embodiment of the present application, the component adapting device 700 of the software system further comprises: a second detection unit and a third selection unit. Wherein:
the second detection unit is used for detecting whether the target component copy normally operates or not at preset time intervals.
And the third selecting unit is used for selecting one component copy except the target component copy from the multiple component copies if the target component copy does not normally operate, and finishing service registration at the service registration center through a service address carried by the one component copy.
In one embodiment of the present application, the component adapting device 700 of the software system further comprises: and a fourth selecting unit.
And the fourth selecting unit is used for selecting one component copy except the target component copy from the multiple component copies if the service registry does not receive the heartbeat packet corresponding to the target component copy and sent by the service proxy component after a preset time period, and finishing service registration at the service registry through a service address carried by the one component copy.
It should be noted that, because the content of information interaction and execution process between the above devices/units is based on the same concept as the method embodiment of the present application, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
Fig. 8 is a schematic structural diagram of a server according to an embodiment of the present application. As shown in fig. 8, the server 8 of this embodiment includes: at least one processor 80 (only one shown in fig. 8), a memory 81 and a computer program 82 stored in the memory 81 and executable on the at least one processor 80, the processor 80 implementing the steps in the component adaptation method embodiments of any of the respective software systems described above when executing the computer program 82.
The server may include, but is not limited to, a processor 80, a memory 81. It will be appreciated by those skilled in the art that fig. 8 is merely an example of the server 8 and is not meant to be limiting as to the server 8, and may include more or fewer components than shown, or may combine certain components, or may include different components, such as input-output devices, network access devices, etc.
The Processor 80 may be a central processing unit (Central Processing Unit, CPU), the Processor 80 may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL processors, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), off-the-shelf Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 81 may be an internal storage unit of the server 8, for example, a memory of the server 8, in some embodiments. The memory 81 may also be an external storage device of the server 8 in other embodiments, such as a plug-in hard disk, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD) or the like, which are provided on the server 1. Further, the memory 81 may also include both an internal storage unit and an external storage device of the server 8. The memory 81 is used for storing an operating system, application programs, boot loader (BootLoader), data, other programs etc., such as program codes of the computer program etc. The memory 81 may also be used to temporarily store data that has been output or is to be output.
Embodiments of the present application also provide a computer readable storage medium storing a computer program which, when executed by a processor, implements steps for implementing the various method embodiments described above.
Embodiments of the present application provide a computer program product which, when run on a server, causes the server to perform steps that enable the implementation of the method embodiments described above.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above-described embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and the computer program may implement the steps of the method embodiments described above when executed by a processor. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a server, a recording medium, computer Memory, read-Only Memory (ROM), random access Memory (RAM, random Access Memory), electrical carrier signals, telecommunications signals, and software distribution media. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (10)

1. A method for adapting components of a software system, applied to a server, the method comprising:
Acquiring a component to be adapted of a software system;
determining the type of service provided by the component to be adapted;
According to a preset processing strategy corresponding to the type, carrying out adaptation processing on the component to be adapted;
the adapting the component to be adapted according to a preset processing strategy corresponding to the type comprises the following steps:
If the type is a stateless and storable service type, deploying a component copy which provides the same service as the component to be adapted; the stateless and non-storage means that the server does not cache information of the client when providing the service, and the related data of the component to be adapted is not stored in an external component.
2. The method for adapting components of a software system according to claim 1, wherein the adapting the components to be adapted according to a preset processing policy corresponding to the type includes:
If the type is a stateless and stored service type, deploying a component copy which provides the same service as the component to be adapted, and storing the data stored by the component to be adapted, the component copy and the external component into a shared memory; the stateless and stored information refers to that the server does not cache the client when providing the service, and the related data of the component to be adapted is stored in the external component.
3. The method for adapting components of a software system according to claim 1, wherein the adapting the components to be adapted according to a preset processing policy corresponding to the type includes:
If the type is a stateful and stored service type or a stateful and non-stored service type, deploying a plurality of component copies which provide the same service as the component to be adapted, and storing the component to be adapted, the plurality of component copies and data stored by an external component into a shared memory; each component copy carries a corresponding service address; the stateful storage means that the server caches information of the client when providing the service, and relevant data of the component to be adapted is stored in the external component; the stateless storage means that the server caches information of the client when providing the service, and the related data of the component to be adapted is not stored in the external component;
and selecting a target component copy from the multiple component copies, and finishing service registration at a service registration center through a service address carried by the target component copy.
4. A method of component adaptation of a software system according to claim 3, wherein said selecting a target component copy from said plurality of component copies comprises:
configuring a plurality of duplicate addresses which are equal to the duplicate number of the component in a configuration item of the service agent component; the plurality of duplicate addresses are in one-to-one correspondence with the plurality of component duplicate addresses; at least two service agent components are provided;
detecting whether component copies corresponding to the copy addresses respectively run normally or not;
and selecting the target component copy from the component copies which normally run.
5. The method of component adaptation of a software system according to claim 4, wherein the service proxy component is a gateway service.
6. A method of component adaptation of a software system according to any one of claims 3-5, wherein after the service registry completes service registration via the service address carried by the target component copy, further comprising:
Detecting whether the target component copy normally operates or not at preset time intervals;
And if the target component copy does not normally operate, selecting one component copy except the target component copy from the multiple component copies, and finishing service registration at the service registration center through a service address carried by the one component copy.
7. A method of component adaptation of a software system according to any one of claims 3-5, wherein after the service registry completes service registration via the service address carried by the target component copy, further comprising:
And if the service registration center detects that the heartbeat packet corresponding to the target component copy, which is sent by the service proxy component, is not received after the preset time period, selecting one component copy except the target component copy from the multiple component copies, and finishing service registration at the service registration center through a service address carried by the one component copy.
8. A component adapting device of a software system, applied to a server, the device comprising:
the acquisition unit is used for acquiring the component to be adapted of the software system;
A determining unit, configured to determine a type of service provided by the component to be adapted;
the processing unit is used for carrying out adaptation processing on the component to be adapted according to a preset processing strategy corresponding to the type;
the processing unit specifically comprises:
The first deployment unit is used for deploying the component copy which provides the same service with the component to be adapted if the type is a stateless and storable service type; the stateless and non-storage means that the server does not cache information of the client when providing the service, and the related data of the component to be adapted is not stored in an external component.
9. A server comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements a method of adapting components of a software system according to any of claims 1 to 7 when the computer program is executed by the processor.
10. A computer readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements a method of component adaptation of a software system according to any one of claims 1 to 7.
CN202211021226.0A 2022-08-24 2022-08-24 Component adaptation method, device, server side and storage medium of software system Active CN115484162B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211021226.0A CN115484162B (en) 2022-08-24 2022-08-24 Component adaptation method, device, server side and storage medium of software system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211021226.0A CN115484162B (en) 2022-08-24 2022-08-24 Component adaptation method, device, server side and storage medium of software system

Publications (2)

Publication Number Publication Date
CN115484162A CN115484162A (en) 2022-12-16
CN115484162B true CN115484162B (en) 2024-06-07

Family

ID=84422579

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211021226.0A Active CN115484162B (en) 2022-08-24 2022-08-24 Component adaptation method, device, server side and storage medium of software system

Country Status (1)

Country Link
CN (1) CN115484162B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1670212A1 (en) * 2004-12-13 2006-06-14 Sap Ag Adaptive software components
CN102023859A (en) * 2010-12-07 2011-04-20 北京航空航天大学 Digital development environment-oriented software integration method with reliability, maintainability and supportability
CN108293048A (en) * 2015-11-25 2018-07-17 索纳泰公司 The method and system of software hazard for control software exploitation
CN109491886A (en) * 2018-09-26 2019-03-19 深圳壹账通智能科技有限公司 Compatibility test method, device, electronic equipment and storage medium
CN112965902A (en) * 2021-03-08 2021-06-15 中国建设银行股份有限公司 Application system evaluation method and device
CN114090179A (en) * 2021-11-23 2022-02-25 北京金山云网络技术有限公司 Migration method and device of stateful service and server

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1670212A1 (en) * 2004-12-13 2006-06-14 Sap Ag Adaptive software components
CN102023859A (en) * 2010-12-07 2011-04-20 北京航空航天大学 Digital development environment-oriented software integration method with reliability, maintainability and supportability
CN108293048A (en) * 2015-11-25 2018-07-17 索纳泰公司 The method and system of software hazard for control software exploitation
CN109491886A (en) * 2018-09-26 2019-03-19 深圳壹账通智能科技有限公司 Compatibility test method, device, electronic equipment and storage medium
CN112965902A (en) * 2021-03-08 2021-06-15 中国建设银行股份有限公司 Application system evaluation method and device
CN114090179A (en) * 2021-11-23 2022-02-25 北京金山云网络技术有限公司 Migration method and device of stateful service and server

Also Published As

Publication number Publication date
CN115484162A (en) 2022-12-16

Similar Documents

Publication Publication Date Title
US10104037B2 (en) Method and system for network access request control
US9253265B2 (en) Hot pluggable extensions for access management system
US7757120B2 (en) Ignoring redundant symptoms in modular self-healing systems
US7536603B2 (en) Maintaining functionality during component failures
US20040153703A1 (en) Fault tolerant distributed computing applications
US10095803B2 (en) Delivering content to electronic devices using local caching servers
EP3584669B1 (en) Webpage loading method, webpage loading system, and server
CN112463318B (en) Timing task processing method, device and system
CN111984289A (en) Service updating method, device, equipment and storage medium
CN113434249A (en) Mirror image synchronization method and device, docker host and storage medium
CN111338829B (en) Calling method and device for remote procedure call service
CN111787036A (en) Solution method, device, storage medium and equipment for front-end private cloud deployment
CN113141412A (en) Domain name switching method, system, device, equipment and storage medium
CN113347037A (en) Data center access method and device
US20080313322A1 (en) Asynchronous Network Stack Operation in an Operating System Independent Environment
CN108111630B (en) Zookeeper cluster system and connection method and system thereof
CN115484162B (en) Component adaptation method, device, server side and storage medium of software system
CN111240760B (en) Application publishing method, system, storage medium and equipment based on registry
CN110381081B (en) Network access method and device and electronic equipment
CN109688232B (en) Mirror image backtracking method, mirror image backtracking system and proxy server
WO2020037607A1 (en) Data transmission method and apparatus
CN114356456A (en) Service processing method, device, storage medium and electronic equipment
US9009546B2 (en) Heuristic failure prevention in software as a service (SAAS) systems
CN106487916B (en) Statistical method and device for connection number
CN111771191A (en) Cross-domain inline event handler

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