There is already one implementation of FastCGI for v8 in k7
(http://github.com/sebastien/k7/tree/master &
http://github.com/sebastien/k7/tree/master/lib/net/http/server/fcgi.cpp).

-Louis

On Mon, Jan 5, 2009 at 6:07 AM, Ondrej Zara <[email protected]> wrote:
>
>>> Understood. So, everything is executed from scratch for each FCGI_Accept(), 
>>> ok?
>>
>> No it is not.  The app keeps an unordered_map<string, pagectx> where
>> the key is the full path of the main javascript file that will handle
>> the request.  'pagectx' in this case is a custom object that contains
>> a V8 context, among other things.  The pagectx object initializes it
>> self on first reference and when the timestamps of any of its
>> defendant javascript source files change.
>>
>
> Aha, that sounds reasonable. However, this solution also introduces
> the concept of "forbidden" global object, which previously sounded
> strange to me. Now this makes a lot more sense. On the other hand, one
> cannot effectively load any JS "libraries" which introduce new classes
> (say MySQL, HTTP, ...), because these are created as properties of
> global object, ok? So any javascript code needs to be run inside an
> anonymous function:
>
> (function() {
>  [code]
> })();
>
> because a simple statement "var a = 3;" would pollute the context...
>
>>> This is interesting, but probably not necessary in my scenario: is it
>>> true that each HTTP request receives a "clean" context?
>>>
>>
>> I may or may not have hit the optimal solution.  I know it works and
>> is fast.  The reason for reusing contexts is to minimize the work done
>> to prepare a context for each request.
>>
>
> IMHO some form of "save/restore" support would be ideal for this case:
> one would be able to generate a snapshot of created context ready for
> usage...
>
>>> Perhaps you would be so kind to share your code with me so I can have
>>> a look at your work? Please? :)
>>
>> It is not really in a sharable form.  It evolved from some trial and
>> error and is in dire need of cleanup and reorganization.
>>
>
> Okay. However, note that I do not seek a final and polished solution -
> just some ideas and working concepts (with FCGI included, as I was not
> brave enought to dive into it!) :)
>
>
> Sincerely,
> Ondrej Zara
>
>
>> --
>> Bryan White
>>
>> >
>>
>
> >
>

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

Reply via email to