Forum: NGINX ecmascript module

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
44436799887cb0dba64a223e5344ae92?d=identicon&s=25 Chris Farmiloe (Guest)
on 2009-01-19 15:14
(Received via mailing list)
Hi,

I've started to build an nginx module to process server-side
ecmascript (javascript) by embedding the spidermonkey engine. I've got
a (very) rough proof of concept hacked together just now, but after
about 30-50 requests the I can't allocate enough memory to build the
spidermonkey runtime.

I'm new to C and just skim-read the white book to get this far so I
expect I am just making naive C mistakes.

What I couldn't understand is that the same jsapi code outside of the
nginx module never seemed to have the allocation issues.
And if it was a memory allocation issue... wouldn't my worker
processes rise above 2MB?

Sorry for the vague message, but if someone could give me a nudge in
the right direction of what might be happening so I can get back to
learning it would be much appreciated!

here's my example so far:

http://github.com/chrisfarms/nginx_ecmascript_modu...
44436799887cb0dba64a223e5344ae92?d=identicon&s=25 Chris Farmiloe (Guest)
on 2009-01-19 15:17
(Received via mailing list)
PS: thanks "Evan Miller" for the module tutorial ;)
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2009-01-19 15:21
(Received via mailing list)
On Mon, Jan 19, 2009 at 02:00:26PM +0000, Chris Farmiloe wrote:

> nginx module never seemed to have the allocation issues.
> And if it was a memory allocation issue... wouldn't my worker
> processes rise above 2MB?
>
> Sorry for the vague message, but if someone could give me a nudge in
> the right direction of what might be happening so I can get back to
> learning it would be much appreciated!
>
> here's my example so far:
>
> 
http://github.com/chrisfarms/nginx_ecmascript_modu...

There is already an attempt to embedd SpiderMonkey:
http://www.cmsbuilder.ru/files/nginx.js/ngx_http_j...

(and some comments in Russian):
http://www.cmsbuilder.ru/blog/2008/12/07/ngx_http_...
http://www.cmsbuilder.ru/blog/2008/11/30/nginx-js/

You may look this implementation.
44436799887cb0dba64a223e5344ae92?d=identicon&s=25 Chris Farmiloe (Guest)
on 2009-01-19 15:51
(Received via mailing list)
Thanks! I'll take a look
4eac1f7d1ff86ab17e7a9dbe6af0b44b?d=identicon&s=25 Phillip B Oldham (Guest)
on 2009-01-19 15:51
(Received via mailing list)
Attachment: phill.vcf (262 Bytes)
Chris Farmiloe wrote:
> Hi,
>
> I've started to build an nginx module to process server-side
> ecmascript (javascript) by embedding the spidermonkey engine.
This is something I've been hoping would be developed for a while now.
However, wouldn't it be better to have the spidermonkey engine running
as an SGI/FCGI module rather than embedded, to open it up to more
services?

--

*Phillip B Oldham*
The Activity People
phill@theactivitypeople.co.uk <mailto:phill@theactivitypeople.co.uk>

------------------------------------------------------------------------

*Policies*

This e-mail and its attachments are intended for the above named
recipient(s) only and may be confidential. If they have come to you in
error, please reply to this e-mail and highlight the error. No action
should be taken regarding content, nor must you copy or show them to
anyone.

This e-mail has been created in the knowledge that Internet e-mail is
not a 100% secure communications medium, and we have taken steps to
ensure that this e-mail and attachments are free from any virus. We must
advise that in keeping with good computing practice the recipient should
ensure they are completely virus free, and that you understand and
observe the lack of security when e-mailing us.
E6595fe908f559e34b87c313ad1b7312?d=identicon&s=25 Johan Bergström (Guest)
on 2009-01-19 16:35
(Received via mailing list)
On Jan 19, 2009, at 15:41 , Phillip B Oldham wrote:

> Chris Farmiloe wrote:
>>
>> Hi,
>>
>> I've started to build an nginx module to process server-side
>> ecmascript (javascript) by embedding the spidermonkey engine.
> This is something I've been hoping would be developed for a while
> now. However, wouldn't it be better to have the spidermonkey engine
> running as an SGI/FCGI module rather than embedded, to open it up to
> more services?

I have to agree with this. There are a couple of attempts out there
such as http://code.google.com/p/jslibs/


>
>
> --
> Phillip B Oldham
> The Activity People
> phill@theactivitypeople.co.uk
>

/J
44436799887cb0dba64a223e5344ae92?d=identicon&s=25 Chris Farmiloe (Guest)
on 2009-01-19 17:58
(Received via mailing list)
That would certainly make it more portable among other servers, but I
do like the simplicity of letting the nginx worker host the request.

That said, making an HTTP server for the jslibs collection might also
be fun, then nginx could just play proxy again.
8c7dccb1a99c9f8fc6a495f4a2f7f904?d=identicon&s=25 Peter Leonov (kung-fu-tzu)
on 2009-02-25 18:12
Chris Farmiloe wrote:

> Sorry for the vague message, but if someone could give me a nudge in
> the right direction of what might be happening so I can get back to
> learning it would be much appreciated!
>

Hi, Chris. That attempt of embedding spidermonkey
(http://www.cmsbuilder.ru/files/nginx.js/ngx_http_j...) in
nginx was mine :) I didn't know that it can be interesting for someone
elsewhere than Russia. So I'v posted that review only in my native
language, russian.

If you kept the interest till now, please contact me via email
(gojpeg@yandex.ru). It will be grate to talk about js in nginx :)
8c7dccb1a99c9f8fc6a495f4a2f7f904?d=identicon&s=25 Peter Leonov (kung-fu-tzu)
on 2009-02-26 00:39
Took my legs in arms and followed your example, Chris:
http://github.com/kung-fu-tzu/ngx_http_js_module/tree/master
This topic is locked and can not be replied to.