A method and system for executing concurrent service processes in intelligent space based on microservices
By adopting process management and resource management component registration of microservice architecture in intelligent space, the reinforcement learning of resource scheduling and process evolution services is realized, the resource scheduling problems in the existing technology are solved, and the scalability and adaptability of the system are improved. In various smart space scenarios.
Patent Information
- Application Number
- CN202111538481.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-15
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2041-12-15
AI Technical Summary
The service framework of the existing intelligent space is mainly designed for a single application scenario, and it is difficult to effectively deal with resource competition and resource scheduling in concurrent service processes, resulting in high maintenance costs, difficulty in scaling, and lack of a general and efficient resource scheduling microservice architecture.
Adopt the intelligent space concurrent service process execution method based on microservices, and through the registration and association of process management and resource management service components, the rational allocation of resources between service processes is realized, and the resource scheduling service components are used to match and schedule resource pools. And use reinforcement learning algorithms to deal with resource blocking in process evolution services.
It realizes efficient allocation of resources between service processes, solves the problems of resource conflicts and variable service process requirements, reduces maintenance costs, improves the scalability and adaptability of the system, and is suitable for a variety of smart space scenarios.
Smart Images

Figure CN114416340B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electronic information technology, and in particular to a method and system for executing concurrent service processes in an intelligent space based on microservices. Background Art
[0002] Most of the service frameworks in smart spaces in the existing technology are designed for a single application scenario or a single function, such as the privacy protection architecture designed for the Internet of Things [1], the new energy management system based on ADHD and PSO online and offline algorithms designed by Danilo et al. [2], and the intelligent heating and air conditioning scheduling method designed by Hyung-Chul et al. [3] for energy management of smart homes. [4] A robot companion in a smart space is proposed to assist users in their lives. The robot companion is responsible for resource management and provides corresponding services to users. However, this is a relatively centralized proposal that lacks corresponding standards and feasibility.
[0003] Hu et al. [5] proposed the concept and system model of software-defined devices (SDD) for the underlying sensor devices and driver devices in the Internet of Things. They also proposed an open IoT system architecture based on SDD and introduced its software definition mechanism in detail. Through illustrative application usage scenarios, they demonstrated the actual effect of the SDD paradigm, achieved unified management and scheduling, sharing, reuse, reorganization and modular customization of devices, and helped solve the interconnection problem of heterogeneous resources and improve the utilization efficiency of device resources. However, this paradigm is not a universal architecture. Different actual applications need to be developed and deployed for different IoT scenarios, such as smart home, smart elderly care, smart city, etc., connected to the SDD platform.
[0004] Reference [6] proposed a new layered architecture based on cloud storage for data processing and management of future smart spaces, taking the smart home scenario as an example. This architecture can be used for any type of smart IoT system, including smart grids, smart retail, etc. Future IoT systems require ubiquity and provide interoperability and a shared data environment. In order to achieve these goals in a smart home environment, Ghassem et al. proposed a platform data processing and exchange architecture based on REST (Representational State Transfer) [7]. The architecture consists of seven main layers: physical layer, fog computing layer, network layer, cloud computing layer, service layer, session layer, and application layer. Parallel research and development of these layers can help provide an effective strategy to deal with the big data problems of future smart homes or smart cities, but a cloud-based control platform will increase the risk of link congestion and data security.
[0005] Pengfei Hu et al. proposed the methods and principles of SDEC (Software Defined Edge Computing) from the perspective of cyber-physical mapping [8], and designed an open edge computing system architecture based on SDEC to coordinate different types of edge resources and services. In addition, they proposed SDED, SDESto, SDECR and SDESer to realize the software definition of edge device resources, edge storage resources, edge computing resources and edge services respectively, and realized the sharing, reuse and reorganization of edge resources and services. The upper-layer application is separated from the underlying physical device, which improves the overall quality of service (QoS) of the edge. [9] Assuming that all applications in the smart home environment are composed of edge nodes and users, a pricing resource allocation model with maximum utility is established for them. The Lagrangian method is used to analyze the model, and a pricing-based low-pass filtering edge computing resource allocation algorithm is proposed, and the resource optimization allocation scheme under different tasks is obtained. The above two methods only optimize the allocation of edge computing resources and do not involve the scene device resources in the smart space.
[0006] At present, with the change of application scenarios and the growth of data volume, the development, deployment and maintenance of the overall architecture with tightly coupled components will only become more complicated. The addition or modification of internal functions needs to consider the compatibility with other functions, which will lead to greater maintenance and development costs, longer continuous cycles and worse expansion. At the same time, due to the insufficient utilization of distributed computing and network service architecture, the monolithic system will not be able to be effectively deployed on the cloud. At the same time, most of the existing service frameworks in smart spaces are designed for a single application scenario or a single function surface. The focus of the smart space service architecture mentioned above is to solve the data storage and computing problems in the smart space or provide a single service for a certain aspect. It does not widely consider the actual activities and specific needs of users, and lacks a general and efficient resource scheduling microservice architecture for solving resource competition and variable service process requirements during concurrent service processes. There are deficiencies in the existing technology.
[0007] [1]Psychoula,Ismini\&Chen,Liming\&Yao,Xuanxia\&Ning,Huansheng.(2019).A Privacy Aware Architecture for IoT Enabled Systems.10.1109 / SmartWorld-UIC-ATC-SCALCOM-IOP-SCI.2019.00073.
[0008] [2]Fuselli D,Angelis FD,Boaro M,Squartini S,Wei Q,Liu D,et al.Actiondependent heuristic dynamic programming for home energy resourcescheduling.Electrical Power and Energy Systems 2013;48:148–60.
[0009] [3]H.Jo,S.Kim and S.Joo,"Smart heating and air conditioningscheduling method incorporating customer convenience for home energymanagement system,"in IEEE Transactions on Consumer Electronics,vol.59,no.2,pp.316-322,May 2013,doi:10.1109 / TCE.2013.6531112.
[0010] [4]Xia,Chongkun\&Zhang,Yunzhou\&Wang,Lei\&Coleman,Sonya\&Liu,Yanbo.(2018).Microservice-based cloud robotics system for intelligentspace.Robotics and Autonomous Systems.110.10.1016 / j.robot.2018.10.001.
[0011] [5]P.Hu,H.Ning,L.Chen and M.Daneshmand,"An Open Internet of ThingsSystem Architecture Based on Software-Defined Device,"in IEEE Internet ofThings Journal,vol.6,no.2,pp.2583-2592,April 2019,doi:10.1109 / JIOT.2018.2872028.
[0012] [6] G.Mokhtari, A.Anvari-Moghaddam and Q.Zhang, "A New LayeredArchitecture for Future Big Data-Driven Smart Homes," in IEEE Access, vol.7, pp.19002-19012, 2019, doi:10.1109 / ACCESS.2019.2896403.
[0013] [7] L.Richardson, M.Amundsen, M.Amundsen, et al., "RESTful Web APIs, O'Reilly Media," 2013.
[0014] [8] P.Hu, W.Chen, C.He, Y.Li and H.Ning, "Software-Defined Edge Computing (SDEC): Principle, Open IoT System Architecture, Applications, and Challenges," in IEEE Internet of Things Journal, vol.7, no.7, pp.5934-5945, July 2020,doi:10.1109 / JIOT.2019.2954528.
[0015] [9] Liu H, Li S, Sun W. Resource Allocation for Edge Computing without Using Cloud Center in Smart Home Environment: A Pricing Approach. Sensors (Basel). 2020Nov 16; 20(22): 6545. doi: 10.3390 / s20226545. PMID: 33207813; PMCID: PMC7698201. Summary of the invention
[0016] In order to solve at least one of the above technical problems, the embodiments of the present invention provide a method and system for executing concurrent service processes in an intelligent space based on microservices, which realizes the reasonable allocation of resources among service processes by scheduling resources during concurrent execution of service processes based on the microservice layer.
[0017] According to an embodiment of the present invention, a method for executing a concurrent service process in a smart space based on microservices is provided, comprising the following steps:
[0018] S1. The service process organized in a directed acyclic graph structure is registered through the process management service component and stored in the service process database; the effective device resources in the smart space are registered through the resource management service component and stored in the resource database;
[0019] S2. The process management service component calls the resource management service component to associate resources;
[0020] S3. When the service processes are executed concurrently, the resource scheduling service component realizes the reasonable allocation of the resources between the service processes based on the process management service component and the resource management service component;
[0021] In the process of steps S1 to S3, the following steps are also included:
[0022] S4. The log service component continuously obtains the operation records of each service in the system and stores them in the log database;
[0023] The service process is associated with multiple task nodes and presented in the form of a directed acyclic graph; the task node is an event occurring in the smart space, and the required resources are independent and inseparable; each of the service processes has corresponding description information.
[0024] Furthermore, in step S4, the service operation record includes: resource operation, service process operation, scheduling log and evolution log.
[0025] Furthermore, in step S3, the reasonable allocation of resources among the service processes includes the following steps:
[0026] S31. The resource scheduling service component obtains all intelligent device resource information in each resource pool, as well as the service process of unbound resource pools;
[0027] S32. The resource scheduling service component sets the resource pool in which the resources it owns and the resources required by the service process are in the maximum matching state as the optimal resource pool;
[0028] S33. The resource scheduling service component binds the service process in the smart space to the corresponding optimal resource pool;
[0029] S34. The resource scheduling service component performs resource scheduling on concurrent service processes in the smart space;
[0030] The resource pool is the minimum space where the valid device resources are located as confirmed by the resource management service component.
[0031] Furthermore, the step S33 also includes the following steps:
[0032] S331. If the resource pool bound to the service process may lack one or more resources, cross-scenario linkage is adopted to call portable and movable resources in other resource pools as replacement resources;
[0033] S332. If the resources required by the service process are occupied, wait for the resources to be released;
[0034] The resource scheduling service component obtains the service process information and required resource status information in the smart space by calling the process management service and the resource management service, and timely recommends available resources for the service process that has been bound to the resource pool.
[0035] Furthermore, the step S33 further includes the following steps:
[0036] S5. In the process of allocating resources to the service process, when the service process bound to the resource pool is blocked during execution, the resource scheduling service component calls the process evolution service to obtain a replacement sub-process so that the service process can continue to execute;
[0037] The blocking means that the service process cannot find any of the resources and thus cannot be executed.
[0038] Furthermore, the step S5 further includes the following steps:
[0039] S6. The process evolution service component uses the scene semantic rule library based on reinforcement learning to update online and the evolution algorithm, calls the log service component to obtain environmental data, continuously updates the rules to ensure that there are always alternative sub-processes available, and records the evolution log through the log service;
[0040] Among them, the task nodes included in the new alternative sub-process all originate from the smart space where the user is located.
[0041] Another embodiment of the present invention provides a microservice-based intelligent space concurrent service process execution system using any of the above execution methods, including: a data entity, a data storage unit, a microservice layer, an API network management and an access terminal;
[0042] The data entity includes service processes organized in a directed acyclic graph structure and valid device hardware resources in the smart space;
[0043] The data storage unit includes a log database, a resource database, a service process database and other databases; the log database is used to store system operation information and record historical operation records; the resource database integrates all effective hardware resources in the smart space and stores device resource information in the scene; the service process database stores all service process information;
[0044] The microservice layer includes: resource management service components, process management service components, log service components, resource scheduling service components, process evolution service components and other service components, as well as inter-service communication methods and communication protocols;
[0045] The access terminal provides a control interface and an operation carrier for users;
[0046] The API gateway is responsible for unified access to the API calls of all the access terminals, and forwards the requests of the access terminals to the backend server. The access terminals only need to interact with the API gateway, and do not need to communicate with the interfaces of each business module separately, which can meet the needs of the client to request multiple services at the same time;
[0047] The service process is associated with multiple task nodes and presented in the form of a directed acyclic graph; the task node is an event occurring in the smart space, and the required resources are independent and inseparable; each of the service processes has corresponding description information.
[0048] Furthermore, the microservice layer also includes: service invocation, service registration, and inter-service communication and communication protocol;
[0049] The service call is based on Feign as a declarative Web Service client, which is between isolated microservices, but it can make the calls between microservices simple;
[0050] The service registration is implemented using the Eureka Server framework. After each resource node is started, it will be registered in the EurekaServer framework. After that, the service registration table will store information about all available resource nodes. The heartbeat mechanism of Eureka can promptly remove resource nodes that have not sent heartbeats within the specified period.
[0051] The inter-service communication adopts a remote procedure call component to provide a remote procedure call mechanism suitable for a distributed environment, and a remote method can be called like a local method;
[0052] The communication protocol uses the REST architectural style based on HTTP.
[0053] Furthermore, the resource management service component centrally manages all effective smart device resources in the smart space, performs personalized operations on all resources in the scene, and abstracts physical resources into semantic description models through device abstraction and description methods;
[0054] The process management module component customizes and creates the service process; different users design and add their own exclusive processes through the process management module component, and view all the service process information to be completed in the smart space;
[0055] The log service component collects operation logs and exception logs in the system, centrally stores and manages log information in a unified format, summarizes and analyzes all log information, provides an objective basis for user behavior tracking and system failure recovery, locates errors and saves historical operation records;
[0056] The resource scheduling service component realizes the reasonable allocation of resources among service processes; uses the resource scheduling service component to obtain all intelligent device resource information in each resource pool and service processes that are not bound to resource pools; binds the best resource pool to the service process; and performs resource scheduling for concurrent service processes in the smart space;
[0057] The optimal resource pool is a resource pool in which the resources owned by the resource pool and the resources required by the service process are in a state of maximum matching;
[0058] The process evolution service component uses the scene semantic rule library based on reinforcement learning to update online and the evolution algorithm, reads the log file as the environment data, and when the service process bound to the resource pool is blocked, the process evolution service can be called to obtain a replacement sub-process. The sub-process will replace the task node and the nodes after it that are blocked during execution, and join the original process to build a new service process, which has the same or similar effect as the original service process;
[0059] The blocking means that the service process cannot find any of the resources and thus cannot be executed;
[0060] The other services also include file storage and conversion.
[0061] Furthermore, when the resource scheduling service component performs resource scheduling for concurrent service processes, if the resource pool bound to the service process may lack one or more resources, cross-scenario linkage is adopted to call portable and movable resources in other resource pools to replace the missing resources. The resource scheduling service component obtains the service process information and required resource status information in the smart space by calling the process management service component and the resource management service component, and timely recommends available resources for the service process that has been bound to the resource pool; if the resources required by the service process are occupied, wait for the resources to be released;
[0062] If the required resources are extremely scarce, neither the idle resources nor the occupied resources contain the resources required by the service process, and the process cannot find any resources and cannot be executed, the process evolution service component is called to obtain an alternative sub-process for the blocked node in order to achieve the same or similar purpose as the original process.
[0063] The microservice-based intelligent space concurrent service process execution method and system in the embodiment of the present invention can effectively control global resources or local resources through the resource registration mechanism, make full use of various intelligent devices as resources in the intelligent space environment, establish a clear correspondence between users and their related activities, abstract the service process required by users, bind the service process to the corresponding resource pool through the maximum matching state, and solve the technical problem of resource conflict through resource scheduling. At the same time, the technical problem of variable service process requirements can be solved through process evolution. The architecture designed by the present invention meets the needs of users to handle daily service processes and customized service processes, and is applicable to almost all intelligent space instance scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0065] Figure 1 It is a flow chart of the method for executing concurrent service processes of a microservice-based smart space of the present invention;
[0066] Figure 2 It is a workflow mechanism diagram between modules of the concurrent service process execution method of the microservice-based intelligent space of the present invention;
[0067] Figure 3 This is a schematic diagram of the structure of the concurrent service process execution system of the microservice-based intelligent space of the present invention. DETAILED DESCRIPTION
[0068] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0069] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0070] Definitions of terms mentioned in this invention;
[0071] Resources: The resources mentioned in this article refer to all smart products, such as Figure 1 As shown, it is a device, apparatus or machine with computing and processing capabilities, supporting mainstream intelligent hardware communication protocols, such as: WiFi technology, Bluetooth protocol, ZigBee protocol and RF433 protocol;
[0072] Task node: A task node refers to an event that occurs in the smart space, and the required resources are independent and inseparable;
[0073] Service process: A service process is linked by multiple task nodes and presented in the form of a directed acyclic graph. Each service process has corresponding description information. For example, the process of a user exercising in a gym may include a series of events such as turning on the air conditioner and air purifier first, and then using a treadmill. Going to the gym to exercise requires the use of resources such as air conditioners, air purifiers, and treadmills. The events contained in each service process may be performed concurrently or sequentially.
[0074] See also Figure 1 and Figure 2 According to an embodiment of the present invention, a method for executing a concurrent service process in a smart space based on microservices is provided, comprising the following steps:
[0075] S1. The service process organized in a directed acyclic graph structure is registered through the process management service component and stored in the service process database; the effective device resources in the smart space are registered through the resource management service component and stored in the resource database;
[0076] S2. The process management service component calls the resource management service component to associate resources;
[0077] S3. When service processes are executed concurrently, the resource scheduling service component realizes the reasonable allocation of resources among service processes based on the process management service component and the resource management service component;
[0078] In the process of steps S1 to S3, the following steps are also included:
[0079] S4. The log service component continuously obtains the operation records of each service in the system and stores them in the log database.
[0080] Among them, the service process is linked by multiple task nodes and presented in the form of a directed acyclic graph; a task node is an event occurring in the smart space, and the required resources are independent and inseparable; each service process has corresponding description information.
[0081] Furthermore, in step S4, the service operation record includes: resource operation, service process operation, scheduling log and evolution log.
[0082] Furthermore, in step S3, the reasonable allocation of resources among service processes includes the following steps:
[0083] S31. The resource scheduling service component obtains all intelligent device resource information in each resource pool, as well as the service process of the unbound resource pool;
[0084] S32. The resource scheduling service component sets the resource pool that has the most matching resources with the resources required by the service process as the best resource pool;
[0085] S33. The resource scheduling service component binds the service process in the smart space to the corresponding optimal resource pool;
[0086] S34. The resource scheduling service component performs resource scheduling on concurrent service processes in the smart space;
[0087] The resource pool is the minimum space where valid device resources are located as confirmed by the resource management service component.
[0088] Furthermore, step S33 also includes the following steps:
[0089] S331. If the resource pool bound to the service process may lack one or more resources, cross-scenario linkage is adopted to call portable and movable resources in other resource pools as replacement resources;
[0090] S332. If the resources required by the service process are occupied, wait for the resources to be released;
[0091] Among them, the resource scheduling service component obtains the service process information and required resource status information in the smart space by calling the process management service and resource management service, and recommends available resources for the service process that has been bound to the resource pool in a timely manner.
[0092] Furthermore, step S33 further includes the following steps:
[0093] S5. In the process of allocating resources to the service process, when the service process bound to the resource pool is blocked during execution, the resource scheduling service component calls the process evolution service to obtain a replacement sub-process so that the service process can continue to execute;
[0094] Among them, blocking means that the service process cannot find any resources and thus cannot execute.
[0095] Furthermore, step S5 further includes the following steps:
[0096] S6. The process evolution service component uses the online update and evolution algorithm of the scenario semantic rule library based on reinforcement learning, calls the log service component to obtain environmental data, continuously updates the rules to ensure that there are always available alternative sub-processes, and records them as evolution logs through the log service;
[0097] Among them, the task nodes included in the new alternative sub-process all originate from the smart space where the user is located.
[0098] like Figure 3 As shown, another embodiment of the present invention provides a microservice-based intelligent space concurrent service process execution system adopting any one of the above-mentioned execution methods, including: a data entity, a data storage unit, a microservice layer, an API network management and an access terminal.
[0099] The data entity includes the service process organized in a directed acyclic graph structure and the effective equipment hardware resources in the smart space;
[0100] The data storage unit includes a log database, a resource database, a service process database and other databases; the log database is used to store system operation information and record historical operation records; the resource database integrates all effective hardware resources in the smart space and stores device resource information in the scene; the service process database stores all service process information.
[0101] In the specific implementation, the data is stored using the most popular relational database management system MySQL. MySQL is powerful and provides a variety of database storage engines. It also supports at least 20 development platforms, including Linux, Windows, FreeBSD, IBMAIX, etc. It provides APIs for multiple programming languages, such as Python, Java, PHP, etc., and can support back-end collaboration with different development styles.
[0102] The log database is used to store system operation information, record historical operation records, etc. The resource database integrates all effective resources in the smart space and stores device resource information in the scene. The service process database stores all service process information, which belongs to the same or different users. For example, in the database, user Alice has a service process information of cleaning. The corresponding information in the service process database includes Alice wants to turn on the air conditioner first, and then use the sweeping robot and washing machine. All databases are dedicated databases, which are specifically designed for a single business function. For example, the log database is designed specifically for the log service component. Since a single database cannot meet the data storage and access requirements of all services, dividing it into different dedicated databases allows different databases to cooperate with each other and support different business functions, which is conducive to keeping services independent of each other. If some microservices are blocked, it will not affect other services, and can ensure the normal operation of most system functions.
[0103] The microservice layer includes: resource management service components, process management service components, log service components, resource scheduling service components, process evolution service components and other service components, as well as inter-service communication methods and communication protocols.
[0104] The access terminal provides a control interface and operation carrier for users.
[0105] Users can use computers, tablets, mobile phones and other terminal devices to form access terminals, which can conveniently use various services. They can also monitor and remotely control the resources and service processes in the smart space in real time at any time. The access terminal should meet basic requirements such as simplicity, beauty and ease of operation, and should be simple and easy to learn for users of different age groups.
[0106] The API gateway is responsible for unified access to the API calls of all access terminals and forwarding the requests of the access terminals to the backend servers. The access terminals only need to interact with the API gateway instead of communicating with the interfaces of each business module separately, which can meet the needs of clients requesting multiple services at the same time.
[0107] API Gateway can also support cache storage of certain services, so that the running results of these services remain unchanged within a certain time interval. Microservices registered in the existing service registry can be directly exposed to external calls through API Gateway, and security protection, protocol conversion, traffic management and fault tolerance can be directly handed over to it. These features of API Gateway allow developers to focus on business logic processing and improve iteration efficiency.
[0108] The service process is linked by multiple task nodes and presented in the form of a directed acyclic graph; a task node is an event that occurs in the smart space, and the required resources are independent and inseparable; each service process has corresponding description information.
[0109] Furthermore, the microservice layer also includes: service invocation, service registration, and inter-service communication and communication protocols;
[0110] The service call is based on Feign as a declarative Web Service client, which is isolated from each other's microservices, but it can make the calls between microservices simple.
[0111] Feign is a client that uses feign to implement microservice calls through interfaces and annotations. It is also a load balancing tool used on the client. Feign provides a template for HTTP requests. By writing simple interfaces and inserting annotations, you can define the parameters, format, address and other information of HTTP requests. Since Feign will completely proxy HTTP requests, you only need to call it like calling a method to complete the service request and related processing.
[0112] Service registration is implemented using the Eureka Server framework. After each resource node is started, it will be registered in the EurekaServer framework. The service registry will then store information about all available resource nodes. The heartbeat mechanism of Eureka can be used to promptly remove resource nodes that have not sent heartbeats within the specified period.
[0113] The Eureka framework also provides a client cache mechanism. Even if all Eureka Servers fail to work, the Feign client can still use the information in the cache to call the service (resource) node. These features of Eureka can ensure that the system has high availability, flexibility and scalability.
[0114] The inter-service communication uses the Remote Procedure Call component (RPC) to provide a remote procedure call mechanism suitable for distributed environments, which can call remote methods just like calling local methods;
[0115] RPC can reduce the cost of microservice architecture, improve the development efficiency of callers and service providers, and ensure the performance and reliability of communication between services.
[0116] The communication protocol uses the REST architectural style based on HTTP.
[0117] REST (Representational State Transfer) is a lightweight protocol that can communicate directly through HTTP requests. Network services that conform to this architectural style allow clients to issue requests to access and operate network resources using uniform resource locators, so REST is often used to build WEB APIs. For example, Twitter, Skydrive, and Sina Weibo all use this method to provide third-party service interfaces. At the same time, in order to match the REST style, the client and server use the JSON format for data exchange.
[0118] Furthermore, the resource management service component centrally manages all effective smart device resources in the smart space, performs personalized operations on all resources in the scene, and abstracts physical resources into semantic description models through device abstraction and description methods.
[0119] In the specific implementation, a resource can be specifically named. In this module, you can see the detailed information of each resource, such as resource status (whether it is idle), resource name, resource type, etc. If the resource is in use, you can also obtain the task node information occupying the resource. The smallest space where the resource is located is regarded as a resource pool. Through the resource management service, you can know the resource pool information where the resource is located. For example, a kitchen in a home scenario is a resource pool, which includes various equipment resources such as microwave ovens, range hoods, coffee machines, etc. There are some resources that you may not want to be under the control of the system. Using this service, you can delete such resources and correct the resource information when it is incorrect.
[0120] The process management module component customizes the service process; different users design and add their own exclusive processes through the process management module component, and view all the service process information to be completed in the smart space.
[0121] In the specific implementation, the process management module component enables viewing the description of each process, the task nodes included in each process, the process creation time, etc., and can selectively delete non-standard or illogical processes by viewing the detailed information of a single service process. The detailed information may include the resources required for specific task nodes and the length of time the resources are occupied.
[0122] The log service component collects operation logs and exception logs in the system, and centrally stores and manages log information in a unified format, summarizes and analyzes all log information, provides an objective basis for user behavior tracking and system fault recovery, locates errors, and saves historical operation records.
[0123] In the microservice architecture, the data of the log service can be recycled, the resource scheduling service will record operation information through the log service, the process evolution service will call the log service to use the scheduling log, and the resource scheduling service will also call the process evolution service when the service process requirements cannot be fully met, thus realizing a closed loop of data flow within the scenario.
[0124] The resource scheduling service component realizes the reasonable allocation of resources among service processes; uses the resource scheduling service component to obtain all intelligent device resource information in each resource pool, as well as service processes that are not bound to resource pools; binds the best resource pool to the service process; and performs resource scheduling for concurrent service processes in the smart space.
[0125] During the specific implementation, the execution process will be visualized to achieve the purpose of real-time monitoring.
[0126] The best resource pool is a resource pool in which the resources owned by the resource pool and the resources required by the service process are in the best matching state.
[0127] The process evolution service component uses the online update and evolution algorithm of the scenario semantic rule library based on reinforcement learning, reads log files as environmental data, and when the service process bound to the resource pool is blocked, calling the process evolution service can obtain a replacement sub-process. The sub-process will replace the task node and the nodes after it that are blocked during execution, and join the original process to build a new service process, which has the same or similar effect as the original service process.
[0128] For example, one of the nodes in the cleaning service process is to complete the vacuuming task, but there is no vacuum cleaner in the user's space. The process evolution service may evolve an alternative sub-process of using a sweeping robot. The task nodes included in the new alternative sub-process are all derived from the user's smart space, and no secondary blocking will occur, thus realizing variable service process requirements.
[0129] Blocking means that the service process cannot find any resources and cannot execute.
[0130] Other services include file storage and conversion. The microservice architecture designed by the present invention has the advantages of low-cost expansion, elastic scaling, and rapid adaptation to cloud environments. Each service component can be independently deployed, operated, and expanded, so the architecture can be easily expanded later, and more functional modules can be added as needed.
[0131] Furthermore, when the resource scheduling service component performs resource scheduling for concurrent service processes, if the resource pool bound to the service process may lack one or more resources, cross-scenario linkage is adopted to call portable and movable resources in other resource pools to replace the missing resources. The resource scheduling service component obtains the service process information and required resource status information in the smart space by calling the process management service component and the resource management service component, and promptly recommends available resources for the service process that has been bound to the resource pool; if the resources required by the service process are occupied, wait for the resources to be released.
[0132] If the required resources are extremely scarce, neither the idle resources nor the occupied resources contain the resources required by the service process, and the process cannot find any resources and cannot be executed, the process evolution service component is called to obtain an alternative sub-process for the blocked node in order to achieve the same or similar purpose as the original process.
[0133] Furthermore, the scheduling architecture system designed based on microservices in the present invention uses container technology based on the Docker engine to ensure that the software design method based on microservices is easy to implement. At the same time, the application system is split into small and loosely coupled distributed business units, and deployed in each Docker container in a fine-grained manner, which can also greatly improve the management and operation efficiency of the microservice system.
[0134] Implementation: Prototype system development and performance testing
[0135] Resource Scheduling and Process Evolvable Microservice Architecture in Smart Spaces Based on Microservice Design The present invention has developed a corresponding simulation demonstration platform for experiments. The data in the experimental platform are all simulations of real smart space scenarios. From the perspective of users and the environment, and considering actual needs, the present invention has designed a variety of smart space scenarios. For example, corresponding examples can be designed for experiments in homes, offices, and nursing homes.
[0136] The system developed by the present invention is used to verify the feasibility of the proposed architecture. Considering the cost issue, hardware equipment resources are not used. Physical resources are abstracted into a semantic description model through equipment abstraction and description methods. After analyzing the functional requirements of the system and designing the database in detail, based on the principle of separation of the front and back ends, the back-end resource scheduling microservice component is developed using the Web application framework Django (3.0.7). The rest is built by creating a Maven (3.3.9) project and using the Spring Boot (2.1.5) framework to build microservices. The system is split into several core service components such as resource management, process management, logs, and process evolution. Next, the Eureka service registration center is built and configured, and Mybatis (3.5.2) is selected as the persistence layer framework to interact with the database. The database uses the most popular relational database management system Mysql. Vue.js (3.0) is used as the front-end development framework, and Bootstrap (3.3.7) is used to design pages. After the simulation experiment system is developed, the backend microservice components are containerized and released through Docker (19.03.12), and the frontend static resources are released using high-performance HTTP and reverse proxy server Nginx (1.18.0). The present invention uses them as auxiliary tools to design and implement a common resource scheduling and process evolvable architecture in smart space, and realizes a workflow mechanism with complete logic and functions.
[0137] The present invention uses two Alibaba Cloud servers to deploy the prototype system, where server A deploys four modules: resource management, process management, resource scheduling, and log service, and server B deploys the process evolution module. The server hardware configuration information is shown in Table 1:
[0138] Table 1 Cloud server configuration
[0139]
[0140] System test evaluation
[0141] The system adopts B / S structure. After deployment, various services of the experimental system are started. The scenario is set to smart home, so the resources and service process data in the system are simulations of real smart home scenarios. The experiment is conducted using python (3.6.3). The local test machine model is Lenovo Rescuer 15ISK, the operating system is Microsoft Windows 10 Home Chinese Edition, the memory is 16GB, the hard disk capacity is 512GB, the database uses MySQL software version 5.7.16, and the browser is Firefox Brower 84.0.1.
[0142] Functional testing
[0143] In terms of functional testing, the core microservice component functions such as resource management, service process management, resource scheduling and process evolution were tested. The application was interacted with through the graphical user interface, and the output or results of the interaction were analyzed to verify and verify whether the functional operations and services met the requirements. The functional test results are shown in Table 2, Table 3, Table 4 and Table 5 respectively. The test results verify that the core functions of the system are running normally, and the normal use of the process evolution service function also indirectly indicates that the registration and call of the log service component is normal.
[0144] From the four tables, we can see that the experimental system developed by this invention perfectly replicates the architecture designed in Section 3, and also proves the feasibility of the proposed architecture. As shown in Table 2, the resource management module is mainly responsible for realizing functions such as resource list display, resource addition, resource editing, and resource deletion. Resource editing and resource addition can be realized by editing fields such as resource name, resource type, resource brand, and resource pool to which it belongs;
[0145] Table 2 Resource management service function test results
[0146] Functional Interface in conclusion Display resource list conform to Add resource conform to Delete resource conform to Modify resource conform to
[0147] As shown in Table 3, through the process management service component, users can customize and create personal service processes by adding Start Task, Mid Task and End Task. They can see a list of all their service processes and detailed information of each process. The completed process can be deleted. If it is a process related to the user's daily fixed habits, it can be retained.
[0148] Table 3 Process management service function test results
[0149]
[0150] As shown in Table 4, the resource scheduling service component can perform operations such as resource allocation, resource release, resource scheduling, and resource pool resource query. Resource pool resource query can display resource equipment information in different resource pools. During process scheduling, select multiple processes and click the Allocate Resources button. A room can be regarded as a resource pool. The processes will be bound to the rooms that match the requirements and wait for resource allocation. Through the "resource scheduling" function, all concurrent processes bound to the resource pool can be executed and resources can be reasonably allocated to them. The following three situations were tested and verified during the resource scheduling process:
[0151] If the resource pool bound to the process does not have the resources required by the task node, it will borrow similar or identical borrowable resources from other resource pools to achieve cross-scenario resource linkage;
[0152] If the resources required by the service process are occupied, wait for the resources to be released;
[0153] If all resource pools do not have the resources required by the node, the evolution service component is called to evolve and obtain an alternative sub-process for the blocked node. For example, the event node of brewing coffee is replaced by using a crowdsourcing service to order coffee for delivery because there is no coffee pot.
[0154] Table 4 Resource scheduling service function test results
[0155] Functional Interface in conclusion Allocating resource conform to One key idle conform to Scheduling resources conform to Display list of resources in a room conform to
[0156] The present invention has been tested for a variety of situations. Whether it is a single process or multiple concurrent processes, the execution of the process can be completed through "resource scheduling" to achieve the user's expected goals. Finally, the resources can be unbound through the "one-key idle" function to release resources;
[0157] As shown in Table 5, the process evolution service component needs to call the log service and use its related log operation data. From the conclusion in the table, it can be seen that the three main functions of log upload, evolution simulation and evolution result management can be realized. "Log upload" can call the log service to upload the system log and parse it, and then you can see the evolution results of the current blocking situation obtained by using the online update of the scene semantic rule library and the evolution algorithm. Of course, users can also manually test the evolution in other situations, and perform "evolution simulation" on some blocked task nodes to obtain different evolution results. The same blocked node will generally evolve several alternative sub-processes. The system defaults to the alternative sub-process with the highest recommended probability in the "result display", and can query the graphical display of the evolution results of the "node" you want through the "filter" function. All stage-by-stage evolution results can be saved locally through the "download results" function.
[0158] Table 5 Process evolution service function test results
[0159]
[0160] The process evolution service uses the resource scheduling log data of the log service. The verification results of the resource scheduling module show that the alternative sub-process of the blocked node can be evolved smoothly, which also shows that the process evolution service component can work normally based on the online update of the scene semantic rule library and the evolution algorithm of reinforcement learning. The normal operation of microservice components such as resource management, process management, resource scheduling, and process evolution reflects that the registration and call of the log service component is normal, realizing the recycling of log data in the smart space, and has the characteristics of a closed loop within the scene.
[0161] Performance Testing
[0162] The present invention selected key functional interfaces in each microservice component for performance testing. Each interface tested the response time of a single user sending a single request and returning data fifty times. The average response time is shown in Table 6:
[0163] Table 6 Average response time of each module's main functional interface to a single request
[0164]
[0165] The performance test results show that the average response time of all interfaces is within 0.06s, among which the average response time of the four interfaces included in module one is 23.2 milliseconds, the average response time of the four interfaces included in module two is 30 milliseconds, the average response time of the four interfaces included in module three is 22.75 milliseconds, and the average response time of the three interfaces included in module four is 55.7 milliseconds. The main interfaces included in the four modules can respond to requests quickly, among which the average response time of the main functional interfaces in the resource management service is relatively small, and the average response time of the main functional interfaces in the process evolution service is larger than that of other components. This is because the resource management business type is relatively simple, and the background algorithm of the process evolution service is relatively complex, so the required response time is different. The performance test results of the prototype system show that the system can respond to user requests quickly and meet performance requirements. The above functional test and performance test results show that the resource scheduling microservice architecture in the intelligent space designed by the present invention can achieve reasonable resource allocation and solve problems such as resource conflicts and process evolution by calling and combining the core functions of each microservice component.
[0166] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for executing concurrent service processes in a smart space based on microservices, characterized in that: The following steps are involved: S1. The service process organized in a directed acyclic graph structure is registered through the process management service component and stored in the service process database; The valid device resources in the smart space are registered through the resource management service component and stored in the resource database; S2. The process management service component calls the resource management service component to associate resources; S3. When the service processes are executed concurrently, the resource scheduling service component realizes the reasonable allocation of the resources between the service processes based on the process management service component and the resource management service component; In the process of steps S1 to S3, the following steps are also included: S4. The log service component continuously obtains the operation records of each service in the system and stores them in the log database; The service process is associated with multiple task nodes and presented in the form of a directed acyclic graph; the task node is an event occurring in the smart space, and the required resources are independent and indivisible; each service process has corresponding description information; In step S3, the reasonable allocation of resources among the service processes includes the following steps: S31. The resource scheduling service component obtains all intelligent device resource information in each resource pool, as well as the service process of unbound resource pools; S32. The resource scheduling service component sets the resource pool in which the resources it owns and the resources required by the service process are in the maximum matching state as the optimal resource pool; S33. The resource scheduling service component binds the service process in the smart space to the corresponding optimal resource pool; S34. The resource scheduling service component performs resource scheduling on concurrent service processes in the smart space; The resource pool is the minimum space where the valid device resources are located as confirmed by the resource management service component.
2. The execution method according to claim 1, characterized in that: In the step S4, the service operation record includes: resource operation, service process operation, scheduling log and evolution log.
3. The execution method according to claim 2, characterized in that: The step S33 also includes the following steps: S331. If the resource pool bound to the service process lacks one or more resources, cross-scenario linkage is adopted to call portable and movable resources in other resource pools as replacement resources; S332. If the resources required by the service process are occupied, wait for the resources to be released; The resource scheduling service component obtains the service process information and required resource status information in the smart space by calling the process management service and the resource management service, and timely recommends available resources for the service process that has been bound to the resource pool.
4. The execution method according to claim 3, characterized in that: The step S33 further includes the following steps: S5. In the process of allocating resources to the service process, when the service process bound to the resource pool is blocked during execution, the resource scheduling service component calls the process evolution service component to obtain a replacement sub-process so that the service process can continue to execute; The blocking means that the service process cannot find any of the resources and thus cannot be executed.
5. The execution method according to claim 4, characterized in that: The step S5 further includes the following steps: S6. The process evolution service component uses the scene semantic rule library based on reinforcement learning to update online and the evolution algorithm, calls the log service component to obtain environmental data, continuously updates the rules to ensure that there are always alternative sub-processes available, and records the evolution log through the log service; Among them, the task nodes included in the new alternative sub-process all originate from the smart space where the user is located.
6. A microservice-based intelligent space concurrent service process execution system using the execution method according to any one of claims 1 to 5, comprising: Data entity, data storage unit, microservice layer, API gateway and access terminal; characterized in that, The data entity includes service processes organized in a directed acyclic graph structure and valid device hardware resources in the smart space; The data storage unit includes a log database, a resource database, a service process database and other databases; the log database is used to store system operation information and record historical operation records; the resource database integrates all effective hardware resources in the smart space and stores device resource information in the scene; the service process database stores all service process information; The microservice layer includes: resource management service components, process management service components, log service components, resource scheduling service components, process evolution service components and other service components, as well as inter-service communication methods and communication protocols; The access terminal provides a control interface and an operation carrier for users; The API gateway is responsible for unified access to the API calls of all the access terminals, and forwards the requests of the access terminals to the backend server. The access terminals only need to interact with the API gateway, instead of communicating with the interfaces of each business module separately, to meet the needs of the client to request multiple services at the same time; The service process is associated with multiple task nodes and presented in the form of a directed acyclic graph; the task node is an event occurring in the smart space, and the required resources are independent and inseparable; each of the service processes has corresponding description information.
7. The microservice-based execution system according to claim 6, characterized in that: The microservice layer also includes: service calling, service registration, inter-service communication and communication protocol; The service call is based on Feign as a declarative Web Service client, which is between isolated microservices, but it makes the calls between microservices simple; The service registration is implemented using the Eureka Server framework. After each resource node is started, it will be registered in the EurekaServer framework. After that, the service registration table will store information about all available resource nodes. The heartbeat mechanism of Eureka can promptly remove resource nodes that have not sent heartbeats within the specified period. The inter-service communication adopts a remote procedure call component to provide a remote procedure call mechanism suitable for a distributed environment, and can call a remote method just like calling a local method; The communication protocol uses the REST architectural style based on HTTP.
8. The microservice-based execution system according to claim 7, characterized in that: The resource management service component centrally manages all effective smart device resources in the smart space, performs personalized operations on all resources in the scene, and abstracts physical resources into semantic description models through device abstraction and description methods; The process management module component customizes and creates the service process; Different users can design and add their own processes through the process management module components, and view all the service process information to be completed in the smart space; The log service component collects operation logs and exception logs in the system, centrally stores and manages log information in a unified format, summarizes and analyzes all log information, provides an objective basis for user behavior tracking and system failure recovery, locates errors and saves historical operation records; The resource scheduling service component realizes the reasonable allocation of resources among service processes; uses the resource scheduling service component to obtain all intelligent device resource information in each resource pool and service processes that are not bound to resource pools; binds the best resource pool to the service process; and performs resource scheduling for concurrent service processes in the smart space; The optimal resource pool is a resource pool in which the resources owned by the resource pool and the resources required by the service process are in a state of maximum matching; The process evolution service component uses the scene semantic rule library based on reinforcement learning to update online and the evolution algorithm, reads the log file as the environment data, and when the service process bound to the resource pool is blocked, the process evolution service component is called to obtain a replacement sub-process; the sub-process will replace the task node and the nodes after it that are blocked during execution, and join the original process to construct a new service process, which has the same or similar effect as the original service process; The blocking means that the service process cannot find any of the resources and thus cannot be executed; The other services also include file storage and conversion.
9. The microservice-based execution system according to claim 8, characterized in that: When the resource scheduling service component performs resource scheduling for concurrent service processes, if the resource pool bound to the service process lacks one or more resources, cross-scenario linkage is adopted to call portable and movable resources in other resource pools to replace the missing resources. The resource scheduling service component obtains the service process information and required resource status information in the smart space by calling the process management service component and the resource management service component, and recommends available resources to the service process that has been bound to the resource pool in a timely manner; if the resources required by the service process are occupied, wait for the resources to be released; If the required resources are extremely scarce, neither the idle resources nor the occupied resources contain the resources required by the service process, and the process cannot find any resources and cannot be executed, the process evolution service component is called to obtain an alternative sub-process for the blocked node in order to achieve the same or similar purpose as the original process.
