Module Question

Hello All,

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:

  1. Initialize thread pool/queue on first run and stash pointer in module
    specific storage
  2. Receive request
  3. Queue request (queuing request wakes up thread to process)
  4. Module returns
  5. Thread sends response when processing is completed.

Note: threads take care of javasript related activities (ie; load, run,
etc.).

Does this sound like a workable solution?

Thanks,
-G

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,21573,21573#msg-21573

On 11/9/09 2:12 PM, “gerryw” [email protected] wrote:

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.

FastCGI.

Hi,

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?

Thanks,
-G

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,21573,21600#msg-21600

And http://code.google.com/p/v8cgi/

Embedding JS in nginx is a kinda great exersize in telepathy :wink:

Better check this out:
http://nodejs.org/

have a look at this project.

http://github.com/rtyler/fastjs