CN112565418A - Message retransmission method and device for service cluster, computer equipment and storage medium - Google Patents
Message retransmission method and device for service cluster, computer equipment and storage medium Download PDFInfo
- Publication number
- CN112565418A CN112565418A CN202011411695.4A CN202011411695A CN112565418A CN 112565418 A CN112565418 A CN 112565418A CN 202011411695 A CN202011411695 A CN 202011411695A CN 112565418 A CN112565418 A CN 112565418A
- Authority
- CN
- China
- Prior art keywords
- message
- identity
- sent
- cache
- fails
- 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.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/55—Push-based network services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
- G06F16/24552—Database cache management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/566—Grouping or aggregating service requests, e.g. for unified processing
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer And Data Communications (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a message retransmission method of a service cluster, which is applied to the technical field of computers and is used for solving the technical problem that the existing message retransmission method has large loss of system performance. The method provided by the invention comprises the following steps: acquiring the identity of the equipment from the cache, and deleting the acquired identity of the equipment from the cache; when the obtained identity is inquired from the database, acquiring a message of failed transmission of the equipment corresponding to the identity; resending the message with failed transmission; when the message which fails to be sent is successfully sent again, deleting the message which fails to be sent and the identity of the corresponding device which fails to be sent which are stored in the database, and storing the identity of the device which corresponds to the message which fails to be sent in the cache; and when the message failed to be sent fails to be sent again, storing the identity of the equipment corresponding to the message failed to be sent in the cache.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for retransmitting a message in a service cluster, a computer device, and a storage medium.
Background
When one end sends a message to the other end, there may be a case that the message sending fails due to a failure of a network or a device itself, and in view of some request messages are important and are messages that a target device has to receive, such as a mail message sent by a user, a result notification message of whether the user transfer is successful or not, and the like, the existing processing method is to store the message that the sending fails first, and then resend the stored message that the sending fails by using an original sending device or other devices.
In the process of retransmitting a message with failed transmission, if a plurality of devices simultaneously acquire the same message with failed transmission, the message with failed transmission can be repeatedly transmitted, and the technical means adopted for the problem at present is to lock a function (which can also be understood as the action of retransmitting the message) of retransmitting the message, when a device retransmits the message with failed transmission history through the function, other devices can not call the function to retransmit the message, so that the aim of preventing the message with failed transmission from being repeatedly retransmitted is fulfilled.
Although the current solution can prevent the message which fails to be sent from being repeatedly retransmitted, in the process of locking the retransmission function, other devices can only wait for the retransmission function to be released and then can retransmit other messages which fail to be sent, and a deadlock situation may occur.
Disclosure of Invention
The embodiment of the invention provides a message retransmission method, a message retransmission device, computer equipment and a storage medium for a service cluster, and aims to solve the technical problem that the existing message retransmission method has large system performance loss.
One aspect of the present invention provides a message retransmission method for a service cluster, where the method is applied to a server, and the method includes:
acquiring the identity of equipment from a cache, and deleting the acquired identity of the equipment from the cache, wherein the identity of a plurality of pieces of equipment is stored in the cache;
when the obtained identity is inquired from the database, acquiring a message of failed transmission of the equipment corresponding to the identity;
resending the message with failed transmission;
when the message which fails to be sent is successfully sent again, deleting the message which fails to be sent and the identity of the corresponding device which fails to be sent which are stored in the database, and storing the identity of the device which corresponds to the message which fails to be sent in the cache;
when the message which fails to be sent again, the message which fails to be sent and the identity of the corresponding device which fails to be sent which are stored in the database are reserved, and the identity of the device which corresponds to the message which fails to be sent is stored in the cache.
Another aspect of the present invention provides a message retransmission apparatus for a service cluster, including:
the identification deleting module is used for acquiring the identification of the equipment from the cache and deleting the acquired identification of the equipment from the cache, wherein the identification of a plurality of pieces of equipment is stored in the cache;
the message acquisition module is used for acquiring a message of failed transmission of the equipment corresponding to the identity identifier when the acquired identity identifier is inquired from the database;
a message retransmission module for retransmitting the message failed to be transmitted;
the first storage module is used for deleting the message which fails to be sent and the identity identifier of the corresponding device which fails to be sent, which are stored in the database, and storing the identity identifier of the corresponding device of the message which fails to be sent in the cache when the message which fails to be sent is successfully retransmitted;
and the second storage module is used for reserving the message which fails to be sent and the identity of the corresponding device which fails to be sent, which are stored in the database, and storing the identity of the device which corresponds to the message which fails to be sent in the cache when the message which fails to be sent again.
A computer device comprising a memory, a processor and a computer program stored in said memory and executable on said processor, said processor implementing the steps of the above-mentioned message retransmission method for a service cluster when executing said computer program.
A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned message retransmission method for a service cluster.
The invention provides a message retransmission method, a device, a computer device and a storage medium of a service cluster, which are characterized in that the identity of a device is acquired from a cache, the acquired identity of the device is deleted from the cache, the identity of a plurality of devices is stored in the cache, then the acquired identity is inquired from a database, when the acquired identity is acquired from the database, a message which is corresponding to the identity and fails to be sent of the device is acquired, the message which fails to be sent is retransmitted, when the message which fails to be sent is retransmitted successfully, the message which fails to be sent and the identity of the device which fails to be sent which are stored in the database are deleted, the identity of the device which fails to be sent is stored in the cache, when the message which fails to be sent is retransmitted, the message which fails to be sent and the identity of the device which corresponds to be sent are stored in the database are reserved, the identity of the equipment corresponding to the message failed to be sent is stored in the cache, the invention stores the history failure message and the physical number of the equipment which sends the history failure message in the database correspondingly, and sequences, deletes and adds the physical numbers of all the equipment which is deployed in the network equipment cluster for message retransmission service through the cache, so that when one equipment preempts the physical number of the equipment A from the cache and acquires the message failed to be sent from the database, because the physical number of the equipment A is deleted from the cache, other equipment cannot acquire the physical number of the equipment A from the cache at the same time, other equipment cannot acquire the message failed to be sent from the database, in the process of realizing the retransmission of the history failure message, no locking mechanism is involved, and no deadlock condition occurs, and when the other equipment can not acquire the physical number of the equipment A from the cache, the other equipment also has the opportunity to acquire the physical number of the equipment B and the message failed to be transmitted by the equipment B, and the message failed to be transmitted by the equipment B is retransmitted, so that the waiting time of the other equipment is reduced, unnecessary performance loss of the other equipment is avoided, and the overall performance of the system is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
Fig. 1 is a schematic diagram of an application environment of a message retransmission method for a service cluster according to an embodiment of the present invention;
FIG. 2 is a flow chart of a message retransmission method for a service cluster according to an embodiment of the present invention;
FIG. 3 is a flow chart of a message retransmission method for a service cluster in another embodiment of the present invention;
FIG. 4 is a flowchart of a message retransmission method for a service cluster in accordance with another embodiment of the present invention;
fig. 5 is a schematic structural diagram of a message retransmission apparatus of a service cluster in an embodiment of the present invention;
FIG. 6 is a schematic diagram of a computer device according to an embodiment of the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. 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 invention.
The message retransmission method for the service cluster can be applied to the application environment shown in fig. 1, wherein the database/cache platform can be implemented by an independent server or a server cluster formed by a plurality of servers, and the database platform and the cache platform can be deployed on the same server or different servers.
In an embodiment, as shown in fig. 2, a message retransmission method for a service cluster is provided, which is described by taking the method as an example applied to the server in fig. 1, and includes the following steps S101 to S105.
S101, obtaining the identity of the equipment from a cache, and deleting the obtained identity of the equipment from the cache, wherein the identity of a plurality of pieces of equipment is stored in the cache.
The device corresponding to all the ids stored in the cache may be understood as forming a network device cluster for message retransmission service, and since the local server is also deployed in the network device cluster for message retransmission and the id of the local server is also stored in the cache, the id of the device acquired by the local server from the cache may be the id of the local server or the ids of other devices.
In one embodiment, the identity of the device identifies, for example, the physical number of the device.
In one embodiment, the cache stores the identity of the device via a two-tier storage structure.
The key at the first layer in the two-layer storage node represents the index of the index list, and the value of the key at the first layer comprises the identity of the equipment, the latest processing time of the message which fails to be sent by the equipment and corresponds to the identity, and the mark of the message which fails to be sent and is stored in the database corresponding to the identity. Wherein each device in the cluster of network devices of the message retransmission service stores a corresponding value in the first layer.
The key at the second layer in the two-layer storage node represents the identity of the equipment, and the value of the key at the second layer is an arbitrary value. The value of the two-tier key is, for example, 0. Wherein the identity of the device not being monopolized in the cluster of network devices served by the message retransmission is stored in the second layer of the cache.
It can be understood that, in the cached second layer data structure, the value specific value corresponding to the key is not important, and the identity of a certain device is stored as the key in the cached second layer data structure to indicate that the device is not exclusive.
Optionally, when the device is initialized, the initial time of the message retransmission time may be the initialization time of the device, when a retransmission message corresponding to the identity identifier is stored in the database, the flag of the retransmission message stored in the database is "yes", and when a retransmission message corresponding to the identity identifier is not stored in the database, the flag of the retransmission message stored in the database is "no".
Further, the step of deleting the acquired identity of the device from the cache in step S101 includes:
deleting the key value representing the identity of the device stored in the second layer of the cache.
S102, when the obtained identity is inquired from the database, a message of failed transmission of the equipment corresponding to the identity is obtained.
In one embodiment, the database stores the message with failed transmission and the identity of the device with failed transmission.
It will be appreciated that the identity of the corresponding failed transmitting device stored in the database is the original transmitting device of the failed transmitting message, and not the retransmitting device.
Optionally, the step of acquiring a message of failed transmission of the device corresponding to the identity identifier in this step includes:
and acquiring the messages which are failed to send and correspond to the identity identifier from the database in batch according to the number of the preconfigured message acquisition pieces, and acquiring all the messages which are failed to send and correspond to the identity identifier from the database when the number of the messages which are failed to send and correspond to the identity identifier and are stored in the database is less than the number of the preconfigured message acquisition pieces.
In one embodiment, the number of message acquirements pre-configured in this step is, for example, 10 or 20.
Optionally, after the step of obtaining the identity of the device from the cache in step S101, the method further includes:
and when the obtained identity identifier cannot be inquired from the database, updating the mark of the retransmission message stored in the database stored in the first layer of the cache to be null.
Further, the message retransmission method for the service cluster further includes:
inquiring a mark of a retransmission message stored in a database corresponding to the identity of the equipment from the cached first layer structure;
the step S102 further includes:
and when the identity of the inquired equipment is corresponding to the mark of the stored retransmission message in the database, inquiring the obtained identity from the database.
In the embodiment, when the identity which cannot be obtained by querying from the database is found for the first time, the mark for storing the retransmission message in the database stored in the first layer of the cache is updated to be null, so that the problem that the invalid query cannot be performed from the database again when the identity is queried again in the later period can be avoided, the invalid access frequency of the database is reduced, and the database access pressure is relieved.
S103, the message with the transmission failure is retransmitted.
In one embodiment, the step S103 further includes:
and carrying out batch retransmission on the messages which are acquired from the database and correspond to the identity identifiers and fail to be sent in batches.
S104, when the message which fails to be sent is successfully sent again, the message which fails to be sent and the identity of the corresponding device which fails to be sent which are stored in the database are deleted, and the identity of the device which corresponds to the message which fails to be sent is stored in the cache.
Optionally, after the step of S104, the message retransmission method of the service cluster further includes:
acquiring the processing time for retransmitting the message which fails to be transmitted;
and updating the latest processing time of the message which is stored in the first layer of the cache and fails to be sent to the acquired processing time.
In this embodiment, when a message with failed transmission is retransmitted successfully, on one hand, the message with failed transmission and the id of the device corresponding to the failed transmission stored in the database are deleted, so that the message with failed transmission that has been retransmitted is not acquired again, thereby avoiding the message with failed transmission from being retransmitted repeatedly, on the other hand, the id of the device corresponding to the message with failed transmission is stored in the cache, so that the id corresponding to the device can still be acquired again, when the id still corresponds to the message with failed transmission that has not been retransmitted, other messages with failed transmission that have not been retransmitted and are transmitted by the device can be acquired again, so that the message with failed transmission that has been retransmitted is not retransmitted repeatedly, the message with failed transmission that has not been retransmitted is still stored in the database, and the id corresponding to the message with failed transmission that has not been retransmitted is still stored in the cache, other devices can also acquire the identity through caching, so that the unremitting message which fails to be sent is acquired through the database, and retransmission is continued.
S105, when the message which fails to be sent again, the message which fails to be sent and the identity of the corresponding device which fails to be sent which are stored in the database are reserved, and the identity of the device which corresponds to the message which fails to be sent is stored in the cache.
The message resending party of the service cluster provided in this embodiment first obtains the identity of the device from the cache, deletes the obtained identity of the device from the cache, where the identity of multiple devices is stored in the cache, then queries the obtained identity from the database, obtains a message of failed transmission of the device corresponding to the identity when the obtained identity is obtained from the database, resends the message of failed transmission, deletes the message of failed transmission and the identity of the device corresponding to the failed transmission stored in the database when the message of failed transmission is successfully resent, stores the identity of the device corresponding to the message of failed transmission in the cache, and retains the message of failed transmission and the identity of the device corresponding to the failed transmission stored in the database when the message of failed transmission is unsuccessfully resent, storing the identity of the device corresponding to the message failed to be sent in the cache, and in this embodiment, by correspondingly storing the history failure message and the physical number of the device sending the history failure message in the database, and by performing operations of sorting, deleting and adding the physical numbers of all the devices deployed in the network device cluster for the message retransmission service through the cache, when one device preempts the physical number of the device a from the cache and acquires the message failed to be sent by the device a from the database, since the physical number of the device a is deleted from the cache, other devices cannot acquire the physical number of the device a from the cache at the same time, so that other devices cannot acquire the message failed to be sent by the device a from the database, and in the process of implementing retransmission of the history failure message, no locking mechanism is involved, the deadlock situation can not occur, and when other equipment cannot acquire the physical number of the equipment A from the cache, the other equipment also has a chance to acquire the physical number of the equipment B and the message failed to be sent by the equipment B, and the message failed to be sent by the equipment B is retransmitted, so that the waiting time of other equipment is reduced, unnecessary performance loss of other equipment is avoided, and the overall performance of the system is improved.
Fig. 3 is a flowchart of a message resending method for a service cluster in another embodiment of the present invention, and further, the step of obtaining the identity of the device from the cache in step S103 specifically includes the following steps S301 to S303.
S301, acquiring each identity marked as an existing identity of the message which is stored in the database and fails to be sent from the first layer of the cache;
s302, sequencing the acquired identity identifications according to the latest processing time of the messages which are failed to be sent corresponding to the identity identifications;
and S303, acquiring the identity of the equipment stored in the second layer of the cache from the sorting result according to the earliest and most preferred principle.
It can be understood that when the identity identifier marked as having the retransmission message stored in the presence database is not stored in the second layer structure of the cache, the message indicating that the transmission failure of the device corresponding to the identity identifier is being exclusively processed by other devices, and at this time, the local server is required to obtain the transmission failure message of the device corresponding to the other identity identifier.
In this embodiment, the obtained identifiers are sorted according to the latest processing time of the messages with the corresponding sending failures of the identifiers, and the identifier of the device stored in the second layer of the cache is obtained from the sorting result according to the earliest and most preferred principle, so that the messages with the sending failures occurring earlier can be preferentially retransmitted. And because the sorted objects are the identity identifications marked as the failed message which is stored in the database, the condition that the message cannot be found can not occur when the message is inquired from the database, and the effective execution capacity of the program is improved.
In one embodiment, when a newly sent message by the home server fails, the method for retransmitting a message of the service cluster further includes:
acquiring the time of failure in sending the message;
storing the identity of the server and the corresponding failed message in the database;
and updating the mark of the message which fails to be sent and is stored in the database corresponding to the identity of the server in the first layer of the cache to be present.
It can be understood that, in this embodiment, when a message newly sent by the home terminal server fails, the identity identifier of the server and the corresponding message that failed to be sent are stored in the database, and a flag of the message that failed to be sent is stored in the database corresponding to the identity identifier of the server in the first layer of the cache is updated to be present, so that both the message that failed to be sent by the home terminal server and the identity identifier of the home terminal server are stored, so that the home terminal server or another device in the network device cluster configured for the message retransmission service can obtain the identity of the home terminal server from the cache at a later stage, and then obtain the corresponding message that failed to be sent from the database for retransmission according to the information that the flag of the message that failed to be sent is stored in the obtained database is present.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
In an embodiment, a message retransmission apparatus of a service cluster is provided, where the message retransmission apparatus of the service cluster corresponds to the message retransmission method of the service cluster in the above embodiment one to one. As shown in fig. 5, the message retransmission apparatus 100 of the service cluster includes an identifier deletion module 11, a message acquisition module 12, a message retransmission module 13, a first storage module 14, and a second storage module. The functional modules are explained in detail as follows:
the identifier deleting module 11 is configured to acquire an identifier of a device from a cache, and delete the acquired identifier of the device from the cache, where the cache stores identifiers of multiple devices;
a message obtaining module 12, configured to obtain a message indicating that the sending of the device corresponding to the identity identifier fails when the obtained identity identifier is queried in the database;
a message retransmission module 13, configured to retransmit the message that failed in transmission;
a first storage module 14, configured to, when the message that fails to be sent is successfully retransmitted, delete the message that fails to be sent and the identifier of the device that fails to be sent stored in the database, and store the identifier of the device that corresponds to the message that fails to be sent in the cache;
a second storage module 15, configured to, when the message that fails to be sent again, reserve the message that fails to be sent and the identity of the device that failed to be sent stored in the database, and store the identity of the device that corresponds to the message that failed to be sent in the cache.
It can be understood that the devices corresponding to all the ids stored in the cache may be understood as forming a network device cluster for the message retransmission service, and since the local server is also deployed in the network device cluster for the message retransmission, the id of the local server is also stored in the cache, so that the id of the device obtained by the local server from the cache may be the id of the local server, or may be the ids of other devices.
In one embodiment, the cache stores the identity of the device via a two-tier storage structure.
The key at the first layer in the two-layer storage node represents the index of the index list, and the value of the key at the first layer comprises the identity of the equipment, the latest processing time of the message which fails to be sent by the equipment and corresponds to the identity, and the mark of the message which fails to be sent and is stored in the database corresponding to the identity. Wherein each device in the cluster of network devices of the message retransmission service stores a corresponding value in the first layer.
The key at the second layer in the two-layer storage node represents the identity of the equipment, and the value of the key at the second layer is an arbitrary value. The value of the two-tier key is, for example, 0. Wherein the identity of the device not being monopolized in the cluster of network devices served by the message retransmission is stored in the second layer of the cache.
It can be understood that, in the cached second layer data structure, the value specific value corresponding to the key is not important, and the identity of a certain device is stored as the key in the cached second layer data structure to indicate that the device is not exclusive.
Optionally, when the device is initialized, the initial time of the message retransmission time may be the initialization time of the device, when a retransmission message corresponding to the identity identifier is stored in the database, the flag of the retransmission message stored in the database is "yes", and when a retransmission message corresponding to the identity identifier is not stored in the database, the flag of the retransmission message stored in the database is "no".
The identifier deleting module 11 specifically includes:
a first identifier obtaining unit, configured to obtain, from the first layer of the cache, each identity identifier marked as an existing identity identifier of the message that fails to be sent and is stored in the database;
the sequencing unit is used for sequencing the acquired identity identifications according to the latest processing time of the messages which are failed to be sent corresponding to the identity identifications;
and the second identifier obtaining unit is used for obtaining the identifier of the device stored in the second cache layer from the sorting result according to the earliest and most preferred principle.
In one embodiment, the identifier deleting module 11 is specifically configured to delete the key value representing the identity identifier of the device stored in the second layer of the cache.
Further, the message retransmission apparatus 100 of the service cluster further includes:
and the mark updating module is used for updating the mark of the retransmission message stored in the database stored in the first layer of the cache to be null when the acquired identity cannot be inquired in the database.
In one of the facts, the message obtaining module 12 is specifically configured to: and acquiring the messages which are failed to send and correspond to the identity identifier from the database in batch according to the number of the preconfigured message acquisition pieces, and acquiring all the messages which are failed to send and correspond to the identity identifier from the database when the number of the messages which are failed to send and correspond to the identity identifier and are stored in the database is less than the number of the preconfigured message acquisition pieces.
Further, the message resending module 13 is specifically configured to resend the messages which are failed to be sent in batches and which correspond to the identity identifier and are obtained from the database in batches.
Further, the message retransmission apparatus 100 of the service cluster further includes:
a processing time acquisition module for acquiring the processing time for resending the message which fails to be sent;
and the processing time updating module is used for updating the latest processing time of the message which is stored in the first layer of the cache and fails to be sent to the acquired processing time.
In one embodiment, when the server fails to send a message, the message retransmission apparatus 100 of the service cluster further includes:
a sending time obtaining module for obtaining the time of failure of sending the message;
the database storage module is used for storing the identity of the server and the corresponding message which is failed to be sent in the database;
and the mark updating module is also used for updating the mark of the message failed to be sent stored in the database corresponding to the identity of the server in the cached first layer to be present.
Further, the message retransmission apparatus 100 of the service cluster further includes:
a tag query module, configured to query, from the cached first layer structure, a tag for storing the retransmission message in a database in which the identity of the device is stored correspondingly;
the message obtaining module 12 is specifically configured to, when the identifier of the queried device corresponds to the stored flag of the retransmission message in the database, query the obtained identifier from the database.
In this embodiment, the tag query module and the message acquisition module are used to update the tag storing the retransmission message in the database stored in the first layer of the cache to null when the identity that cannot be queried in the database is found for the first time, so that the problem that the identity cannot be queried in a later period again when the identity is queried again is avoided, the number of times of invalid access to the database is reduced, and the database access pressure is relieved.
Wherein the meaning of "first" and "second" in the above modules/units is only to distinguish different modules/units, and is not used to define which module/unit has higher priority or other defining meaning. 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 modules is not necessarily limited to those steps or modules explicitly listed, but may include other steps or modules not explicitly listed or inherent to such process, method, article, or apparatus, and such that a division of modules presented in this application is merely a logical division and may be implemented in a practical application in a further manner.
For specific limitations of the message retransmission apparatus of the service cluster, reference may be made to the above limitations of the message retransmission method of the service cluster, which are not described herein again. The modules in the message retransmission apparatus of the service cluster may be implemented in whole or in part by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing data involved in the message retransmission method of the service cluster. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a message retransmission method for a service cluster.
In one embodiment, a computer device is provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the steps of the message retransmission method for the service cluster in the above-described embodiments are implemented, for example, steps 101 to 105 and other extensions of the method and extensions of related steps shown in fig. 2. Alternatively, the processor, when executing the computer program, implements the functions of the modules/units of the message retransmission apparatus of the service cluster in the above-described embodiments, such as the functions of the modules 11 to 15 shown in fig. 5. To avoid repetition, further description is omitted here.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like which is the control center for the computer device and which connects the various parts of the overall computer device using various interfaces and lines.
The memory may be used to store the computer programs and/or modules, and the processor may implement various functions of the computer device by running or executing the computer programs and/or modules stored in the memory and invoking data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, video data, etc.) created according to the use of the cellular phone, etc.
The memory may be integrated in the processor or may be provided separately from the processor.
In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, which when executed by a processor implements the steps of the message retransmission method of the service cluster in the above-described embodiments, such as the extensions of steps 101 to 105 and other extensions and related steps of the method shown in fig. 2. Alternatively, the computer program, when executed by the processor, implements the functions of the modules/units of the message retransmission apparatus of the service cluster in the above-described embodiments, such as the functions of the modules 11 to 15 shown in fig. 5. To avoid repetition, further description is omitted here.
In the method, the apparatus, the computer device, and the storage medium for retransmitting a message of a service cluster according to this embodiment, an identifier of a device is obtained from a cache, the obtained identifier of the device is deleted from the cache, the identifiers of a plurality of devices are stored in the cache, the obtained identifier is queried from a database, when the obtained identifier is obtained from the database, a message of failed transmission of the device corresponding to the identifier is obtained, the message of failed transmission is retransmitted, when the message of failed transmission is retransmitted, the message of failed transmission and the identifier of the device corresponding to the failed transmission stored in the database are deleted, the identifier of the device corresponding to the message of failed transmission is stored in the cache, and when the message of failed transmission is retransmitted, the message of failed transmission and the identifier of the device corresponding to the failed transmission stored in the database are retained, and storing the identity of the equipment corresponding to the message with failed transmission in the cache.
In this embodiment, the history failure message and the physical numbers of the devices that send the history failure message are stored in the database correspondingly, and the cache performs operations of sorting, deleting and adding the physical numbers of all the devices deployed in the network device cluster for the message retransmission service, so that when one device preempts the physical number of the device a from the cache and acquires the message that the device a fails to send from the database, since the physical number of the device a has been deleted from the cache, other devices cannot acquire the physical number of the device a from the cache at the same time, so that other devices cannot acquire the message that the device a fails to send from the database, in the process of implementing retransmission of the history failure message, a lock mechanism is not involved, a deadlock situation does not occur, and when other devices cannot acquire the physical number of the device a from the cache, and the physical number of the device B and the message failed to be sent by the device B are obtained, and the message failed to be sent by the device B is retransmitted, so that the waiting time of other devices is reduced, unnecessary performance loss of other devices is avoided, and the overall performance of the system is improved.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.
Claims (10)
1. A message retransmission method for a service cluster, the method being applied to a server, the method comprising:
acquiring the identity of equipment from a cache, and deleting the acquired identity of the equipment from the cache, wherein the identity of a plurality of pieces of equipment is stored in the cache;
when the obtained identity is inquired from a database, acquiring a message of failed transmission of equipment corresponding to the identity;
resending the message with failed transmission;
when the message which fails to be sent is successfully sent again, deleting the message which fails to be sent and the identity of the corresponding device which fails to be sent, which are stored in the database, and storing the identity of the device which corresponds to the message which fails to be sent in the cache;
when the message which fails to be sent again, the message which fails to be sent and the identity of the corresponding device which fails to be sent, which are stored in the database, are reserved, and the identity of the device which corresponds to the message which fails to be sent is stored in the cache.
2. The message resending method for service cluster according to claim 1, wherein the cache stores the identity of the device through a two-layer storage structure;
a key at the first layer in the two-layer storage node represents a reference number of an index list, and a value of the key at the first layer comprises an identity of the equipment, the latest processing time of the message which is failed to be sent by the equipment and corresponds to the identity, and a mark for storing the message which is failed to be sent in a database corresponding to the identity;
and the key at the second layer in the two-layer storage node represents the identity of the equipment, and the value of the key at the second layer is an arbitrary value.
3. The method according to claim 2, wherein the step of obtaining the device id from the cache specifically comprises:
acquiring each identity marked as an existing identity of the message which is stored in the database and fails to be sent from the first layer of the cache;
sequencing the acquired identity identifications according to the latest processing time of the messages which are failed to be sent corresponding to the identity identifications;
and acquiring the identity of the equipment stored in the second layer of the cache from the sorting result according to the earliest and most preferred principle.
4. The method of claim 2, wherein the step of deleting the obtained id of the device from the cache comprises:
deleting the key value representing the identity of the device stored in the second layer of the cache.
5. The method of claim 2, wherein after the step of retrieving the device identifier from the cache, the method further comprises:
and when the obtained identity identifier cannot be inquired from the database, updating the mark of the retransmission message stored in the database stored in the first layer of the cache to be null.
6. The method of claim 2, wherein the step of obtaining the message indicating that the device corresponding to the identity failed to send comprises:
acquiring messages of failed sending corresponding to the identity identification from the database in batch according to the number of preconfigured message acquisition pieces, and acquiring all messages of failed sending corresponding to the identity identification from the database when the number of messages of failed sending corresponding to the identity identification stored in the database is less than the number of preconfigured message acquisition pieces;
the step of retransmitting the message with failed transmission includes:
the messages which are obtained from the database and correspond to the identity identifiers and failed in batch sending are subjected to batch resending;
after the step of retransmitting the message of which transmission has failed, the method further includes:
acquiring processing time for retransmitting the message which fails to be transmitted;
and updating the latest processing time of the message which is stored in the first layer of the cache and fails to be sent to the acquired processing time.
7. The method for retransmitting messages of a service cluster according to any of claims 2 to 6, wherein when the server fails to send a message, the method further comprises:
acquiring the time of failure in sending the message;
storing the identity of the server and the corresponding failed transmission message in the database;
and updating the mark of the message failed to be sent stored in the database corresponding to the identity of the server in the cached first layer to be present.
8. An apparatus for message retransmission for a service cluster, the apparatus comprising:
the device comprises an identification deleting module, a storage module and a processing module, wherein the identification deleting module is used for acquiring the identification of the device from a cache and deleting the acquired identification of the device from the cache, and the cache stores the identification of a plurality of devices;
the message acquisition module is used for acquiring a message of failed transmission of the equipment corresponding to the identity identifier when the acquired identity identifier is inquired from a database;
the message retransmission module is used for retransmitting the message which fails to be transmitted;
the first storage module is used for deleting the message which fails to be sent and the identity identifier of the corresponding device which fails to be sent, which are stored in the database, and storing the identity identifier of the corresponding device of the message which fails to be sent in the cache when the message which fails to be sent is successfully retransmitted;
and the second storage module is used for reserving the message which fails to be sent and the identity identifier of the corresponding device which fails to be sent, which are stored in the database, and storing the identity identifier of the corresponding device of the message which fails to be sent in the cache when the message which fails to be sent again.
9. Computer arrangement comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor realizes the steps of the message retransmission method of the service cluster according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the message retransmission method for a service cluster according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011411695.4A CN112565418B (en) | 2020-12-04 | 2020-12-04 | Message retransmission method and device for service cluster, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011411695.4A CN112565418B (en) | 2020-12-04 | 2020-12-04 | Message retransmission method and device for service cluster, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112565418A true CN112565418A (en) | 2021-03-26 |
CN112565418B CN112565418B (en) | 2022-11-15 |
Family
ID=75048783
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011411695.4A Active CN112565418B (en) | 2020-12-04 | 2020-12-04 | Message retransmission method and device for service cluster, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112565418B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113823025A (en) * | 2021-08-24 | 2021-12-21 | 广州市瑞立德信息系统有限公司 | Command retry method, system, equipment and storage medium |
CN114900803A (en) * | 2022-05-31 | 2022-08-12 | 深圳市智信科技有限公司 | Distributed short message verification message sending method based on computer cloud platform |
CN115086414A (en) * | 2022-05-10 | 2022-09-20 | 北京明略昭辉科技有限公司 | Message processing method and device, storage medium and electronic equipment |
CN116056052A (en) * | 2022-08-17 | 2023-05-02 | 荣耀终端有限公司 | Message processing method, device, electronic equipment and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101494834A (en) * | 2009-02-24 | 2009-07-29 | 宇龙计算机通信科技(深圳)有限公司 | Method, system and mobile communication terminal for retransmitting information |
CN108234599A (en) * | 2017-12-06 | 2018-06-29 | 链家网(北京)科技有限公司 | A kind of message repeating method and system |
-
2020
- 2020-12-04 CN CN202011411695.4A patent/CN112565418B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101494834A (en) * | 2009-02-24 | 2009-07-29 | 宇龙计算机通信科技(深圳)有限公司 | Method, system and mobile communication terminal for retransmitting information |
CN108234599A (en) * | 2017-12-06 | 2018-06-29 | 链家网(北京)科技有限公司 | A kind of message repeating method and system |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113823025A (en) * | 2021-08-24 | 2021-12-21 | 广州市瑞立德信息系统有限公司 | Command retry method, system, equipment and storage medium |
CN115086414A (en) * | 2022-05-10 | 2022-09-20 | 北京明略昭辉科技有限公司 | Message processing method and device, storage medium and electronic equipment |
CN115086414B (en) * | 2022-05-10 | 2024-10-22 | 北京明略昭辉科技有限公司 | Message processing method and device, storage medium and electronic equipment |
CN114900803A (en) * | 2022-05-31 | 2022-08-12 | 深圳市智信科技有限公司 | Distributed short message verification message sending method based on computer cloud platform |
CN116056052A (en) * | 2022-08-17 | 2023-05-02 | 荣耀终端有限公司 | Message processing method, device, electronic equipment and storage medium |
CN116056052B (en) * | 2022-08-17 | 2023-10-31 | 荣耀终端有限公司 | Message processing method, device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112565418B (en) | 2022-11-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112565418B (en) | Message retransmission method and device for service cluster, computer equipment and storage medium | |
EP3669274B1 (en) | Event delivery | |
CN109828847B (en) | Block chain-based lock processing method, device, computer equipment and storage medium | |
CN109688235A (en) | Virtual network method for processing business, device and system, controller, storage medium | |
CN111159233B (en) | Distributed caching method, system, computer equipment and storage medium | |
US11824950B2 (en) | Subscription information update method and apparatus | |
CN111258723B (en) | Transaction processing method, device, system, medium and equipment of distributed system | |
CN112153170B (en) | Method, device and equipment for accessing server and storage medium | |
US20140056299A1 (en) | Information processing system, relay device, information processing device, and information processing method | |
CN111182014B (en) | Data synchronization method and device | |
CN114189384B (en) | Service processing method, device, equipment and storage medium | |
CN114270309A (en) | Resource acquisition method and device and electronic equipment | |
CN112738264B (en) | Message middleware message transmission method and device, computer equipment and storage medium | |
CN114979985A (en) | Indirect communication message transmission method, system and gateway equipment | |
CN109254853B (en) | Data sharing method, data sharing system and computer readable storage medium | |
CN109688204B (en) | File downloading method, node and terminal based on NDN (named data networking) | |
CN114490681A (en) | Service request response method and device and server cluster | |
CN111953621A (en) | Data transmission method and device, computer equipment and storage medium | |
CN112468386A (en) | Method and terminal for processing repeated messages | |
CN115208937B (en) | Service request processing method and device | |
CN113810266B (en) | Retry operation method, device, equipment and storage medium for message object | |
CN111917572B (en) | Transaction request processing method and device, electronic equipment and readable storage medium | |
CN115361440B (en) | Method and device for updating endpoint resources of multiple Kubernetes clusters and electronic equipment | |
CN113489809B (en) | Data transmission method and structure of microservice and computer equipment | |
JP6930942B2 (en) | Message delivery control device and message delivery control method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |