Intelligent sound box control method, device and system and storage medium
Technical Field
the invention relates to the technical field of electronics, in particular to a method, a device and a system for controlling an intelligent sound box and a storage medium.
background
The intelligent sound box is a product of sound box upgrading, can directly send an instruction through voice recognition, and can also realize instruction operation on the intelligent sound box through a mobile terminal, and therefore the intelligent sound box mainly has the following two framework schemes:
(1) only the sound box equipment is combined with the mobile phone app and the back-end cloud system, the supported functions are few, and the sound box and the equipment are controlled through basic voice;
(2) the smart sound box device combines a mobile phone end and a back end cloud service, but the overall architecture has poor lateral expansion capability and cannot meet high availability.
Therefore, the intelligent sound box device in the existing scheme can be combined with a mobile phone end and a back-end cloud service, so that the intelligent sound box device is controlled to realize corresponding functions through a voice command and a command sent by a mobile terminal, but the architecture cannot meet high availability on the whole, and therefore, when a large number of online users use the intelligent sound box device at the same time, the system stability is poor, and the delay is high.
disclosure of Invention
the invention mainly aims to provide a method, a device and a system for controlling an intelligent sound box and a storage medium, and aims to solve the problems that in the prior art, an intelligent sound box cloud service system for combining a mobile terminal and an intelligent sound box rear-end cloud server is poor in data processing performance, and the system is unstable when a large number of users use the system at the same time.
In order to achieve the above object, a first aspect of the embodiments of the present invention provides a smart speaker control method, which is applied to a smart speaker cloud service system formed by N sets of processing subsystems, where N is a positive integer, where the processing subsystems include a first processing subsystem and a second processing subsystem, and the method includes:
Acquiring a control instruction of a first mobile terminal, updating the control instruction to a first database of the first processing subsystem, and updating the control instruction to a first cache unit of the first processing subsystem;
After the updating is finished, writing the control instruction in the first cache unit into a message queue, wherein the message queue is used for the second processing subsystem to obtain the control instruction;
Analyzing the control instruction through a second central server of the second processing subsystem, determining the request type of the control instruction, and forwarding the control instruction to a second application server corresponding to the request type;
and executing the operation corresponding to the control instruction through the second application server.
With reference to the first aspect of the present invention, in the first implementation manner of the present invention, after acquiring a control instruction of a first mobile terminal, and updating the control instruction to a first database of the first processing subsystem, and at the same time updating to a first cache unit of the first processing subsystem, the method further includes:
updating the control instruction to a second cache unit of the second processing subsystem;
and when the cache in the second cache unit is expired, the control instruction is acquired again from the first database and updated to the second cache unit again.
With reference to the first aspect of the present invention, in a second implementation manner of the present invention, the second processing subsystem includes a plurality of central servers;
After the updating is completed, writing the control instruction in the first cache unit into a message queue, and then:
selecting the second central server from a plurality of central servers of the second processing subsystem according to a load balancing principle;
and sending the control instruction to the second central server.
with reference to the first aspect of the present invention, in a third implementation manner of the present invention, the analyzing, by the second central server of the second processing subsystem, the request type of the control instruction, and forwarding the control instruction to the second application server corresponding to the request type includes:
analyzing the parameters of the control command through the second central server to obtain the request type of the control command;
dividing the second application server into a plurality of clusters, wherein each cluster corresponds to one request category;
Forwarding, by the second central server, the control instruction to a cluster of the same request category as the control instruction.
With reference to the first aspect of the present invention, in a fourth implementation manner of the present invention, the method for controlling a smart sound box further includes:
when a control instruction of a first mobile terminal is acquired, if a control instruction of a second mobile terminal is acquired, the control instruction is respectively updated to a first database of a first processing subsystem and a second database of a second processing subsystem, and a first cache unit of the first processing subsystem and a second cache unit of the second processing subsystem are updated at the same time;
After updating, writing the control instruction into a message queue, so that the first processing subsystem and the second processing subsystem respectively acquire the control instruction from the message queue, and respectively process the control instruction through the first processing subsystem and the second processing subsystem.
With reference to the first aspect of the present invention, in a fifth embodiment of the present invention, the executing, by the second application server, an operation corresponding to the control instruction includes:
and controlling the intelligent sound box to execute the control instruction through the second application server, or enabling the intelligent sound box to control an external device to execute the control instruction, or carrying out user management on the intelligent sound box according to the control instruction.
With reference to the fifth implementation manner of the first aspect of the present invention, in a sixth implementation manner of the present invention, the smart sound box controlling an external device to execute the control instruction includes:
controlling an external device through a wireless mesh technology;
the external equipment comprises household appliances.
a second aspect of the embodiments of the present invention provides an intelligent speaker control device, which is applied to an intelligent speaker cloud service system formed by N sets of processing subsystems, where N is a positive integer, the processing subsystems include a first processing subsystem and a second processing subsystem, and the device includes:
the control instruction acquisition module is used for acquiring a control instruction of a first mobile terminal, updating the control instruction to a first database of the first processing subsystem and updating the control instruction to a first cache unit of the first processing subsystem;
a control instruction writing module, configured to write the control instruction in the first cache unit into a message queue after the update is completed, where the message queue is used for the second processing subsystem to obtain the control instruction;
the control instruction processing module is used for analyzing the control instruction through a second central server of the second processing subsystem, determining the request type of the control instruction and forwarding the control instruction to a second application server corresponding to the request type;
and the control instruction execution module executes the operation corresponding to the control instruction through the second application server.
The invention provides a cloud service system of an intelligent sound box, which comprises N groups of first processing subsystems and second processing subsystems, wherein each first processing subsystem comprises a first database, a first cache unit, a first central server and a first application server;
The second processing subsystem comprises a second database, a second cache unit, a second central server and a second application server;
the first processing subsystem and the second processing subsystem implement the smart sound box control method according to any one of claims 1 to 7.
a fourth aspect of embodiments of the present invention provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the steps of the method as provided in the first aspect above.
The embodiment of the invention provides an intelligent sound box control method, which is applied to an intelligent sound box cloud service system formed by N groups of first processing subsystems and second processing subsystems, wherein when a control instruction is obtained, the control instruction is written into a first database and a first cache unit by the first processing subsystem, then the control instruction is executed by the second processing subsystem, a second central server of the second processing subsystem further analyzes the request type of the control instruction, and the control instruction is forwarded to a corresponding second application server according to the service type for execution, so that the processing performance of the intelligent sound box cloud service system is improved, the master-slave deployment of the second central server and the second application server and the cluster deployment of the second application server can improve the overall performance stability of the system under the condition of concurrency, and finally the intelligent sound box cloud platform architecture supports transverse expansion, The system performance is not influenced while the large-scale user is supported to use online at the same time.
Drawings
Fig. 1 is a schematic diagram illustrating an implementation flow of a smart sound box control method according to an embodiment of the present invention;
Fig. 2 is a schematic flow chart illustrating an implementation of another intelligent sound box control method according to an embodiment of the present invention;
FIG. 3 is a detailed implementation flowchart of step S103 in FIG. 1;
Fig. 4 is an interaction schematic diagram of a mobile terminal, a smart speaker cloud service system, a smart speaker, and an external device according to an embodiment of the present invention;
Fig. 5 is a schematic view of an implementation flow of a smart sound box control method according to a second embodiment of the present invention;
fig. 6 is a schematic structural diagram of a component of an intelligent sound box control device according to a third embodiment of the present invention;
Fig. 7 is a schematic structural diagram of a composition of the cloud service system for smart speakers according to the fourth embodiment of the present invention.
the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
it should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
suffixes such as "module", "part", or "unit" used to denote elements are used herein only for the convenience of description of the present invention, and have no specific meaning in themselves. Thus, "module" and "component" may be used in a mixture.
In the following description, the serial numbers of the embodiments of the invention are merely for description and do not represent the merits of the embodiments.
Example one
In order to solve the defect of poor data processing performance of a smart speaker cloud service system for combining a mobile terminal and a smart speaker backend cloud server in the related art, a first embodiment of the present application provides a smart speaker control method, which is applied to a smart speaker cloud service system formed by N sets of processing subsystems, where N is a positive integer, where the processing subsystems include a first processing subsystem and a second processing subsystem, for example, fig. 1 is a basic flow chart of the smart speaker control method provided in this embodiment, and the smart speaker control method may include, but is not limited to, the following steps:
s101, a control instruction of a first mobile terminal is obtained, the control instruction is updated to a first database of the first processing subsystem, and meanwhile, the control instruction is updated to a first cache unit of the first processing subsystem.
In the step S101, the first processing subsystem and the second processing subsystem have the same composition structure, and when the smart sound box cloud service system acquires the control instruction of the mobile terminal, any one of the processing subsystems may acquire the control instruction of the mobile terminal, and for convenience of description, the processing subsystem that acquires the control instruction is used as the first processing subsystem.
in a specific application, the updating of the first database and the updating of the first cache unit are processes in which the first processing subsystem writes the control instruction into the database and the cache unit, where the cache unit may be a Redis cache unit, and the database may be a Mysql database.
in a specific application, the database is used to store data, the cache unit is used to cache hot spot data, and other units or modules call the data therein, and the hot spot data cached in the cache unit may be out of date, so as shown in fig. 2, an embodiment of the present invention further shows another intelligent speaker control method, and after the step S101, the method further includes the following steps:
S1011, updating the control instruction to a second cache unit of the second processing subsystem;
s1012, when the cache in the second cache unit is expired, obtaining the control command again from the first database, and updating the control command to the second cache unit again.
In a specific application, the data in the first cache unit is directly called by the second processing subsystem and is updated to the second cache unit, so that the data in the second cache unit may be out of date, and through the above steps, when the cache data is out of date, the second cache unit may penetrate through the first database to request the data and update to the second cache unit at the same time.
And S102, after the updating is finished, writing the control instruction in the first cache unit into a message queue, wherein the message queue is used for the second processing subsystem to obtain the control instruction.
in the step S102, the first processing subsystem writes the control instruction into the message queue, and the second processing subsystem obtains the control instruction from the message queue, so that by the intelligent sound box control method provided by the embodiment of the present invention, the intelligent sound box cloud service system can implement read-write separation, thereby improving the data processing efficiency of the intelligent sound box cloud service system.
in a specific application, the message queue is a communication method of an application program to the application program, and is used for establishing communication between two processing subsystems in the embodiment of the present invention.
In the embodiment of the invention, the second processing subsystem comprises a plurality of central servers and a plurality of application servers. The central server determines the work of the application server, and the work of the central server is selected by a load balancing principle. As shown in fig. 2, another smart speaker control method is further shown in the embodiment of the present invention, after step S102, the following steps are further included to explain how to select the second center server in the second processing subsystem to obtain the control instruction:
s1021, selecting the second central server from the plurality of central servers of the second processing subsystem according to a load balancing principle;
S1022, the control instruction is sent to the second central server.
in certain applications, the load balancing rules may include a one-tier load balancing rule or a two-tier load balancing rule. The embodiment of the invention adopts a one-layer load balancing principle, wherein the one-layer load balancing principle refers to L4 (four-layer) load balancing or L7 (seven-layer) load balancing. The embodiment of the invention only explains the load balance of L4:
l4 load balancing: and selecting the server according to the target address and the port in the message and a server selection mode set by the load balancing equipment. Taking TCP (Transmission Control Protocol) as an example, when receiving a first SYN (synchronization Sequence number) request from a client, the load balancing device selects a server in the above manner, modifies a target IP (Internet Protocol) address in a message to an IP address of the selected server, and forwards the message to the server.
s103, the control instruction is analyzed through a second central server of the second processing subsystem, the request type of the control instruction is determined, and the control instruction is forwarded to a second application server corresponding to the request type.
In step S103, the second central server and the first central server have the same functional structure, and are used for analyzing parameters and forwarding messages to the corresponding application server; the second application server and the first application server have the same functional structure and are used for executing the instructions, and the second application server and the first application server can be divided according to the service classes of the instructions to be executed by the second application server and the first application server, so that a distributed system architecture is realized.
As shown in fig. 3, the embodiment of the present invention further provides an implementation manner of the step S103, which includes, but is not limited to, the following steps:
s1031, analyzing the parameters of the control command through the second central server, and acquiring the request type of the control command;
s1032, dividing the second application server into a plurality of clusters, wherein each cluster corresponds to one request category;
S1033, forwarding the control instruction to a cluster with the same request type as the control instruction through the second central server.
In the above step, the first application server and the second application server are the same and are all divided into different clusters according to the request type, that is, the service type corresponding to the instruction, for example, the application servers in the 3-cluster a all execute the service related to the user, and the application servers in the cluster B all execute the service related to the operation of the speaker equipment.
And S104, executing the operation corresponding to the control instruction through the second application server.
in step S104, the operation corresponding to the control instruction may include: and controlling the intelligent sound box to execute the control instruction through the second application server, or enabling the intelligent sound box to control an external device to execute the control instruction, or carrying out user management on the intelligent sound box according to the control instruction.
In a specific application, if the sound box executes the control instruction, the control instruction is related to a request for controlling the intelligent sound box device, such as music playing, alarm setting, audio and video communication and the like;
If the control instruction is executed by the external equipment, the control instruction is related to controlling household equipment, such as bulbs, air conditioners and the like, through the intelligent sound box;
If the user management of the intelligent sound box is carried out according to the control instruction, the fact that the control instruction relates to data verification is shown, and if the user registration account information is legal, the control instruction is judged; or data access related operations, such as storing user information, logging in and logging out a user, or call log access.
as shown in fig. 4, the embodiment of the present invention further shows an interaction diagram of the mobile terminal, the smart speaker cloud service system, the smart speaker, and the external device, so as to explain the operation of the control instruction in step S104.
in an embodiment, the above smart speaker controls the external device to execute the control command, including:
Controlling an external device through a wireless mesh technology;
the external equipment comprises household appliances.
In specific application, the intelligent sound box is used for controlling the household equipment, and compared with the household equipment controlled by the mobile terminal, the household equipment is wider in range.
The intelligent sound box control method provided by the embodiment of the invention is applied to an intelligent sound box cloud service system composed of N groups of first processing subsystems and second processing subsystems, when a control instruction is obtained, the control instruction is written into a first database and a first cache unit by the first processing subsystem, then the control instruction is executed by the second processing subsystem, wherein a second central server of the second processing subsystem further analyzes the request type of the control instruction, and the control instruction is forwarded to a corresponding second application server according to the service type for execution, so that the processing performance of the intelligent sound box cloud service system is improved, the master and slave of the second central server and the second application server and the cluster deployment of the second application server can improve the overall performance stability of the system under the condition of concurrency, and finally the intelligent sound box cloud platform architecture supports transverse expansion, The system performance is not influenced while the large-scale user is supported to use online at the same time.
example two
in the intelligent sound box control method provided in the first embodiment, only the process of writing an instruction into one sub-processing system of the intelligent sound box cloud service system and reading an instruction from the other sub-processing system is shown, but in practical application, two processing subsystems in the same group can read and write at the same time, as shown in fig. 5, the embodiment of the present invention further exemplarily shows an intelligent sound box control method in the case where both processing subsystems of the intelligent sound box cloud service system receive a control instruction, and an implementation flow of the intelligent sound box control method, which includes but is not limited to the following steps:
S501, when a control instruction of a first mobile terminal is obtained, if a control instruction of a second mobile terminal is obtained, the control instruction is respectively updated to a first database of the first processing subsystem and a second database of the second processing subsystem, and a first cache unit of the first processing subsystem and a second cache unit of the second processing subsystem are updated at the same time.
And S502, after the updating is finished, writing the control instruction into a message queue so that the first processing subsystem and the second processing subsystem respectively acquire the control instruction from the message queue and respectively process the control instruction through the first processing subsystem and the second processing subsystem.
In the above steps S501 and S502, when the smart speaker cloud service system acquires two or more mobile terminal control instructions, for any one of the two or more mobile terminal control instructions, the process of writing the control instruction into the database and the cache is in one sub-processing system, the process of reading the control instruction from the message queue is performed, and the process of performing instruction analysis and instruction execution is in the other sub-processing system.
EXAMPLE III
As shown in fig. 6, an embodiment of the present invention further provides a smart speaker control apparatus 60, which is also applied to a smart speaker cloud service system formed by N sets of processing subsystems, where N is a positive integer, the processing subsystems include a first processing subsystem and a second processing subsystem, and the apparatus includes:
The control instruction obtaining module 61 is configured to obtain a control instruction of the first mobile terminal, update the control instruction to the first database of the first processing subsystem, and update the control instruction to the first cache unit of the first processing subsystem.
the first processing subsystem and the second processing subsystem have the same composition structure, when the intelligent sound box cloud service system acquires the control instruction of the mobile terminal, any one of the processing subsystems can acquire the control instruction of the mobile terminal, and for convenience in description, the processing subsystem acquiring the control instruction is used as the first processing subsystem.
and a control instruction writing module 62, configured to write the control instruction in the first cache unit into a message queue after the update is completed, where the message queue is used for the second processing subsystem to obtain the control instruction.
according to the intelligent sound box control method provided by the embodiment of the invention, the intelligent sound box cloud service system can realize read-write separation, and the data processing efficiency of the intelligent sound box cloud service system is improved.
the control instruction processing module 63 analyzes the control instruction through the second central server of the second processing subsystem, determines the request type of the control instruction, and forwards the control instruction to the second application server corresponding to the request type.
the second central server and the first central server have the same functional structure and are used for analyzing parameters and forwarding messages to the corresponding application server; the second application server and the first application server have the same functional structure and are used for executing the instructions, and the second application server and the first application server can be divided according to the service classes of the instructions to be executed by the second application server and the first application server, so that a distributed system architecture is realized.
And a control instruction execution module 64 for executing an operation corresponding to the control instruction through the second application server.
the operation corresponding to the control instruction may include: and controlling the intelligent sound box to execute the control instruction through the second application server, or enabling the intelligent sound box to control an external device to execute the control instruction, or carrying out user management on the intelligent sound box according to the control instruction.
the embodiment of the present invention further provides a storage medium, where the storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium, and when the computer program is executed by a processor, the steps in the intelligent sound box control method according to the first embodiment are implemented.
Example four
As shown in fig. 7, the embodiment of the present invention further exemplarily shows a composition structure of a smart speaker cloud service system, so as to illustrate the smart speaker control method in the first embodiment and the smart speaker control method in the second embodiment, and an application scenario or an application basis of the smart speaker control device in the third embodiment. In the embodiment of the present invention, two processing subsystems are used, and one processing subsystem includes four central servers and four application servers.
Referring to fig. 7, the smart speaker cloud service system includes a first processing subsystem 71 and a second processing subsystem 72, where the first processing subsystem 71 includes a first database 711, a first cache unit 712, a first central server 713, and a first application server 714. The second processing subsystem 72 includes a second database 721, a second cache unit 722, a second central server 723 and a second application server 724;
The first processing subsystem 71 and the second processing subsystem 72 may implement the smart sound box control method in the first embodiment and the second embodiment.
the first central server and the second central server are AR servers.
In the embodiment of the present invention, before the control command passes through the central server, it is further used to select the central server through a layer of load balancing 73.
as can be seen from fig. 5, the smart speaker cloud service system is a distributed cloud platform architecture, and the working process of the smart speaker cloud service system is described as follows from the first processing subsystem:
1. the mobile terminal accesses the L4 load to perform a layer of load balancing, and selects a first central server for receiving a control instruction;
2. The first central server performs cluster deployment, firstly analyzes parameters of the control instruction, forwards the control instruction according to an analysis result, and specifically forwards the control instruction to the first application server;
3. The first application server can be divided into different clusters according to the service, for example, the cluster A is the service related to the user, and the cluster B is the service related to the operation of the sound box equipment;
4. The method comprises the following steps that a first central server and a first application server are internally subjected to micro-service splitting, and data such as control instructions and the like are called through DUBBO and RPC;
5. And performing master-slave deployment through the first cache unit.
6. And performing master-slave deployment and read-write separation through the first database.
in the embodiment of the present invention, the workflow of the first processing subsystem in the smart speaker cloud service system is the same as the above process, and is not described again.
The embodiment of the invention also explains that the data calling process of the first sub-processing system and the second sub-processing system in the intelligent sound box cloud service system from the first processing subsystem is as follows:
1. Updating the first database when the first sub-processing system writes a request, synchronously updating the first database into the first cache unit, and writing the first database into a message queue;
2. the second sub-processing system starts a process to consume data from the message queue and updates the data into a second database;
In the embodiment of the present invention, the cache unit is configured to cache hot spot data, and the cache update policy is as follows:
When the database is updated, the cache is synchronously updated;
When the cache is expired, data is requested through to the database and updated to the cache.
In specific applications, the distributed architecture of the smart speaker cloud service system has universality, and not only can be used for realizing business functions in the smart speaker control method, but also other mobile phone apps and interactive products between devices can use the architecture, and the embodiment is not limited.
the above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the foregoing embodiments illustrate the present invention in detail, those of ordinary skill in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.