[fpc-devel] Inter Process Communication
Aavani at iust.ac.ir
Aavani at iust.ac.ir
Mon Mar 5 18:46:23 CET 2007
Jason P Sage wrote:
> Michael Schnell Wrote:
>
>
>> Why not use TCP/IP to send informations from one program to another ?
>>
> In
>
>> Linux this should perform at least as well as anything else, in Windows
>>
>
>
>> named pipes or windows messages with "attached" shared memory blocks
>> might perform better.
>>
>
>
>> Moreover you now easily can split the application between multiple
>>
> machines.
>
>
>> -Michael
>>
>
> Hi Micheal. Glad you asked.
>
> First of all - I just may use the Sockets Unit - I recently asked for
> whatever changes need to occur in the demo programs "server" and
> "client" in the FPC 2.0.4 manual (around pg 1056) of the RTL PDF
> documentation because I'm looking into this.
>
> What I'm trying to do is speed up how my web server application runs -
> which is entirely written in Free Pascal.
>
> I used CGI for portability - but to counter the delay of loading
> involved CGI executables - I created a very thin CGI client (50k on
> Win32 - unfortunately - 250k+ on Linux - (something about the smart
> linking isn't as good on linux).
>
> I used only "non-class" libs and non-sysutils (because of the overhead
> loading the class code (Around 200k).
>
> The idea - which is similar to FastCGI - is by having a small CGI client
> - that can hopefully execute fairly quickly - pass the CGI environment
> to a multithreaded daemon - and wait for and then send the response - I
> could get speed + portability. I used a binary filebased IPC. (Which is
> actually pretty fast because I used block reads etc. But not as fast as
> other means could be like shared mem or tcp/ip.. both of which explode
> the cgi EXE filesize)
>
> Unfortunately - I'm only getting 8-9 requests per second. Partly due to
> the "unique filename" generator - which sometimes fails in Windows -
> (Write Back Cache possibly on USB external Harddrives ..can't shut it
> off) and the Linux - well the 250k+ hurts no matter what I do.
>
> I tried the simpleipc unit supplied with freepascal to try and eliminate
> the the file based IPC I wrote - but in Linux - it was awful - and
> seemed to have symptoms of thread safety - could be my end or FPC rtl -
> I'm not sure. Regardless I abandoned it because in Win32 - CGI
> applications don't have the priviledges to be able to get window handles
> - so simpleipc unit only works from the command line and not when
> launched from inside apache, lighttpd or MyServer.
>
> My next two agendas are creating my own web server - possibly using the
> sockets unit if I can see a working demo that runs on both linux and
> win32. I'd prefer to the FPC RTL version "sockets"; second - I may go
> full bore FastCGI, which is very clear on how its supposed to work - but
> documentation is lacking for setting it up for non-php and non-ruby
> solutions (I'll figure it out eventually).
>
> The PSP "Pascal Server Pages" - just isn't the right framework - or I
> would use it. It suffers from the same issues as CGI normally does - it
> just gets by for awhile - but when you application gets "big" - it seems
> to have the same issues as other CGI implementations.
>
Did you check the O-PSP :
http://www.psp.furtopia.org/cgi-bin/psp/news.psp and
http://sourceforge.net/project/showfiles.php?group_id=145841.
The O-PSP is going to handle the requests using multi-threading
mechanism while it doesn't need to install any apache module. Currently,
It is developed for Linux. So, having a big application (regarding its
size) isn't a problem. I used the "named pipes" to communicate between
the dispatcher main application.
> I definitely see the advantages of the TCP/IP between the web server and
> the application for scalability - etc. and I will do that even if I make
> my own web server - simply because that makes sense.
>
But as far as I know, the TCP/IP has some (huge) overheads and reduces
the performance specially if your site has many visitors.
> FastCGI seems the right way to go - but I've yet to get one of the
> FastCGI programs - like echo or threaded to actually return something in
> a browser after much configuration experiments.
>
> Wish me well and thanx for your advice.
>
> Best Regards,
> Jason P Sage
>
>
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20070305/06dc5bfb/attachment.html>
More information about the fpc-devel
mailing list