I’m considering writing a module that would provide javascript as a
backend development language. I would like to get some advice on the
best way to implement this. I was considering using a thread pool/queue
combination to load and run scripts.
For example:
Initialize thread pool/queue on first run and stash pointer in module
specific storage
Receive request
Queue request (queuing request wakes up thread to process)
Module returns
Thread sends response when processing is completed.
Note: threads take care of javasript related activities (ie; load, run,
etc.).
I’m considering writing a module that would provide javascript as a backend
development language. I would like to get some advice on the best way to
implement this.
I considered FastCGI, but I’m interested in a self contained solution.
There would be very little difference in the code between both
approaches and I didn’t see the point in pushing it out to FastCGI.
After looking at the FastCGI module, it’s looks like the code I outlined
will work. The main issue seems to be returning control to nginx as soon
as possible. Whether the threads are running from nginx or a separate
FastCGI process should make little difference from a system/performance
perspective. The self contained solution would be much easier to
configure/run. Does anyone see any issues with the module based
approach?