Digital library cloud cache and distributed resource scheduling optimization method
By marking shadow copies and generating dual-version connection scheduling instructions, the problem of reading discontinuity caused by changes in the main text content in the cloud resource service of digital libraries is solved, and session continuity and cache consistency are achieved during the change period, thereby improving resource utilization efficiency.
Patent Information
- Application Number
- CN202610804789.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-05
- Publication Date
- 2026-08-25
AI Technical Summary
In existing technologies for digital library cloud resource services, changes to the main text content can lead to jumps in reading content, discontinuous segment connections, and abrupt changes in access routes, affecting cache consistency and the accuracy of resource publishing. There is a lack of effective scheduling optimization methods.
By receiving resource change information, marking the original text cache copy as a shadow copy, recording the established reading sessions and serviceable shards, determining the relevance of access requests, scheduling them to the target service node, and generating dual-version connection scheduling instructions, we can ensure a smooth connection and session continuity between the old version and the current version.
It enables the continuity of established reading sessions during changes in the main text content, reduces reading interruptions and content jumps, improves resource utilization efficiency and cache consistency, and ensures that new access requests obtain the current version of the content.
Smart Images

Figure CN122640409A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cloud caching and distributed resource scheduling technology for digital libraries, specifically to optimization methods for cloud caching and distributed resource scheduling in digital libraries. Background Technology
[0002] In existing technologies for cloud resource services in digital libraries, resources such as e-books, journal texts, ancient book images, metadata, and search results are typically pre-cached across multiple cloud nodes. Scheduling is then based on user access location, node load, cache hit rate, or network status to reduce origin server pressure and improve access speed. However, as the scale of digital library collections and the number of concurrent online readers continue to increase, the text content is no longer merely a static file but frequently changes due to errata, supplements, copyright updates, formatting reflows, OCR revisions, or chapter replacements. For users who have already established a reading session, their reading progress, returned segments, and subsequent continuous accesses have strong contextual relationships. If the old cache is directly invalidated and a forced switch to the new version is made after the text content changes, it can easily cause problems such as content jumps, discontinuous segment connections, and abrupt changes in access routes. On the other hand, if the old cache copy continues to be allowed to respond as a complete service copy, new users may receive content that is not the current version, affecting cache consistency and the accuracy of resource publishing.
[0003] For example, Chinese invention patent application CN119760013A discloses a data synchronization method, apparatus, device, and medium under a multi-level caching architecture. It focuses on how, after receiving a data update request, the target application server pushes updates between the local caching layer and the distributed system caching layer, and updates the local caches of other application servers based on the cache node security index and subscription information, thereby improving data consistency and security between different caching levels. While this type of solution provides an improvement to the synchronization problem after cache data changes, it primarily addresses the update propagation and node synchronization issues between multi-level caching layers. It does not specifically address issues such as the retention of old version copies of digital library text resources during continuous reading sessions, serviceable shard limitations, isolation of unrelated access requests, and the connection between new and old versions of the text. Therefore, in scenarios where changes to text content occur simultaneously with continuous reading, relying solely on the cache synchronization mechanism is insufficient to balance the accuracy of the current version with the continuity of the existing reading session.
[0004] For example, Chinese invention patent application CN116320033A discloses a resource scheduling optimization method and apparatus. It generates a function call network topology diagram and uses a preset scheduling calculation model to determine the call frequency, thereby allocating resources, including computing power and cache resources, to functions in the cloud platform. This scheme embodies the technical idea of dynamically allocating cloud resources based on call relationships and call frequencies. However, its scheduling object mainly focuses on cloud function runtime resources and does not involve the collaborative determination of version identifiers, service status identifiers, and session association identifiers of digital library text cache copies. It also fails to address whether old copies can still be served after text changes, which fragments can be served, and when service should be stopped. Therefore, while existing technologies have conducted some research on cache consistency and dynamic resource allocation, in the scenario of digital library text resource changes, there is still a lack of a scheduling optimization method that can combine resource change type, cache copy version, reading session association, and fragment-level service scope to prevent old version content from being misused by unrelated requests, while ensuring that established reading sessions continue to receive continuous and stable text access services within a reasonable range. Summary of the Invention
[0005] The purpose of this invention is to provide a method for optimizing cloud caching and distributed resource scheduling in digital libraries, thereby addressing some of the shortcomings and deficiencies mentioned in the background art.
[0006] The present invention adopts the following technical solution to solve the above-mentioned technical problems:
[0007] The system receives resource change information for a target resource, queries the cached copy information of the target resource in the cloud cache node, the cached copy information includes a copy version identifier, a service status identifier, and a session association identifier, and determines the resource change type based on the resource change information; when the resource change type is a text content change, the cached copy of the text before the change is marked as a shadow copy, and the established reading session and serviceable shard set of the shadow copy are recorded, so that the shadow copy does not receive resource access requests unrelated to the established reading session as a complete text service copy; when an access request for the target resource is received, it is determined whether the access request is associated with the established reading session; if associated, the shadow copy continues to respond according to the serviceable shard set; if not associated, the target service node is determined from the cloud cache nodes whose copy version identifier is consistent with the current version identifier and whose service status identifier is serviceable, and the access request is scheduled to the target service node; when the established reading session ends or the shadow copy reaches the preset retention condition, the shadow copy is deleted or the text service of the shadow copy is stopped.
[0008] Furthermore, after marking the original text cache copy as a shadow copy, the continuous reading boundary is determined based on the position of the text fragment that was last successfully returned before the text content was changed in the established reading session and the preset continuous fragment range. The text fragments in the shadow copy that are located within the continuous reading boundary are set as sustainable service fragments. When the fragment identifier carried by the access request associated with the established reading session falls into the sustainable service fragment, the shadow copy responds. When the fragment identifier carried by the access request does not fall into the sustainable service fragment, the access request is scheduled to the target service node.
[0009] Furthermore, the resource change information has a text change location identifier. The affected and unaffected text fragments in the shadow replica are determined based on the text change location identifier. When the fragment identifier carried by an access request not associated with the established reading session falls into the unaffected text fragment, the scheduling node calls the unaffected text fragment for fragment reuse. When the fragment identifier carried by the access request falls into the affected text fragment, the shadow replica is prohibited from responding to the access request.
[0010] Furthermore, when an access request associated with the established reading session crosses the serviceable shard set of the shadow replica and the serviceable shard set of the current version cache replica, a dual-version connection scheduling instruction is generated, causing the shadow replica to return the main content before the version switch position, and causing the target service node to return the main content after the version switch position.
[0011] Furthermore, when determining the affected text segment based on the text change location identifier, the text segment that partially overlaps with the text change location identifier is re-divided into changed sub-segments and unchanged sub-segments. The changed sub-segments are assigned to the affected text segments, and the unchanged sub-segments are assigned to the unaffected text segments.
[0012] Furthermore, before reusing the unaffected text fragment, the fragment verification identifier of the unaffected text fragment is obtained, and the fragment verification identifier is compared with the verification identifier of the text fragment at the same text position in the current version cache copy; if the comparison is consistent, the unaffected text fragment is allowed to be reused; if the comparison is inconsistent, the unaffected text fragment is remarked as the affected text fragment.
[0013] Furthermore, when an access request not associated with the established reading session carries the fragment identifiers of both the affected and unaffected text fragments, the unaffected text fragment is treated as a reusable fragment, the affected text fragment is replaced with a text fragment at the same text position in the current version cache copy, and the fragments are combined and returned according to the text order corresponding to the access request.
[0014] Furthermore, when generating the dual-version connection scheduling instruction, the version switching position is determined based on the last service shard of the established reading session in the shadow replica and the first serviceable shard arranged along the reading progress direction in the current version cache replica, and the version switching position is written into the dual-version connection scheduling instruction.
[0015] Furthermore, after the target service node returns the main content after the version switch position, the session routing relationship of the established reading session is updated to point to the target service node, and the shadow replica stops providing main content services for access requests received after the version switch position.
[0016] Furthermore, before writing the version switching position into the dual-version connection scheduling instruction, the end text fragment in the shadow copy that is before the version switching position and the start text fragment in the current version cache copy that is after the version switching position are read, and connection verification is performed based on the text offset interval and fragment order identifier; when the connection verification fails, the version switching position is adjusted to the fragment boundary in the current version cache copy that passes the verification and is continuous with the reading progress of the established reading session.
[0017] This invention, upon receiving resource change information for a target resource, queries the cached copy information of the target resource in the cloud cache node. It then determines the resource change type by combining the copy version identifier, service status identifier, and session association identifier, enabling the differentiation between changes to the main text content and ordinary resource status changes. By marking the cached copy of the main text before the change as a shadow copy when the main text content changes, and recording the established reading session and the set of serviceable shards, the old version cached copy is no longer provided as a complete main text service copy for general service. This reduces the risk of unrelated access requests hitting expired main text content and improves version consistency of main text resources after publication in the digital library.
[0018] This invention further determines whether an access request is associated with an established reading session upon arrival: for associated requests, the shadow replica is allowed to continue responding according to the set of serviceable shards; for unassociated requests, the target service node is determined and scheduled from cloud cache nodes whose replica version identifier matches the current version identifier and whose service status is serviceable. This maintains the reading continuity of established reading sessions, reduces reading interruptions, content jumps, or duplicate loading caused by changes in the main text, and ensures that new access requests prioritize the current version's main text content, achieving isolation between session continuation services and current version access services.
[0019] This invention also deletes the shadow copy or stops its text service when an established reading session ends or the shadow copy reaches a preset retention condition, giving the old version cached copy a clear lifecycle and service boundary. This approach helps release cloud cache resources, avoids historical copies occupying node storage and scheduling capabilities for extended periods, and improves the resource utilization efficiency and operational reliability of distributed cache nodes in scenarios with frequent text updates. Attached Figure Description
[0020] Figure 1 This is a flowchart of the digital library cloud caching and distributed resource scheduling optimization method of the present invention.
[0021] Figure 2 This is a diagram showing the determination of continuous reading boundaries in Embodiment 1 of the present invention.
[0022] Figure 3 This is the dual-version connection scheduling diagram in Embodiment 1 of the present invention.
[0023] Figure 4 This is the session routing migration diagram in Embodiment 1 of the present invention.
[0024] Figure 5 This is a diagram showing the determination of text position change and segment overlap in Embodiment 2 of the present invention.
[0025] Figure 6 This is a diagram confirming the reuse ratio of unchanged content in Embodiment 2 of the present invention.
[0026] Figure 7 This is a return diagram of the affected fragment replacement combination in Embodiment 2 of the present invention. Detailed Implementation
[0027] As attached Figure 1As shown, in one implementation, the digital library cloud caching and distributed resource scheduling optimization method is executed by a resource scheduling system. After receiving resource change information for a target resource, the resource scheduling system queries the cached copy information of the target resource in the cloud cache node. The cached copy information includes a copy version identifier, a service status identifier, and a session association identifier. The session association identifier includes at least one of a resource identifier, a session identifier, a user access token, and a session establishment time, used to represent the correspondence between the cached copy and an established reading session. The resource scheduling system identifies the resource change type based on the resource change information to determine whether the target resource has undergone a change in its main content. When the resource change type is a change in main content, the resource scheduling system marks the cached copy of the main content before the change as a shadow copy and records the established reading session and the set of serviceable shards corresponding to the shadow copy. This prevents the shadow copy from receiving resource access requests unrelated to established reading sessions as a complete main content service copy, thereby avoiding new access requests from obtaining the old version of the main content while preserving the continuous reading capability of established reading sessions. When the resource scheduling system receives an access request for a target resource, it reads the session identifier carried in the access request and determines whether the access request is associated with an established reading session based on the session association identifier. If the session identifier in the access request matches the session identifier recorded in the session association identifier, and the resource identifier corresponding to the access request matches the target resource, it determines that the access request is associated with an established reading session. If the access request is associated with an established reading session, the resource scheduling system calls shadow replicas according to the set of serviceable shards to continue responding to the access request. If the access request is not associated with an established reading session, the resource scheduling system determines the target service node from cloud cache nodes whose replica version identifier matches the current version identifier and whose service status is serviceable, and then schedules the access request to the target service node. When determining the target service node, the resource scheduling system selects based on the current load, network response status, and node availability of the cloud cache node. When multiple cloud cache nodes meet the conditions, the system prioritizes cloud cache nodes with lower current load and normal response status. When the resource scheduling system detects that an established reading session has ended or that the shadow copy has reached a preset retention condition, it deletes the shadow copy or stops the text service of the shadow copy to release cache resources and complete cache cleanup after the text version switch. The preset retention conditions include at least one of the following: the shadow copy exceeds the preset retention time, the session corresponding to the shadow copy is not accessed within the preset time, the remaining cache space of the cloud cache node is lower than the preset space threshold, or a forced cleanup command is received from the resource management terminal.
[0028] After marking the original cached copy of the main text as a shadow copy, the resource scheduling system obtains the location of the last successfully returned main text fragment before the content change in the established reading session, and determines the continuous reading boundary by combining it with a preset continuous fragment range. The preset continuous fragment range is pre-set by the resource scheduling system based on the reading direction of the target resource, the fragment order identifier, and the session reading progress. It is used to limit the range of main text fragments extending from the last successfully returned main text fragment location in the reading progress direction. The continuous reading boundary is used to limit the range of old version main text that the established reading session can continue to access during the main text version switch. The resource scheduling system sets the main text fragments within the continuous reading boundary in the shadow copy as reusable service fragments and establishes a correspondence between reusable service fragments and established reading sessions. This correspondence is recorded in the session routing table, which includes the session identifier, shadow copy identifier, reusable service fragment identifier, and target resource identifier. When the resource scheduling system receives an access request associated with an established reading session, it reads the fragment identifier carried in the access request and determines whether the fragment identifier falls within a reusable service fragment. If the shard identifier falls within a sustainable service shard, the resource scheduling system invokes the shadow copy to respond to the access request, maintaining the user's continuous reading experience before and after the content changes. If the shard identifier does not fall within a sustainable service shard, the resource scheduling system routes the access request to the target service node, which then provides the content based on the current version's cached copy, thus preventing the shadow copy from continuing to provide older versions of the content beyond the continuous reading boundary.
[0029] In one implementation, the resource change information carries a text change location identifier. The resource scheduling system determines the range of text locations where the text content has changed based on the text change location identifier and maps this range to text fragments in the shadow copy. The text change location identifier includes at least one of a chapter identifier, a paragraph identifier, a text offset identifier, and a fragment order identifier. The text fragment records in the shadow copy have a fragment start position, a fragment end position, and a fragment order identifier. The resource scheduling system determines the text fragment corresponding to the text change location identifier by comparing it with the location range recorded in the text fragment records. The resource scheduling system identifies text fragments that correspond to the text location range as affected text fragments and those that do not correspond to the text location range as unaffected text fragments. When the resource scheduling system receives an access request not associated with an established reading session, it reads the fragment identifier carried in the access request and determines whether the fragment identifier falls within an unaffected text fragment. If the fragment identifier falls into an unaffected text fragment, the resource scheduling system will reuse the unaffected text fragment to reduce duplicate transmission and storage of the current version cache copy. If the fragment identifier falls into an affected text fragment, the resource scheduling system will prevent the shadow copy from responding to the access request and will redirect the access request to the service node corresponding to the current version cache copy, thereby avoiding the return of the old version text content that has undergone text changes.
[0030] When identifying affected text fragments, the resource scheduling system determines the overlap between the text change location identifier and the text fragment. For text fragments that partially overlap with the text change location identifier, the resource scheduling system re-divides the text fragments into changed sub-fragments and unchanged sub-fragments according to the text location range. The changed sub-fragments are assigned to the affected text fragments, and the unchanged sub-fragments are assigned to the unaffected text fragments. The re-divided changed and unchanged sub-fragments inherit the resource identifier and version identifier of the original text fragments, respectively, and record the corresponding sub-fragment start position, sub-fragment end position, and sub-fragment sequence identifier for identification during subsequent scheduling and reuse. Through the above processing, the resource scheduling system can further distinguish between changed and unchanged text areas at the fragment granularity, improving the reuse ratio of unchanged content in shadow copies.
[0031] Before reusing unaffected text fragments, the resource scheduling system obtains the fragment verification identifier of the unaffected text fragment and the verification identifier of the text fragment at the same text position in the current version's cache copy. The fragment verification identifier is generated by the resource scheduling system based on the text content, fragment order identifier, and resource version identifier of the text fragment, and is stored along with the corresponding text fragment's metadata. When a text fragment at the same text position in the current version's cache copy has not yet generated a verification identifier, the resource scheduling system first reads the content of that text fragment and generates the corresponding verification identifier. The resource scheduling system compares the two verification identifiers. If they match, it confirms that the unaffected text fragment's content is consistent with the text fragment at the same text position in the current version's cache copy, and allows the resource scheduling system to reuse the unaffected text fragment. If they do not match, the resource scheduling system confirms that the unaffected text fragment no longer meets the reuse conditions and re-marks the unaffected text fragment as an affected text fragment to avoid inconsistencies in text content caused by fragment reuse.
[0032] When an access request not associated with an established reading session carries fragment identifiers for both affected and unaffected text fragments, the resource scheduling system treats the unaffected text fragment as a reusable fragment and reads a text fragment with the same text position as the affected text fragment from the current version's cache copy. The resource scheduling system replaces the affected text fragment with the text fragment read from the current version's cache copy, then combines the reusable fragment and the replaced text fragment according to the text order corresponding to the access request, and returns the combined text content to the request initiator. During the combination process, the resource scheduling system determines the return order based on the fragment order identifier and the text position identifier, and retains the resource version identifier and fragment identifier corresponding to each text fragment in the combined text content, so that the request initiator can continue to initiate subsequent fragment requests. Through this method, the resource scheduling system can reuse unchanged text content in the shadow copy while ensuring the consistency of the current version's text, thereby reducing the transmission overhead during cache updates and resource scheduling.
[0033] In one implementation, when processing an access request associated with an established reading session, the resource scheduling system determines whether the text fragment range corresponding to the access request spans both the serviceable fragment set of the shadow replica and the serviceable fragment set of the current version cache replica. If the text fragment range corresponding to the access request spans both serviceable fragment sets, the resource scheduling system generates a dual-version continuation scheduling instruction. This instruction coordinates the return of text content from different version ranges by the shadow replica and the target service node. The dual-version continuation scheduling instruction includes a session identifier, a target resource identifier, a shadow replica identifier, a target service node identifier, a version switch position, the fragment range returned by the shadow replica, the fragment range returned by the current version cache replica, and the order of content combination. Based on the dual-version continuation scheduling instruction, the resource scheduling system causes the shadow replica to return text content before the version switch position and the target service node to return text content after the version switch position, thus enabling continuous continuation between the old and current version text within the same reading session.
[0034] When generating the dual-version connection scheduling instruction, the resource scheduling system reads the last service fragment of the established reading session in the shadow copy and the first serviceable fragment arranged along the reading progress direction in the current version cache copy. The resource scheduling system determines the version switch position based on the last service fragment and the first serviceable fragment, and performs a connection verification on the version switch position before writing it. During the connection verification, the resource scheduling system reads the last text fragment in the shadow copy that is before the version switch position and the first text fragment in the current version cache copy that is after the version switch position. It then determines whether the last text fragment and the first text fragment can be continuously connected according to the reading progress based on the text offset range and fragment order identifier. If the connection verification passes, the resource scheduling system writes the version switch position into the dual-version connection scheduling instruction. If the connection verification fails, the resource scheduling system adjusts the version switch position to the fragment boundary in the current version cache copy that passes the verification and is continuous with the reading progress of the established reading session, and writes the adjusted version switch position into the dual-version connection scheduling instruction. If no shard boundary that is continuous with the reading progress of an established reading session is found in the current version cache copy, the resource scheduling system will stop calling the shadow copy to continue providing the old version of the main text content, and will schedule the access request to the target service node so that the target service node provides the main text content according to the current version cache copy.
[0035] After the target service node returns the main content following the version switch location, the resource scheduling system updates the session routing relationship of established reading sessions to point to the target service node. This ensures that subsequent main content access for established reading sessions is provided by the target service node based on the current version cache copy. Simultaneously, the resource scheduling system stops the shadow copy from providing main content services for access requests received after the version switch location, preventing established reading sessions from continuing to access the old version's main content after the version switch is complete. The resource scheduling system also writes the session routing relationship update time, the target service node identifier, and the current version identifier into the session routing table, and updates the session association identifier corresponding to the shadow copy to a migrated state. When the shadow copy has no other unmigrated established reading sessions, the resource scheduling system deletes the shadow copy or stops the shadow copy's main content service according to preset retention conditions. Through these processes, the resource scheduling system can achieve a smooth transition between the old version's shadow copy and the current version's cache copy during main content changes, and stably migrate session services to the current version's cache copy after the transition is complete.
[0036] Example 1:
[0037] In one implementation, the digital library cloud caching and distributed resource scheduling optimization method is executed by a resource scheduling system deployed on Company A's cloud resource management platform. After receiving resource change information for target resource R1, the resource scheduling system queries the cached replica information of target resource R1 in multiple cloud caching nodes. The cached replica information includes replica version identifier, service status identifier, and session association identifier, and determines the resource change type based on the resource change information.
[0038] When the resource change type is a change in the main text content, the resource scheduling system marks the cached copy of the main text before the change as a shadow copy. It records the established reading session S1 and the set of serviceable shards corresponding to the shadow copy, ensuring that the shadow copy does not receive resource access requests unrelated to the established reading session S1 as a complete service copy of the main text. Thus, the resource scheduling system can prevent new access requests from accessing the old version of the main text content, while preserving the continuous reading capability of the established reading session S1 before and after the main text content change.
[0039] In this embodiment, the target resource R1 has 120 text fragments. The resource change information indicates that the text content of the target resource R1 has changed near the 47th fragment. The resource scheduling system reads the sequence number L of the last successfully returned text fragment of the established reading session S1 before the text content change, and reads the preset continuous fragment range W, where L represents the sequence number of the last successfully returned text fragment of session S1 before the text content change, W represents the number of continuous fragments that the shadow replica is allowed to continue serving after the last successfully returned text fragment, and E represents the continuous reading boundary endpoint. The continuous reading boundary endpoint E is determined according to the following formula:
[0040]
[0041] When L is 45 and W is 8, the resource scheduling system calculates E to be 53. This calculation indicates that the established reading session S1 has successfully read up to the 45th fragment before the content changes. The resource scheduling system allows the shadow copy to continue providing 8 more fragments after the 45th fragment, i.e., fragments 46 to 53. Therefore, the continuous reading boundary corresponding to the shadow copy is fragments 45 to 53. Based on this, the resource scheduling system sets fragments 45 to 53 in the shadow copy as reusable service fragments and establishes a correspondence between the reusable service fragments and the established reading session S1. Figure 2 As shown in the figure, the horizontal reading direction is based on the text fragment number. The 45th fragment is the last successfully returned fragment, the 53rd fragment is the end point of the continuous reading boundary, and the 54th fragment is the starting point of the current version cached copy to continue the service. This can intuitively show that the shadow copy only continues to serve within the limited boundary, while the current version cached copy takes over the text access after the boundary.
[0042] When the resource scheduling system receives an access request for the target resource R1, it reads the session identifier and fragment identifier carried in the access request, and determines whether the access request is associated with an established reading session S1 based on the session association identifier. If the access request is associated with an established reading session S1, and the fragment identifier carried in the access request falls within the range of sustainable service fragments corresponding to fragments 45 to 53, the resource scheduling system calls the shadow copy to respond to the access request, so as to maintain the user's continuous reading experience before and after the change of the main text content.
[0043] If the shard identifier carried by an access request associated with an established reading session S1 does not fall within the range of sustainable service shards, the resource scheduling system determines the target service node from cloud cache nodes whose replica version identifier matches the current version identifier and whose service status is serviceable, and schedules the access request to the target service node. The target service node provides the main content based on the current version cache replica, ensuring that the established reading session S1 no longer retrieves the old version of the main content after exceeding the continuous reading boundary.
[0044] When an access request for an established reading session S1 crosses the serviceable shard set of the shadow replica and the serviceable shard set of the current version cache replica, the resource scheduling system generates a dual-version transition scheduling instruction. This instruction coordinates the shadow replica to return the content before the version transition position and coordinates the target service node to return the content after the version transition position. P represents the version transition position, which is the shard number from which the current version cache replica begins service. P is determined by the following formula:
[0045]
[0046] When E is 53, the resource scheduling system calculates P to be 54. This calculation indicates that after the shadow copy service reaches the 53rd shard, the target service node starts providing the current version of the main text content from the 54th shard. Since the 54th shard is the first currently available shard after the 53rd shard in the reading progress direction, using the 54th shard as the version switching point allows for a continuous transition between the old and current versions of the main text within the same reading session. Combined with... Figure 3 As shown, when the access request covers fragments 50 to 57, the resource scheduling system includes fragments 50 to 53 in the shadow replica return range and fragments 54 to 57 in the target service node return range, and uses fragment 54 as the concatenation boundary of the two types of content, so that a cross-version access request can form a combined return content according to the order of the content.
[0047] Before writing the version switch position into the dual-version connection scheduling instruction, the resource scheduling system reads the last text fragment (fragment 53) in the shadow copy that is before the version switch position, and reads the first text fragment (fragment 54) in the current version cache copy that starts from the version switch position. The resource scheduling system performs a connection check based on the text offset range and fragment order identifier to determine whether fragments 53 and 54 can be connected continuously according to the reading progress.
[0048] If the connection verification passes, the resource scheduling system writes the version switch position into the dual-version connection scheduling instruction, and according to the instruction, causes the shadow replica to return the content before the 54th shard, and the target service node to return the content from the 54th shard onwards. If the connection verification fails, the resource scheduling system adjusts the version switch position to the shard boundary in the current version cache replica that passes the verification and is continuous with the reading progress of the established reading session S1, and writes the adjusted version switch position into the dual-version connection scheduling instruction.
[0049] After the target service node returns the version switch location and the subsequent content, the resource scheduling system updates the session routing relationship of the established reading session S1 to point to the target service node. This ensures that subsequent content access for the established reading session S1 is served by the target service node based on the current version cached copy. Simultaneously, the resource scheduling system stops the shadow replica from providing content service for access requests received at and after the version switch location, to prevent the established reading session S1 from continuing to access the old version's content after the version switch is complete. Combined with... Figure 4 As shown, the session routing points from the shadow replica service stage to the dual-version transition stage, and switches to the target service node service after the route migration; correspondingly, the shadow replica status changes from "maintained by the main text service" to "stopped by the main text service". This status change corresponds to the route update and old version main text service convergence process after the resource scheduling system completes the version switch.
[0050] When the resource scheduling system detects that an established reading session S1 has ended, or that the shadow copy has reached a preset retention condition, it deletes the shadow copy or stops the text service of the shadow copy. The preset retention conditions include the shadow copy exceeding a preset retention period, the session corresponding to the shadow copy not being accessed within a preset time, insufficient remaining cache space on the cloud cache node, or receiving a cleanup command from the resource management terminal. Through the above processing, the resource scheduling system can achieve a smooth transition between the old version shadow copy and the current version cache copy during changes to the text content of the target resource R1, and stably migrate the session service to the current version cache copy after the transition is complete.
[0051] Example 2:
[0052] In one implementation, the digital library cloud caching and distributed resource scheduling optimization method is executed by a resource scheduling system deployed on Company A's cloud resource management platform. After receiving resource change information for target resource R2, the resource scheduling system reads the text change location identifier carried in the resource change information and determines the affected and unaffected text fragments in the shadow copy based on the text change location identifier.
[0053] In this embodiment, the old version of the text cache copy of the target resource R2 has been marked as a shadow copy. The shadow copy includes multiple text fragments, and each text fragment records a fragment identifier, a text offset range, and a fragment order identifier. After reading the text change location identifier, the resource scheduling system compares the text offset range corresponding to the text change location identifier with the text offset ranges of each text fragment in the shadow copy to determine whether the location where the text content has changed falls within the corresponding text fragment.
[0054] In this embodiment, the old version text fragment F20 corresponds to the text offset range from character 38001 to character 40000, and the text change position identifier carried in the resource change information corresponds to the text offset range from character 39200 to character 39650. 'a' represents the starting offset position of the old version text fragment, 'b' represents the ending offset position of the old version text fragment, 'c' represents the starting offset position of the text change position, 'd' represents the ending offset position of the text change position, and 'O' represents the overlap length between the old version text fragment and the text change position. The overlap length 'O' is determined according to the following formula:
[0055]
[0056] Substituting 'a' (38001), 'b' (40000), 'c' (39200), and 'd' (39650) into the above expression, the resource scheduling system determines that the common coverage portion of the two intervals is characters 39200 to 39650, and calculates O as 451 characters. This result indicates that there is partial overlap between the text fragment F20 and the text change location identifier. The resource scheduling system identifies the content corresponding to characters 39200 to 39650 in F20 as the changed sub-fragment, and identifies the content corresponding to characters 38001 to 39199 and characters 39651 to 40000 as the unchanged sub-fragments. Combined with... Figure 5 As shown in the figure, the upper and lower segmentation bands represent the interval relationship before and after F20 division, and the overlapping area from character 39200 to character 39650 is defined by two change position boundaries, so that the affected content and the unaffected content remain corresponding under the same text offset coordinate, which makes it easier to explain how the resource scheduling system completes the segmentation overlap judgment based on the text offset interval.
[0057] Based on the above overlap determination results, the resource scheduling system classifies changed sub-fragments into affected text fragments and unchanged sub-fragments into unaffected text fragments. For text fragments that do not overlap with the text change location identifier, the resource scheduling system determines them as unaffected text fragments; for text fragments that fall entirely within the range corresponding to the text change location identifier, the resource scheduling system determines them as affected text fragments.
[0058] When repartitioning F20, the resource scheduling system retains the resource identifier and fragmentation order identifier of F20, and records the corresponding sub-fragment offset ranges for the changed and unchanged sub-fragments obtained from the repartitioning. During subsequent access scheduling, the resource scheduling system identifies the text content that needs to be provided by the current version cache replica, as well as the text content that can be reused by shadow replicas, based on the sub-fragment offset ranges.
[0059] In this embodiment, T represents the total character length of the original text fragment F20, U represents the reusable character length in F20, and Q represents the reuse ratio. The resource scheduling system determines the reusable character length U based on the overlap length O, and determines the reuse ratio Q according to the following formula:
[0060]
[0061] In F20, the total character length T is 2000 characters, the overlap length O is 451 characters, and the reusable character length U is 1549 characters. The resource scheduling system substitutes U (1549) and T (2000) into the above expression, calculating Q as 77.45%. This result indicates that 77.45% of the main text content in F20 remains unaffected by text changes, and the resource scheduling system can reuse this unaffected content after verification. Combined with... Figure 6 As shown in the figure, the 2000 characters of F20 are divided into 1549 reusable characters and 451 modified characters. The source of the reuse ratio is shown through the reuse boundary and the total length boundary of the fragment, so that the reuse ratio Q can correspond to the actual characters in the text fragment.
[0062] Before reusing unaffected text fragments, the resource scheduling system obtains the fragment verification identifier of the unaffected text fragments and the verification identifier of the text fragments at the same text position in the current version cache replica. The fragment verification identifier is used to indicate the content consistency of the corresponding text fragments at the same text position. The resource scheduling system compares the two verification identifiers to determine whether the unaffected text fragments in the shadow replica meet the reuse conditions.
[0063] If the fragment verification identifier of an unaffected text fragment matches the verification identifier of a text fragment at the same position in the current version's cached copy, the resource scheduling system allows the reuse of the unaffected text fragment. If the two verification identifiers do not match, the resource scheduling system confirms that the unaffected text fragment no longer meets the reuse condition and re-marks the unaffected text fragment as an affected text fragment, causing the corresponding access request to be handled by the service node corresponding to the current version's cached copy.
[0064] When an access request not associated with an established reading session carries a fragment identifier that falls into an unaffected text fragment, the resource scheduling system calls the unaffected text fragment for fragment reuse. When an access request carries a fragment identifier that falls into an affected text fragment, the resource scheduling system prohibits the shadow replica from responding to the access request and causes the access request to be handled by the service node corresponding to the current version cache replica.
[0065] When access requests for F19, F20, and F21 simultaneously, and these requests are not associated with an established reading session, the resource scheduling system first determines the correspondence between each fragment and the text change location identifier. If F19 and F21 do not overlap with the text change location identifier, the resource scheduling system treats F19 and F21 as reusable fragments. If F20 partially overlaps with the text change location identifier, the resource scheduling system treats the unchanged sub-fragments in F20 as reusable content and replaces the changed sub-fragments in F20 with the text content at the same text location in the current version's cached copy. Figure 7 As shown in the figure, the access request covers F19, F20 and F21 under the same text offset coordinate, and the shadow copy reuse segment and the current version replacement segment are marked in the combined returned content, which can represent the process of the resource scheduling system to reuse unchanged content, replace changed positions and reorganize the return order in an access request.
[0066] After completing the replacement, the resource scheduling system combines the unchanged sub-fragments in F19 and F20, the changed content provided by the current version cache copy, and F21 according to the text order corresponding to the access request, and returns the combined text content to the initiator of the access request. During the combination process, the resource scheduling system determines the return order of each content segment based on the text offset range and fragment order identifier, ensuring that the returned text remains continuous in the reading direction.
[0067] When an access request only involves affected text fragments, the resource scheduling system does not invoke the shadow replica to respond to the access request. Instead, it schedules the access request to the service node corresponding to the current version cache replica. When an access request only involves unaffected text fragments and the verification identifier matches, the resource scheduling system calls the unaffected text fragments in the shadow replica for reuse, thereby reducing duplicate transmission and storage of the current version cache replica.
[0068] Through the above methods, the resource scheduling system can distinguish between affected and unaffected text fragments based on the location identifier of the text change after the text content is changed, and perform fine-grained division of some overlapping text fragments, thereby increasing the reuse ratio of unchanged text content in shadow copies while ensuring the consistency of the text in the current version.
Claims
1. A method for optimizing cloud caching and distributed resource scheduling in a digital library, characterized in that, include: Receive resource change information of the target resource, query the cached copy information of the target resource in the cloud cache node, the cached copy information includes copy version identifier, service status identifier and session association identifier, and determine the resource change type based on the resource change information; When the resource change type is a change in the main text content, the cached copy of the main text before the change is marked as a shadow copy, and the established reading sessions and serviceable shard set of the shadow copy are recorded, so that the shadow copy does not receive resource access requests that are not associated with the established reading sessions as a complete main text service copy. When an access request for the target resource is received, it is determined whether the access request is associated with the established reading session; if associated, the shadow replica continues to respond according to the set of serviceable shards. When not associated, the target service node is determined from cloud cache nodes whose copy version identifier matches the current version identifier and whose service status is serviceable, and the access request is scheduled to the target service node; when the established reading session ends or the shadow copy reaches the preset retention conditions, the shadow copy is deleted or the text service of the shadow copy is stopped.
2. The optimization method according to claim 1, characterized in that, After marking the original text cache copy as a shadow copy, the continuous reading boundary is determined based on the position of the text fragment that was last successfully returned before the text content was changed in the established reading session and the preset continuous fragment range. The text fragments in the shadow copy that are located within the continuous reading boundary are set as sustainable service fragments. When the fragment identifier carried by the access request associated with the established reading session falls into the sustainable service fragment, the shadow copy responds. When the fragment identifier carried by the access request does not fall into the sustainable service fragment, the access request is scheduled to the target service node.
3. The optimization method according to claim 1, characterized in that, The resource change information has a text change location identifier, and the affected text fragments and unaffected text fragments in the shadow copy are determined according to the text change location identifier; When the fragment identifier carried by an access request not associated with the established reading session falls into the unaffected text fragment, the scheduling node calls the unaffected text fragment for fragment reuse; when the fragment identifier carried by the access request falls into the affected text fragment, the shadow copy is prohibited from responding to the access request.
4. The optimization method according to claim 1, characterized in that, When an access request associated with the established reading session spans the serviceable shard set of the shadow replica and the serviceable shard set of the current version cache replica, a dual-version connection scheduling instruction is generated, causing the shadow replica to return the main content before the version switch position and the target service node to return the main content after the version switch position.
5. The optimization method according to claim 3, characterized in that, When determining the affected text segment based on the text change location identifier, the text segment that partially overlaps with the text change location identifier is re-divided into changed sub-segments and unchanged sub-segments. The changed sub-segments are assigned to the affected text segments, and the unchanged sub-segments are assigned to the unaffected text segments.
6. The optimization method according to claim 3, characterized in that, Before reusing the unaffected text fragment, obtain the fragment verification identifier of the unaffected text fragment and compare the fragment verification identifier with the verification identifier of the text fragment at the same text position in the current version cache copy; if the comparison matches, the unaffected text fragment is allowed to be reused; if the comparison does not match, the unaffected text fragment is remarked as the affected text fragment.
7. The optimization method according to claim 3, characterized in that, When an access request that is not associated with the established reading session carries the fragment identifiers of both the affected and unaffected text fragments, the unaffected text fragment is treated as a reusable fragment, the affected text fragment is replaced with a text fragment at the same text position in the current version cache copy, and then returned after being combined according to the text order corresponding to the access request.
8. The optimization method according to claim 4, characterized in that, When generating the dual-version connection scheduling instruction, the version switching position is determined based on the last service shard of the established reading session in the shadow replica and the first serviceable shard arranged along the reading progress direction in the current version cache replica, and the version switching position is written into the dual-version connection scheduling instruction.
9. The optimization method according to claim 4, characterized in that, After the target service node returns the main content after the version switch position, the session routing relationship of the established reading session is updated to point to the target service node, and the shadow replica stops providing main content services for access requests received after the version switch position.
10. The optimization method according to claim 8, characterized in that, Before writing the version switching position into the dual-version connection scheduling instruction, the system reads the end text fragment in the shadow copy that is before the version switching position and the start text fragment in the current version cache copy that is after the version switching position, and performs connection verification based on the text offset range and fragment order identifier. When the connection verification fails, the version switching position is adjusted to the fragment boundary in the current version cache copy that passes the verification and is continuous with the reading progress of the established reading session.
Citation Information
Patent Citations
Resource scheduling optimization method and device
CN116320033A
Data synchronization method and device under multi-level cache architecture, equipment and medium
CN119760013A