CN112565418B - 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 PDF

Info

Publication number
CN112565418B
CN112565418B CN202011411695.4A CN202011411695A CN112565418B CN 112565418 B CN112565418 B CN 112565418B CN 202011411695 A CN202011411695 A CN 202011411695A CN 112565418 B CN112565418 B CN 112565418B
Authority
CN
China
Prior art keywords
message
identity
sent
cache
failed
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.)
Active
Application number
CN202011411695.4A
Other languages
Chinese (zh)
Other versions
CN112565418A (en
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202011411695.4A priority Critical patent/CN112565418B/en
Publication of CN112565418A publication Critical patent/CN112565418A/en
Application granted granted Critical
Publication of CN112565418B publication Critical patent/CN112565418B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/55Push-based network services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/566Grouping or aggregating service requests, e.g. for unified processing

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

Message retransmission method and device for service cluster, computer equipment and storage medium
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 the network or the device itself, and in view of some request messages being very important and being messages that must be received by the target device, for example, a mail message sent by the user, a result notification message of whether the user transfer is successful, and the like, the existing processing method is to store the message that fails to be sent first, and then resend the stored message that fails to be sent by using the 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 of a service cluster, which aim 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 failed to be sent is successfully sent again, deleting the message failed to be sent and the identity of the corresponding device failed to be sent, which are stored in the database, and storing the identity of the device corresponding to the message failed 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, and 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 identification when the acquired identity identification 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 of the corresponding device which fails to be sent which are stored in the database when the message which fails to be sent is successfully retransmitted, and storing the identity of the device which corresponds to the message which fails to be sent in the cache;
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, which stores a computer program that, 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 acquire an identity of a device from a cache, delete the acquired identity of the device from the cache, wherein the cache stores identities of a plurality of devices, then query the acquired identity from a database, acquire a message of failed transmission of the device corresponding to the identity when the acquired identity is acquired from the database, resend the message of failed transmission, delete the message of failed transmission and the identity of the device corresponding to failed transmission stored in the database when the message of failed transmission is successfully resent, store the identity of the device corresponding to the message of failed transmission in the cache, when the message of failed transmission fails to be resent, keep the message of failed transmission and the identity of the device corresponding to failed transmission stored in the database, store the identity of the device corresponding to the message of failed transmission in the cache, and enable the device corresponding to the message of failed transmission to be allocated in the cache from other devices in a, and enable the device corresponding to be allocated in the cache from the same physical retransmission history number of the device, and the device to be allocated in the cache from the cache by the physical retransmission history device A, and the device which is unable to be allocated in the cache when the message of failed transmission history of the device A, and the retransmission history of the acquired physical retransmission information is allocated from the cache, and the other devices which is unable to be allocated from the cache, and the physical device A, thereby, and the cache, and the physical device which is unable to be allocated in the network, in the process of retransmitting the historical failure message, a locking mechanism is not involved, the deadlock situation cannot occur, and when other equipment cannot acquire the physical number of the equipment A from the cache, the physical number of the equipment B and the message failed to be transmitted by the equipment B are acquired at a chance, and the message failed to be transmitted 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.
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, a 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 identification 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 identification from the database when the number of the messages which are failed to send and correspond to the identity identification 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.
And S103, retransmitting the message with the failed transmission.
In one embodiment, the step S103 further includes:
and carrying out batch retransmission on the messages which are acquired from the database and have failed to be sent in batches and correspond to the identity identification.
S104, when the message which fails to be sent is successfully retransmitted, 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 that fails to be sent is retransmitted successfully, on one hand, the message that fails to be sent and the id of the device corresponding to the message that fails to be sent are deleted, so that the message that has been retransmitted and failed to be sent cannot be acquired again, thereby avoiding the message that fails to be sent being retransmitted repeatedly, and on the other hand, the id of the device corresponding to the message that fails to be sent is stored in the cache, so that the id corresponding to the device can still be acquired again, and when the id still corresponds to the message that fails to be retransmitted, other messages that have not been retransmitted and failed to be sent by the device can be acquired again, so that the message that has failed to be retransmitted cannot be retransmitted repeatedly, the message that has not failed to be retransmitted and is still stored in the database, the id corresponding to the message that has not failed to be retransmitted and is still stored in the cache, and other devices can acquire the message that has not failed to be retransmitted by caching the id, thereby continuing the retransmission.
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 proposed in this embodiment first acquires the id of a device from a cache, deletes the acquired id of the device from the cache, the ids of a plurality of devices are stored in the cache, then queries the acquired id from a database, acquires a failed transmission message of the device corresponding to the id when the acquired id is acquired from the database, resends the failed transmission message, deletes the failed transmission message and the id of the device corresponding to the failed transmission stored in the database when the failed transmission message is successful, stores the id of the device corresponding to the failed transmission message in the cache, when the failed transmission message is unsuccessful, retains the failed transmission message and the id of the device corresponding to the failed transmission stored in the database, stores the id of the device corresponding to the failed transmission message in the cache, and when the failed transmission message is unsuccessful, stores the history message and the physical number of the device transmitting the message in the cache in the same physical number in the cache, and deletes all the acquired messages from the physical number of the device corresponding to the failed transmission device in the cache by the physical number of the cache, and deletes all the failed transmission message from the physical number of the device in the cache, thereby enabling the device to be unable to be allocated from the cache. The method does not relate to a locking mechanism, 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, the 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 a valid identity of the message failed to send and stored in the database 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 correspondingly 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.
Fig. 4 is a flowchart of a message retransmission method of a service cluster according to another embodiment of the present invention; in this 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 detailed description of each functional module is 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 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.
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 device's identity via a two-tier storage structure.
The key at the first layer in the two-layer storage node represents the index list, and the value of the key at the first layer comprises the identity of the device, the latest processing time of the message which fails to be sent by the device and corresponds to the identity, and the mark of the message which fails to be sent and is stored in the database and corresponds 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-layer 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 valid, 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 null.
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 layer of the cache from the sorting result according to the earliest and most preferred principle.
In one embodiment, the identifier deletion module 11 is specifically configured to delete the key value representing the identity 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 none 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 into 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 wholly or partially implemented 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), a Field-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, the processor being the control center of the computer apparatus, various interfaces and lines connecting the various parts of the overall computer apparatus.
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.
The method, the apparatus, the computer device, and the storage medium for retransmitting a message of a service cluster according to embodiments of the present invention acquire an identifier of a device from a cache, delete the acquired identifier of the device from the cache, where the identifiers of multiple devices are stored in the cache, then query the acquired identifier from a database, acquire a message that fails to be sent of the device corresponding to the identifier when the acquired identifier is acquired from the database, resend the message that fails to be sent, delete the message that fails to be sent and the identifier of the device that fails to be sent, which are stored in the database, when the message that fails to be sent is resent successfully, store the identifier of the device corresponding to the message that fails to be sent in the cache, and when the message that fails to be sent is resent, retain the message that fails to be sent and the identifier of the device corresponding to be sent, which is stored in the database, and store the identifier of the device corresponding to the message that fails to be sent 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 on 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, the lock mechanism is not involved, and a deadlock situation does not occur.
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 may be implemented by hardware instructions of a computer program, which may be stored in a non-volatile computer-readable storage medium, and when executed, may 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 (Rambus) direct RAM (RDRAM), direct memory 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.

