2009/9/10 krovosos <[email protected]>:
>
> Hello,
>
> we are currently using V8 in a kind of server-side scripting engine.
> Javascript is used for implementing business-level logic. V8 is nice,
> really! It is fast and well structured. But... Suppose we want to run
> a 1000+ small scripts simultaneosly. How can we achieve this? Run
> 1000+ processes like Chrome do? Well, not a smart idea. So we have a
> single process with 1000+ V8 contexts and there can be only one script
> running in V8 at the moment. If it is somehow slow we are stuck,
> others are waiting.

I appreciate this is annoying, but it's not actually that easy.  The
contexts are not really independent at the VM level.  The
single-threaded assumption is in 1000 undocumented places in the code.

Let me suggest some workarounds.  I am guessing that you don't have
1000 CPUs.  So it might be possible to have one or two V8 processes
per CPU, then a load balancer that distributes incoming requests to V8
proceses.  If you run with preemption support you can switch between
V8 threads if one thread gets into a long calculation.  If your V8
threads are hanging because they are doing long-running IO then you
can use the v8::Unlocker class to free up the V8 lock while IO takes
place.

-- 
Erik Corry, Software Engineer
Google Denmark ApS.  CVR nr. 28 86 69 84
c/o Philip & Partners, 7 Vognmagergade, P.O. Box 2227, DK-1018
Copenhagen K, Denmark.

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to