1) How heavy/light is each instance of V8, assuming each thread would get a difference instance. I want to know what it would look like if I spun up 1000+ instances.
On my laptop each context uses ca 75kb - I did spawn ca 1500 threads in a test. But decided to use a thread pool because V8 is capable of handling more calls than a PC can handle threads. 2) We could like compile server side scripts once and run them over and over. Do I need to compile a new copy for each instance? No problem. V8 is very nice in this area. You can run the over + you can add more code you compile in later etc. It's quite capable once you get under the hood, but I will not brag about their API, doc or samples - that has "room for improvements" :D 2) We are looking at using V8 for a web server where there can be a "session" started on the server. The session has a special "session global" which can be shared by each request having the same session id (via cookie). How well does V8 support a global for use in multiple threads, each with its own context? It is assumed that serialized access to the global may be needed depending on the V8 implementation. The "session global" holds standard classes which must be preserved between server hits for the same session id. I create an array of context which I re-use. Once a call arrive I need to grab a context for CCXML and one for VXML - they do some initial processing and then just sleep - waiting for something to happen. What I found most effective was to use a thread pool - rather than a thread per session - the reason is that threads are a resource budged on any computer - Also I use processes - in a array 10 x processes and 10 x threads etc. The use of processes makes it easier for the OS to utilize several cores - you get more out of V8 that way. It's not all 100% yet, but I spent quite a lot of time testing out what I could achieve with V8 and get around what seemed to be limitations at first - and it worked out very well in the end. If they only can support Sparck's ... :) Jan Thanks! -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