Claims (7)

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 failed to be sent is successfully sent again, deleting the message failed to be sent and the identity of the corresponding device failed to be sent, which are stored in the database, and storing the identity of the device corresponding to the message failed to be sent in the cache; the cache stores the identity of the equipment through a two-layer storage structure; a key at a first layer in the two-layer storage structure represents a label of an index list, and a value of the key at the first layer comprises an identity of the device, the latest processing time of a message which is failed to be sent by the device 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; the key of the second layer in the two-layer storage structure represents the identity of the equipment, and the value of the key of the second layer is an arbitrary value;
when the message failed to be sent fails to be sent again, the message failed to be sent and the identity of the corresponding device failed to be sent, which are stored in the database, are reserved, and the identity of the device corresponding to the message failed to be sent is stored in the cache; the step of obtaining the identity of the device from the cache specifically includes: acquiring each identity marked as 'available' 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; acquiring the identity of the equipment stored in the second layer of the cache from the sequencing result of the identity according to the earliest and most preferred principle; the step of deleting the acquired identity 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.
2. The method for retransmitting messages in a service cluster according to claim 1, wherein after the step of retrieving the device's identity 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 'none'.
3. The method of claim 1, 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.
4. The method for retransmitting messages of a service cluster according to any of claims 1 to 3, 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 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 'available'.
5. An apparatus for retransmission of messages 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 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 is successfully resent; the cache stores the identity of the equipment through a two-layer storage structure; a key at a first layer in the two-layer storage structure represents a label of an index list, and a value of the key at the first layer comprises an identity of the device, the latest processing time of a message which is failed to be sent by the device 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; the key of the second layer in the two-layer storage structure represents the identity of the equipment, and the value of the key of the second layer is an arbitrary value;
a second storage module, configured to, when the retransmission of the message that fails to be sent fails, 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; the step of obtaining the identity of the device from the cache specifically includes: acquiring each identity marked as 'available' of the message which is stored in the database and fails to be sent from the first layer of the cache; sequencing each obtained identity according to the latest processing time of the message which is failed to be sent corresponding to the identity, and obtaining the identity of the equipment stored in the second layer of the cache from the sequencing result of the identity according to the earliest and most prior principle; the step of deleting the acquired identity 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.
6. A 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 when executing the computer program realizes the steps of the message retransmission method of the service cluster according to any of the claims 1 to 4.
7. 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 4.
CN202011411695.4A 2020-12-04 2020-12-04 Message retransmission method and device for service cluster, computer equipment and storage medium Active CN112565418B (en)

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 CN112565418A (en) 2021-03-26
CN112565418B true 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)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113823025B (en) * 2021-08-24 2023-04-21 广州市瑞立德信息系统有限公司 Command retry method, system, device and storage medium
CN115086414A (en) * 2022-05-10 2022-09-20 北京明略昭辉科技有限公司 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
CN116056052B (en) * 2022-08-17 2023-10-31 荣耀终端有限公司 Message processing method, device, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
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

