CN114330772A - Garbage recycling method, system, equipment, medium and product of collaboration example - Google Patents

Garbage recycling method, system, equipment, medium and product of collaboration example Download PDF

Info

Publication number
CN114330772A
CN114330772A CN202111633060.3A CN202111633060A CN114330772A CN 114330772 A CN114330772 A CN 114330772A CN 202111633060 A CN202111633060 A CN 202111633060A CN 114330772 A CN114330772 A CN 114330772A
Authority
CN
China
Prior art keywords
snapshot
client
server
time
latest
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
CN202111633060.3A
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.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202111633060.3A priority Critical patent/CN114330772A/en
Publication of CN114330772A publication Critical patent/CN114330772A/en
Pending legal-status Critical Current

Links

Images

Abstract

The application provides a garbage recycling method of a collaborative instance, which comprises the following steps: when the garbage collection rule is met, the server executes garbage collection to generate the latest snapshot of the collaborative instance, the client sends a snapshot obtaining request to the server, and then the latest snapshot returned by the server is used for replacing the historical snapshot, so that the latest snapshot takes effect at the client, the garbage collection of the server and the client is realized, and the performance of the server and the performance of the client are improved.

Description

Garbage recycling method, system, equipment, medium and product of collaboration example
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, a system, a device, a computer-readable storage medium, and a computer program product for garbage collection of a collaboration instance.
Background
In computer science, Garbage Collection (GC) refers to an automatic memory management mechanism. When a portion of the memory space occupied by a program is no longer accessed by the program, the program returns the portion of the memory space to the operating system via a garbage collection algorithm.
Some programs are typically deployed on a collaborative platform. A collaboration platform particularly refers to a plurality of platforms that collaborate with each other. The program deployed on the collaboration platform comprises a server and a plurality of clients. In consideration of performance, most collaborative algorithms employ a mechanism of client-side collaboration. To achieve collaboration, clients tend to keep OpHistory or TombStones. Wherein, OpHistory, also called Operation History, refers to the Operation record of the collaborative algorithm. Tombstones refer to "Tombstones," which are Data types that are marked as deleted in collaborative algorithms (CRDTs) that handle conflicts with Data types, in order to subsequently garbage collect Data marked as deleted. When OpHistory is large, a large amount of memory is usually occupied, and further performance is greatly reduced, so that garbage collection can be performed at a client.
However, garbage collection at The client side can cause Stop-The-World (all other threads are suspended to ensure The correctness of reference update) on one hand, and further cause The whole collaborative program to be stuck; on the other hand, each client participating in the cooperation needs to perform garbage collection, and unnecessary performance overhead is increased.
Disclosure of Invention
The purpose of the present disclosure is: a garbage collection method, device, equipment, computer readable storage medium and computer program product of a collaborative instance are provided, which can improve the garbage collection performance in the collaborative instance.
In a first aspect, the present disclosure provides a garbage collection method for a collaboration instance, where the method is applied to a server and includes:
when the garbage collection rule is met, the server executes garbage collection to generate the latest snapshot of the collaborative instance;
and the server side responds to the snapshot obtaining request of the client side and sends the latest snapshot of the collaborative instance to the client side so that the latest snapshot of the collaborative instance takes effect at the client side.
In a second aspect, the present disclosure provides a garbage collection method for a collaboration instance, where the method is applied to a client, and includes:
the client sends a snapshot acquisition request to the server;
the client receives the latest snapshot of the collaborative instance returned by the server;
and the client replaces the historical snapshot of the client by using the latest snapshot returned by the server so as to enable the latest snapshot to take effect at the client.
In a third aspect, the present disclosure provides a garbage recycling apparatus for a collaboration instance, where the apparatus is deployed at a server, and the apparatus includes:
the snapshot generating module is used for executing garbage collection by the server side when a garbage collection rule is met, and generating the latest snapshot of the collaborative instance;
and the communication module is used for responding to the snapshot acquisition request of the client by the server and sending the latest snapshot of the collaborative instance to the client so as to enable the latest snapshot of the collaborative instance to take effect at the client.
In a fourth aspect, the present disclosure provides a garbage recycling apparatus for collaborative instances, where the apparatus is deployed at a client, and the apparatus includes:
the first communication module is used for the client side to send a snapshot acquisition request to the server side;
the second communication module is used for receiving the latest snapshot of the collaborative instance returned by the server by the client;
and the replacing module is used for replacing the historical snapshot of the client by using the latest snapshot returned by the server so as to enable the latest snapshot to take effect at the client.
In a fifth aspect, the present disclosure provides an electronic device comprising: a storage device having a computer program stored thereon; processing means for executing the computer program in the storage means to implement the steps of the method of the first or second aspect of the disclosure.
In a sixth aspect, the present disclosure provides a computer readable medium having stored thereon a computer program which, when executed by a processing apparatus, performs the steps of the method of the first or second aspect of the present disclosure.
In a seventh aspect, the present disclosure provides a computer program product comprising instructions which, when run on an apparatus, cause the apparatus to perform the steps of the method of the first or second aspect.
From the above technical solution, the present disclosure has at least the following advantages:
in the technical scheme, when the garbage collection rule is met, the server executes garbage collection to generate the latest snapshot of the collaborative instance, the client sends a snapshot obtaining request to the server, and then the latest snapshot returned by the server is used for replacing the historical snapshot so that the latest snapshot takes effect at the client, and therefore garbage collection of the server and the client is achieved.
On one hand, the garbage collection is executed by the server side, so that the problem that the client side is in overall pause and the performance of the client side is influenced due to the fact that the client side executes the garbage collection can be avoided.
On the other hand, when a plurality of clients exist, the server only needs to execute garbage collection once to update all the client snapshots participating in the collaborative instance, and a large amount of performance overhead caused by the fact that a plurality of clients execute multiple garbage collection is avoided.
Moreover, the server executes garbage collection, so that garbage data of the server can be cleaned, and the phenomenon that the occupied server data expands infinitely and occupies more storage space is avoided.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Drawings
In order to more clearly illustrate the technical method of the embodiments of the present application, the drawings used in the embodiments will be briefly described below.
Fig. 1 is a system architecture diagram of a garbage recycling method according to a cooperative example provided in an embodiment of the present application;
fig. 2 is a flowchart of a garbage recycling method of a collaborative example according to an embodiment of the present application;
fig. 3 is a schematic diagram of a server side of a garbage collection method according to a collaborative example provided in an embodiment of the present application;
fig. 4 is a schematic view of an effective client side of a garbage collection method of a collaboration example according to an embodiment of the present application;
fig. 5 is a schematic diagram of a client of a garbage collection method of a collaboration example according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a garbage recycling device according to a cooperative example provided in the embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of a garbage recycling device according to another synergistic example provided in the embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
The terms "first" and "second" in the embodiments of the present application are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
Some technical terms referred to in the embodiments of the present application will be first described.
Garbage Collection (GC) refers to an automatic memory management mechanism. The garbage data may be unnecessary operation records, or may be data marked as deleted but not deleted.
The collaboration instance refers to an instance in which the server and the client jointly apply a collaboration algorithm for performing collaboration (operation). In the mechanism of client collaboration, the client typically keeps a record of operations of the collaboration algorithm (operations history) or data that has been marked as deleted (e.g., tombstones). Therefore, it may happen that the garbage data is more and more, resulting in a large amount of useless data occupying the memory, and affecting the performance of the client.
When The client needs to delete The data through garbage collection, in order to ensure The accuracy of The post-data of The garbage collection, The client needs to suspend all other running threads (generally called Stop-The-World) in The garbage collection process, so that The client is in global pause, and The performance of The client is affected. Moreover, since garbage collection occurs at the client, garbage collection is required for each of the plurality of clients participating in the collaboration instance. For example, if there are N clients participating in the collaboration instance, N garbage recoveries are required, resulting in a large performance overhead of the client. Meanwhile, garbage collection occurs at the client, so that garbage data of the server cannot be cleaned, and wireless expansion of the server data may be caused to affect the storage space of the server.
In view of this, the present application provides a garbage collection method for a collaboration instance, which is applied to a client and a server. The client may be a terminal, including but not limited to a smart phone, a tablet computer, a notebook computer, a Personal Digital Assistant (PDA), and the like. The server may be a cloud server, such as a central server in a central cloud computing cluster, or an edge server in an edge cloud computing cluster. Of course, the server may also be a server in a local data center. The local data center refers to a data center directly controlled by a user.
Specifically, when the garbage collection rule is met, the server executes garbage collection to generate a latest snapshot of the collaborative instance, the client sends a snapshot obtaining request to the server, the server sends the latest snapshot to the client according to the request, the client receives the latest snapshot, and then the latest snapshot returned by the server is used for replacing the historical snapshot, so that the latest snapshot takes effect at the client. Therefore, the server executes garbage collection, and the phenomenon that the garbage collection of the client causes the overall pause of the client and influences the performance of the client is avoided. And can clear up the junk data of server, avoid causing the unlimited inflation of server data, occupy the storage space of server.
In a possible implementation manner, the system architecture of the method may be as shown in fig. 1, which includes a server and a plurality of clients. Specifically, when the garbage collection rule is satisfied, the server executes garbage collection to generate the latest snapshot of the collaborative instance. Then, the plurality of clients respectively send snapshot obtaining requests to the server, and the server responds to the snapshot obtaining requests of the plurality of clients and respectively sends the latest snapshots to the plurality of clients. And the plurality of clients replace the historical snapshots by using the acquired latest snapshots, delete tombstones and partial historical operation records in the clients and enable the latest snapshots to take effect at the clients. Therefore, the server only needs to execute garbage collection once, so that all client snapshots participating in the collaborative instance can be updated, and a large amount of performance overhead of multiple clients executing garbage collection is avoided.
In order to make the technical solution of the present disclosure clearer and easier to understand, a client is taken as an example from the perspective of interaction between a server and the client, and as shown in fig. 2, a garbage collection method of a collaboration example provided in the embodiment of the present disclosure is introduced.
S202: and when the garbage collection rule is met, the server executes garbage collection to generate the latest snapshot of the collaborative instance.
The garbage collection rule is a rule for specifying a garbage collection condition. And when the garbage collection rule is met, triggering garbage collection by the server. In some possible implementations, different garbage collection rules may correspond to different garbage collection operations. In this embodiment, the garbage collection rule of the server may include a quantity condition of the operation records, or a time condition of the garbage collection time, or may include both the quantity condition of the operation records and the time condition of the garbage collection time.
For example, the server garbage collection rule may be: (1) the number of operation records received by the server after the last garbage collection is greater than the preset number of operation records (for example, may be a); (2) the time difference between the last garbage collection time and the current time of the server is greater than a preset time length (for example, T1 may be used). The garbage collection rule may be only (1) or (2), or both (1) and (2) may be satisfied. The number of the operation records received by the server after the last garbage collection is larger than the preset number of the operation records, which indicates that the server stores more operation records and needs to perform garbage collection. The time difference between the last garbage collection time and the current time of the server is greater than the preset time length, which indicates that a long time has passed from the last garbage collection, and the time may generate more data to be deleted, so that the garbage collection is required.
In some possible implementations, the garbage collection rule may also be a certain proportion of the used memory of the server. For example, the used memory of the server accounts for B% of the total memory of the server. When the used memory of the server reaches a certain proportion, in order to ensure the normal operation of the server, other data of the server needs to be cleaned.
Server-side garbage collection includes generating a latest snapshot (snapshot) of the collaborative instance. Specifically, during the generation of the latest snapshot, the data marked as deleted (i.e., the tombstone) is deleted, and the historical snapshot and the operation record are deleted.
The history snapshot deleted by the server side is the history snapshot meeting the first condition. The first condition is a delete condition for the historical snapshot in garbage collection. And when the historical snapshot meets the first condition, deleting the part of the historical snapshot in the garbage collection of the server, thereby avoiding the historical snapshot occupying the storage space of the server.
In some possible implementations, the first condition may be: (1) the difference between the snapshot generation time and the current time is greater than a first preset time (which may be T2, for example); (2) the snapshots do not belong to the latest C snapshots, where C is a positive integer. The first condition may be (1) or (2), or may satisfy both (1) and (2). When the history snapshots meeting the first condition exist in the history snapshots, deleting the snapshots meeting the first history condition. And when the difference between the snapshot generation time and the current time is greater than the first preset time, the snapshot generation time is far away from the current time. When the snapshot does not belong to the latest C snapshots, wherein C is a positive integer, the snapshot is a snapshot with a generation time farther from the current time because the snapshots correspond to different generation times.
The operation record deleted by the server is the operation record meeting the second condition. The second condition is a deletion condition for the operation record in garbage collection. And when the operation record meets the second condition, deleting the part of the operation record in the garbage collection of the server, thereby avoiding the operation record occupying the storage space of the server.
In some possible implementations, the second condition may be: (1) the operation records have been merged into the snapshot; (2) the time difference between the generation time of the operation record and the current time is greater than a second preset time (for example, may be T3); (3) the operation records do not belong to the latest D operation records, wherein D is a positive integer. The second condition may be only (1), (2) or (3), or (1) and (2) may be satisfied simultaneously, (1) and (3) may be satisfied simultaneously or (2) and (3) may be satisfied simultaneously, or (1) and (2) and (3) may be satisfied simultaneously. When an operation record has been merged into a snapshot, it indicates that the operation record has been saved by the snapshot. When the time difference between the generation time of the operation record and the current time is greater than the second preset time, the fact that the generation time of the operation record is far away from the current time is indicated, the storage significance is small, the deletion can save space, and therefore the operation record can be deleted. When the operation record does not belong to the latest D operation records, wherein D is a positive integer, the operation record corresponds to different generation times, so that the operation record is an operation record with the generation time far away from the current time, and can be deleted correspondingly.
Therefore, when the garbage collection rule is met, the server side executes garbage collection. The service end executes garbage collection, wherein the garbage collection comprises deleting the tombstone and generating the latest snapshot. In some possible implementations, the performing garbage collection by the server further includes deleting the snapshot that satisfies the first condition. In some possible implementations, the performing garbage collection by the server further includes deleting the operation record satisfying the second condition. In some possible implementations, the performing garbage collection by the server further includes deleting the snapshot satisfying the first condition and deleting the operation record satisfying the second condition. Therefore, the server deletes the gravestone, the historical snapshot and the historical operation record through garbage collection, reduces the occupation of the data space of the data in the memory of the server, and generates the latest snapshot of the collaborative instance.
Specifically, as shown in fig. 3, in the operation of the collaborative algorithm, the client sends a corresponding operation record to the server every time the client operates, and the server stores the operation record. And the server judges whether the operation records and the garbage collection in the server meet the garbage collection rule or not, and executes the garbage collection to generate the latest snapshot of the collaborative instance when the garbage collection rule is met.
In some possible implementation manners, the server includes a shadow service, and the server determines whether garbage collection and snapshot update are needed through the shadow service according to the saved operation record.
S204: the client sends a snapshot acquisition request to the server.
Through S202, the server completes a garbage collection, and deletes the tombstone, the historical snapshot, and the historical operation record, but the garbage collection of the collaboration instance also needs to act on the client, so that the client needs to update according to the latest snapshot.
And when the snapshot obtaining condition of the client is met, sending a snapshot obtaining request to the server. The snapshot obtaining condition refers to a condition that needs to be met when the client sends a snapshot obtaining request to the server. And when the snapshot obtaining condition is met, the client sends a snapshot obtaining request to the server so as to obtain the latest snapshot of the server, so that the latest snapshot is effective at the client, and the garbage collection of the client is completed.
In some possible implementations, the snapshot acquisition condition may be: (1) the number of data with tombstone markers that are not recycled by the client is greater than a set number (e.g., may be E); (2) the time difference between the time when the client last sent the snapshot obtaining request and the current time is greater than the set time (for example, T4 may be used); (3) the version number of the latest snapshot in the heartbeat data acquired by the client is greater than the version number of the snapshot acquired by the client sending the snapshot acquisition request last time. The snapshot obtaining condition may be only (1), (2) or (3), or may be that (1) and (2) are simultaneously satisfied, (1) and (3) are simultaneously satisfied, or (2) and (3) are simultaneously satisfied, or may be that all three conditions (1) and (2) and (3) are simultaneously satisfied. When the quantity of the data with the tombstone markers, which is not recycled by the client, is greater than the set quantity, the client is indicated to comprise a large quantity of data with the tombstone markers but not recycled, and the garbage recycling benefit of the client is prevented from being too low. When the time difference between the last time of sending the snapshot obtaining request and the current time of the client is larger than the set time, the preset time of sending the snapshot obtaining request is indicated, and frequent garbage collection is avoided. The heartbeat data obtained by the client is the heartbeat data returned by the server according to the heartbeat data sent by the client. The heartbeat data returned by the server side comprises the version number of the latest snapshot in the server side, and when the version number of the latest snapshot in the heartbeat data obtained by the client side is larger than the version number of the snapshot obtained by the last snapshot obtaining request sent by the client side, the server side is indicated to have performed snapshot updating. In some possible implementations, F garbage recoveries may be made for one validation, thereby reducing the overhead of the client pulling snapshots from the server. Since the client always sends data to the server, the heartbeat data returned by the server may include the version number of the latest snapshot in the server, and no additional overhead is incurred.
S206: and the server side responds to the snapshot obtaining request of the client side and sends the latest snapshot of the collaborative instance to the client side.
S208: and the client receives the latest snapshot of the collaborative instance returned by the server, and replaces the historical snapshot of the client by using the latest snapshot returned by the server so as to enable the latest snapshot to take effect at the client.
The client replaces the historical snapshots of the client with the latest snapshots returned by the server so that the latest snapshots take effect at the client, and the method specifically comprises the cleaning of tombstones and the cleaning of historical snapshots according to the latest snapshots.
Specifically, as shown in fig. 4, (a) is the client memory before the latest snapshot takes effect at the client, and (B) is the client memory after the latest snapshot takes effect at the client. As shown in fig. a, the memory of the client includes a snapshot including a plurality of tombstones and an operation record. For example, the time corresponding to the snapshot version number in fig. (a) is m, and the client memory includes a tombstone and an operation record generated in a period from m to n. When the latest snapshot takes effect at the client, the historical snapshot, the tombstone and a part of the operation record are deleted from the memory of the client. For example, the time corresponding to the latest snapshot version number in the graph (B) is i, the client validates the latest snapshot, deletes the snapshot whose time corresponding to the snapshot version number is m to i in a period of time, and the tombstone and the operation record generated in the period of m to i, thereby achieving the effect of clearing the tombstone and the historical operation record. When n ═ i, then the snapshot and operation records may not be included in graph (B). When n > i, the snapshot and operation records in time from i to n are included in the graph (B).
As shown in fig. 5, in general, the client sends a heartbeat to the server, and the server may return the version number of the latest snapshot to the client. And the client judges whether to send a snapshot acquisition request to the server according to the snapshot acquisition condition so as to pull the latest snapshot. When the snapshot obtaining condition of the client is met, sending a snapshot obtaining request to the server, and returning the latest snapshot by each level of the server, so that the client can take the latest snapshot into effect and clear the tombstone and the historical operation record.
Based on the description above, the present application provides a garbage collection method for a collaboration instance, where the method is applied to a server and a client. Specifically, when the garbage collection rule is satisfied, the server executes garbage collection to generate a latest snapshot of the collaborative instance, and then the client replaces the historical snapshot according to the latest snapshot to enable the latest snapshot to take effect at the client. Because the garbage is recycled and sent to the server side, the client side does not need to suspend other running left and right threads, and the influence on the performance of the client side is avoided. The scheme can be applied to a scene that one server corresponds to a plurality of clients, and performance overhead caused by the fact that the plurality of clients need to carry out garbage collection is avoided. Furthermore, garbage collection is mainly executed by the server, so that redundant historical data of the server can be deleted, and the memory of the server is saved.
Fig. 6 is a schematic diagram illustrating a garbage collection apparatus of a collaboration instance deployed on a server according to an exemplary disclosed embodiment, where the garbage collection apparatus 600 of the collaboration instance includes:
a snapshot generating module 602, configured to execute garbage collection by the server when a garbage collection rule is satisfied, and generate a latest snapshot of the collaborative instance;
a communication module 604, configured to send, by the server, the latest snapshot of the collaborative instance to the client in response to the snapshot obtaining request of the client, so that the latest snapshot of the collaborative instance takes effect at the client.
Optionally, the snapshot generating module 602 may be configured to:
and the server deletes the data with the tombstone mark to generate the latest snapshot of the collaborative instance.
Optionally, the apparatus further comprises a recycling module 606 configured to:
the server side recovers the historical snapshots meeting the first condition; and/or the presence of a gas in the gas,
and the server side recovers the operation records meeting the second condition.
Optionally, the first condition comprises:
the time difference between the snapshot generating time and the current time is greater than a first preset time; and/or the presence of a gas in the gas,
the snapshots do not belong to the latest N snapshots, N being a positive integer.
Optionally, the second condition comprises:
the operation records are merged into a snapshot; and/or the presence of a gas in the gas,
the time difference between the operation record generation time and the current time is greater than a second preset time; and/or the presence of a gas in the gas,
the operation records do not belong to the latest M operation records, wherein M is a positive integer.
Optionally, the garbage collection rule includes:
the number of the operation records received by the server after the last garbage recovery is larger than the preset number; and/or the presence of a gas in the gas,
and the time difference between the last garbage recovery time of the server and the current time is greater than the preset time.
Fig. 7 is a schematic diagram illustrating a garbage collection apparatus of a collaboration instance deployed on a client according to an exemplary disclosed embodiment, where the garbage collection apparatus 700 of the collaboration instance includes, as shown in fig. 7:
a first communication module 702, configured to send a snapshot obtaining request to a server by a client;
a second communication module 704, configured to receive, by the client, a latest snapshot of the collaboration instance returned by the server;
a replacing module 706, configured to replace, by the client, the historical snapshot of the client with the latest snapshot returned by the server, so that the latest snapshot takes effect at the client.
Optionally, the client sends the snapshot obtaining request to the server when the following conditions are met:
the quantity of the data with the tombstone markers, which are not recycled by the client, is more than the set quantity; and/or;
the time difference between the time when the client sends the snapshot obtaining request last time and the current time is larger than the set time; and/or;
the version number of the latest snapshot in the heartbeat data acquired by the client is greater than the version number of the snapshot acquired by the client sending the snapshot acquisition request last time.
The functions of the above modules have been elaborated in the method steps in the previous embodiment, and are not described herein again.
Referring now to FIG. 8, shown is a schematic diagram of an electronic device 800 suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 8, an electronic device 800 may include a processing means (e.g., central processing unit, graphics processor, etc.) 801 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage means 808 into a Random Access Memory (RAM) 803. In the RAM803, various programs and data necessary for the operation of the electronic apparatus 800 are also stored. The processing apparatus 801, the ROM802, and the RAM803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
Generally, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 807 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; storage 808 including, for example, magnetic tape, hard disk, etc.; and a communication device 809. The communication means 809 may allow the electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While fig. 7 illustrates an electronic device 800 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 809, or installed from the storage means 808, or installed from the ROM 802. The computer program, when executed by the processing apparatus 801, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: when a garbage collection rule is met, performing garbage collection to generate a latest snapshot of the collaborative instance; and responding to the snapshot obtaining request of the client, and sending the latest snapshot of the collaborative instance to the client so as to enable the latest snapshot of the collaborative instance to take effect at the client. Or, sending a snapshot acquisition request to the server; receiving the latest snapshot of the collaborative instance returned by the server; and replacing the historical snapshot of the client by using the latest snapshot returned by the server so as to enable the latest snapshot to take effect at the client.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present disclosure may be implemented by software or hardware. Wherein the name of a module in some cases does not constitute a limitation on the module itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
Example 1 provides, in accordance with one or more embodiments of the present disclosure, a method of garbage collection for a collaborative instance, the method comprising: when the garbage collection rule is met, the server executes garbage collection to generate the latest snapshot of the collaborative instance; and the server side responds to the snapshot obtaining request of the client side and sends the latest snapshot of the collaborative instance to the client side so that the latest snapshot of the collaborative instance takes effect at the client side.
Example 2 provides the method of example 1, the performing, by the server, garbage collection to generate a latest snapshot of the collaborative instance, including: and the server deletes the data with the tombstone mark to generate the latest snapshot of the collaborative instance.
Example 3 provides the method of example 2, further comprising, in accordance with one or more embodiments of the present disclosure: the server side recovers the historical snapshots meeting the first condition; and/or the server side recovers the operation records meeting the second condition.
Example 4 provides the method of example 3, the first condition comprising: the time difference between the snapshot generating time and the current time is greater than a first preset time; and/or the snapshots do not belong to the latest N snapshots, wherein N is a positive integer.
Example 5 provides the method of example 3, the second condition comprising: the operation records are merged into a snapshot; and/or the time difference between the operation record generation time and the current time is greater than a second preset time; and/or the operation record does not belong to the latest M operation records, wherein M is a positive integer.
Example 6 provides the method of any one of examples 1 to 5, the garbage collection rule including: the number of the operation records received by the server after the last garbage recovery is larger than the preset number; and/or the time difference between the last garbage collection time of the server and the current time is greater than the preset time length.
Example 7 provides a method of garbage collection of a collaborative instance, the method comprising: the client sends a snapshot acquisition request to the server; the client receives the latest snapshot of the collaborative instance returned by the server; and the client replaces the historical snapshot of the client by using the latest snapshot returned by the server so as to enable the latest snapshot to take effect at the client.
Example 8 provides the method of example 7, the client sending the snapshot acquisition request to the server when the following conditions are met: the quantity of the data with the tombstone markers, which are not recycled by the client, is more than the set quantity; and/or; the time difference between the time when the client sends the snapshot obtaining request last time and the current time is larger than the set time; and/or; the version number of the latest snapshot in the heartbeat data acquired by the client is greater than the version number of the snapshot acquired by the client sending the snapshot acquisition request last time.
Example 9 provides, in accordance with one or more embodiments of the present disclosure, a garbage collection apparatus of a collaborative instance, the apparatus including: the snapshot generating module is used for executing garbage collection by the server side when a garbage collection rule is met, and generating the latest snapshot of the collaborative instance; and the communication module is used for responding to the snapshot acquisition request of the client by the server and sending the latest snapshot of the collaborative instance to the client so as to enable the latest snapshot of the collaborative instance to take effect at the client.
Example 10 provides the apparatus of example 9, the snapshot generation module to: and the server deletes the data with the tombstone mark to generate the latest snapshot of the collaborative instance.
Example 11 provides the apparatus of example 10, further comprising a recycling module to: the server side recovers the historical snapshots meeting the first condition; and/or the server side recovers the operation records meeting the second condition.
Example 12 provides the apparatus of example 10, the first condition comprising: the time difference between the snapshot generating time and the current time is greater than a first preset time; and/or the snapshots do not belong to the latest N snapshots, wherein N is a positive integer.
Example 13 provides the apparatus of example 10, in accordance with one or more embodiments of the present disclosure, the second condition comprising: the operation records are merged into a snapshot; and/or the time difference between the operation record generation time and the current time is greater than a second preset time; and/or the operation record does not belong to the latest M operation records, wherein M is a positive integer.
Example 14 provides the apparatus of any one of examples 9 to 13, the garbage collection rule comprising: the number of the operation records received by the server after the last garbage recovery is larger than the preset number; and/or the time difference between the last garbage collection time of the server and the current time is greater than the preset time length.
Example 15 provides, in accordance with one or more embodiments of the present disclosure, a garbage collection apparatus of a collaborative instance, the apparatus comprising: the first communication module is used for the client side to send a snapshot acquisition request to the server side; the second communication module is used for receiving the latest snapshot of the collaborative instance returned by the server by the client; and the replacing module is used for replacing the historical snapshot of the client by using the latest snapshot returned by the server so as to enable the latest snapshot to take effect at the client.
Example 16 provides the apparatus of example 15, the client sending the snapshot acquisition request to the server when the following conditions are satisfied, in accordance with one or more embodiments of the present disclosure: the quantity of the data with the tombstone markers, which are not recycled by the client, is more than the set quantity; and/or; the time difference between the time when the client sends the snapshot obtaining request last time and the current time is larger than the set time; and/or; the version number of the latest snapshot in the heartbeat data acquired by the client is greater than the version number of the snapshot acquired by the client sending the snapshot acquisition request last time.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims. With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

