CN113742108B - Service calling method and device, electronic equipment and computer readable storage medium - Google Patents

Service calling method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN113742108B
CN113742108B CN202111046429.0A CN202111046429A CN113742108B CN 113742108 B CN113742108 B CN 113742108B CN 202111046429 A CN202111046429 A CN 202111046429A CN 113742108 B CN113742108 B CN 113742108B
Authority
CN
China
Prior art keywords
service
cluster
sub
registration information
types
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
CN202111046429.0A
Other languages
Chinese (zh)
Other versions
CN113742108A (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 CN202111046429.0A priority Critical patent/CN113742108B/en
Publication of CN113742108A publication Critical patent/CN113742108A/en
Application granted granted Critical
Publication of CN113742108B publication Critical patent/CN113742108B/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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/544Remote

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The present disclosure provides a service invocation method and apparatus, an electronic device, and a computer-readable storage medium, and the present disclosure may be used in the big data technical field, and may also be used in the financial technical field. The service calling method comprises the following steps: acquiring service registration information from a registration center, wherein the service registration information comprises reservation service type configuration information externally provided by each service node in each service sub-cluster, the types of reservation service externally provided by each service sub-cluster are different, the types of reservation service externally provided by each service node in the same service sub-cluster are the same, and the types of reservation service externally provided by each service sub-cluster are summarized to be the types of all reservation service externally provided by the service sub-cluster; storing the service registration information at the service consumer; and respectively calling each subscribed service of each service sub-cluster of the service provider according to the subscribed service type and the service registration information prestored by the service consumer.

Description

Service calling method and device, electronic equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of big data technology, and more particularly, to a service invocation method and apparatus, an electronic device, a computer-readable storage medium, and a computer program product.
Background
Based on the distributed framework, a producer initiates service registration to a registry through an API service cluster, and a consumer subscribes to a service from the registry to realize service call.
In the process of implementing the disclosed concept, the inventor finds that at least the following problems exist in the related art: because the basis of consuming the service based on the distributed framework is that the registry informs the consumer when the information of the service provider is subscribed by the consuming party registry, the information related to the service is stored in the memory of the server of the consumer by opening up space. As the service volume of the consumer increases, the subscription service volume increases, or the service provider increases the number of the capacity-expanding service nodes due to the rapid increase of the service, the memory of the consumer is occupied too much, and the normal execution of the service of the consumer is further affected.
Disclosure of Invention
In view of this, the present disclosure provides a service invocation method and apparatus, an electronic device, a computer-readable storage medium, and a computer program product.
One aspect of the present disclosure provides a service invocation method, including:
acquiring service registration information from a registration center, wherein the service registration information comprises reservation service type configuration information externally provided by each service node in each service sub-cluster, each service sub-cluster belongs to a service cluster of a service provider, wherein the types of reservation service externally provided by each service node in the same service sub-cluster are different, the types of reservation service externally provided by each service node in the same service sub-cluster are the same, and the types of reservation service externally provided by each service sub-cluster are summarized to be the types of total reservation service externally provided by the service sub-cluster;
storing the service registration information at the service consumer;
and respectively calling each subscribed service of each service sub-cluster of the service provider according to the subscribed service type and the service registration information prestored by the service consumer.
According to the embodiment of the disclosure, after the service registration information is stored, the memory capacity of the occupied service consumer is:
the product of the total service number and the memory capacity occupied by the unit service;
the total service number is the sum of the component service numbers, wherein the component service number is the product of the service node number of the service sub-cluster and the category number of the reserved service provided by the service sub-cluster.
According to an embodiment of the present disclosure, the method further includes, before acquiring the service registration information from the registry:
and loading the service type configuration information of the reserved service provided by each current service node by using the service provider so as to generate service registration information, and then sending the service registration information to a registration center.
According to an embodiment of the present disclosure, loading the configuration information of the subscribed service types provided by each current service node to the outside includes:
determining a current service sub-cluster to which each current service node belongs;
determining a current preset loading path of a current service sub-cluster, wherein the current preset loading path is as follows: the current service subset group provides reservation service type configuration information to the outside and stores the path in the service provider;
and loading the configuration information of the service types of the reserved business provided by each current service node respectively according to the current preset loading path.
According to an embodiment of the present disclosure, invoking each subscribed service of each service sub-cluster of a service provider according to a subscribed service class and service registration information pre-stored by a service consumer, respectively, includes:
Determining each service node in the service sub-cluster matched with each reserved service according to the reserved service type and the service registration information;
a target service node of the service nodes is selected based on load balancing in order to invoke respective subscribed service of respective service sub-clusters of the service provider by accessing respective target service nodes.
According to an embodiment of the present disclosure, invoking each subscribed service of each service sub-cluster of a service provider according to a subscribed service class and service registration information pre-stored by a service consumer, respectively, includes:
and calling each subscribed service of each service sub-cluster of the service provider in a remote procedure calling mode according to the subscribed service type and the service registration information.
A service calling device comprises an acquisition module, a storage module and a calling module.
The service registration information comprises reservation service type configuration information which is externally provided by each service node in each service sub-cluster, each service sub-cluster belongs to the service cluster of the service provider, the types of reservation service which are externally provided by each service node in the same service sub-cluster are the same, and the total of the types of reservation service which are externally provided by each service sub-cluster is the type of the total reservation service which is externally provided by the service sub-cluster.
And the storage module is used for storing the service registration information in the service consumer.
And the calling module is used for calling each reserved service of each service sub-cluster of the service provider according to the reserved service type and the service registration information prestored by the service consumer.
According to the embodiment of the disclosure, after the service registration information is stored, the memory capacity of the occupied service consumer is: the product of the total service number and the memory capacity occupied by the unit service; the total service number is the sum of the component service numbers, wherein the component service number is the product of the service node number of the service sub-cluster and the category number of the reserved service provided by the service sub-cluster.
According to an embodiment of the disclosure, the apparatus further includes a loading module, configured to load, by using the service provider, service type configuration information of the subscribed service provided by each current service node to the outside before obtaining the service registration information from the registry, so as to generate service registration information, and then send the service registration information to the registry.
According to the embodiment of the disclosure, the loading module comprises a first determining unit, a second determining unit and a loading unit.
The first determining unit is used for determining a current service sub-cluster to which each current service node belongs; the second determining unit is configured to determine a current preset loading path of the current service sub-cluster, where the current preset loading path is: the current service subset group provides reservation service type configuration information to the outside and stores the path in the service provider; the loading unit is used for loading the configuration information of the reserved business service types provided by each current service node respectively according to the current preset loading path.
According to the embodiment of the disclosure, the calling module comprises a third determining unit and a first calling unit.
The third determining unit is used for determining each service node in the service sub-cluster matched with each reserved service according to the reserved service type and the service registration information; and the first calling unit is used for selecting target service nodes in the service nodes based on load balancing so as to call each reserved service of each service sub-cluster of the service provider by accessing each target service node.
According to an embodiment of the present disclosure, the calling module includes: and the second calling unit is used for calling each subscribed service of each service sub-cluster of the service provider in a remote procedure calling mode according to the type of the subscribed service and the service registration information.
Another aspect of the present disclosure provides an electronic device, comprising: one or more processors, and memory; wherein the memory is for storing one or more programs; wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the methods as described above.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions that, when executed, are configured to implement a method as described above.
Another aspect of the present disclosure provides a computer program product comprising computer executable instructions which, when executed, are for implementing a method as described above.
According to the embodiment of the disclosure, after the service consumer obtains the service registration information from the registry, the service registration information needs to be stored in the memory of the service consumer, and the size of the capacity of the service registration information determines the size of the memory occupied by the service consumer. The capacity of the service registration information is related to the number of service types externally provided by each service node of the service provider, and the service types externally provided by each service node in the same service sub-cluster are reduced by splitting the service provider cluster and setting different service sub-clusters to be different in service types of reserved service respectively externally provided by the service provider cluster. In the service mode, when the service consumer stores the service registration information of the service provider in the service calling process, the memory occupation of the service consumer is reduced, the potential risk of the memory occupation of the consumer is reduced, and the normal execution of the consumer service is ensured. And the service sub-group respectively and externally provided subscribed service types are summarized to provide the total quantity of subscribed service types for the service sub-group, so that the service types externally and integrally provided by the service provider are ensured to be unchanged, and the service subscription experience which is not perceived by consumers is realized.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments thereof with reference to the accompanying drawings in which:
FIG. 1 schematically illustrates an exemplary system architecture to which the service invocation methods and apparatus of the present disclosure may be applied;
FIG. 2 schematically illustrates a system architecture for applying a service invocation method in the related art;
FIG. 3 schematically illustrates a flow chart of a service invocation method according to an embodiment of the disclosure;
FIG. 4 schematically illustrates a flow chart for loading respective externally provided subscribed business service class configuration information for each current service node in accordance with an embodiment of the present disclosure;
FIG. 5 schematically illustrates a block diagram of a service invocation apparatus according to an embodiment of the disclosure; and
fig. 6 schematically illustrates a block diagram of an electronic device for implementing a service invocation method according to an embodiment of the disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where expressions like at least one of "A, B and C, etc. are used, the expressions should generally be interpreted in accordance with the meaning as commonly understood by those skilled in the art (e.g.," a system having at least one of A, B and C "shall include, but not be limited to, a system having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a formulation similar to at least one of "A, B or C, etc." is used, in general such a formulation should be interpreted in accordance with the ordinary understanding of one skilled in the art (e.g. "a system with at least one of A, B or C" would include but not be limited to systems with a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
Before describing embodiments of the present disclosure in detail, the following description is given to a system structure and an application scenario related to the method provided by the embodiments of the present disclosure.
Fig. 1 schematically illustrates an exemplary system architecture 100 to which the service invocation methods and apparatuses of the present disclosure may be applied. It should be noted that fig. 1 is only an example of a system architecture to which embodiments of the present disclosure may be applied to assist those skilled in the art in understanding the technical content of the present disclosure, but does not mean that embodiments of the present disclosure may not be used in other devices, systems, environments, or scenarios.
As shown in fig. 1, a system architecture 100 according to this embodiment may include a service provider 101, a registry 102, and a service consumer 103. The service provider 101, registry 102, and service consumer 103 may communicate with each other over a network, which may include various connection types, such as wired and/or wireless communication links, and the like.
Registry 102 may be used to record the mapping of services and service addresses. In the distributed architecture, the service of the service provider 101 is registered in the registry 102, and when the service consumer 103 needs to call the service, the service consumer obtains information of the service through the registry 102 and calls the service.
The registry 102 may be a system built based on a ZooKeeper, where the ZooKeeper provides basic services such as unified naming service, configuration management, distributed locks, and the like, and based on these basic services, functions such as cluster management, soft load, publish/subscribe, naming service, and the like may be implemented.
The service provider 101 and the service consumer 103 establish a connection (such as a long connection of a ZooKeeper) with the over-registry 102 through a client provided by the registry 102, the service provider 101 writes the published service address information and related access information to the registry, and the service consumer 103 obtains a call list from the registry 102 according to the information such as the name of the called service and caches the call list locally.
In an application scenario of the embodiment of the present disclosure, the service provider 101 provides a full-service subscription to the outside through a service cluster, where the service cluster of the service provider 101 may include a plurality of service sub-clusters, where the types of service subscription provided to the outside by each of the different service sub-clusters are different, the types of service subscription provided to the outside by each of the service nodes in the same service sub-cluster are the same, and the types of service subscription provided to the outside by each of the service sub-clusters are the types of the full-service subscription provided to the outside by the service sub-clusters after the types of service subscription provided to the outside are summarized.
The service provider 101 needs to register its service provided externally (i.e. the configuration information of the service types of the subscribed services provided externally by each current service node) in the registry 102, and then, when the service consumer 103 needs to call the related subscribed service, the service consumer obtains a call list from the registry 102 and caches the call list locally, and calls each subscribed service of each service sub-cluster of the service provider according to the subscribed service types and the service registration information stored in advance by the service consumer.
It should be understood that the number of sub-clusters, the number of servers in fig. 1 are merely illustrative. There may be any number of sub-clusters, servers, as desired for implementation.
It should be noted that the service calling method and apparatus of the present disclosure may be used in the big data technical field, may also be used in the financial technical field, and may also be used in any field other than the big data technical field and the financial technical field, and the application field of the service calling method and apparatus of the present disclosure is not limited.
In the technical scheme of the disclosure, the acquisition, storage, application and the like of the related personal information of the user all conform to the regulations of related laws and regulations, necessary security measures are taken, and the public order harmony is not violated.
In the related art, a service provider is used as a producer, initiates service registration to a registry through an API service cluster based on a distributed framework, the registry stores information such as stubs, service version numbers, service providing node IPs and the like of registered services, and a service consumer subscribes to services from the registry to realize service call. When the server is started, the consumer caches the subscribed service list, service stubs and service provider information in the memory of the consumer, and when the service is called, the service provider information is obtained from the memory, and RPC call is realized by means of a distributed framework.
In the process of implementing the present disclosure, it is found that, because the distributed framework is based on the registry, the consumer is informed of the service provider information when the consumer subscribes to the registry, and the service related information is stored in the memory of the consumer server by opening up space. As the amount of subscription services increases, the problem of excessive memory usage by consumers is created.
Fig. 2 schematically illustrates a system architecture to which a service invocation method in the related art is applied. In the application scenario shown in fig. 2, the system architecture may include a service provider 201, a registry 202, and a service consumer 203. The service provider 201 and the service consumer 203 establish a connection (such as a long connection of a ZooKeeper) with the registry 202 through a client provided by the registry 202, the service provider 201 writes the published service address information and related access information to the registry, and the service consumer 203 obtains a call list from the registry 202 according to the information such as the name of the called service and caches locally. Wherein, the service provider 201 provides the full-scale subscription service outwards through the service cluster, wherein, the service cluster of the service provider 201 can comprise a plurality of service sub-clusters, wherein, the types of the subscription service provided by different service sub-clusters respectively outwards are the same, and the full-scale subscription service is provided outwards.
The unit service occupies memory capacity, that is, a consumer subscribes to a service occupying consumer memory as C, the memory occupied by the service consumer is equal to the number of subscribed services, the number of service nodes is provided as C, and as the service volume of the consumer increases, the subscribed service volume increases, or the service provider increases the number of the service nodes due to the rapid increase of the service, the potential risk of the consumer memory occupation is caused. When the memory occupation of the consumer due to the service subscription exceeds a threshold value, the other business processes of the consumer may be insufficient when the memory resource is contended, so that the JVM is caused to recover the garbage frequently, and the normal execution of the business of the consumer is affected.
As the number of services provided by service providers increases, the memory occupied by consumers after subscribing to the services increases. To avoid frequent garbage collection due to potential memory increases to consumers caused by the proliferation of service numbers by traffic, service providers need to circumvent risks by reducing the number of services offered or reducing the number of service providing nodes. For example, according to the concept of reducing the number of services, a plurality of services can be combined into one service, and a plurality of methods are exposed to the outside. Therefore, preferably, according to the concept of reducing the number of service providing nodes, the original service providing node is to physically split the API service cluster to be the whole API service cluster into a plurality of service groups, and the total service on the original API cluster is split into the services of the plurality of service groups according to the service domain and the high-frequency and low-frequency services, and the service combination of the total service groups is the total service of the original API service cluster.
In view of the above, the present disclosure provides a service calling method to solve the above technical problems. In an application scenario of the embodiment of the present disclosure, a service provider provides a total amount of subscription services to the outside through a service cluster, where the service cluster of the service provider may include a plurality of service sub-clusters, unlike in the related art, where different service sub-clusters each provide a different type of subscription service to the outside, each service node in the same service sub-cluster each provides the same type of subscription service to the outside, and the service sub-clusters each provide the same type of subscription service to the outside after the types of subscription services provided to the outside are aggregated, which is the type of the total amount of subscription services provided to the outside by the service cluster.
Fig. 3 schematically illustrates a flowchart of a service invocation method according to an embodiment of the present disclosure.
As shown in fig. 3, the method includes operations S301 to S303.
In operation S301, the service consumer obtains service registration information from the registry, where the service registration information includes configuration information of types of subscribed services provided by each service node in each service sub-cluster, each service sub-cluster belongs to a service cluster of the service provider, types of subscribed services provided by each service node in the same service sub-cluster are different, types of subscribed services provided by each service node in the same service sub-cluster are the same, and the types of subscribed services provided by each service sub-cluster are aggregated to be the types of all subscribed services provided by the service sub-cluster.
According to the embodiment of the disclosure, the service registration information may include service type configuration information of each service node that provides each service for external service, and may further include service stub configuration, service consumption configuration, service monitoring configuration, service cluster information, service attribution application information, and the like of each service node that subscribes to the service.
According to the embodiment of the disclosure, the configuration information of the types of the subscribed service provided by each service node respectively, for example, may include the types of the subscribed service provided by each service node respectively, the mapping relationship between each subscribed service and the address of each service node providing the related subscribed service, and the like.
In operation S302, service registration information is stored at a service consumer.
In operation S303, the service consumer invokes each subscribed service of each service sub-cluster of the service provider according to the subscribed service class and service registration information pre-stored by the service consumer, respectively. According to the embodiment of the disclosure, when the server is started, the service consumer caches the subscribed service registration information in the memory of the consumer, and when the service is invoked, the service registration information of the service provider is obtained from the memory, and according to the service registration information, the service is invoked by means of the distributed framework, for example, the service is invoked by means of RPC (remote procedure call) in a manner of invoking remote procedure invocation, or is invoked by means of other communication modes (such as HTTP).
According to the embodiment of the disclosure, after the service consumer obtains the service registration information from the registry, the service registration information needs to be stored in the memory of the service consumer, and the size of the capacity of the service registration information determines the size of the memory occupied by the service consumer. The capacity of the service registration information is related to the number of service types externally provided by each service node of the service provider, and the service types externally provided by each service node in the same service sub-cluster are reduced by splitting the service provider cluster and setting different service sub-clusters to be different in service types of reserved service respectively externally provided by the service provider cluster. In the service mode, when the service consumer stores the service registration information of the service provider in the service calling process, the memory occupation of the service consumer is reduced, the potential risk of the memory occupation of the consumer is reduced, and the normal execution of the consumer service is ensured. And the service sub-groups respectively provide the types of the reserved service to the outside after the types of the reserved service provided by the service sub-groups are summarized, so that the types of the service provided by the service provider to the outside are unchanged, and the service subscription experience which is not perceived by consumers is realized.
According to the embodiment of the disclosure, after the service registration information is stored, the memory capacity of the occupied service consumer is:
the product of the total service number and the memory capacity occupied by the unit service; the total service number is the sum of the component service numbers, wherein the component service number is the product of the service node number of the service sub-cluster and the category number of the reserved service provided by the service sub-cluster.
According to the embodiment of the disclosure, for further explanation, the method of the embodiment of the disclosure can effectively reduce the memory occupation of the service consumer. The following exemplary comparative analysis shows the results of the computation of the service consumer memory occupied by the method according to the embodiments of the present disclosure and the service consumer memory occupied by the related art.
For example, the service provider provides M total subscription services to the outside through the service clusters, where the service clusters of the service provider may include N service sub-clusters, and the service clusters have X service nodes, where the X service nodes are split into N service sub-clusters, and the number of service nodes of each service sub-cluster is X 1 ,X 2 ...X N Satisfy X 1 +X 2 +X 3 +……X N =x. Assuming that the consumer subscribes to the full amount of service, the unit service occupies the memory capacity, that is, the consumer subscribes to a service to occupy the memory of the consumer for C calculation:
(1) By adopting the service calling method of the related technology (under the service framework shown in fig. 2), since the types of the reserved service services provided by different service sub-clusters respectively and externally are the same, the full reserved service is provided outwards, so that the service calling method comprises the following steps:
occupying service consumer memory
Unit service occupancy memory capacity C =total number of services
=X*M*C=(X 1 +X 2 +X 3 +……X N ) Formula M C (one)
(2) By adopting the service calling method in the embodiment of the disclosure, the types of the reserved service provided by different service sub-clusters respectively and externally are different, the types of the reserved service provided by each service node in the same service sub-cluster respectively and externally are the same, and the types of the reserved service provided by each service sub-cluster respectively and externally are summarized to be the types of the total reserved service provided by the service sub-cluster. The M total subscription services are provided through N service sub-clusters, and the types and numbers of subscription service services provided by each service sub-cluster are M1, M2 and M3 … … respectively, and satisfy m1+m2+m3+m4+m5+ 5 … … =m. The total service number is the sum of the component service numbers, wherein the component service number is the product of the service node number of the service sub-cluster and the type number of the reserved service provided by the service sub-cluster.
Occupying service consumer memory
Unit service occupancy memory capacity C =total number of services
=X 1 *M1*C+X 2 *M2*C+X 3 * M3+ … … equation (two)
Comparing the formula (one) and the formula (two), it can be seen that the service consumer memory occupied by the method according to the embodiments of the present disclosure is smaller than the service consumer memory occupied by the related technology. Therefore, by adopting the method disclosed by the embodiment of the disclosure, when the service consumer stores the service registration information of the service provider in the service calling process, the memory occupation of the service consumer is reduced.
According to an embodiment of the present disclosure, the method further includes, before acquiring the service registration information from the registry:
and loading the service type configuration information of the reserved service provided by each current service node by using the service provider so as to generate service registration information, and then sending the service registration information to a registration center.
According to an embodiment of the present disclosure, loading the configuration information of the subscribed service types provided by each current service node to the outside includes:
first, a current service sub-cluster to which each current service node belongs is determined.
Secondly, determining a current preset loading path of the current service sub-cluster, wherein the current preset loading path is as follows: the current service subset group provides reservation service type configuration information to the outside and stores the path in the service provider. According to the embodiment of the disclosure, when the service provider initiates service registration to the registration center, depending on a series of configuration files, namely service registration information, the service provider may include configuration information of types of subscribed services provided by each service node respectively, and may further include configuration of service stubs, configuration of service provision, configuration of service monitoring, information of service clusters, information of service attribution application, and the like of each subscribed service, which may be configuration files under a preset loading type path. When the service provider performs cluster splitting, the service cluster is split into a plurality of service sub-clusters according to the service field and high-frequency and low-frequency call in the same service field, the service of each service sub-cluster is placed under a provider file, each provider file represents a service list provided by one service sub-cluster outwards, the provider files are distributed under different file directories, namely, the current preset loading path is obtained, and each file directory represents the initialization loading configuration of one service sub-cluster.
And then, loading the configuration information of the service types of the reserved business provided by each current service node respectively according to the current preset loading path.
Fig. 4 schematically illustrates a flowchart for loading the respective externally provided subscribed business service class configuration information for each current service node according to an embodiment of the present disclosure. The above-described method of the embodiments of the present disclosure is described below in conjunction with fig. 4.
When each server of the service provider is started, the configuration of which path the current server should load is judged according to the flow chart shown in fig. 4, so that the purpose that different service nodes register different reserved service services in a registry is realized.
As shown in fig. 4 (a total of 4 service nodes are illustrated in fig. 4):
according to embodiments of the present disclosure, a system in which a registry uses a distributed architecture may employ a Dubbo distributed framework.
Firstly, when the server is initialized to start Dubbo, by setting environment variables, the service node of which service sub-cluster the current server is judged before starting, namely the current service sub-cluster to which each current service node belongs is determined.
Secondly, the current preset loading path of the current service sub-cluster is determined by local inquiry, namely, the storage path of reservation service type configuration information provided by the current service sub-cluster on the outside in a service provider.
And then, setting a configuration file path loaded by the startup parameter configuration dubbo as a current preset loading path of the corresponding service sub-cluster according to a judging result, so that each service sub-cluster only registers related services of the service sub-cluster to a registry, namely, loading reservation service type configuration information externally provided by each current service node according to the current preset loading path.
According to the embodiment of the disclosure, through the loading method, each service sub-cluster only registers the related service of the service sub-cluster to the registration center, so that service splitting which is not felt by a service consumer is completed under the condition that an externally exposed service interface and a service method are unchanged, and operation decoupling is realized under the premise that a version is not decoupled.
According to an embodiment of the present disclosure, invoking each subscribed service of each service sub-cluster of a service provider according to a subscribed service class and service registration information pre-stored by a service consumer, respectively, includes:
determining each service node in the service sub-cluster matched with each reserved service according to the reserved service type and the service registration information; and selecting a target service node of the service nodes based on load balancing so as to call each subscribed service of each service sub-cluster of the service provider by accessing each target service node.
According to an embodiment of the present disclosure, invoking each subscribed service of each service sub-cluster of a service provider according to a subscribed service class and service registration information pre-stored by a service consumer, respectively, includes:
and calling each subscribed service of each service sub-cluster of the service provider in a RPC (remote procedure call) remote procedure call mode according to the subscribed service type and the service registration information. According to the embodiment of the disclosure, when a server is started, a service consumer caches subscribed service registration information in a consumer memory, and when a service is called, the service registration information of the service provider is obtained from the memory, and service calling is realized by means of a distributed framework in an RPC mode according to the service registration information.
According to the embodiment of the disclosure, the remote function is called like a local function by the RPC calling mode, so that when a service consumer calls a service provided by the service, the calling among the services is as simple as the local calling.
Fig. 5 schematically shows a block diagram of a service invocation apparatus according to an embodiment of the present disclosure.
The service invocation means 500 may be used to implement the method illustrated with reference to fig. 3.
As shown in fig. 5, the service invocation apparatus 500 includes: an acquisition module 510, a storage module 520, and a calling module 530.
The obtaining module 510 is configured to obtain service registration information from a registration center, where the service registration information includes configuration information of types of subscribed services provided by each service node in each service sub-cluster, each service sub-cluster belongs to a service cluster of a service provider, types of subscribed services provided by each service node in the same service sub-cluster are different, types of subscribed services provided by each service node in the same service sub-cluster are the same, and the types of subscribed services provided by each service sub-cluster are aggregated to provide all types of subscribed services provided by the service sub-cluster.
A storage module 520 for storing service registration information at the service consumer.
And a calling module 530, configured to call each subscribed service of each service sub-cluster of the service provider according to the subscribed service type and the service registration information stored in advance by the service consumer.
In the disclosed embodiment, the service consumer acquires the service registration information from the registry and then stores the service registration information in the memory of the service consumer, and the capacity of the service registration information determines the size of the memory occupied by the service consumer. The capacity of the service registration information is related to the number of service types externally provided by each service node of the service provider, and different service sub-clusters are set to be different in the types of the reserved service externally provided by each service node in the same service sub-cluster through cluster splitting of the service provider, so that the number of the service types externally provided by each service node in the same service sub-cluster is reduced, and the capacity of the service registration information can be reduced. In this service mode, through the calling module 530, when the service consumer stores the service registration information of the service provider in the service calling process, the memory occupation of the service consumer is reduced, the potential risk of the memory occupation of the consumer is reduced, and the normal execution of the consumer service is ensured. And the service sub-groups respectively provide the types of the reserved service to the outside after the types of the reserved service provided by the service sub-groups are summarized, so that the types of the service provided by the service provider to the outside are unchanged, and the service subscription experience which is not perceived by consumers is realized.
According to the embodiment of the disclosure, after the service registration information is stored, the memory capacity of the occupied service consumer is: the product of the total service number and the memory capacity occupied by the unit service; the total service number is the sum of the component service numbers, wherein the component service number is the product of the service node number of the service sub-cluster and the category number of the reserved service provided by the service sub-cluster.
According to an embodiment of the disclosure, the apparatus further includes a loading module, configured to load, by using the service provider, service type configuration information of the subscribed service provided by each current service node to the outside before obtaining the service registration information from the registry, so as to generate service registration information, and then send the service registration information to the registry.
According to the embodiment of the disclosure, the loading module comprises a first determining unit, a second determining unit and a loading unit.
The first determining unit is used for determining a current service sub-cluster to which each current service node belongs; the second determining unit is configured to determine a current preset loading path of the current service sub-cluster, where the current preset loading path is: the current service subset group provides reservation service type configuration information to the outside and stores the path in the service provider; the loading unit is used for loading the configuration information of the reserved business service types provided by each current service node respectively according to the current preset loading path.
According to an embodiment of the present disclosure, the calling module 530 includes a third determining unit, a first calling unit.
The third determining unit is used for determining each service node in the service sub-cluster matched with each reserved service according to the reserved service type and the service registration information; and the first calling unit is used for selecting target service nodes in the service nodes based on load balancing so as to call each reserved service of each service sub-cluster of the service provider by accessing each target service node.
According to an embodiment of the present disclosure, the calling module 530 includes: and the second calling unit is used for calling each subscribed service of each service sub-cluster of the service provider in a remote procedure calling mode according to the type of the subscribed service and the service registration information.
Any number of modules, sub-modules, units, sub-units, or at least some of the functionality of any number of the sub-units according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented as split into multiple modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system-on-chip, a system-on-substrate, a system-on-package, an Application Specific Integrated Circuit (ASIC), or in any other reasonable manner of hardware or firmware that integrates or encapsulates the circuit, or in any one of or a suitable combination of three of software, hardware, and firmware. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be at least partially implemented as computer program modules, which when executed, may perform the corresponding functions.
For example, any of the acquisition module 510, the storage module 520, and the invocation module 530 may be combined in one module/unit/sub-unit or any of the modules/units/sub-units may be split into multiple modules/units/sub-units. Alternatively, at least some of the functionality of one or more of these modules/units/sub-units may be combined with at least some of the functionality of other modules/units/sub-units and implemented in one module/unit/sub-unit. According to embodiments of the present disclosure, at least one of the acquisition module 510, the storage module 520, and the invocation module 530 may be implemented at least in part as hardware circuitry, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system-on-chip, a system-on-substrate, a system-on-package, an Application Specific Integrated Circuit (ASIC), or by hardware or firmware, such as any other reasonable manner of integrating or packaging the circuitry, or in any one of or a suitable combination of any of three implementations of software, hardware, and firmware. Alternatively, at least one of the acquisition module 510, the storage module 520, and the invocation module 530 may be at least partially implemented as a computer program module, which when executed, may perform the corresponding functions.
Fig. 6 schematically illustrates a block diagram of an electronic device for implementing a service invocation method according to an embodiment of the disclosure. The electronic device shown in fig. 6 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 6, an electronic device 600 according to an embodiment of the present disclosure includes a processor 601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. The processor 601 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or an associated chipset and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. Processor 601 may also include on-board memory for caching purposes. The processor 601 may comprise a single processing unit or a plurality of processing units for performing different actions of the method flows according to embodiments of the disclosure.
In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. The processor 601 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 602 and/or the RAM 603. Note that the program may be stored in one or more memories other than the ROM 602 and the RAM 603. The processor 601 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the present disclosure, the electronic device 600 may also include an input/output (I/O) interface 605, the input/output (I/O) interface 605 also being connected to the bus 604. The electronic device 600 may also include one or more of the following components connected to the I/O interface 605: an input portion 606 including a keyboard, mouse, etc.; an output portion 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
According to embodiments of the present disclosure, the method flow according to embodiments of the present disclosure may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the embodiments of the present disclosure are performed when the computer program is executed by the processor 601. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
The present disclosure also provides a computer-readable storage medium that may be embodied in the apparatus/device/system described in the above embodiments; or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium carries one or more programs which, when executed, implement methods in accordance with embodiments of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
For example, according to embodiments of the present disclosure, the computer-readable storage medium may include ROM 602 and/or RAM 603 and/or one or more memories other than ROM 602 and RAM 603 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program comprising program code for performing the methods provided by the embodiments of the present disclosure, the program code for causing an electronic device to implement the service invocation methods provided by the embodiments of the present disclosure when the computer program product is run on the electronic device.
The above-described functions defined in the system/apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 601. The systems, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed in the form of signals over a network medium, and downloaded and installed via the communication section 609, and/or installed from the removable medium 611. The computer program may include program code that may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
According to embodiments of the present disclosure, program code for performing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, such computer programs may be implemented in high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. Programming languages include, but are not limited to, such as Java, c++, python, "C" or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. Those skilled in the art will appreciate that the features recited in the various embodiments of the disclosure and/or in the claims may be combined in various combinations and/or combinations, even if such combinations or combinations are not explicitly recited in the disclosure. In particular, the features recited in the various embodiments of the present disclosure and/or the claims may be variously combined and/or combined without departing from the spirit and teachings of the present disclosure. All such combinations and/or combinations fall within the scope of the present disclosure.
The embodiments of the present disclosure are described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be made by those skilled in the art without departing from the scope of the disclosure, and such alternatives and modifications are intended to fall within the scope of the disclosure.

Claims (9)

1. A service invocation method, comprising:
acquiring service registration information from a registration center, wherein the service registration information comprises reservation service type configuration information externally provided by each service node in each service sub-cluster, each service sub-cluster belongs to a service cluster of a service provider, wherein the types of reservation service provided externally by each service sub-cluster are different, the types of reservation service provided externally by each service node in the same service sub-cluster are the same, and the types of reservation service provided externally by each service sub-cluster are the same as the types of total reservation service provided externally by the service sub-cluster after being summarized;
Storing the service registration information at a service consumer;
and respectively calling each reserved business service of each business sub-cluster of the service provider according to the reserved business service type and the service registration information prestored by the service consumer.
2. The method of claim 1, wherein after storing the service registration information, the occupied memory capacity of the service consumer is:
the product of the total service number and the memory capacity occupied by the unit service;
the total service number is the sum of the component service numbers, wherein the component service number is the product of the service node number of the service sub-cluster and the category number of the reserved service provided by the service sub-cluster.
3. The method of claim 1, further comprising, prior to the obtaining service registration information from a registry:
and loading the service type configuration information of the reserved service provided by each current service node by utilizing the service provider so as to generate the service registration information, and then sending the service registration information to the registration center.
4. The method of claim 3, wherein loading the subscription business service class configuration information provided by each current service node to the outside comprises:
Determining a current service sub-cluster to which each current service node belongs;
determining a current preset loading path of the current service sub-cluster, wherein the current preset loading path is: the current service subset group provides reservation service type configuration information to the outside and stores the path of the service provider;
and loading the configuration information of the service types of the reserved business provided by each current service node respectively according to the current preset loading path.
5. The method of claim 1, wherein invoking each of the subscribed service of each of the service sub-clusters of the service provider, respectively, according to the subscribed service class and the service registration information pre-stored by the service consumer comprises:
determining each service node in the service sub-cluster matched with each reserved service according to the reserved service type and the service registration information;
a target one of the service nodes is selected based on load balancing in order to invoke the respective subscribed service of the respective service sub-cluster of the service provider by accessing the respective target service node.
6. The method of claim 1, wherein invoking each of the subscribed service of each of the service sub-clusters of the service provider, respectively, according to the subscribed service class and the service registration information pre-stored by the service consumer comprises:
and calling each service of each service sub-cluster of a service provider in a remote procedure calling mode according to the service type of the reserved service and the service registration information.
7. A service invocation apparatus comprising:
the service registration module is used for acquiring service registration information from a registration center, wherein the service registration information comprises reservation service type configuration information which is externally provided by each service node in each service sub-cluster, each service sub-cluster belongs to a service cluster of a service provider, wherein the types of reservation service which are externally provided by each service sub-cluster are different, the types of reservation service which are externally provided by each service node in the same service sub-cluster are the same, and the types of reservation service which are externally provided by each service sub-cluster are the same, and are the types of total reservation service which are externally provided by the service sub-cluster after being summarized;
The storage module is used for storing the service registration information in a service consumer;
and the calling module is used for calling the reserved business services of the business sub-clusters of the service provider respectively according to the reserved business service types and the service registration information prestored by the service consumer.
8. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1 to 6.
9. A computer readable storage medium having stored thereon executable instructions which when executed by a processor cause the processor to implement the method of any of claims 1 to 6.
CN202111046429.0A 2021-09-07 2021-09-07 Service calling method and device, electronic equipment and computer readable storage medium Active CN113742108B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111046429.0A CN113742108B (en) 2021-09-07 2021-09-07 Service calling method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111046429.0A CN113742108B (en) 2021-09-07 2021-09-07 Service calling method and device, electronic equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN113742108A CN113742108A (en) 2021-12-03
CN113742108B true CN113742108B (en) 2024-02-02

Family

ID=78736756

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111046429.0A Active CN113742108B (en) 2021-09-07 2021-09-07 Service calling method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113742108B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002185A (en) * 2022-05-09 2022-09-02 北京城市网邻信息技术有限公司 Data processing method and device, electronic equipment and storage medium
CN115134373A (en) * 2022-06-28 2022-09-30 中国工商银行股份有限公司 Data synchronization method and device, storage medium and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111756841A (en) * 2020-06-23 2020-10-09 中国平安财产保险股份有限公司 Service implementation method, device, equipment and storage medium based on micro-service cluster
CN112769945A (en) * 2021-01-19 2021-05-07 中国工商银行股份有限公司 Distributed service calling method and device
CN112910708A (en) * 2021-02-07 2021-06-04 中国工商银行股份有限公司 Distributed service calling method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104426871A (en) * 2013-08-29 2015-03-18 中兴通讯股份有限公司 Method and device for realizing remote calling

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111756841A (en) * 2020-06-23 2020-10-09 中国平安财产保险股份有限公司 Service implementation method, device, equipment and storage medium based on micro-service cluster
CN112769945A (en) * 2021-01-19 2021-05-07 中国工商银行股份有限公司 Distributed service calling method and device
CN112910708A (en) * 2021-02-07 2021-06-04 中国工商银行股份有限公司 Distributed service calling method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于Zookeeper的GIS集群实现;苟丽美;张锋叶;林国华;;计算机工程与设计(第09期);全文 *

Also Published As

Publication number Publication date
CN113742108A (en) 2021-12-03

Similar Documents

Publication Publication Date Title
CN113742108B (en) Service calling method and device, electronic equipment and computer readable storage medium
US10554604B1 (en) Low-load message queue scaling using ephemeral logical message topics
US7779304B2 (en) Diagnosing changes in application behavior based on database usage
US10375072B2 (en) Dashboard as remote computing services
JP2009539170A (en) How to use heterogeneous services on heterogeneous devices using script plug-ins
CN114172966B (en) Service calling method, service processing method and device under unitized architecture
US8578119B2 (en) File system quota and reservation
US11757889B2 (en) Method and system for implementing customer resource use as a service
US20170180406A1 (en) Aggregation of network traffic source behavior data across network-based endpoints
AU2005246352B2 (en) System and method for context propagation in application servers and transaction-based systems
US10666713B2 (en) Event processing
US20170154192A1 (en) Method and apparatus for specifying time-varying intelligent service-oriented model
US11470068B2 (en) System and methods for securely storing data for efficient access by cloud-based computing instances
JP6616404B2 (en) Automatic response to threat detection for cloud virtual machines
US20070245314A1 (en) Method, system and computer program for collecting inventory information through a data mover
CN114363233B (en) Packet routing method, device, electronic equipment and storage medium
US9361140B1 (en) Isolating applications in server environment
US8966016B2 (en) Resource-based event typing in a rules system
US20230237181A1 (en) Extending private cloud security model to public cloud
US20230007092A1 (en) Prediction-based resource provisioning in a cloud environment
CN114780361A (en) Log generation method, device, computer system and readable storage medium
CN114968552A (en) Cache allocation method, apparatus, device, storage medium and program product
CN114745316B (en) Routing method, device, equipment and medium
CN112929195A (en) Service system, method executed by service system, processing apparatus, and storage medium
US11720507B2 (en) Event-level granular control in an event bus using event-level policies

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