Patent Citations (2)

* Cited by examiner, † Cited by third party
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

Also Published As

Publication number Publication date
CN112565418A (en) 2021-03-26

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
CN112153170B (en) Method, device and equipment for accessing server and storage medium
US11824950B2 (en) Subscription information update method and apparatus
CN111343237A (en) Server cluster communication method, communication device and computer storage medium
CN102340410A (en) Cluster management system and method
US9344363B2 (en) Information processing system, relay device, information processing device, and information processing method
CN112650606A (en) Message processing method, device and system, electronic equipment and storage medium
CN110741617B (en) Resource updating method and device, computer equipment and storage medium
CN111314899B (en) Message processing method, related device and system
CN111506443A (en) Service calling method, device, equipment and storage medium
CN112328632B (en) Distributed two-level caching method and system
CN111159233B (en) Distributed caching method, system, computer equipment and storage medium
CN110798349B (en) Configuration distribution and receiving method, equipment and computer readable storage medium
CN109254853B (en) Data sharing method, data sharing system and computer readable storage medium
CN113612735B (en) Secure storage system
CN114979985A (en) Indirect communication message transmission method, system and gateway equipment
CN112738264B (en) Message middleware message transmission method and device, computer equipment and storage medium
CN109688204B (en) File downloading method, node and terminal based on NDN (named data networking)
CN112100190A (en) Distributed lock state synchronization method based on update sequence
CN112068899A (en) Plug-in loading method and device, electronic equipment and storage medium
CN111953621A (en) Data transmission method and device, computer equipment and storage medium
CN113489809B (en) Data transmission method and structure of microservice and computer equipment
CN111182014B (en) Data synchronization method and device
CN111917572B (en) Transaction request processing method and device, electronic equipment and readable storage 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
GR01 Patent grant
GR01 Patent grant