Message Queue Segmentation for Data Packet Synchronization
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current servers face challenges in processing data packets in the correct order, leading to errors during game operations between clients and servers.
Innovation Solution
The implementation of a data packet synchronization method where each logical thread is assigned a corresponding message queue, allowing data packets to be processed and written into the correct queue based on thread identifiers and frame identifiers, ensuring correct order and reducing memory occupancy.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Device complexity
If multiple logical threads share a single message queue, then device complexity is reduced, but write conflicts occur and data processing reliability deteriorates
Solution Approach 1:
The patent divides the single message queue into multiple logical thread-specific queues, where each logical thread has its own dedicated message queue. This segmentation eliminates write conflicts between threads while maintaining manageable complexity through structured organization. The server allocates specific message queues to specific logical threads, ensuring that data packets are processed in the correct order without interference from other threads.
2Reliability
If each logical thread is assigned a dedicated message queue, then data processing reliability is improved, but server memory usage increases
Solution Approach 1:
The patent implements a pooling mechanism where message queues are created once and then shared across multiple logical threads through reference sharing. Instead of creating separate queue instances for each thread, the same message queue object can be referenced by multiple threads, reducing overall memory consumption while still maintaining the benefit of dedicated queue assignment for each logical thread.
3Quantity of substance
If data packets are processed without thread-specific queues, then memory usage is reduced, but data packet ordering errors increase
Solution Approach 1:
The patent performs preliminary assignment of message queues to logical threads before data packet processing begins. This pre-allocation ensures that each logical thread knows its dedicated queue in advance, preventing ordering errors from the outset. The server establishes the thread-to-queue mapping relationship beforehand, so that when data packets arrive, they can be immediately routed to the correct queue without confusion or ordering issues.
Data Source
AI summary
Disclosed in this application are a data packet synchronization method and apparatus, a device, and a storage medium, relating to the field of data communication. The method includes receiving a data packet transmitted by a client, the data packet including a thread identifier and a frame identifier, the thread identifier being added by the client according to a logical operation type required by the data packet, the frame identifier being used for identifying a picture frame triggering the data packet; writing, after the data packet is transmitted to a logical thread corresponding to the thread identifier for a logical operation, a data packet obtained after the operation into a message queue corresponding to the logical thread; and reading the data packet obtained after the operation from the message queue according to the frame identifier, and synchronizing the data packet obtained after the operation to an associated client.


