Interface-oriented high-performance and easy-to-expand data assembly system
Through an interface-oriented high-performance data assembly system, it adopts asynchronous processing and parallel tasks, real-time fault monitoring and decorator design patterns to solve the problem that the more interface calls take longer, it improves data assembly efficiency and system stability, and simplifies expansion and maintenance.
Patent Information
- Application Number
- CN202410797937.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-09-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing technology, when there are more back-end interface calls, data assembly takes longer, resulting in reduced page rendering efficiency. Moreover, when business logic and data sources change, system maintenance is complex and it is difficult to cope with failures.
Design an interface-oriented high-performance, easy-to-expand data assembly system, including a floor static data module that requests configuration, a configuration center filtering module, a data processing assembly module, and a data sorting and verification module. It adopts asynchronous processing and parallel task mechanisms. The configuration center monitors and filters fault data sources in real time, uses the decorator design pattern for data processing, and supports switching between synchronous and asynchronous calls.
It effectively improves the efficiency of data assembly and processing, ensures rapid front-end response, realizes real-time filtering of faulty data sources, simplifies system expansion and maintenance, and improves the system's fault tolerance and availability.
Smart Images

Figure CN118656146A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of interface data assembly, and in particular to a high-performance, easily expandable data assembly system oriented to an interface. Background Art
[0002] For C-end products such as e-commerce malls and service apps, page rendering efficiency has a great impact on user experience in scenarios where reads far outweigh writes. One of the most critical factors in page rendering efficiency is the time consumption of the backend interface. In addition, these scenarios change frequently, data may increase or decrease at any time, and the dependent upstream and downstream may also fail. The commonly used solution is that the backend calls one or more interfaces to obtain data, assembles it uniformly, and then returns it to the front end. The efficiency of the backend interface depends on the number of calls to the external interface and the performance of the upstream and downstream interfaces.
[0003] A problem with an interface will affect the entire data assembly process, and thus prevent the front end from obtaining the final data. When a new business backend needs to add interface calls, the time required to assemble the current data will increase proportionally, that is, the more interfaces are called, the longer it takes. When new business logic is needed, it is necessary to continue to accumulate on the original data assembly logic, causing the logic to become more complex and difficult to maintain later. When the caller interface is abnormal for a long time, it is necessary to return an exception through the caller interface for processing each time, and dynamic real-time filtering is not possible. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention provides a high-performance, easily expandable interface-oriented data assembly system, which solves the problem that when a new business backend needs to increase interface calls, the time spent on assembling the current data will increase proportionally, that is, the more interfaces are called, the longer it takes.
[0005] To achieve the above objectives, the present invention is implemented through the following technical solutions: a high-performance, easily expandable data assembly system oriented to an interface, the data assembly system comprising a floor static data module for requesting configuration, a configuration center filtering module, a data processing assembly module, and a data sorting and verification module:
[0006] The floor static data module configured by request is used to request floor static data including text, pictures, jump addresses and other business parameters;
[0007] The configuration center filtering module is used to filter out floors that do not need to be displayed through the configuration center and can be adjusted dynamically;
[0008] The data processing and assembly module is used to process and assemble data for different floors, obtain business data by synchronously or asynchronously calling the downstream interface, and fill the results into the extended json field;
[0009] The data sorting and verification module sorts and verifies the final assembled data to ensure the correctness and consistency of the data.
[0010] Specifically, the floor static data module will initiate a request to the specified data source interface according to the pre-defined request rules and parameters, obtain all static data related to the floor, and perform preliminary analysis and processing to ensure the integrity and accuracy of the data. The configuration center filtering module dynamically filters the acquired floor static data by reading the filtering rules of the configuration center, and eliminates floor data that does not meet the display conditions. At the same time, it supports real-time updating of filtering rules to adapt to different business needs.
[0011] Preferably, the data processing and assembly module uses CompletableFuture to asynchronously submit tasks, processes multiple data source logics in parallel, and finally merges the results. The data processing and assembly module returns the results to the front end in a unified manner by designing a common extended json field, thereby achieving a unified definition of the overall data structure.
[0012] Specifically, the data processing and assembly module will add an extended JSON field in each floor data object to store detailed data obtained from various business interfaces, and ensure that this data can be returned to the front end in a unified format for display.
[0013] Preferably, the data processing and assembly module adds a switching switch between synchronization and asynchrony, which can be adjusted in real time by the configuration center. For large batch tasks, it can be switched to asynchronous mode, and for single tasks that take a short time, it can be switched to synchronous mode.
[0014] Specifically, the switching switch of the data processing and assembly module is controlled by the configuration center. Through the parameter adjustment of the configuration center, it can flexibly switch between synchronous and asynchronous calls to adapt to the performance requirements in different scenarios.
[0015] Preferably, the data processing and assembly module can filter different data source faults, and the floors to be filtered can be manually adjusted in real time through the configuration center, or filtering can be performed automatically according to the faults.
[0016] Specifically, the data processing and assembly module will monitor the health status of each data source. When a data source is detected to be faulty, the filtering rules can be adjusted in real time through the configuration center to filter the floor data corresponding to the faulty data source to ensure the stability and reliability of the system.
[0017] Preferably, the data processing and assembling module adopts a decorator design pattern, including an abstract component role, a specific component role, an abstract decorator role and a specific decorator role.
[0018] Specifically, the data processing and assembly module uses the decorator design pattern to enable each data processing logic to be independently developed and expanded. The specific decorator can dynamically add new processing logic to the data object without modifying the original code.
[0019] Preferably, the abstract component role defines an object interface or an abstract class, and responsibilities can be dynamically added to these objects.
[0020] Specifically, the abstract component role serves as the basic interface or abstract class of the entire data processing chain, defining the basic operations and extension methods of data objects, so that specific components and decorators can be extended based on this basic interface.
[0021] Preferably, the specific component role is an object to which responsibilities are actually added dynamically.
[0022] Specifically, the concrete component role is the actual data object that implements the abstract component role interface, contains basic data processing logic, and can dynamically add responsibilities through the decorator pattern on this basis.
[0023] Preferably, the abstract decorator role implements the Component interface to extend the functionality of the Component class.
[0024] Specifically, the abstract decorator role implements the abstract component role interface and holds a reference to a component role object. Through this reference, it can extend and process the data object before and after calling its own method to achieve function superposition.
[0025] Preferably, the objects to which the specific decorator role dynamically adds responsibilities can develop independently without being coupled to each other.
[0026] Specifically, when implementing data processing logic, a specific decorator role only needs to focus on adding its own responsibilities and does not rely on other decorators, thus ensuring the independence and scalability of each decorator.
[0027] Preferably, the decorator class and the decorated class can dynamically extend the functionality of an implementation class, and later additions of data sources only need to focus on their own logic.
[0028] Specifically, through the decorator pattern, the decorator class and the decorated class can dynamically add new functions to the data object without modifying the original code. The newly added data preprocessing logic only needs to focus on its own business processing without affecting other parts of the code, which greatly improves the maintainability and scalability of the system.
[0029] The present invention provides an interface-oriented, high-performance, and easily expandable data assembly system, which has the following beneficial effects:
[0030] 1. The present invention effectively improves the processing efficiency of data assembly by adopting asynchronous processing and parallel task mechanism. Even when the business logic continues to increase and the data source continues to expand, the system can still respond to data requests quickly to ensure the user experience of front-end users. In addition, the design of the universal extended JSON field reduces the time of data conversion and further improves the overall processing speed. This efficient data assembly capability is particularly important for coping with complex business scenarios and large-scale data processing needs.
[0031] 2. The present invention can effectively handle the failure of a single or multiple data sources by designing a real-time fault monitoring and filtering mechanism. The configuration center monitors the data source status in real time and automatically filters the faulty data sources to ensure that the system can still operate normally when problems occur in some data sources. At the same time, the function of manually adjusting the filtering strategy enables the system to flexibly respond to various failures according to actual conditions, greatly improving the fault tolerance and stability of the system. This design is of great significance for ensuring the high availability of the system.
[0032] 3. The present invention adopts the decorator design pattern to avoid the problem of unlimited expansion of subclasses. Through the design of abstract components and decorator roles, the addition of new data sources only needs to focus on their own logical implementation without modifying the original system structure, which complies with the design principle of "open for expansion and closed for modification". This design not only simplifies the expansion process of the system, but also greatly reduces the complexity and maintenance cost of the code, ensuring the long-term scalability and maintainability of the system. This design is particularly important in the face of rapidly changing business needs and increasing data sources. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is a flow chart of the present invention;
[0034] Figure 2 A data loading flow chart for the present invention;
[0035] Figure 3 A flow chart is used for data processing of the present invention. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the specification of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0037] Please see attached Figure 1 -Attached Figure 3 ;
[0038] 1. Example 1: Data assembly system based on asynchronous processing
[0039] Implementation steps:
[0040] Environment setup and configuration: deploy the server, install the Java environment and Spring framework.
[0041] Interface development: Design data source interface and define input and output parameters.
[0042] Asynchronous module configuration: Use Java's CompleteFuture to implement asynchronous processing logic.
[0043] Request distributor development: Build a request distributor, which is responsible for distributing requests according to data sources.
[0044] Data acquisition and processing: Acquire data by asynchronously calling multiple data source interfaces.
[0045] Data caching strategy: Implement data caching to reduce duplicate data requests.
[0046] Result merging and formatting: Merge multi-source data results and format them into a unified JSON format.
[0047] Performance optimization and debugging: Debug the system, optimize the asynchronous processing flow, and ensure that the performance meets the requirements.
[0048] System deployment and monitoring: deploy to the production environment, set up monitoring, and ensure stable operation of the system.
[0049] Summary of embodiments:
[0050] This embodiment greatly improves the data processing speed and reduces the response time through asynchronous processing, and is suitable for business scenarios with large data volumes and abundant resources.
[0051] 2. Example 2: Data assembly system with automatic fault filtering
[0052] Implementation steps:
[0053] Configuration center establishment and management: Establish a configuration center to maintain data sources and their status.
[0054] Fault detection service development: Develop fault detection services to automatically identify unhealthy data sources.
[0055] Dynamic filtering strategy design: Design dynamic filtering logic and apply fault data source filtering rules in real time.
[0056] Data collection and verification module: collect data from data sources and verify data integrity.
[0057] Fault recovery mechanism: Implement an automatic recovery mechanism after a data source failure.
[0058] Data assembly and integration: Assemble the filtered data and integrate them into a unified format.
[0059] Performance testing and optimization: Perform performance testing and optimize filtering strategies based on test results.
[0060] Deployment and operation monitoring: Deploy the system to the production environment and monitor the operation status.
[0061] Summary of embodiments:
[0062] This embodiment enhances the stability of the system and the accuracy of data through automatic fault detection and filtering, and is suitable for operation in an unstable data source environment.
[0063] 3. Embodiment 3: Data assembly system supporting synchronous and asynchronous switching
[0064] Implementation steps:
[0065] System architecture design: Design system architecture to support switching between synchronous and asynchronous modes.
[0066] Switching mechanism implementation: Develop synchronous and asynchronous mode switching logic and control it through the configuration center.
[0067] Data processing flow development: Develop data processing flows, including synchronous direct processing and asynchronous processing.
[0068] Scheduler configuration: Configure the task scheduler to automatically select the processing mode based on the system load.
[0069] Performance evaluation module: Implement the performance evaluation module to monitor the performance under different modes.
[0070] Load testing and optimization: Perform load testing and adjust switching logic and performance parameters based on the results.
[0071] User Interface Development: Develop a user interface to allow the user to manually select the processing mode.
[0072] System deployment and maintenance: system deployment, regular maintenance and updates.
[0073] Summary of embodiments:
[0074] This embodiment provides a flexible data processing method, and optimizes performance and resource usage by dynamically switching between synchronous and asynchronous processing to adapt to different business requirements and system loads.
[0075] 4. Example 4: Data processing and assembly system using decorator mode
[0076] Implementation steps:
[0077] Pattern design and implementation: Use decorator pattern to design data processing components.
[0078] Basic component development: Develop abstract components and specific components, and process basic data logic.
[0079] Decorator component development: Develop abstract decorators and concrete decorators to add additional functionality such as caching and logging.
[0080] Component integration testing: Integrate various components and perform complete functional testing.
[0081] Performance analysis and optimization: Analyze the performance impact introduced by decorators and perform necessary optimizations.
[0082] User Configuration Interface: Develop a configuration interface that allows users to select and configure decorator functionality.
[0083] System deployment and monitoring: Deploy the system and set up monitoring to ensure that the system runs as expected.
[0084] Summary of embodiments:
[0085] Through the decorator pattern, this embodiment realizes the flexible expansion of data processing functions, maintains the maintainability and extensibility of the code, and is suitable for systems that need frequent updates or expansion of functions.
[0086] 5. Example 5: Service-oriented data assembly system
[0087] Implementation steps:
[0088] Microservice architecture planning: Design microservice architecture and define service boundaries.
[0089] Service development and deployment: Develop each microservice and deploy it to a containerized platform.
[0090] Service discovery and registration: Implement service discovery and registration mechanisms to ensure that services can be interconnected.
[0091] API gateway configuration: Set up the API gateway to manage service requests and routing.
[0092] Load balancing and fault tolerance: Implement load balancing strategies and fault tolerance mechanisms.
[0093] Data consistency management: Use appropriate distributed transactions to manage data consistency.
[0094] Performance monitoring and tuning: Monitor service performance and optimize system configuration based on demand.
[0095] User Interface and Documentation: Develop user interface and system documentation to improve system usability and ease of use.
[0096] Summary of embodiments:
[0097] This embodiment provides extremely high system scalability and reliability through a microservice architecture, is suitable for large-scale and complex business environments, and can effectively cope with high concurrency and complex data processing requirements.
[0098] Summary
[0099] These five embodiments, through different technical means and design patterns, each solves the common problems faced by data assembly systems, such as performance, stability, scalability and maintainability. From asynchronous processing to microservice architecture, each embodiment has its unique advantages and applicable scenarios, demonstrating the flexibility and high-performance characteristics of the data assembly system of the present invention. These embodiments jointly demonstrate a future-oriented data processing solution, providing effective technical options for enterprises of different sizes and needs.
[0100] Test Experiment Design
[0101] 1. Test environment construction
[0102] Hardware environment: A server cluster with the same configuration is used uniformly, and each server is equipped with an 8-core CPU, 32GB memory, and 1TB SSD.
[0103] Software environment: All systems are deployed on the same containerization platform (such as Kubernetes) and use the same version of the Java environment and Spring framework.
[0104] 2. Test data preparation
[0105] Data source: Ten different data sources are simulated. The data volume and response time of each data source are different. Some data sources will randomly introduce failures.
[0106] Data request: simulates real user requests, including high-concurrency requests and large data volume requests.
[0107] 3. Test indicators
[0108] Response time: The average and maximum time it takes for the system to process a request.
[0109] Throughput: The number of requests processed per second by the system.
[0110] Error rate: The number and type of errors that occur while the system is processing requests.
[0111] Resource usage: CPU and memory usage of the system when processing requests.
[0112] System stability: The stability of the system during long-term operation, including fault recovery capabilities.
[0113] Scalability: The performance change of the system after increasing the data source and request volume.
[0114] Testing Process
[0115] 1. Performance Testing
[0116] step:
[0117] Deploy each embodiment system.
[0118] Gradually increase the number of concurrent requests from 100 QPS (Queries Per Second) to 1000 QPS. Record the response time, throughput, error rate, and resource usage of each system.
[0119] 2. Stability test
[0120] step:
[0121] Ongoing requests run 24 hours per system.
[0122] Randomly introduce data source failures and observe the system's fault detection and recovery capabilities.
[0123] Record the system's error rates and recovery times.
[0124] 3. Scalability testing
[0125] step:
[0126] Increase the number of data sources from 10 to 20.
[0127] Increase the request volume from 100QPS to 2000QPS.
[0128] Record system response time, throughput, and resource utilization.
[0129] Test results and analysis
[0130] 1. Performance test results
[0131]
[0132]
[0133] 2. Stability test results
[0134]
[0135] 3. Scalability test results
[0136]
[0137]
[0138] Summarize
[0139] Through comprehensive test experiments, we found that each embodiment has unique advantages in different aspects: the asynchronous processing system has excellent response time and throughput, and is suitable for high concurrency and large data volume scenarios; the automatic fault filtering system has the best performance in stability and fault recovery, and is suitable for unstable data source environments; the synchronous and asynchronous switching system has good flexibility and comprehensive performance, and is suitable for changing business needs; the decorator mode system has advantages in functional scalability and code maintainability, and is suitable for systems that require frequent functional updates; the microservice system has outstanding system scalability and reliability, and is suitable for large-scale and complex business environments. Through these test results, we can better understand the characteristics and applicable scenarios of each embodiment, and provide effective technical options for enterprises with different needs.
[0140] Comparative Experimental Design
[0141] Experiment 1: Comparison of data assembly efficiency
[0142] Purpose:
[0143] By comparing the differences in data assembly processing efficiency between the present invention and the prior art, the advantages of asynchronous processing and parallel task mechanisms are verified.
[0144] Existing technical solutions:
[0145] The existing technology adopts a synchronous processing mechanism, and all data processing tasks are executed in sequence. After the data source is expanded, the data structure needs to be redesigned.
[0146] Technical solution of the present invention:
[0147] The present invention adopts asynchronous processing and parallel task mechanisms, data processing tasks can be executed in parallel, and there is no need to redesign the data structure after the data source is expanded.
[0148] Experimental steps:
[0149] The same data source and business logic are prepared, and the existing technology and the present invention are used to assemble data respectively.
[0150] Set different data volumes (10,000, 50,000, 100,000, 200,000, 500,000).
[0151] At each data level, the system's processing time is tested in single-thread and multi-thread (4 threads, 8 threads, and 16 threads) situations.
[0152] The processing time of the two techniques under different data amounts and thread numbers is measured and recorded.
[0153] Experimental data table:
[0154]
[0155]
[0156] Result analysis:
[0157] The present invention significantly reduces the processing time when the amount of data and the number of threads increase, and the efficiency is more significantly improved in large-scale data processing, which verifies the advantages of asynchronous processing and parallel task mechanisms.
[0158] Experiment 2: Comparison of system fault tolerance
[0159] Purpose:
[0160] The differences in system fault tolerance between the present invention and the prior art are compared to verify the effectiveness of the real-time fault monitoring and filtering mechanism.
[0161] Existing technical solutions:
[0162] The existing technology lacks real-time fault monitoring and automatic filtering mechanisms. When a data source fails, the overall system performance will decline or even crash.
[0163] Technical solution of the present invention:
[0164] The present invention designs a real-time fault monitoring and filtering mechanism, which can automatically detect and filter fault data sources to ensure the normal operation of the system.
[0165] Experimental steps:
[0166] Simulate data source failure (10%, 30%, 50%, 70%, 90% data source failure).
[0167] The system response time and availability of the prior art and the present invention under different failure ratios were tested.
[0168] Record the system's response time and availability under different failure ratios.
[0169] Test the system's response time and recovery speed after failure recovery.
[0170] Experimental data table:
[0171]
[0172]
[0173] Result analysis:
[0174] The present invention can maintain a low response time and 100% system availability under different fault ratios, verifying the effectiveness of the real-time fault monitoring and filtering mechanism. At the same time, the present invention is also significantly better than the prior art in terms of response time and recovery speed after fault recovery.
[0175] Experiment 3: Comparison of system scalability and maintenance costs
[0176] Purpose:
[0177] By comparing the differences between the present invention and the prior art in terms of system scalability and maintenance cost, the advantages of the decorator design pattern are verified.
[0178] Existing technical solutions:
[0179] The existing technology adopts the traditional inheritance method, and the system structure needs to be modified when adding a new data source, which leads to increased code complexity and maintenance costs.
[0180] Technical solution of the present invention:
[0181] The present invention adopts the decorator design pattern. When adding a new data source, there is no need to modify the system structure. Only the logic implementation itself needs to be focused on, which complies with the design principle of "open for extension and closed for modification".
[0182] Experimental steps:
[0183] Simulate the scenario of adding new data sources (adding 3, 5, 10, 20, and 50 new data sources).
[0184] The code modification amount and maintenance time of the prior art and the present invention when different data sources are added are recorded.
[0185] Measure and record the system scalability (code complexity) and maintenance cost (time) of the two technologies when different data sources are added.
[0186] Experimental data table:
[0187]
[0188] Result analysis:
[0189] The present invention significantly reduces the amount of code modification and maintenance time when adding a new data source, verifies the advantages of the decorator design pattern, and greatly reduces the complexity and maintenance cost of the system.
[0190] Summarize
[0191] Through the above three comparative experiments, the advantages of the present invention in data assembly efficiency, system fault tolerance, system scalability and maintenance cost are fully verified. Experimental data show that the asynchronous processing and parallel task mechanism, real-time fault monitoring and filtering mechanism and decorator design pattern adopted by the present invention significantly improve the performance, stability and scalability of the system, and are suitable for complex business scenarios and large-scale data processing needs.
[0192] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A high-performance, easily scalable data assembly system oriented to an interface, characterized in that: The data assembly system includes a floor static data module for requesting configuration, a configuration center filtering module, a data processing and assembly module, and a data sorting and verification module: The floor static data module configured by request is used to request floor static data including text, pictures, jump addresses and other business parameters; The configuration center filtering module is used to filter out floors that do not need to be displayed through the configuration center and can be adjusted dynamically; The data processing and assembly module is used to process and assemble data for different floors, obtain business data by synchronously or asynchronously calling the downstream interface, and fill the results into the extended json field; The data sorting and verification module sorts and verifies the final assembled data to ensure the correctness and consistency of the data.
2. According to claim 1, a high-performance, easily expandable interface-oriented data assembly system is characterized in that: The data processing and assembly module uses CompletableFuture to asynchronously submit tasks, processes multiple data source logics in parallel, and finally merges the results. The data processing and assembly module returns them to the front end in a unified manner by designing a common extended json field, thereby achieving a unified definition of the overall data structure.
3. The interface-oriented, high-performance, and easily expandable data assembly system according to claim 1, characterized in that: The data processing and assembly module adds a switching switch between synchronization and asynchrony, which can be adjusted in real time by the configuration center. For large batch tasks, it can be switched to asynchronous mode, and for single tasks that take a short time, it can be switched to synchronous mode.
4. The interface-oriented, high-performance, and easily expandable data assembly system according to claim 1, characterized in that: The data processing and assembly module can filter different data source faults. The floors to be filtered can be manually adjusted in real time through the configuration center, or the filtering can be performed automatically according to the faults.
5. The interface-oriented, high-performance, and easily expandable data assembly system according to claim 1, characterized in that: The data processing and assembling module adopts a decorator design pattern, including an abstract component role, a specific component role, an abstract decorator role and a specific decorator role.
6. The interface-oriented, high-performance, and easily expandable data assembly system according to claim 5, characterized in that: The abstract component role defines an object interface or abstract class, and responsibilities can be dynamically added to these objects.
7. The interface-oriented, high-performance, and easily expandable data assembly system according to claim 5, characterized in that: The specific component role is an object to which responsibilities are actually added dynamically.
8. The interface-oriented, high-performance, and easily expandable data assembly system according to claim 5, characterized in that: The abstract decorator role implements the Component interface to extend the functionality of the Component class.
9. The interface-oriented, high-performance, and easily expandable data assembly system according to claim 5, characterized in that: The specific decorator role dynamically adds responsibilities to objects and can develop independently without being coupled to each other.
10. The interface-oriented, high-performance, and easily expandable data assembly system according to claim 5, characterized in that: The decorator class and the decorated class can dynamically extend the functionality of an implementation class, and later new data sources only need to focus on their own logic.
