CN115145615A - Memory data refreshing method and device, storage medium and electronic device - Google Patents

Memory data refreshing method and device, storage medium and electronic device Download PDF

Info

Publication number
CN115145615A
CN115145615A CN202210570075.8A CN202210570075A CN115145615A CN 115145615 A CN115145615 A CN 115145615A CN 202210570075 A CN202210570075 A CN 202210570075A CN 115145615 A CN115145615 A CN 115145615A
Authority
CN
China
Prior art keywords
service
target
message
data
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210570075.8A
Other languages
Chinese (zh)
Inventor
陈磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Original Assignee
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Haier Technology Co Ltd, Haier Smart Home Co Ltd filed Critical Qingdao Haier Technology Co Ltd
Priority to CN202210570075.8A priority Critical patent/CN115145615A/en
Publication of CN115145615A publication Critical patent/CN115145615A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a memory data refreshing method and device, a storage medium and an electronic device, and relates to the field of smart homes, wherein the memory data refreshing method comprises the following steps: receiving a theme change message pushed by a message server, wherein the theme change message is used for indicating that a service message in a target theme corresponding to a target service is updated; responding to the theme change message, and acquiring a target service message under a target theme from the message server, wherein the target service message carries service data to be updated of the target service; and performing data refreshing operation on the node memory of the first service node by using the service data to be updated so as to refresh the first service data in the node memory of the first service node, wherein the first service data is the service data of the target service. By the method and the device, the problem that the memory data refreshing efficiency is low due to the fact that the restarting service node is adopted in the memory data refreshing method in the related technology is solved.

Description

