nginx / njs

A subset of JavaScript language to use in nginx
http://nginx.org/en/docs/njs/
BSD 2-Clause "Simplified" License
1.25k stars 155 forks source link

Add Support for js_balancer like balancer_by_lua_block #696

Open liaojianxiong opened 8 months ago

liaojianxiong commented 8 months ago

Are there any plans to introduce a js_balancer function akin to balancer_by_lua_block found in the Lua Nginx Module (https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#balancer_by_lua_block)? We rely on balancer_by_lua for dynamically selecting servers. For instance, we utilize server tagging across multiple upstreams and use variables as a switch to avoid selecting servers with specific tags during proxying. This balancer hook is highly beneficial. However, it seems that NJS lacks a comparable hook.

xeioex commented 8 months ago

Hi @liaojianxiong,

we plan to introduce js_balancer in the future. Thank you for the feedback. Speaking of priority, we plan to introduce a new JS engine first, before adding new features, like js_balancer.

liaojianxiong commented 8 months ago

Thanks @xeioex , hope the new JS engine goes smoothly.