peter-leonov / ngx_http_js_module

nginx javascript module
226 stars 16 forks source link

port to plain old C++ #10

Open peter-leonov opened 14 years ago

peter-leonov commented 14 years ago

reread those great books about C++ and port all the module to it

brylie commented 9 years ago

Is this still in progress? If so, what would help this to be completed?

peter-leonov commented 9 years ago

Nope. Developers would definitely help. By the way, how do you actually use the project which is 6 years old?

brylie commented 9 years ago

There is a project called API Umbrella that is planning to rewrite its Node.js backend using Lua/nginx. The primary developer has described the plans/considerations in detail, mentioning a few positives and negatives. One of the potential drawbacks is that the Lua ecosystem does not seem as active as the JavaScript ecosystem in some regards, specifically async libraries.

My interest is to see if JavaScript might be a viable option for the rewrite, and I have found some mention that nginx plans to natively support JavaScript. So, in the meantime, I am curious if your _ngx_httpjs might be a stepping stone to rebuild API Umbrella gatekeeper as an nginx integrated app.

peter-leonov commented 9 years ago

Ok, I think I've got the point of the proposed architecture.

My experience tells me that the best skill of nginx as a frontent server is it's scalability and stability. Adding thick JS engine not built for server-side usage, adding shared heap with garbage collector, adding JS libraries with crazy quality, adding purely written JS + C code + network code modules, adding all of this to nginx one can easily break the two mentioned advantages.

It is always better write simple nginx modules which send simple HTTP/FCGI request to a cluster of decision making fat Umbrella. Then the Umbrella server can send back simple instructions the nginx module should easily follow. It may even be a portion of Lua code, or a byte code for a simple stack based VM nginx already has.

peter-leonov commented 9 years ago

It might be strange to hear such things from a developer of this kind of module, but this is life. My opinion as also based on Igor Sysoev's answers and his own experiments with JS engines. Native to nginx the Perl module never got out of beta because of Perl too like to just core dump on OOM killing nginx worker process with thousands of requests in memory, ruining shared memory, locks, etc.

Better try to spare few developers to make a C++ wrappers for native nginx structures/objects and then easily write small and reliable modules, which is easy as nginx is very flexible and is buit as a set of modules.

In the end, yes, I'm a microkernel adopt :)