Memory data refreshing method and device, storage medium and electronic device
Technical Field
The application relates to the field of smart homes, in particular to a memory data refreshing method and device, a storage medium and an electronic device.
Background
Currently, the same service may in many cases be deployed in a cluster, e.g. to multiple nodes in a cluster. In order to improve service response time and reduce access to a database or a cache, a service node may directly store some high-frequency service data into a memory. When the memory data of a certain service node is updated, the memory data read by other nodes is still old, which may cause abnormal service operation.
In order to avoid abnormal service operation, all service nodes are usually manually restarted by operation and maintenance personnel, and the service nodes refresh memory data each time service is restarted. However, the memory refreshing of each service node is performed by using a restarting method, so that the service is stopped for a short time, the user experience is not good, and the operation time is long by using the restarting method for refreshing the memory data.
Therefore, the memory data refreshing mode in the related art has the problem of low memory data refreshing efficiency caused by the adoption of the restarting service node.
Disclosure of Invention
The embodiment of the application provides a memory data refreshing method and device, a storage medium and an electronic device, and aims to at least solve the problem that the memory data refreshing efficiency is low due to the adoption of a restarting service node in the memory data refreshing method in the related art.
According to an aspect of an embodiment of the present application, there is provided a memory data refreshing method, including: receiving a theme change message pushed by a message server, wherein the theme change message is used for indicating that a service message in a target theme corresponding to a target service is updated; responding to the theme change message, and acquiring a target service message under the target theme from the message server, wherein the target service message carries service data to be updated of the target service; and performing data refreshing operation on a node memory of a first service node by using the service data to be updated so as to refresh first service data in the node memory of the first service node, wherein the first service data is service data of the target service.
In an exemplary embodiment, after the data refresh operation is performed on the node memory of the first service node by using the service data to be updated, the method further includes: and under the condition that the first service data is successfully refreshed, updating a message offset corresponding to the target service, wherein the message offset is used for indicating the position of the service message acquired by the first service node under the target theme.
In an exemplary embodiment, after the data refresh operation is performed on the node memory of the first service node by using the service data to be updated, the method further includes: under the condition that the first service data refreshing fails, repeatedly executing the following service data refreshing steps until an execution ending condition is met, wherein the execution ending condition comprises at least one of the following conditions: the number of times of repeated execution of the service data refreshing step reaches a target number of times, and the first service data is successfully refreshed: acquiring at least one service message of the target service under the target theme from the message server, wherein the at least one service message at least carries the service data to be updated; and performing data refreshing operation on the node memory of the first service node by using the service data of the target service carried in the at least one service message.
In one exemplary embodiment, the method further comprises: and sending abnormal refreshing prompt information to target equipment under the condition that the repeated execution times of the service data refreshing step reach the target times and the first service data fails to be refreshed, wherein the abnormal refreshing prompt information is used for indicating that the service data of the target service in the node memory of the first service node fails to be refreshed.
In an exemplary embodiment, the obtaining the target service message under the target topic from the message server includes: sending a service message request to the message server, wherein the service message request carries a target partition identifier under the target subject, and the target partition identifier is used for identifying a target partition where the service message to be acquired by the first service node is located; and receiving the target service message returned by the message server in response to the service message request, wherein the target service message is the service message of the target service acquired from the target partition.
In an exemplary embodiment, the performing, by using the service data to be updated, a data refresh operation on a node memory of a first service node includes: and using the service data to be updated to perform a refreshing operation on the service data of the target service on a target virtual machine of the first service node, wherein the target virtual machine is located in a node memory of the first service node.
In an exemplary embodiment, before the receiving the theme change message pushed by the message server, the method further includes: and receiving, by the message server, the target service message sent by a second service node, where the target service message is sent when service data of the target service in a node memory of the second service node is updated.
According to another aspect of the embodiments of the present application, there is also provided a memory data refreshing apparatus, including: the system comprises a first receiving unit, a first sending unit and a second receiving unit, wherein the first receiving unit is used for receiving a theme change message pushed by a message server, and the theme change message is used for indicating that a service message in a target theme corresponding to a target service is updated; an obtaining unit, configured to obtain, in response to the theme change message, a target service message under the target theme from the message server, where the target service message carries service data to be updated of the target service; a first execution unit, configured to perform a data refresh operation on a node memory of a first service node by using the service data to be updated, so as to refresh first service data in the node memory of the first service node, where the first service data is service data of the target service.
In one exemplary embodiment, the apparatus further comprises: and an updating unit, configured to update a message offset corresponding to the target service under the condition that the first service data is successfully refreshed after the data refreshing operation is performed on the node memory of the first service node by using the service data to be updated, where the message offset is used to indicate a position of the service message acquired by the first service node under the target topic.
In one exemplary embodiment, the apparatus further comprises: a second execution unit, configured to, after performing a data refresh operation on a node memory of a first service node by using the service data to be updated, repeat, until an execution end condition is satisfied, the execution end condition including at least one of: the number of times of repeated execution of the service data refreshing step reaches a target number of times, and the first service data is successfully refreshed: acquiring at least one service message of the target service under the target theme from the message server, wherein the at least one service message at least carries the service data to be updated; and performing data refreshing operation on the node memory of the first service node by using the service data of the target service carried in the at least one service message.
In one exemplary embodiment, the apparatus further comprises: and a sending unit, configured to send a refresh exception notification message to a target device when the number of times of repeated execution of the service data refresh step reaches the target number of times and the first service data refresh fails, where the refresh exception notification message is used to indicate that the service data refresh of the target service in the node memory of the first service node fails.
In one exemplary embodiment, the acquisition unit includes: a sending module, configured to send a service message request to the message server, where the service message request carries a target partition identifier under the target topic, and the target partition identifier is used to identify a target partition where a service message to be acquired by the first service node is located; a receiving module, configured to receive the target service message returned by the message server in response to the service message request, where the target service message is a service message of the target service acquired from the target partition.
In one exemplary embodiment, the first execution unit includes: and the executing module is used for executing a refreshing operation on the service data of the target service on a target virtual machine of the first service node by using the service data to be updated, wherein the target virtual machine is located in a node memory of the first service node.
In one exemplary embodiment, the apparatus further comprises: a second receiving unit, configured to receive, by the message server, the target service message sent by a second service node before receiving the theme change message pushed by the message server, where the target service message is sent when service data of the target service in a node memory of the second service node is updated.
According to another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium, in which a computer program is stored, where the computer program is configured to execute the above memory data refreshing method when running.
According to another aspect of the embodiments of the present application, there is also provided an electronic apparatus, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the memory data refreshing method through the computer program.
In the embodiment of the application, the theme change message pushed by the message server is received in a manner that the change of the service data is stored under a certain theme in the message server in a service message manner and the message server actively pushes the service message change message to the service node, wherein the theme change message is used for indicating that the service message in the target theme corresponding to the target service is updated; responding to the theme change message, and acquiring a target service message under a target theme from a message server, wherein the target service message carries service data to be updated of the target service; the method comprises the steps that data refreshing operation is carried out on a node memory of a first service node by using service data to be updated, so that the first service data in the node memory of the first service node is refreshed, the first service data is service data of a target service, when a service message under a theme corresponding to a specific service is updated, a message server pushes a change message to a service node needing memory refreshing so as to inform each service node of pulling the update data, each service node uses the pulled update data to refresh the memory, the aim of refreshing the memory of an asynchronous node without restarting the service node can be fulfilled, the technical effect of improving the memory data refreshing efficiency is achieved, and the problem that the memory data refreshing efficiency is low due to the fact that the service node is restarted in a memory data refreshing method in the related technology is solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive labor.
FIG. 1 is a diagram illustrating a hardware environment for an alternative memory data refresh method according to an embodiment of the present application;
FIG. 2 is a flow chart illustrating an alternative memory data refresh method according to an embodiment of the present disclosure;
FIG. 3 is a diagram illustrating an alternative memory data refresh method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of another alternative memory data refresh method according to an embodiment of the present application;
FIG. 5 is a block diagram of an alternative memory data refresh apparatus according to an embodiment of the present application;
fig. 6 is a block diagram of an alternative electronic device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be implemented in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of the embodiments of the present application, a method for refreshing memory data is provided. The memory data refreshing method is widely applied to full-House intelligent digital control application scenes such as Smart Home, intelligent Home equipment ecology, intelligent House (Intelligence House) ecology and the like. Alternatively, in this embodiment, the memory data refreshing method may be applied to a hardware environment formed by the terminal device 102 and the server 104 shown in fig. 1. As shown in fig. 1, the server 104 is connected to the terminal device 102 through a network, and may be configured to provide a service (e.g., an application service) for the terminal or a client installed on the terminal, set a database on the server or independent of the server, and provide a data storage service for the server 104, and configure a cloud computing and/or edge computing service on the server or independent of the server, and provide a data operation service for the server 104.
The network may include, but is not limited to, at least one of: wired networks, wireless networks. The wired network may include, but is not limited to, at least one of: wide area networks, metropolitan area networks, local area networks, which may include, but are not limited to, at least one of the following: WIFI (Wireless Fidelity), bluetooth. Terminal equipment 102 can be and not be limited to PC, the cell-phone, the panel computer, intelligent air conditioner, intelligent cigarette machine, intelligent refrigerator, intelligent oven, intelligent kitchen range, intelligent washing machine, intelligent water heater, intelligent washing equipment, intelligent dish washer, intelligent projection equipment, the intelligent TV, intelligent clothes hanger, intelligent (window) curtain, intelligence audio-visual, smart jack, intelligent stereo set, intelligent audio amplifier, intelligent new trend equipment, intelligent kitchen guarding's equipment, intelligent bathroom equipment, the intelligence robot of sweeping the floor, the intelligence robot of wiping the window, intelligence robot of mopping the floor, intelligent air purification equipment, intelligent steam ager, intelligent microwave oven, intelligent kitchen guarding, intelligent clarifier, intelligent water dispenser, intelligent lock etc..
The memory data refreshing method according to the embodiment of the present application may be executed by the server 104, or may be executed by the terminal device 102, or may be executed by both the server 104 and the terminal device 102. The terminal device 102 may execute the memory data refreshing method according to the embodiment of the present application, or execute the memory data refreshing method by a client installed thereon.
Taking the memory data refreshing method in this embodiment executed by the server 104 as an example, fig. 2 is a schematic flow chart of an optional memory data refreshing method according to an embodiment of the present application, and as shown in fig. 2, the flow chart of the method may include the following steps:
step S202, a theme change message pushed by the message server is received, wherein the theme change message is used for indicating that a service message in a target theme corresponding to the target service is updated.
The memory data refreshing method in this embodiment may be applied to a scenario in which memory data is refreshed in service nodes in the same service cluster, where the service nodes may be one or more service nodes in a server cluster providing the same service, and may be synchronous nodes or asynchronous nodes. The memory data may be service data corresponding to the target service, or may be other types of memory data, which is not limited herein. In this embodiment, a service node is taken as an asynchronous node, and memory data is taken as service data corresponding to a target service.
In the related art, cluster deployment is adopted in many cases for services, when data change is managed through a background, only memory data of one node (namely, a service node) can be changed in real time, and the memory data read by other nodes is old memory data, so that service operation is abnormal. When the memory data of each node service needs to be updated, the memory data can be updated in a restarting service mode, the restarting can be realized by manually restarting all nodes by operation and maintenance personnel, and the memory data can be refreshed each time the service is restarted.
However, the service is stopped for a very short time by restarting the service, the user experience is not good, and the cost for restarting the memory is large. In addition, the memory data refresh can also be realized by adopting an interface access mode, namely, an interface is exposed in service, and the node data refresh is realized by the interface access. However, in a manner of implementing memory data refresh by interface call, since node network access is not external in many cases, each node calls a corresponding interface, which poses a certain security risk.
In this embodiment, when the service data on one service node is changed, the change of the service data is stored in a certain theme in the message server in a service message manner, the message server actively pushes the service message change message to the service node, and the service node which needs to perform memory refresh pulls and uses the pulled update data to perform memory refresh. By the mode, unnecessary restarting caused by the need of refreshing the memory can be avoided, and hot refreshing of the service node is realized under the condition of not restarting, namely dynamic refreshing of memory data is realized. And the time delay caused by calling the refresh through the interface and the security risk of exposing the interface can be avoided.
For the target service, the topic (i.e., topic) on the message server corresponding to the target service is the target topic. Each service node of the target service can subscribe to the target topic, so that when the service message under the target topic is updated, the updated service message can be acquired from the message server. The target topic may be split into partitions, i.e., the target topic may contain multiple partitions, each partition message having a so-called partition offset identification that may uniquely identify the respective partition.
For example, when the memory data is changed in the background, kafka can be used to implement real-time data refreshing of each node service. As shown in fig. 3, a set of Kafka servers may be deployed to enable each service node to receive a service message in time, and define a topic (main memory data update), and each service node may subscribe to the topic. Here, kafka is a high throughput, distributed publish-subscribe messaging system that can handle all the action flow data of a consumer in a web site.
When the memory data is refreshed, the first service node may receive a theme change message pushed by a message server (e.g., kafka server), where the theme change message may be used to indicate that a service message in a target theme corresponding to a target service is updated. The updated service message may be generated by a service node corresponding to the target service when the service data of the target service is updated and sent to the message server.
For example, when the memory data is refreshed, the operation and maintenance personnel or other related personnel may perform data modification operation on the background management page, modify data information to be updated, write the change information (i.e., updated service data) into the topic in the form of service messages through the background management page, generate topic data by Kafka, broadcast the change message through Kafka, and notify each service node to pull up the updated service data.
Step S204, responding to the theme change message, and acquiring a target service message under a target theme from the message server, wherein the target service message carries service data to be updated of the target service.
In this embodiment, after receiving the theme change message, the first service node may respond to the theme change message, and obtain a subscribed target service message under the target theme from the message server, where the target service message carries service data to be updated of the target service.
For example, after receiving the change message, each service node may obtain updated traffic data from the subscribed topic.
Step S206, performing a data refresh operation on the node memory of the first service node by using the service data to be updated, so as to refresh the first service data in the node memory of the first service node, where the first service data is service data of the target service.
In this embodiment, after the target service message is obtained from the message server, the service data to be updated of the target service carried in the target service message may be extracted, and a data refreshing operation is performed on the node memory of the first service node by using the service data to be updated, so as to refresh the first service data in the node memory of the first service node, where the first service data is the service data of the target service. Due to the fact that the change message is pushed and the service node pulls the subscribed service data under the theme, the refreshing efficiency of the memory data of the service node can be improved, the time delay of memory data refreshing is reduced, and second-level memory data updating can be achieved.
As shown in fig. 4, node 1, node 2, node 3 to node N may subscribe to topic of data update on Kafka server. The operation and maintenance personnel or other related personnel can modify the data information needing to be updated through the background management page of the background management system, the data modification is sent to the Kafka server, and the Kafka server writes the change information into the topic to generate the topic data. Each service node consumes the topic, and after receiving the data of the topic, the memory information of the node can be refreshed.
Receiving a theme change message pushed by the message server through the steps S202 to S206, wherein the theme change message is used for indicating that a service message in a target theme corresponding to a target service is updated; responding to the theme change message, and acquiring a target service message under a target theme from the message server, wherein the target service message carries service data to be updated of the target service; the method comprises the steps of using service data to be updated to carry out data refreshing operation on a node memory of a first service node so as to refresh the first service data in the node memory of the first service node, wherein the first service data is service data of a target service, so that the problem that the memory data refreshing efficiency is low due to the fact that logs need to be analyzed one by one in a related memory data refreshing method is solved, and the memory data refreshing efficiency is improved.
In an exemplary embodiment, after performing a data refresh operation on a node memory of the first service node using the service data to be updated, the method further includes:
and S11, under the condition that the first service data is successfully refreshed, updating a message offset corresponding to the target service, wherein the message offset is used for indicating the position of the service message acquired by the first service node under the target theme.
In this embodiment, after the data refresh operation performed on the node memory of the first service node by using the service data to be updated is successful, the message offset of the node itself may be modified according to the message offset corresponding to the target service message, where the message offset is equivalent to a pointer and may be used to indicate a position of the service message that has been acquired by the service node in the corresponding target topic.
Optionally, the message offset may be a partition offset of a plurality of partitions under the target topic, that is, the message offset of the first service node is used to indicate a partition in which the service message acquired by the first service node is located in the plurality of partitions under the target topic.
For example, after the memory data refresh is completed, the service node may modify its topic offset. The message offset when the service node does not refresh the memory data is 5, and the message offset corresponding to the service node and the target service can be modified to be 6 according to the received service data under the condition that the data refresh is successful.
By the embodiment, the message offset of the service node is modified under the condition that the data refreshing is successful, so that the accuracy of the data refreshing can be ensured.
In an exemplary embodiment, after the data refresh operation is performed on the node memory of the first service node by using the service data to be updated, the method further includes:
s21, under the condition that the first service data refreshing fails, repeatedly executing the following service data refreshing steps until an execution ending condition is met, wherein the execution ending condition comprises at least one of the following conditions: the number of times of repeated execution of the service data refreshing step reaches the target number of times, and the first service data is successfully refreshed:
acquiring at least one service message of a target service under a target theme from a message server, wherein the at least one service message at least carries service data to be updated;
and using the service data of the target service carried in at least one service message to perform data refreshing operation on the node memory of the first service node.
In this embodiment, if the service node fails to refresh the memory data, the offset will not be updated, and the memory data can be refreshed by repeatedly consuming the theme, that is, the service data refresh step is repeatedly executed until the execution end condition is satisfied. The execution end condition may include at least one of: the number of times of repeated execution of the service data refreshing step reaches the target number of times, and the first service data is successfully refreshed, namely, the number of times of refreshing reaches the preset number of times, and the service data is successfully refreshed.
In the process of executing the service data refreshing step each time, the first service node may acquire at least one service message of the target service under the target topic from the message server, where the acquired at least one service message carries service data to be updated, and perform a data refreshing operation on a node memory of the first service node by using the service data of the target service carried in the at least one service message, so as to refresh the memory data of the first service node.
By the embodiment, a fault tolerance mechanism is provided, and the real-time refreshing of data of each service node can be ensured by repeatedly executing the refreshing operation.
In an exemplary embodiment, the method further comprises:
and S31, sending a refresh abnormity prompting message to the target equipment under the condition that the times of repeated execution of the service data refresh step reaches the target times and the refresh of the first service data fails, wherein the refresh abnormity prompting message is used for indicating that the refresh of the service data of the target service in the node memory of the first service node fails.
In this embodiment, after the step of repeatedly executing the service data, if the service data is not successfully refreshed yet, that is, the number of times that the step of repeatedly executing the service data is executed reaches the target number of times, and the first service data fails to be refreshed, the first service node may send a refresh exception notification message to the target device, where the refresh exception notification message is used to indicate that the service data of the target service in the node memory of the first service node fails to be refreshed.
Optionally, the target device may be a device corresponding to a background management system, and after receiving the refresh exception prompt information on the background management system, the operation and maintenance staff may monitor the service node that fails to be refreshed, analyze the reason why the memory data fails to be refreshed, perform data maintenance on the service node, and the like. The target device may also be another device, as long as the related person can be reminded that the service data of the target service in the node memory of the first service node fails to be refreshed.
Optionally, the condition for determining that the service node fails to refresh may also be: and if the time consumed by the repeated execution of the service data refreshing step exceeds the preset time, for example, the time for repeatedly refreshing the memory data exceeds the preset time 5s, sending a refresh exception prompt message to the target device.
For example, after the refresh is completed, the service node may modify its topic offset. If the refresh fails, the offset is not updated and the copy of the topic is consumed repeatedly for data refresh. If the failure occurs for many times, reporting is carried out, and the back end carries out reprocessing.
Through the embodiment, when the service data refresh fails, the service node which is abnormally refreshed can be maintained in real time by sending the prompt message to the management equipment, and the efficiency and the accuracy of the memory data refresh are improved.
In an exemplary embodiment, obtaining a target business message under a target topic from a message server includes:
s41, sending a service message request to a message server, wherein the service message request carries a target partition identifier under a target subject, and the target partition identifier is used for identifying a target partition where a service message to be acquired by a first service node is located;
and S42, receiving a target service message returned by the message server in response to the service message request, wherein the target service message is the service message of the target service acquired from the target partition.
In this embodiment, the theme in the message server may be physically divided into one or more partitions, and different messages may be stored in different partitions. In addition, the service node (i.e., the consumer) corresponding to the message server may include a plurality of nodes, which may correspond to different node groups. For the target theme, the target theme may be service data for storing target service update, and the updated service data acquired at different times may be stored in the same partition of the target theme or in different partitions of the target theme.
When a target service message under a target topic is acquired from a message server, a first service node may send a service message request to the message server, where the service request message carries a target partition identifier under the target topic, and the target partition identifier is used to identify a target partition where the service message to be acquired by the first service node is located, where the target partition identifier may be a current message offset of the first service node, or may be other offsets, that is, a partition where the service message to be acquired is located is represented by a target partition identifier (for example, a target partition offset), and a currently synchronized service message is identified by a message offset.
The message server may respond to the service message request, obtain a service message to be synchronized to the first service node, i.e., a target service message, from the target partition according to the target partition identifier, and send the target service message to the first service node. After receiving the target service message returned by the message server in response to the service message request, the first service node may perform a relevant memory data refresh operation based on the target service message.
Optionally, the theme change message may carry a target version number of a service message of a target service under the target theme, and the target version number may be a version number of a latest version updated by the service message. For a certain attribute value change, the target version number may be a version number to which a target service attribute of the target service is updated. The service node stores a current version number, and pulls the latest configuration according to the version number after the update pushed in the push message. Correspondingly, the service message request carries the current version number of the service message, which may be the target service on the service node, or the current version number of the target service attribute.
Through the embodiment, the partition where the service message to be acquired is located is identified through the partition identification, so that the convenience and the message of service data acquisition can be improved, and the efficiency of memory data refreshing is further improved.
In an exemplary embodiment, the data refresh operation performed on the node memory of the first service node by using the service data to be updated includes:
s51, using the service data to be updated to execute a refreshing operation on the service data of the target service on the target virtual machine of the first service node, wherein the target virtual machine is located in the node memory of the first service node.
In order to improve the service response time and reduce the access to the database or the cache, the service node may store some data used with high frequency directly in a JVM (Java Virtual Machine), where the JVM is equivalent to a memory and the data is stored in the JVM. The JVM is similar to a virtual computer on which java code runs, and is implemented by emulating real computer functions on a physical computer, which makes java implementation platform independent and a compilation available everywhere.
In this embodiment, the first service node may use a target virtual machine (e.g., the aforementioned JVM) in a node memory thereof to store service data of the target service. After the service data to be updated is obtained, the first service node may perform a refresh operation on the service data of the target service on the target virtual machine by using the service data to be updated.
According to the embodiment, the service data of the service is stored by using the virtual machine in the node memory, and the service data on the virtual machine is dynamically refreshed by using the obtained service data, so that the convenience of refreshing the service data is improved.
In an exemplary embodiment, before receiving the theme change message pushed by the message server, the method further includes:
and S61, receiving a target service message sent by the second service node through the message server, wherein the target service message is sent under the condition that service data of the target service in the node memory of the second service node is updated.
In this embodiment, the update of the service data may be performed for the second service node, and the operation and maintenance person or other persons may perform data modification operation on the background management page on the second service node. In response to the detected data modification operation, the second service node may generate a target service message and send the generated target service message to the message server, where the second service node is a producer of the target service message. Optionally, the second service node may also send the indication information of the service data modification of the target service to the message server, and the message server generates the target service message.
The message server may receive a target service message sent by the second service node, associate the target service message with a target topic, and push a topic change message to all service nodes subscribed with the target topic, so as to synchronously refresh data of each service node.
By the embodiment, asynchronous memory refreshing of each node under the same service cluster can be realized, unnecessary restarting caused by the need of refreshing the memory is avoided, and the efficiency of refreshing the memory of the service node is improved.
It should be noted that for simplicity of description, the above-mentioned embodiments of the method are described as a series of acts, but those skilled in the art should understand that the present application is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art will recognize that the embodiments described in this specification are preferred embodiments and that acts or modules referred to are not necessarily required for this application.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (e.g., a ROM (Read-Only Memory)/RAM (Random Access Memory), a magnetic disk, an optical disk) and includes several instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the methods according to the embodiments of the present application.
According to another aspect of the embodiments of the present application, there is also provided a memory data refreshing apparatus for implementing the above memory data refreshing method. Fig. 5 is a block diagram of a structure of an optional memory data refreshing apparatus according to an embodiment of the present application, and as shown in fig. 5, the apparatus may include:
a first receiving unit 502, configured to receive a theme change message pushed by a message server, where the theme change message is used to indicate that a service message in a target theme corresponding to a target service is updated;
an obtaining unit 504, connected to the first receiving unit 502, configured to obtain, in response to the theme change message, a target service message under the target theme from the message server, where the target service message carries service data to be updated of the target service;
a first executing unit 506, connected to the obtaining unit 504, configured to perform a data refresh operation on the node memory of the first service node by using the service data to be updated, so as to refresh first service data in the node memory of the first service node, where the first service data is service data of the target service.
It should be noted that the first receiving unit 502 in this embodiment may be configured to execute the step S202, the obtaining unit 504 in this embodiment may be configured to execute the step S204, and the first executing unit 506 in this embodiment may be configured to execute the step S206.
Receiving a theme change message pushed by a message server through the module, wherein the theme change message is used for indicating that a service message in a target theme corresponding to a target service is updated; responding to the theme change message, and acquiring a target service message under a target theme from the message server, wherein the target service message carries service data to be updated of the target service; the method comprises the steps of using service data to be updated to carry out data refreshing operation on a node memory of a first service node so as to refresh the first service data in the node memory of the first service node, wherein the first service data is service data of a target service, so that the problem that the memory data refreshing efficiency is low due to the fact that logs need to be analyzed one by one in a related memory data refreshing method is solved, and the memory data refreshing efficiency is improved.
In an exemplary embodiment, the apparatus further comprises:
and the updating unit is used for updating the message offset corresponding to the target service under the condition that the first service data is successfully refreshed after the data refreshing operation is performed on the node memory of the first service node by using the service data to be updated, wherein the message offset is used for indicating the position of the service message acquired by the first service node under the target theme.
In an exemplary embodiment, the apparatus further includes:
a second execution unit, configured to, after performing a data refresh operation on a node memory of the first service node by using service data to be updated, under a condition that the first service data refresh fails, repeatedly perform the following service data refresh steps until an execution end condition is satisfied, where the execution end condition includes at least one of: the number of times of repeated execution of the service data refreshing step reaches the target number of times, and the first service data is successfully refreshed:
acquiring at least one service message of a target service under a target theme from a message server, wherein the at least one service message at least carries service data to be updated;
and using the service data of the target service carried in at least one service message to perform data refreshing operation on the node memory of the first service node.
In an exemplary embodiment, the apparatus further includes:
and the sending unit is used for sending abnormal refreshing prompt information to the target equipment under the condition that the repeated execution times of the service data refreshing step reach the target times and the refreshing of the first service data fails, wherein the abnormal refreshing prompt information is used for indicating the failure of the refreshing of the service data of the target service in the node memory of the first service node.
In one exemplary embodiment, the acquisition unit includes:
the sending module is used for sending a service message request to the message server, wherein the service message request carries a target partition identifier under a target subject, and the target partition identifier is used for identifying a target partition where a service message to be acquired by the first service node is located;
and the receiving module is used for receiving a target service message returned by the message server in response to the service message request, wherein the target service message is the service message of the target service acquired from the target partition.
In one exemplary embodiment, the first execution unit includes:
and the executing module is used for executing a refreshing operation on the service data of the target service on the target virtual machine of the first service node by using the service data to be updated, wherein the target virtual machine is positioned in the node memory of the first service node.
In an exemplary embodiment, the apparatus further includes:
and a second receiving unit, configured to receive, by the message server, a target service message sent by the second service node before receiving the theme change message pushed by the message server, where the target service message is sent when service data of the target service in the node memory of the second service node is updated.
It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules described above as a part of the apparatus may be operated in a hardware environment as shown in fig. 1, and may be implemented by software, or may be implemented by hardware, where the hardware environment includes a network environment.
According to still another aspect of an embodiment of the present application, there is also provided a storage medium. Optionally, in this embodiment, the storage medium may be a program code for executing any memory data refreshing method in this embodiment of the present application.
Optionally, in this embodiment, the storage medium may be located on at least one of a plurality of network devices in a network shown in the above embodiment.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the steps of:
s1, receiving a theme change message pushed by a message server, wherein the theme change message is used for indicating that a service message in a target theme corresponding to a target service is updated;
s2, responding to the theme change message, and acquiring a target service message under a target theme from the message server, wherein the target service message carries service data to be updated of the target service;
and S3, using the service data to be updated to perform data refreshing operation on the node memory of the first service node so as to refresh the first service data in the node memory of the first service node, wherein the first service data is the service data of the target service.
Optionally, for a specific example in this embodiment, reference may be made to the example described in the foregoing embodiment, and details of this are not described again in this embodiment.
Optionally, in this embodiment, the storage medium may include but is not limited to: various media capable of storing program codes, such as a U disk, a ROM, a RAM, a removable hard disk, a magnetic disk or an optical disk, etc.
According to another aspect of the embodiments of the present application, there is also provided an electronic device for implementing the memory data refreshing method, where the electronic device may be a server, a terminal, or a combination thereof.
Fig. 6 is a block diagram of an alternative electronic device according to an embodiment of the present invention, as shown in fig. 6, including a processor 602, a communication interface 604, a memory 606, and a communication bus 608, where the processor 602, the communication interface 604, and the memory 606 communicate with each other through the communication bus 608, where,
a memory 606 for storing computer programs;
the processor 602, when executing the computer program stored in the memory 606, implements the following steps:
s1, receiving a theme change message pushed by a message server, wherein the theme change message is used for indicating that a service message in a target theme corresponding to a target service is updated;
s2, responding to the theme change message, and acquiring a target service message under a target theme from the message server, wherein the target service message carries service data to be updated of the target service;
and S3, using the service data to be updated to perform data refreshing operation on the node memory of the first service node so as to refresh the first service data in the node memory of the first service node, wherein the first service data is the service data of the target service.
Alternatively, the communication bus may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 6, but that does not indicate only one bus or one type of bus. The communication interface is used for communication between the electronic device and other equipment.
The memory may include RAM, and may also include non-volatile memory, such as at least one disk memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
As an example, the storage 606 may include, but is not limited to, the first receiving unit 502, the obtaining unit 504, and the first executing unit 506 in the memory data refresh device. In addition, the memory data refresh device may further include, but is not limited to, other module units in the memory data refresh device, which is not described in detail in this example.
The processor may be a general-purpose processor, and may include but is not limited to: a CPU (Central Processing Unit), an NP (Network Processor), and the like; but also DSPs (Digital Signal Processing), ASICs (Application Specific Integrated circuits), FPGAs (Field-Programmable Gate arrays) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
Optionally, for a specific example in this embodiment, reference may be made to the example described in the foregoing embodiment, and this embodiment is not described herein again.
It can be understood by those skilled in the art that the structure shown in fig. 6 is only an illustration, and the device for implementing the memory data refreshing method may be a terminal device, and the terminal device may be a terminal device such as a smart phone (e.g., an Android Mobile phone, an iOS Mobile phone, etc.), a tablet computer, a palmtop computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 6 is a diagram illustrating a structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 6, or have a different configuration than shown in FIG. 6.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disk, ROM, RAM, magnetic or optical disk, and the like.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solutions of the present application, which are essential or part of the technical solutions contributing to the prior art, or all or part of the technical solutions, may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, or the like) to execute all or part of the steps of the methods described in the embodiments of the present application.
In the embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to the related descriptions of other embodiments.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, and may also be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution provided in the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or at least two units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

