Kong: a custom plugin's shared state is per worker, not per node

kong.ctx and Lua module-level variables live in one nginx worker process. With several workers, a counter or cache initialised in a plugin exists once per worker - so a node with 8 workers holds 8 independent copies.

Full code & output

This topic is available to PRO members.

Sign in Create a free account

Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.

Published 2026-08-25