Gateway API Settings Management via Dual Rule Tables
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In a multi-thread environment, gateway apparatuses face performance degradation due to the need for locks to manage API settings, leading to race conditions and inefficiencies in processing client API requests.
Innovation Solution
The implementation of a gateway apparatus using two rule tables and a reference flag allows sub-threads to access the latest API settings without locks, with the main thread updating the rule tables and setting the reference flag to indicate which table contains the current settings, enabling efficient API request processing.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If a lock is used to manage API settings in a multi-thread environment, then thread safety is improved, but system performance deteriorates due to processing delays
Solution Approach 1:
The single rule table is segmented into two separate rule tables (first rule table and second rule table). This segmentation allows different threads to access different tables simultaneously without conflict, eliminating the need for locks while maintaining thread safety. The reference flag indicates which table currently holds valid settings, enabling safe concurrent access without performance degradation.
2Stability of the object's composition
If a lock is used to prevent race conditions, then data consistency is improved, but processing speed deteriorates
Solution Approach 1:
The system performs preliminary actions by maintaining two rule tables where one table is always available for reading while the other is being updated. This preliminary preparation of alternate tables allows immediate switching without locks, ensuring data consistency is maintained while processing speed is preserved through pre-configured fallback options.
Solution Approach 2:
A copy of the rule table is created and maintained as an alternate (first table and second table). When one table is being updated, the other serves as a ready-made copy for immediate reading. This copying mechanism ensures data consistency without requiring locks during processing, as readers always access the stable copy while writers update the alternate.
3Manufacturing precision
If locks are used for setting updates, then setting accuracy is improved, but API request processing time increases
Solution Approach 1:
The system dynamically switches between two rule tables using a reference flag. Instead of using static locks, the system dynamically alternates which table is for reading and which is for writing. This dynamic approach ensures setting accuracy through the reference flag mechanism while minimizing processing time loss, as threads can immediately access the current valid settings without waiting for lock acquisition.
Data Source
AI summary
A gateway apparatus and a method for dynamically applying API settings are disclosed. The gateway apparatus includes a sub-processing unit processing an API (application programming interface) request of a client terminal based on API settings through a plurality of sub-threads, a setting unit comprising a first rule table and a second rule table to store a set value for processing the API request, and a reference flag, and a main processing unit updating new API settings in a rule table other than the rule table corresponding to a reference value of the reference flag through a main thread when receiving the new API settings, and setting the reference value of the reference flag to a reference value corresponding to the updated rule table when the update is completed.