Claims (10)

1. A method for refreshing memory data, comprising:
receiving a theme change message pushed by a message server, wherein the theme change message is used for indicating that a service message in a target theme corresponding to a target service is updated;
responding to the theme change message, and acquiring a target service message under the target theme from the message server, wherein the target service message carries service data to be updated of the target service;
and performing data refreshing operation on the node memory of the first service node by using the service data to be updated so as to refresh the first service data in the node memory of the first service node, wherein the first service data is the service data of the target service.
2. The method of claim 1, wherein after the data refresh operation is performed on the node memory of the first service node using the service data to be updated, the method further comprises:
and updating a message offset corresponding to the target service under the condition that the first service data is successfully refreshed, wherein the message offset is used for indicating the position of the service message acquired by the first service node under the target theme.
3. The method of claim 2, wherein after the data refresh operation is performed on the node memory of the first service node using the service data to be updated, the method further comprises:
under the condition that the first service data refreshing fails, repeatedly executing the following service data refreshing steps until an execution ending condition is met, wherein the execution ending condition comprises at least one of the following conditions: the number of times of repeated execution of the service data refreshing step reaches a target number of times, and the first service data is successfully refreshed:
acquiring at least one service message of the target service under the target theme from the message server, wherein the at least one service message at least carries the service data to be updated;
and performing data refreshing operation on the node memory of the first service node by using the service data of the target service carried in the at least one service message.
4. The method of claim 3, further comprising:
and sending abnormal refreshing prompt information to target equipment under the condition that the repeated execution times of the service data refreshing step reach the target times and the first service data fails to be refreshed, wherein the abnormal refreshing prompt information is used for indicating that the service data of the target service in the node memory of the first service node fails to be refreshed.
5. The method according to claim 1, wherein the obtaining the target service message under the target topic from the message server comprises:
sending a service message request to the message server, wherein the service message request carries a target partition identifier under the target subject, and the target partition identifier is used for identifying a target partition where the service message to be acquired by the first service node is located;
and receiving the target service message returned by the message server in response to the service message request, wherein the target service message is the service message of the target service acquired from the target partition.
6. The method according to claim 1, wherein the performing a data refresh operation on a node memory of a first service node using the service data to be updated comprises:
and using the service data to be updated to execute a refreshing operation on the service data of the target service on a target virtual machine of the first service node, wherein the target virtual machine is located in a node memory of the first service node.
7. The method according to any one of claims 1 to 6, wherein before the receiving the theme change message pushed by the message server, the method further comprises:
and receiving, by the message server, the target service message sent by a second service node, where the target service message is sent when service data of the target service in a node memory of the second service node is updated.
8. A memory data refresh apparatus, comprising:
the system comprises a first receiving unit, a first sending unit and a second receiving unit, wherein the first receiving unit is used for receiving a theme change message pushed by a message server, and the theme change message is used for indicating that a service message in a target theme corresponding to a target service is updated;
an obtaining unit, configured to obtain, in response to the theme change message, a target service message under the target theme from the message server, where the target service message carries service data to be updated of the target service;
a first execution unit, configured to perform a data refresh operation on a node memory of a first service node by using the service data to be updated, so as to refresh first service data in the node memory of the first service node, where the first service data is service data of the target service.
9. A computer-readable storage medium, comprising a stored program, wherein the program when executed performs the method of any of claims 1 to 7.
10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 7 by means of the computer program.
CN202210570075.8A 2022-05-24 2022-05-24 Memory data refreshing method and device, storage medium and electronic device Pending CN115145615A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210570075.8A CN115145615A (en) 2022-05-24 2022-05-24 Memory data refreshing method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210570075.8A CN115145615A (en) 2022-05-24 2022-05-24 Memory data refreshing method and device, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN115145615A true CN115145615A (en) 2022-10-04