Claims (19)

1. A method for garbage collection of a collaborative instance, the method comprising:
when the garbage collection rule is met, the server executes garbage collection to generate the latest snapshot of the collaborative instance;
and the server side responds to the snapshot obtaining request of the client side and sends the latest snapshot of the collaborative instance to the client side so that the latest snapshot of the collaborative instance takes effect at the client side.
2. The method of claim 1, wherein the server performs garbage collection to generate the latest snapshot of the collaboration instance, comprising:
and the server deletes the data with the tombstone mark to generate the latest snapshot of the collaborative instance.
3. The method of claim 2, further comprising:
the server side recovers the historical snapshots meeting the first condition; and/or the presence of a gas in the gas,
and the server side recovers the operation records meeting the second condition.
4. The method of claim 3, wherein the first condition comprises:
the time difference between the snapshot generating time and the current time is greater than a first preset time; and/or the presence of a gas in the gas,
the snapshots do not belong to the latest N snapshots, N being a positive integer.
5. The method of claim 3, wherein the second condition comprises:
the operation records are merged into a snapshot; and/or the presence of a gas in the gas,
the time difference between the operation record generation time and the current time is greater than a second preset time; and/or the presence of a gas in the gas,
the operation records do not belong to the latest M operation records, wherein M is a positive integer.
6. The method according to any one of claims 1 to 5, wherein the garbage collection rules comprise:
the number of the operation records received by the server after the last garbage recovery is larger than the preset number; and/or the presence of a gas in the gas,
and the time difference between the last garbage recovery time of the server and the current time is greater than the preset time.
7. A method for garbage collection of a collaborative instance, the method comprising:
the client sends a snapshot acquisition request to the server;
the client receives the latest snapshot of the collaborative instance returned by the server;
and the client replaces the historical snapshot of the client by using the latest snapshot returned by the server so as to enable the latest snapshot to take effect at the client.
8. The method according to claim 7, wherein the client sends the snapshot acquisition request to the server when the following conditions are satisfied:
the quantity of the data with the tombstone markers, which are not recycled by the client, is more than the set quantity; and/or;
the time difference between the time when the client sends the snapshot obtaining request last time and the current time is larger than the set time; and/or;
the version number of the latest snapshot in the heartbeat data acquired by the client is greater than the version number of the snapshot acquired by the client sending the snapshot acquisition request last time.
9. A garbage collection apparatus of the collaborative example, the apparatus comprising:
the snapshot generating module is used for executing garbage collection by the server side when a garbage collection rule is met, and generating the latest snapshot of the collaborative instance;
and the communication module is used for responding to the snapshot acquisition request of the client by the server and sending the latest snapshot of the collaborative instance to the client so as to enable the latest snapshot of the collaborative instance to take effect at the client.
10. The apparatus of claim 9, wherein the snapshot generating module is configured to:
and the server deletes the data with the tombstone mark to generate the latest snapshot of the collaborative instance.
11. The apparatus of claim 10, further comprising a recycling module to:
the server side recovers the historical snapshots meeting the first condition; and/or the presence of a gas in the gas,
and the server side recovers the operation records meeting the second condition.
12. The apparatus of claim 10, wherein the first condition comprises:
the time difference between the snapshot generating time and the current time is greater than a first preset time; and/or the presence of a gas in the gas,
the snapshots do not belong to the latest N snapshots, N being a positive integer.
13. The apparatus of claim 10, wherein the second condition comprises:
the operation records are merged into a snapshot; and/or the presence of a gas in the gas,
the time difference between the operation record generation time and the current time is greater than a second preset time; and/or the presence of a gas in the gas,
the operation records do not belong to the latest M operation records, wherein M is a positive integer.
14. The apparatus of any one of claims 9 to 13, wherein the garbage collection rules comprise:
the number of the operation records received by the server after the last garbage recovery is larger than the preset number; and/or the presence of a gas in the gas,
and the time difference between the last garbage recovery time of the server and the current time is greater than the preset time.
15. A garbage collection apparatus of the collaborative example, the apparatus comprising:
the first communication module is used for the client side to send a snapshot acquisition request to the server side;
the second communication module is used for receiving the latest snapshot of the collaborative instance returned by the server by the client;
and the replacing module is used for replacing the historical snapshot of the client by using the latest snapshot returned by the server so as to enable the latest snapshot to take effect at the client.
16. The apparatus according to claim 15, wherein the client sends the snapshot obtaining request to the server when the following conditions are satisfied:
the quantity of the data with the tombstone markers, which are not recycled by the client, is more than the set quantity; and/or;
the time difference between the time when the client sends the snapshot obtaining request last time and the current time is larger than the set time; and/or;
the version number of the latest snapshot in the heartbeat data acquired by the client is greater than the version number of the snapshot acquired by the client sending the snapshot acquisition request last time.
17. An apparatus, comprising a processor and a memory;
the processor is to execute instructions stored in the memory to cause the device to perform the method of any of claims 1 to 8.
18. A computer-readable storage medium comprising instructions that direct a device to perform the method of any of claims 1-8.
19. A computer program product, characterized in that it causes a computer to carry out the method according to any one of claims 1 to 8 when said computer program product is run on the computer.
CN202111633060.3A 2021-12-28 2021-12-28 Garbage recycling method, system, equipment, medium and product of collaboration example Pending CN114330772A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111633060.3A CN114330772A (en) 2021-12-28 2021-12-28 Garbage recycling method, system, equipment, medium and product of collaboration example

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111633060.3A CN114330772A (en) 2021-12-28 2021-12-28 Garbage recycling method, system, equipment, medium and product of collaboration example

