Hybrid architecture dynamic cache synchronization method based on high-concurrency scene
By building a C++ dynamic link library in JavaWeb applications and using the operating system shared memory mechanism, the cache data sharing and synchronization problems between Java and C++ modules are solved, and cache consistency and performance optimization in high concurrency scenarios are achieved, improving system response speed and throughput.
Patent Information
- Application Number
- CN202510623722.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2025-08-26
AI Technical Summary
The existing technology lacks an effective cross-language cache data sharing mechanism in high concurrency scenarios, which makes it difficult to ensure real-time and consistency of data between Java applications and C++ modules, increases system complexity, and performance bottlenecks and lock competition problems may occur when pure Java caches have high concurrency.
By building a C++ dynamic link library, using the operating system shared memory mechanism to create a shared storage space, realizing cached data sharing and synchronization between JavaWeb application instances, combining event drivers and message queue mechanisms for update notifications, and using efficient data structures such as read and write locks and hash tables to optimize performance.
It realizes cached data consistency and efficient synchronization in cross-language environments, reduces lock competition and thread blocking, improves the system's response speed and throughput in high concurrency scenarios, reduces the pressure of garbage collection of Java virtual machines, and improves system stability and scalability.
Smart Images

Figure CN120541003A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer Web application development, and in particular to a hybrid architecture dynamic cache synchronization method based on a high-concurrency scenario. Background Art
[0002] Currently, in Web development and distributed systems, caching technology is often used to improve data access efficiency. For example, distributed services are built using mixed programming of C++ and Java, and communication is carried out between the server and the client, thereby improving the efficiency of cross-language calls. However, the patent does not address the issue of sharing cache data through C++ dynamic link libraries, that is, it does not provide a mechanism for directly sharing caches between Java and C++. For example, consistency is maintained by configuring the order of transactions and cache operations, capturing cache update failure events and processing them. In a pure Java environment, this method can alleviate the inconsistency problem caused by "double writing" between the cache and the database. However, this solution is limited to a single language or a conventional distributed cache environment, and does not consider cache synchronization and data sharing issues in a cross-language environment.
[0003] Although the above technologies have made contributions in their respective fields, existing solutions still have shortcomings in high-concurrency cache consistency and cross-language data sharing: existing technologies lack effective means to share cache data between different programming languages. When Java applications and C++ modules need to share a high-speed cache, they can usually only transfer through network requests, files or databases, which makes it difficult to ensure data real-time and consistency. Different languages maintain their own cache copies, which easily leads to data asynchrony or redundancy, increasing system complexity. In addition, pure Java cache implementations may encounter performance bottlenecks at high concurrency. A large amount of cached data occupying heap memory will lead to frequent garbage collection, which in turn affects response time and throughput. To maintain cache consistency, existing methods often use synchronization mechanisms such as global locks or polling checks. In high-concurrency environments, serious lock contention may occur, thread blocking will increase, and overall system performance will decrease. Moreover, existing technologies have not yet been able to effectively support the cache management needs of high-concurrency Java Web applications.
[0004] In summary, existing solutions have limitations in cache data sharing, consistency maintenance, and performance optimization. They cannot fully meet the needs of cross-language cache management for high-concurrency Java Web applications, and there are bottlenecks and inefficiencies in the synchronization mechanism. Summary of the Invention
[0005] In order to solve the above problems existing in the prior art, the present invention provides a hybrid architecture dynamic cache synchronization method based on a high concurrency scenario.
[0006] The purpose of the present invention can be achieved through the following technical solutions:
[0007] A hybrid architecture dynamic cache synchronization method based on a high concurrency scenario, characterized by comprising the following steps:
[0008] S1: Build a C++ dynamic link library. The C++ dynamic link library implements cache data management by allocating or connecting to a shared storage space. The shared storage space supports access by Java Web application instances. The cache data management includes cache data writing, cache data reading, and cache data eviction.
[0009] S2: Start the Java Web application and load the C++ dynamic link library in the Java local interface to achieve hybrid architecture dynamic cache synchronization.
[0010] Preferably, the shared storage space is created by mapping files to memory, and n Java Web application instances in the shared storage space share cache data by mapping corresponding files to memory spaces of respective processes.
[0011] Preferably, the shared storage space is created through an operating system shared memory mechanism, and n Java Web application instances in the shared storage space share cache data by accessing the same shared memory area.
[0012] Preferably, the method is adapted to the JavaWeb application environment of the Spring framework, and by encapsulating the C++ dynamic link library as a Bean component in the Spring framework, the cache sharing function is loaded and used by the application when the Spring application context is initialized.
[0013] Preferably, the method is adapted to the Tomcat server environment. By utilizing the lifecycle management mechanism of the Tomcat container to load the C++ dynamic link library during the Web application deployment process, the cache data sharing function is initialized when the Tomcat server is started or the Web application is initialized and is available for use by multiple Web applications.
[0014] Preferably, the hybrid architecture dynamic cache synchronization method includes a cache data consistency control mechanism, comprising the following steps:
[0015] When any Java Web application instance needs to update the target cache data, it first obtains an exclusive lock for the target cache data for exclusive access;
[0016] Writing the updated data into the shared storage space managed by the C++ dynamic link library through the library, and releasing the exclusive lock after the writing is completed;
[0017] After the cache data is updated, an update notification is triggered to notify other Java Web application instances of the updated information of the cache data;
[0018] After receiving the update notification, other Java Web application instances obtain updated data according to the cache identifier included in the notification, or mark the corresponding local cache data as invalid and obtain the latest data from the shared storage space during the next access.
[0019] Preferably, the update operation of the cache data supports transaction management, that is, when multiple cache data items need to be updated in batches, the update operation is encapsulated into a transaction; only when all update operations in the transaction are successfully completed, the corresponding cache update notification is sent to other JavaWeb application instances; if any update operation in the transaction fails, the executed cache update is canceled and the update notification is not sent.
[0020] Preferably, the update notification is implemented through an event-driven mechanism, that is, when any Java Web application instance updates cache data, a pre-registered event notification is triggered to notify other Java Web application instances of the cache update information.
[0021] Preferably, the update notification is implemented through a message queue mechanism, which includes encapsulating cache data update information into a message, and distributing the message by the message queue to notify other Java Web application instances to perform corresponding cache updates.
[0022] Preferably, a cache performance optimization mechanism is also included, comprising the following steps:
[0023] Store cache data in the memory space managed by the C++ dynamic link library;
[0024] Providing a direct access interface to cache data to the Java Web application through the C++ dynamic link library;
[0025] Use data structures and search algorithms to organize and manage cache data;
[0026] Pre-allocate and recycle storage space for cached data;
[0027] Through a read-write lock mechanism or a lock-free concurrency control strategy, multiple threads can concurrently read cached data without blocking, and only the affected data range is locked when performing write operations.
[0028] The beneficial effects of the present invention are:
[0029] (1) By implementing cache data storage and management logic in a C++ dynamic link library and using Java native interfaces for direct cross-language access, the delay and inconsistency problems caused by the repeated transfer of data in traditional multi-level cache solutions are avoided, thereby significantly improving real-time performance and consistency in high-concurrency scenarios;
[0030] (2) Through an optimized synchronization mechanism, multiple threads can quickly read and write shared cache data. Under the premise that read operations are not blocked by write operations, the probability of lock contention and thread blocking during concurrent access is reduced, effectively improving the overall throughput and response speed of the system in high-concurrency scenarios;
[0031] (3) By storing a large amount of cache data in the off-heap memory space managed by the C++ dynamic link library and organizing it with efficient data structures such as hash tables, the garbage collection pressure of the Java virtual machine is reduced, and the performance loss caused by frequent memory allocation or release is reduced. At the same time, the cache data storage area is pre-allocated and recycled, which improves the cache data search efficiency and memory usage efficiency, further enhancing the stability and scalability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] To facilitate understanding by those skilled in the art, the present invention is further described below with reference to the accompanying drawings.
[0033] Figure 1 It is a schematic diagram of the overall system operation of the present invention;
[0034] Figure 2 This is a flow chart of the interaction between Java and C++ dynamic link libraries of the present invention;
[0035] Figure 3 This is a flow chart of cache consistency processing of the present invention;
[0036] Figure 4 This is a schematic diagram of multi-threaded concurrent reading and writing of the present invention;
[0037] Figure 5 This is a schematic diagram of the shared storage space management structure of the present invention;
[0038] Figure 6 This is a flow chart of the update notification and transactional batch update process of the present invention. DETAILED DESCRIPTION
[0039] In order to better understand the present invention, various aspects of the present invention will be described in more detail with reference to the accompanying drawings. It should be understood that these detailed descriptions are only descriptions of exemplary embodiments of the present invention and are not intended to limit the scope of the present invention in any way. Throughout the specification, the expression "and / or" includes any and all combinations of one or more of the associated listed items. As used herein, the terms "roughly", "approximately" and similar terms are used as terms to indicate approximate values, rather than as terms to indicate degree, and are intended to illustrate inherent deviations in measurements or calculated values that will be recognized by those of ordinary skill in the art. In addition, in the present invention, the order in which the steps are described does not necessarily represent the order in which these processes occur in actual operation, unless otherwise specified or can be derived from the context.
[0040] It should also be understood that expressions such as "comprises," "including," "having," "includes," and / or "comprising" are open rather than closed expressions in this specification, indicating the presence of the stated features, elements, and / or components, but do not exclude the presence of one or more other features, elements, components, and / or combinations thereof. In addition, when expressions such as "at least one of..." appear after a list of listed features, they modify the entire list of features rather than just the individual elements in the list. In addition, when describing embodiments of the present invention, "may" is used to mean "one or more embodiments of the present invention." And, the term "exemplary" is intended to refer to an example or illustration.
[0041] Unless otherwise defined, all terms used herein (including engineering terms and scientific and technological terms) have the same meaning as commonly understood by those skilled in the art to which the present invention pertains. It should also be understood that, unless otherwise expressly stated in the present invention, words defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant technology, and should not be interpreted in an idealized or overly formal sense.
[0042] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments of the present invention can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0043] Example 1:
[0044] See also Figures 1 to 6The present invention relates to a hybrid architecture dynamic cache synchronization method for high-concurrency scenarios. The core concept is to implement cache data storage and management logic in a C++ dynamic link library and utilize the Java Native Interface (JNI) to enable direct communication between Java Web applications and C++ modules, thereby achieving high-speed cache data sharing and synchronization in a cross-language environment. The following describes the embodiments of the present invention in detail, based on the common knowledge of those skilled in the art.
[0045] The present invention is applicable to various Java Web application frameworks and server environments, including the Spring framework and Tomcat servers. During system startup, Java Web applications load pre-compiled C++ dynamic link libraries through the Java Native Interface (JNI). For applications using the Spring framework, the C++ dynamic link library can be encapsulated as a SpringBean component, which can be automatically loaded and configured as a cache module during application initialization using the Spring container's lifecycle management. For applications based on Web containers such as Tomcat, the listener mechanism or context initialization configuration during container startup can be used to load the dynamic library and initialize the shared cache.
[0046] The present invention places the cache data storage and management logic in a C++ dynamic link library to fully utilize the high-performance memory management capabilities of C++. When the dynamic library is loaded, it will automatically allocate or connect a shared storage space according to the configuration parameters. The shared storage space can be created in two ways: one is to use file mapping (Memory-Mapped) technology to map a disk file to the memory address space so that multiple processes (such as multiple JavaWeb instances) can share access to the memory; the other is to use the shared memory mechanism (SharedMemory) of the operating system to directly allocate a cross-process visible memory area. Regardless of which method is used, all JavaWeb application instances will be mapped or attached to the same shared memory area, thereby forming a unified cache data storage area. This unified storage avoids the data redundancy and inconsistency problems caused by different instances in the traditional solution each storing a copy of cache data.
[0047] In the shared memory area, the C++ dynamic link library uses efficient data structures (such as hash table-based indexes) to organize cached data. Each cache record contains a key value (such as a string key) and the corresponding data content, which can be quickly retrieved and located based on the key. The C++ dynamic link library pre-allocates sufficient memory internally and adopts a circular allocation strategy to avoid frequent memory request and release operations, further improving data access speed and reducing memory fragmentation. In addition, since the cached data is stored in memory outside the Java heap, the memory usage on the Java Virtual Machine (JVM) heap is reduced, effectively reducing the frequency and pressure of garbage collection (GC), thereby improving the system's performance in high-concurrency scenarios.
[0048] In order to ensure the consistency of cached data among multiple JavaWeb instances, the present invention designs a cache update notification and synchronization mechanism driven by a C++ dynamic link library. When an instance calls the C++ interface through JNI to perform an update operation on the shared cache (such as adding, modifying or deleting data), the dynamic library triggers a cache update notification at the same time as completing the data writing. This notification mechanism can choose different implementation methods according to the actual deployment environment: in a single-machine multi-process environment, it can adopt the method of inter-process event triggering or signal notification; in a distributed cluster environment, it can be combined with middleware such as message queues to broadcast update messages to other nodes. The JavaWeb application instance that receives the notification can adopt two strategies to maintain cache synchronization: one is to immediately re-read the updated data from the shared memory through the JNI interface, thereby updating its own cache status; the other is to mark the corresponding local cache as invalid, and then obtain the latest value from the shared memory when the data is requested next time. Through the above mechanism, it can be ensured that the cached data seen by all instances is consistent, avoiding a node from using stale data.
[0049] Furthermore, the present invention selects synchronous or asynchronous notification strategies based on the importance of the data to achieve a balance between consistency and performance. In batch update scenarios, transactional update processing is also supported: multiple cache update operations are packaged into a single transaction, and a unified update notification is sent only when all operations in the transaction are successfully completed. If any operation fails, the executed update is rolled back without notifying other instances, thus ensuring the atomicity and consistency of cache update operations.
[0050] The present invention optimizes cache access performance and reduces system overhead through various means. First, cache read and write operations are performed directly at the C++ layer, leveraging the efficient operation of native code to reduce Java layer serialization overhead and reduce GC pressure caused by object creation. Second, hash indexing and memory pool technology are used to achieve fast access with an average O(1) time, and memory fragmentation and allocation overhead are reduced by pre-allocating large blocks of memory and reusing memory. The above measures minimize performance loss in cache operations while ensuring consistency, meeting application requirements in high-concurrency, large-data-volume scenarios.
[0051] To facilitate Java to call C++ dynamic link library, this invention provides a set of concise and clear interface methods. The main interface and its parameters are designed as follows:
[0052] Initialization APIs, such as inheritance (Reconfiguration), are used to initialize the shared cache area and internal data structures. The configuration parameter specifies the configuration file path or configuration information (such as shared memory size, file mapping path, hash table capacity, etc.). This API should be called at application startup, typically only once, to complete the creation or connection of the underlying shared memory.
[0053] Write cache APIs, such as putData(String key, byte[] value), are used to write cached data with a specified key to shared memory. The key parameter is the data key (e.g., a string), and the value parameter is the data to be cached (a byte array). When this API is called, the C++ library writes the data to shared memory. Successful writes trigger the cache update notification mechanism, notifying other instances that the data corresponding to the key has been updated.
[0054] Cache read APIs, such as getData(String key), are used to read cached data based on a key. The key parameter is the query key, and the return value is the cached data content (byte array or Java object). When calling getData, the C++ library quickly locates the corresponding data using a hash index and returns it to the Java layer for use. If the requested data does not exist, a null value or a predefined identifier is returned.
[0055] Cache deletion APIs, such as remonstrate(String key), are used to remove data with a specific key from the shared cache. The parameter key is the key of the data to be removed. After calling this API, the C++ library deletes the corresponding record in shared memory and triggers a notification to other instances to clear the corresponding data from their caches, maintaining consistency across nodes.
[0056] Update Notification Registration Interface: This interface is used to register callbacks for cache updates on the Java side. When the C++ library detects an update to a key value, it calls the callback passed to it from Java via JNI. The callback parameter is a callback interface instance defined on the Java side. When the specified key value is updated, its predefined method is triggered to handle the event. By registering a listener, Java applications can promptly detect cache modifications made by other instances and take appropriate measures (such as refreshing local references).
[0057] The above interface design adheres to the principles of high cohesion and low coupling, with simple and clear parameters, making it easy to call applications from different Java Web frameworks. Developers can extend further interfaces as needed, such as batch retrieval interfaces or transaction control interfaces, to enhance system functionality. These interface methods decouple the Java application's business logic from the underlying cache implementation, allowing cached data to be accessed and maintained simply by calling the corresponding methods.
[0058] In summary, the specific embodiments of the present invention achieve efficient sharing and consistency maintenance of cached data in a multi-instance environment through the organic combination of a C++ dynamic link library and a JavaWeb platform. Each JavaWeb instance runs independently but collaborates closely through predefined local interfaces and synchronization mechanisms, ensuring real-time data consistency while improving cache access performance and reducing memory overhead. Compared to existing pure Java caching solutions, this invention effectively avoids the bottlenecks of frequent garbage collection and data synchronization, offering significant performance advantages and good scalability.
[0059] Example 2:
[0060] In this embodiment, in a typical high-concurrency Web system, the cache sharing solution of the present invention is used to uniformly manage user session data. When the system starts, the C++ dynamic link library is loaded through JNI and the shared cache area is initialized. Assume that there are multiple Java Web server instances (such as multiple Tomcat servers deploying the same application) that jointly serve a large number of user requests. After the user logs in, his session data (such as login credentials, personal settings, etc.) is stored in the shared memory cache by calling the C++ interface by the instance currently processing the request. When the session data is written, the C++ library locks the corresponding memory area to ensure the atomicity of the write operation. After the write is completed, an update notification is triggered, so that other server instances mark the old session cache of the user as invalid. When subsequent requests are routed to another server in the cluster, the server instance will not use expired local session data, but will obtain the latest session information from the shared memory through the getData interface. Since all instances share the same session cache area, the user's session status is consistent and up-to-date regardless of which server they access. For example, when a user modifies their profile on server A and updates it to the session, server B, when it subsequently processes a new request from the user, will read the updated profile from server A through the shared cache provided by the present invention. This avoids the delays and inconsistencies caused by traditional distributed session management relying on databases or sticky sessions, and enables real-time sharing of session data across multiple instances.
[0061] This embodiment faces high-concurrency requests. The caching mechanism of the present invention is used to accelerate query result responses and ensure data consistency across nodes. In this system, each application node loads a C++ dynamic link library upon startup and creates or connects to a shared memory area of a preset size as a query result cache. When the first batch of query requests arrives, one node interacts with the backend database to obtain the results and writes them to the shared cache using the putData interface. Because the write process is controlled by a locking mechanism in the C++ library, cache access to the query key by other nodes will be blocked or deemed a miss until the write is complete. After the cache write is complete and an update notification is triggered, all nodes can directly retrieve the query result from the shared memory using the getData interface to respond to subsequent identical queries, avoiding repeated database access. In high-concurrency scenarios, this design significantly reduces the pressure on the backend database and shortens user wait time. If the data corresponding to a query changes in the background (for example, inventory updates), the node responsible for monitoring data source changes will promptly update the shared cache using the C++ interface and broadcast the update notification to other nodes in the cluster using a message queue. Upon receiving the notification, other nodes clear the corresponding cache entry, ensuring that subsequent identical queries will re-retrieve the cache from the database and update the cache, thus ensuring that users receive the latest results. Through this cache management strategy, the present invention achieves efficient support for high-concurrency query scenarios while maintaining data consistency.
[0062] In this embodiment, the caching mechanism of the present invention can be smoothly integrated into different JavaWeb frameworks. The following uses the Spring framework and Tomcat server environment as examples to illustrate its cache synchronization solution. In applications using the Spring framework, the C++ dynamic link library can be encapsulated as a SpringBean. The library is loaded through Spring configuration and initCache is called when the application starts to complete the shared memory initialization. When the business component (such as Service or Controller) needs to access the cache, it obtains the cache interface object through dependency injection and then calls methods such as getData or putData. With the help of Spring's AOP feature, the cache read and write operations can also be designed as aspects for unified processing: for example, for methods with specific annotations (such as @Cacheable), transparent calls to the cache interface of the present invention can be implemented through aspect interception, thereby completing cache access without changing the business code. In the Tomcat server environment, the Servlet container's listener can be used to load the C++ dynamic link library when the application starts. For example, write a ServletContextListener, load the C++ library in the contextInitialized event, and call initCache to complete the shared cache initialization. For multiple Tomcat instances on the same physical server, the same shared memory identifier can be configured to connect each instance to the same shared memory area. In this way, when an instance updates the cache and triggers a notification, other instances can directly read the updated data from the shared memory without the need for network transmission. In a cross-server cluster environment, other synchronization means (such as broadcast notifications or centralized cache invalidation services) can be combined with the local sharing mechanism of the present invention to ensure that the cached data in the entire distributed system remains consistent. Through the above scheme, the present invention embodies the versatility and effectiveness in different types of JavaWeb platforms. Whether it is a full-stack framework such as Spring or a basic Web container such as Tomcat, the present invention can utilize its lifecycle management mechanism to realize the loading and operation of the cache module. Applications under each framework interact with the C++ cache module through a unified JNI interface, which ensures data synchronization consistency in a multi-instance environment while achieving performance improvement. In summary, in various JavaWeb platforms, the present invention provides an efficient and reliable cache synchronization solution with good portability and scalability.
[0063] The above description is merely a preferred embodiment of the present invention and does not constitute any form of limitation to the present invention. Although the present invention has been disclosed as a preferred embodiment as above, it is not intended to limit the present invention. Any person skilled in the art can make some changes or modifications to equivalent embodiments using the technical contents disclosed above without departing from the scope of the technical solution of the present invention. However, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention are still within the scope of the technical solution of the present invention.
Claims
1. A hybrid architecture dynamic cache synchronization method based on high concurrency scenarios, characterized in that: The following steps are involved: S1: Build a C++ dynamic link library. The C++ dynamic link library implements cache data management by allocating or connecting to a shared storage space. The shared storage space supports access by Java Web application instances. The cache data management includes cache data writing, cache data reading, and cache data eviction. S2: Start the Java Web application and load the C++ dynamic link library in the Java local interface to achieve hybrid architecture dynamic cache synchronization.
2. The hybrid architecture dynamic cache synchronization method according to claim 1, characterized in that: The shared storage space is created by mapping files to memory, and n Java Web application instances in the shared storage space share cache data by mapping corresponding files to memory spaces of respective processes.
3. The hybrid architecture dynamic cache synchronization method according to claim 1, characterized in that: The shared storage space is created through the shared memory mechanism of the operating system, and the n Java Web application instances in the shared storage space share cache data by accessing the same shared memory area.
4. The hybrid architecture dynamic cache synchronization method according to claim 1, characterized in that: The hybrid architecture dynamic cache synchronization method is adapted to the JavaWeb application environment of the Spring framework. By encapsulating the C++ dynamic link library as a Bean component in the Spring framework, the cache sharing function is loaded and used by the application when the Spring application context is initialized.
5. The hybrid architecture dynamic cache synchronization method according to claim 1, characterized in that: The hybrid architecture dynamic cache synchronization method is adapted to the Tomcat server environment. By utilizing the lifecycle management mechanism of the Tomcat container to load the C++ dynamic link library during the Web application deployment process, the cache data sharing function is initialized when the Tomcat server is started or the Web application is initialized and is available for use by multiple Web applications.
6. The hybrid architecture dynamic cache synchronization method according to claim 1, further comprising a cache data consistency control mechanism, characterized in that: The following steps are involved: When any Java Web application instance needs to update the target cache data, it first obtains an exclusive lock for the target cache data for exclusive access; Writing the updated data into the shared storage space managed by the C++ dynamic link library through the library, and releasing the exclusive lock after the writing is completed; After the cache data is updated, an update notification is triggered to notify other Java Web application instances of the updated information of the cache data; After receiving the update notification, other Java Web application instances obtain updated data according to the cache identifier included in the notification, or mark the corresponding local cache data as invalid and obtain the latest data from the shared storage space during the next access.
7. The hybrid architecture dynamic cache synchronization method according to claim 6, characterized in that: The cache data update operation supports transaction management, that is, when multiple cache data items need to be updated in batches, the update operation is encapsulated into a transaction; only when all update operations in the transaction are successfully completed, the corresponding cache update notification is sent to other JavaWeb application instances; when any update operation in the transaction fails, the executed cache update is canceled and the update notification is not sent.
8. The hybrid architecture dynamic cache synchronization method according to claim 6, characterized in that: The update notification is implemented through an event-driven mechanism, that is, when any Java Web application instance updates cache data, a pre-registered event notification is triggered to notify other Java Web application instances of the cache update information.
9. The hybrid architecture dynamic cache synchronization method according to claim 6, characterized in that: The update notification is implemented through a message queue mechanism, which includes encapsulating cache data update information into a message, and distributing the message by the message queue to notify other Java Web application instances to perform corresponding cache updates.
10. The hybrid architecture dynamic cache synchronization method according to claim 1, characterized in that: It also includes a cache performance optimization mechanism, including the following steps: Store cache data in the memory space managed by the C++ dynamic link library; Providing a direct access interface to cache data to the Java Web application through the C++ dynamic link library; Use data structures and search algorithms to organize and manage cache data; Pre-allocate and recycle storage space for cached data; Through a read-write lock mechanism or a lock-free concurrency control strategy, multiple threads can concurrently read cached data without blocking, and only the affected data range is locked when performing write operations.
Citation Information
Patent Citations
Real-time event management method for intelligent electronic equipment
CN101944119A
High-concurrency IPC data interaction method based on shared memory
CN114490141A
Map service method and system based on Vue and Mapbox GLJS
CN118689955A
Method for calculating takeoff and landing weight of multi-aircraft aircraft based on micro-service architecture
CN119597510A
Distributed change notifications for a distributed filesystem
US20150356116A1
Cited By
Gradle-based software RPM package construction method and system
CN120762733A