Method and apparatus for removing stale context in service instances in providing microservices

Inventors

Wang, XiaodongLiao, Qinghua

Assignees

Hong Kong Applied Science and Technology Research Institute ASTRI

Interested in licensing this patent?

MTEC can help explore whether this patent might be available for licensing for your application.

Publication Number

US-12095885-B2

Patent

Publication Date

2024-09-17

Expiration Date


Abstract

A method for removing stale context in a service instance, comprising: generating a user message according to UID and request instruction of received request data; routing the user message to first service instance; if target context corresponding to the user ID is saved in a global cache of a database, loading the target context from the global cache; when the loaded target context does not belong to the first service instance, setting the loaded target context to belong to the first service instance, wherein the set target context is saved into a first local cache and the global cache; and instructing to remove one or more invalid target contexts corresponding to the user ID from one or more other service instances, wherein the invalid target contexts are target contexts which do not belong to the first service instance, such that stale contexts which are the invalid target context are removed.

Core Innovation

The invention relates to removing stale context in a microservice architecture during auto-scaling for a service instance providing a microservice to an electronic device. A server receives request data from the electronic device, where the request data includes a UID and a request instruction, generates a user message according to the UID and the request instruction, and routes the user message to a first service instance of the microservice.

The server determines whether a target context corresponding to the user ID is saved in a first local cache of the first service instance. When the target context is not saved in the first local cache, the server determines whether the target context is saved in a global cache of a database.

If the target context is not saved in the global cache, the server creates the target context based on the user message and sets the created target context to belong to the first service instance, and saves the target context into the first local cache and into the global cache residing in the database. If the target context is saved in the global cache, the server loads the target context from the global cache, determines whether the loaded target context belongs to the first service instance, and, when it does not belong, sets the loaded target context to belong to the first service instance and saves it to the local and global caches. The server instructs other service instances to remove one or more invalid target contexts corresponding to the user ID such that stale contexts are removed.

Claims Coverage

The partial content includes three independent claims: clm-00001 (method), clm-00008 (server), and clm-00015 (system). Across these independent claims, the inventive coverage centers on local and global cache checking for a user-specific target context, creating or reassigning that context to a first service instance using membership determination, and propagating invalidation so stale contexts are removed from other service instances.

Routing a user message by UID and instruction with a user ID

Receiving request data including a UID and a request instruction, generating a user message according to the UID and the request instruction, where the user message includes a user ID corresponding to the UID, and routing the user message to a first service instance of the microservice.

Local-first and global-cache determination for a target context

Determining whether a target context corresponding to the user ID is saved in a first local cache of the first service instance, and when it is not saved in the first local cache, determining whether a target context corresponding to the user ID is saved in a global cache of a database.

Create or load target context and assign it to the first service instance

When the target context is not saved in the global cache, creating the target context based on the user message and setting the created target context to belong to the first service instance, saving the target context into the first local cache and into the global cache; and when the target context is saved in the global cache, loading the target context from the global cache and determining whether the loaded target context belongs to the first service instance.

Reassign ownership by membership determination and correct caches

When the loaded target context does not correspond the first service instance, setting the loaded target context to belong to the first service instance, saving the set target context into the first local cache and into the global cache residing in the database.

Remove invalid target contexts from other service instances

Instructing to remove one or more invalid target contexts corresponding to the user ID from one or more other service instances, where the invalid target contexts are target contexts which do not belong to the first service instance, such that stale contexts which are the invalid target context are removed.

Across the independent claims, the core claim coverage implements stale-context removal by routing a user message to a first service instance, checking for a corresponding target context in a first local cache and then a global database cache, creating or loading the target context, reassigning it to the first service instance when membership does not match, saving to local and global caches, and instructing removal of invalid target contexts from other service instances.

Stated Advantages

Removes stale contexts by removing invalid target contexts corresponding to the user ID from one or more other service instances.

Ensures the target context belongs to the first service instance by creating or reassigning it based on local/global cache presence and membership determination.

Documented Applications

No documented applications found

JOIN OUR MAILING LIST

Stay Connected with MTEC

Keep up with active and upcoming solicitations, MTEC news and other valuable information.