Publications (1)

Publication Number Publication Date
CN114330772A true CN114330772A (en) 2022-04-12

Family

ID=81015586

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111633060.3A Pending CN114330772A (en) 2021-12-28 2021-12-28 Garbage recycling method, system, equipment, medium and product of collaboration example

Country Status (1)

Country Link
CN (1) CN114330772A (en)

Similar Documents

Publication Publication Date Title
CN111240767A (en) Component and page loading method and device, electronic equipment and storage medium
CN111274503B (en) Data processing method, device, electronic equipment and computer readable medium
CN111309747A (en) Data synchronization method, system and device
CN112256733A (en) Data caching method and device, electronic equipment and computer readable storage medium
CN112015816A (en) Data synchronization method, device, medium and electronic equipment
CN111309366B (en) Method, device, medium and electronic equipment for managing registration core
CN111241137B (en) Data processing method, device, electronic equipment and storage medium
CN108121514B (en) Meta information updating method and device, computing equipment and computer storage medium
CN112181733A (en) Service request processing method, device, equipment and storage medium
CN114330772A (en) Garbage recycling method, system, equipment, medium and product of collaboration example
CN113360348B (en) Abnormal request processing method and device, electronic equipment and storage medium
CN112994949A (en) Private network connection method, device, equipment and storage medium
CN112311842A (en) Method and device for information interaction
CN113742376A (en) Data synchronization method, first server and data synchronization system
CN113934692A (en) File cleaning method and device, storage medium and equipment
CN110727694A (en) Data processing method and device, electronic equipment and storage medium
CN111581930A (en) Online form data processing method and device, electronic equipment and readable medium
CN110716885B (en) Data management method and device, electronic equipment and storage medium
CN115993942B (en) Data caching method, device, electronic equipment and computer readable medium
CN112667607B (en) Historical data management method and related equipment
CN116700956A (en) Request processing method, apparatus, electronic device and computer readable medium
CN116821378A (en) Multimedia data processing method and device, electronic equipment and medium
CN114003382A (en) Index construction method, device and equipment
CN115827694A (en) User information query method and device, electronic equipment and storage medium
CN115080571A (en) Index updating method and device, electronic equipment and computer readable medium

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