Family

ID=83406958

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210570075.8A Pending CN115145615A (en) 2022-05-24 2022-05-24 Memory data refreshing method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN115145615A (en)

Similar Documents

Publication Publication Date Title
CN112866017B (en) Method, system, medium and device for configuring BMC IP address of bare metal server
CN111064626B (en) Configuration updating method, device, server and readable storage medium
CN107957888B (en) Application program gray scale upgrading method and device
CN110659109A (en) Openstack cluster virtual machine monitoring system and method
CN111061498B (en) Configuration information management system
WO2009027286A1 (en) Monitoring of newly added computer network resources having service level objectives
CN111506331A (en) Server BMC refreshing method, system, terminal and storage medium
CN115145615A (en) Memory data refreshing method and device, storage medium and electronic device
CN116360584A (en) Virtual target product generation method and device, storage medium and electronic device
CN115048392A (en) Data deletion method and device, storage medium and electronic device
CN113220342A (en) Centralized configuration method and device, electronic equipment and storage medium
CN115174296B (en) Equipment function access method and device, storage medium and electronic device
CN111125223B (en) Database connection pool updating method and device
CN114697345B (en) Information updating method and device, storage medium and electronic device
CN116243944A (en) Application interface updating method and device, storage medium and electronic device
CN114157725B (en) Method, device, server, electronic equipment and storage medium for equipment linkage
CN116301767A (en) Interface file generation method and device, storage medium and electronic device
CN115550214A (en) Task monitoring method and device, storage medium and electronic device
CN115658524A (en) Test case generation method and device, storage medium and electronic device
CN115268962A (en) Program updating method, program updating device, storage medium and electronic device
CN116545791A (en) Parameter adjustment method and device, storage medium and electronic device
CN116541012A (en) Basic parameter modification method and device, storage medium and electronic device
CN117579409A (en) Control instruction processing method and device, storage medium and electronic device
CN115373958A (en) Method and device for determining abnormal information, storage medium and electronic device
CN116257498A (en) Link log association method and link log association device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination