openresty / openresty/lua-nginx-module

conditional shm get, eagain

Open
#2,307 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.8k
Forks
2.1k
Avg merge
6h 1m
Merged PRs (30d)
6

Description

Some time ago, an issue was raised: #1921, followed by a subsequent pull request: #1954.

The issue we aimed to address was selectively retrieving data from shared memory (shm) and deserializing it only if the version of the key in shm differed from what was stored in the least recently used (lru) cache or a local Lua variable. This feature could prove immensely useful for swiftly and accurately updating configuration changes while maintaining a cached copy in each worker for efficiency (which is validated upon request).

@agentzh, the original issue became somewhat complex due to the inclusion of both compare-or-get (cog) and compare-and-swap (cas) operations, as well as incorporating the original value into the get API. Could you or someone else reconsider this and possibly streamline it, for instance, into a function like get_conditional(key, flags?) returning value, flags, flags_match, where value and flags are returned only if flags_match is false?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading issues #1921 and pull request #1954 to understand the prior compare-or-get and compare-and-swap work. Then evaluate the proposed get_conditional(key, flags?) API and its shared-memory behavior; the issue is complete only when the streamlined return behavior and scope are defined and implemented.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, lua, nginx
Domain
backend, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.