Re: c++ web scripting
From: Shailesh Humbad (noreply_at_nowhere.com)
Date: 09/13/04
- Next message: Ioannis Vranos: "Re: gui"
- Previous message: Ioannis Vranos: "Re: gui"
- In reply to: Phlip: "Re: c++ web scripting"
- Next in thread: Phlip: "Re: c++ web scripting"
- Reply: Phlip: "Re: c++ web scripting"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 13 Sep 2004 14:22:19 GMT
Phlip wrote:
> Okay, this is a non-sequitur. Here's how C++ works. You write a
program, run
> a compiler, produce an executable, put it on a server, and stroll away. The
> executable never changes. It may frequently serve similar pages with
> different content. There's never a need to recompile it (regardless what
> page content it serves).
>
> When you say "cached", this makes me think you think C++ must recompile each
> time it is used, or each time the data changes, or something. If you
> envision some slight performance boost from serving the same page twice
> without re-rendering it, then you are confusing some other CGI optimization
> system with C++ compilation. If you need such a performance boost, just save
> your page an re-serve it.
>
> Please tell a complete, round-trip story that you envision some hypothetical
> C++ CGI layer doing.
>
Yeah, I can see where the confusion lies. When I say cached, I mean
the executables themselves are cached, not the HTML output of those
executables. Here is the algorithm:
(In Web Server)
* Web server receives request for a .cpp file.
* Web server invokes the CGI handler for .cpp files, ServeCPPFile.
(In ServeCPPFile)
If file does not exist Then
Delete any file status entry from the database
Return 404
End If
* Lookup FileLastModifiedTime in database, searching by file name.
If no file status exist in the database Then
Save the FileName and LastModified timestamp in the database
Compile the cpp code (save exe in cache folder)
Else
If actual FileLastModified != FileLastModified in database Then
Compile the cpp code (save exe in cache folder)
End If
End If
* Run the compiled code
(In Web Server)
* Output of ServeCPPFile is sent to the client.
It's easiest to think of the C++ CGI Layer as spawning/forking a new
process to handle each page request. In this case, the ServeCPPFile
process is launched, and then ServeCPPFile launches another process to
run the compiled CPP code. In practice, some other techniques might
be used to save the overhead of creating processes.
Process heirarchy:
Apache -> ServeCPPFile -> EXE File
Output piping:
Client <- Apache <- ServeCPPFile <- EXE File
>
> No religion needed. If you pipe data, whatever its format, into XML, it will
> become compatible with a very good template system, XSLT, which has a
> built-in mode to emit XHTML.
>
> Further, you can detect the user's browser type, and if it is compatible,
> you can send it your XSLT, and it will render the pages for you. All you
> need to do is send that browser your XML payload, and it does the rest.
> That's not religion, it is interoperability. We could have got it with
> tab-delimited files, or INI file format, or whatever. As an accident of
> history, we got it with XML.
>
I'm not familiar with XSLT's advantages, having never tried it, but
I'll take your word for it. One caveat is that one loses some
performance for the gain in interoperability, particularly for legacy
data in databases.
- Next message: Ioannis Vranos: "Re: gui"
- Previous message: Ioannis Vranos: "Re: gui"
- In reply to: Phlip: "Re: c++ web scripting"
- Next in thread: Phlip: "Re: c++ web scripting"
- Reply: Phlip: "Re: c++ web scripting"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|