v8cgi as apache module on windows with polling

29 views
Skip to first unread message

Hepner

unread,
Jan 6, 2011, 11:52:45 AM1/6/11
to v8cgi
v8cgi seems to fail upon implementing a simple polling architecture
since apache does not spawn more than one process per request and
ThreadsPerChild=1 - so if one request hangs - all other requests are
not handled. Is this something that is solvable while still using
v8cgi as an apache module or are different approaches better used?

thanks

hepner

Ondřej Žára

unread,
Jan 8, 2011, 7:14:22 AM1/8/11
to v8...@googlegroups.com
I strongly believe that this is a matter of Apache configuration.
v8cgi does not support multiple threads, so the webserver must be
configured to work in "prefork" mode, where requests are handled by
multiple child subprocesses. This is a general scenario, common to all
apache modules - PHP works the same way, if I remember correctly.


O.

2011/1/6 Hepner <gaf...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "v8cgi" group.
> To post to this group, send email to v8...@googlegroups.com.
> To unsubscribe from this group, send email to v8cgi+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/v8cgi?hl=en.
>
>

Amir Gafner

unread,
Jan 8, 2011, 3:29:44 PM1/8/11
to v8...@googlegroups.com
I see, but it seems to me like there is no prefork mode for Windows - could this be true? 

Hepner

Ondřej Žára

unread,
Jan 8, 2011, 5:12:28 PM1/8/11
to v8...@googlegroups.com
Well, it can be possible. I do not use Windows as my primary
development platform, but I will try to find out. Stay tuned :)


O.


2011/1/8 Amir Gafner <gaf...@gmail.com>:

Ondřej Žára

unread,
Jan 19, 2011, 3:22:27 AM1/19/11
to v8...@googlegroups.com
Hi again,

sorry it took me so long to resolve this. Here are my observations:

1) windows apache version indeed ships only with the "worker" module (threaded);

2) v8cgi is not threadsafe, so one must use ThreadsPerChild=1 on Windows.

Therefore, your initial statement holds - only one request can be
served at a time.

However, I find this situation uncomfortable, so I started
implementing some stuff in v8cgi with the goal to make it threadsafe.
My latest commit (revision 898) makes v8cgi at least basically
threadsafe by using the v8::Locker object; this way, v8cgi can be used
by multithreaded apache module.

HOWEVER, there is a big technical limitation caused by V8: even in
multithreaded environment, only one thread can access V8 at a time.
This means that all used threads must wait until V8 is released by the
current thread. It is possible to explicitely release V8 in order to
call some long-running non-V8 tasks; i just implemented this for the
system.sleep() function.

To make long story short: there is a room for improvements; my latest
commit allows some level of multithreaded processing, when one thread
performs system.sleep() and other threads do their normal tasks.

Sincerely,
Ondrej Zara

2011/1/8 Ondřej Žára <ondre...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages