Service Communication Mode Selection for Timeout and Workload Balance
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing information system platforms lack a dynamic mechanism to select the most suitable communication mode between services, leading to potential task failures due to inappropriate mode selection during design, whether using Restful API or Message Queue, resulting in inefficiencies or performance losses.
Innovation Solution
An intelligent selection method and unit that dynamically determines the use of Restful API or Message Queue based on real-time calculations of unfinished tasks and task completion times, adjusting thresholds adaptively to ensure optimal communication mode selection.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Speed
If Restful API is used for communication between services, then processing speed is faster and the communication is simpler, but task execution may fail when tasks require long time to be executed due to timeout period
Solution Approach 1:
The system dynamically selects between Restful API and Message Queue communication modes based on real-time conditions such as task complexity, estimated execution time, and current system load. This dynamic selection mechanism allows the system to use Restful API for simple, fast tasks while switching to Message Queue for long-running tasks that would otherwise timeout, thereby resolving the contradiction between speed and reliability
Solution Approach 2:
The system changes the communication mode parameter based on task characteristics. By evaluating task parameters (execution time, complexity) and system state (current load, queue depth), the system selects the appropriate communication mode (synchronous Restful API or asynchronous Message Queue) to optimize both processing speed and task execution success rate
2Reliability
If Message Queue is used for communication between services, then tasks can be executed successfully even when they require long time, but speed performance is lost when workload is not large or work can be completed in short time
Solution Approach 1:
The system dynamically adjusts the communication mode based on real-time conditions. When task execution time is short and workload is light, it switches to Restful API for faster synchronous processing. When tasks are long-running or system load is high, it switches to Message Queue for reliable asynchronous processing, thus optimizing speed without sacrificing reliability
3Device complexity
If communication mode is predetermined at design stage, then system architecture is simpler to design, but the system cannot dynamically select the most suitable communication mode to complete tasks
Solution Approach 1:
The system performs preliminary evaluation of task characteristics and system conditions before selecting the communication mode. By assessing task complexity, estimated execution time, and current system state in advance, the system can make informed decisions about whether to use Restful API or Message Queue, achieving adaptability without requiring complex runtime reconfiguration
Solution Approach 2:
The system implements a feedback mechanism that monitors task execution outcomes and system performance. Based on this feedback, it learns from past decisions and adjusts future communication mode selections to optimize both task success rate and processing speed, balancing design simplicity with operational adaptability
Data Source
AI summary
An intelligent selection method is provided to determine the communication mode when the first service calls the second service in the information system platform to execute a service with multiple tasks. The aforementioned method includes calculating the unfinished workload of the first service's previous call to the second service, and calculating the task-completion time of the most recent work completed by the second service. The aforementioned method includes selecting whether to use the first strategy or the second strategy to communicate when the first service calls the second service, according to the unfinished workload and the completion time. Finally, the aforementioned method includes notifying the first service of the selection result.


