Company
Date Published
Author
Chrono Law
Word count
1476
Language
English
Hacker News points
None

Summary

Kong Gateway, built on Nginx/OpenResty, faced challenges in efficiently sharing information between its isolated worker processes, prompting a shift from the lua-resty-worker-events library to the newly developed lua-resty-events library. The older library relied heavily on shared memory and polling, which resulted in high overhead and inefficiencies, particularly under conditions of heavy traffic. The new lua-resty-events library, integrated into Kong 3.0, leverages Nginx's native event loop and a publish/subscribe system using UNIX domain sockets to facilitate asynchronous message dispatch without the drawbacks of shared memory, thus improving performance and reducing CPU usage. Benchmark tests demonstrated that lua-resty-events significantly enhances the handling of massive events compared to its predecessor, offering lower latency and more stable CPU consumption. This transition reflects an advancement in Kong Gateway's capability to manage large-scale cloud-native traffic, with ongoing development aimed at further enhancing the library's features and efficiency.