From craigh01 at gmail.com Sat Jan 2 12:31:56 2010 From: craigh01 at gmail.com (Craig Hilles) Date: Sat, 2 Jan 2010 12:31:56 -0500 Subject: [FASTCGI] Problem running ./configure on hosting service Message-ID: 'm trying to run the makefile to build echo, echo-x, etc. It worked on Windows! But it won't work on Linux. When I run ./configure I get this: configure: error: cannot run /bin/sh ./config.sub I tried searching but couldn't find an answer. Can anyone help? I have 3 different hosting accounts, I tried uploading the contents of fcgi-2.4.0.tar.gz to all 3 of them, and did chmod 775 on configure, then ran ./configure. It seemed to be doing things ("checking for a BSD compatible install", "whether gcc accepts -g... yes", etc). I get the same thing on all 3 sites. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Howard.May at dialogic.com Thu Jan 14 07:18:03 2010 From: Howard.May at dialogic.com (Howard May) Date: Thu, 14 Jan 2010 07:18:03 -0500 Subject: [FASTCGI] Manually spawning a Windows fastCGI application In-Reply-To: <360130.40839.qm@web65610.mail.ac4.yahoo.com> References: <3256B665A5FD30499BA25BFF2EB77F3F04D7FE9D1D@MBX.dialogic.com> <360130.40839.qm@web65610.mail.ac4.yahoo.com> Message-ID: <3256B665A5FD30499BA25BFF2EB77F3F04D81619CE@MBX.dialogic.com> Thanks for your help. The thing which helped me was realising I needed to use the FCGX interface which supports a command FCGX _OpenSocket to a FCGI socket. Then I don't need an application like spawn_fcgi. Best Regards and Happy New Year ________________________________ From: fastcgi-developers-bounces+howard.may=dialogic.com at mailman.fastcgi.com [mailto:fastcgi-developers-bounces+howard.may=dialogic.com at mailman.fastcgi.com] On Behalf Of Konstantin Ivanov Sent: 24 December 2009 17:24 To: Howard May; fastcgi-developers at mailman.fastcgi.com Subject: Re: [FASTCGI] Manually spawning a Windows fastCGI application The fastcgi website contains a C library as an example how to use the protocol. This code file (http://www.fastcgi.com/devkit/libfcgi/os_win32.c) contains example code on how to spawn a process on windows using either Named pipes or TCP for communication with the process. It is a good start, but, not to offend creators of the site and this example library, I think there is a major gap in documentation and while the this library is a good start I believe there are a lot of things that are unnecessary and overcomplicated for beginners to understand. Howard, if you have any questions I would be glad to help to my ability as I've experimented with fastcgi on named pipes and sockets. Hope the code file referenced earlier is somewhat of a help. Merry Christmas. ________________________________ From: Howard May To: "fastcgi-developers at mailman.fastcgi.com" Sent: Thu, December 24, 2009 1:49:03 AM Subject: [FASTCGI] Manually spawning a Windows fastCGI application I am struggling to find documentation explaining how to manually start a windows fastCGI document using a named pipe or a TCP/ IP connection. I would be exceptionally grateful if someone could point me in the direction of some documentation explaining this. Best Regards Howard May -------------- next part -------------- An HTML attachment was scrubbed... URL: From Howard.May at dialogic.com Thu Jan 14 07:23:22 2010 From: Howard.May at dialogic.com (Howard May) Date: Thu, 14 Jan 2010 07:23:22 -0500 Subject: [FASTCGI] FastCGI, Comet and Client Link failure Message-ID: <3256B665A5FD30499BA25BFF2EB77F3F04D81619D3@MBX.dialogic.com> Consider a simple fastCGI application with a comet connection to a remote Client. The application is periodically sending chunks to the Client but at some point the Client connection fails. How and when does the fastCGI application learn about this? Best Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: From jsprenkle at gmail.com Thu Jan 14 10:24:14 2010 From: jsprenkle at gmail.com (Jay Sprenkle) Date: Thu, 14 Jan 2010 09:24:14 -0600 Subject: [FASTCGI] FastCGI, Comet and Client Link failure In-Reply-To: <3256B665A5FD30499BA25BFF2EB77F3F04D81619D3@MBX.dialogic.com> References: <3256B665A5FD30499BA25BFF2EB77F3F04D81619D3@MBX.dialogic.com> Message-ID: <1b5f39a11001140724m6853a69ua32aaee5a6cced8e@mail.gmail.com> fastcgi is a transactional style application. If you want to run a persistent program you probably want the fastcgi application to communicate requests to, and retrieve status from, the daemon/service that implements your comet connection. On Thu, Jan 14, 2010 at 6:23 AM, Howard May wrote: > Consider a simple fastCGI application with a comet connection to a remote > Client. The application is periodically sending chunks to the Client but at > some point the Client connection fails. How and when does the fastCGI > application learn about this? > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Howard.May at dialogic.com Thu Jan 14 10:37:49 2010 From: Howard.May at dialogic.com (Howard May) Date: Thu, 14 Jan 2010 10:37:49 -0500 Subject: [FASTCGI] FastCGI, Comet and Client Link failure In-Reply-To: <1b5f39a11001140724m6853a69ua32aaee5a6cced8e@mail.gmail.com> References: <3256B665A5FD30499BA25BFF2EB77F3F04D81619D3@MBX.dialogic.com> <1b5f39a11001140724m6853a69ua32aaee5a6cced8e@mail.gmail.com> Message-ID: <3256B665A5FD30499BA25BFF2EB77F3F04D8161A63@MBX.dialogic.com> Hi Jay, I start a new comet connection after I accept a FCGX_Accept_r returns a FCGX_Request with a URL of "http:///new_comet_connection_please". I can then send chunks down this connection using FCGX_FPrintF. I do not call FCGX_Finish_r for this request because I want to leave the HTTP transaction open for further data. So fastCGI is giving me access to a new HTTP transaction and the FCGXFPrintF function allows my fastcgi application to send chunks to the web server (Abyss at present) to pass to the remote Client. So far so good. My problem is that at some point the TCP connection to the Client may die and I don't at present have any way of detecting this. Cheers ________________________________ From: Jay Sprenkle [mailto:jsprenkle at gmail.com] Sent: 14 January 2010 15:24 To: Howard May Cc: fastcgi-developers at mailman.fastcgi.com Subject: Re: [FASTCGI] FastCGI, Comet and Client Link failure fastcgi is a transactional style application. If you want to run a persistent program you probably want the fastcgi application to communicate requests to, and retrieve status from, the daemon/service that implements your comet connection. On Thu, Jan 14, 2010 at 6:23 AM, Howard May > wrote: Consider a simple fastCGI application with a comet connection to a remote Client. The application is periodically sending chunks to the Client but at some point the Client connection fails. How and when does the fastCGI application learn about this? -------------- next part -------------- An HTML attachment was scrubbed... URL: From Howard.May at dialogic.com Thu Jan 14 10:56:47 2010 From: Howard.May at dialogic.com (Howard May) Date: Thu, 14 Jan 2010 10:56:47 -0500 Subject: [FASTCGI] FastCGI, Comet and Client Link failure In-Reply-To: <1b5f39a11001140747t5745d730xf6c0acf622f53275@mail.gmail.com> References: <3256B665A5FD30499BA25BFF2EB77F3F04D81619D3@MBX.dialogic.com> <1b5f39a11001140724m6853a69ua32aaee5a6cced8e@mail.gmail.com> <3256B665A5FD30499BA25BFF2EB77F3F04D8161A63@MBX.dialogic.com> <1b5f39a11001140747t5745d730xf6c0acf622f53275@mail.gmail.com> Message-ID: <3256B665A5FD30499BA25BFF2EB77F3F04D8161A7A@MBX.dialogic.com> Hi Jay, Have a look at "http://en.wikipedia.org/wiki/Comet_(programming)" to see how HTTP transactions can be used for server push events. A common application of this sort of technology is browser based web chat. My understanding is that this is possible with fastCGI but as I've explained I am unsure about this specific aspect. Cheers ________________________________ From: Jay Sprenkle [mailto:jsprenkle at gmail.com] Sent: 14 January 2010 15:48 To: Howard May Subject: Re: [FASTCGI] FastCGI, Comet and Client Link failure HTTP is by design transactional. You make a request, get a response, and the connection can then close without hurting anything. Do you want something that's more permanently connected or just to deliver a file? There are methods designed for delivering file content and even restarting lost connections. On Thu, Jan 14, 2010 at 9:37 AM, Howard May > wrote: Hi Jay, I start a new comet connection after I accept a FCGX_Accept_r returns a FCGX_Request with a URL of "http:///new_comet_connection_please". I can then send chunks down this connection using FCGX_FPrintF. I do not call FCGX_Finish_r for this request because I want to leave the HTTP transaction open for further data. So fastCGI is giving me access to a new HTTP transaction and the FCGXFPrintF function allows my fastcgi application to send chunks to the web server (Abyss at present) to pass to the remote Client. So far so good. My problem is that at some point the TCP connection to the Client may die and I don't at present have any way of detecting this. Cheers ________________________________ From: Jay Sprenkle [mailto:jsprenkle at gmail.com] Sent: 14 January 2010 15:24 To: Howard May Cc: fastcgi-developers at mailman.fastcgi.com Subject: Re: [FASTCGI] FastCGI, Comet and Client Link failure fastcgi is a transactional style application. If you want to run a persistent program you probably want the fastcgi application to communicate requests to, and retrieve status from, the daemon/service that implements your comet connection. On Thu, Jan 14, 2010 at 6:23 AM, Howard May > wrote: Consider a simple fastCGI application with a comet connection to a remote Client. The application is periodically sending chunks to the Client but at some point the Client connection fails. How and when does the fastCGI application learn about this? -- Cause united breaks guitars http://www.youtube.com/watch?v=5YGc4zOqozo -------------- next part -------------- An HTML attachment was scrubbed... URL: From mysql.jorge at decimal.pt Mon Jan 18 16:14:23 2010 From: mysql.jorge at decimal.pt (Jorge Bastos) Date: Mon, 18 Jan 2010 21:14:23 -0000 (WET) Subject: [FASTCGI] Newbit questions about PHP Message-ID: <3005.87.196.77.114.1263849263.squirrel@webmail.decimal.pt> Howdy, I'm new to FastCGI, and i'd like to know if it does what I need. I have several virtualhosts on my apache server, and I want that the files what are uploaded via HTTP stay with certain permissions per virtualhost, other than the user and group of the webserver. I've saw this and I don't know if it does the job for me. Can someone help me on this? Thanks, Jorge, From aron at aron.ws Mon Jan 18 16:39:03 2010 From: aron at aron.ws (Aron Szabo) Date: Mon, 18 Jan 2010 22:39:03 +0100 Subject: [FASTCGI] Newbit questions about PHP In-Reply-To: <3005.87.196.77.114.1263849263.squirrel@webmail.decimal.pt> References: <3005.87.196.77.114.1263849263.squirrel@webmail.decimal.pt> Message-ID: <4B54D4F7.70901@aron.ws> Hi! Well if you handle the incoming files with PHP using FastCGI than the file will be created with the permissions of the running php interpreter. But you can can create a php script file like "avatar.uphp" and add a handler for them. After that you can use spawn-fcgi. Check this guide out: http://www.cyberciti.biz/tips/rhel-fedora-centos-apache2-external-php-spawn.html So here: /usr/bin/spawn-fcgi -c /httpdjail -a 127.0.0.1 -p 9000 -P /var/run/php-cgi.fastcgi.pid -u apache -g apache -- /usr/bin/php-cgi You have fcgi daemon that listens on port 9000 for requests. After that you have to set apache to send the request and receive response from your fcgi daemon: AddHandler php5-fastcgi .uphp FastCgiExternalServer /webroot/http -host 127.0.0.1:9000 Aron Szabo Pointless Software http://pointless.hu/ On 01/18/2010 10:14 PM, Jorge Bastos wrote: > Howdy, > > I'm new to FastCGI, and i'd like to know if it does what I need. > > I have several virtualhosts on my apache server, and I want that the files > what are uploaded via HTTP stay with certain permissions per virtualhost, > other than the user and group of the webserver. > I've saw this and I don't know if it does the job for me. > > Can someone help me on this? > > Thanks, > Jorge, > > _______________________________________________ > FastCGI-developers mailing list > FastCGI-developers at mailman.fastcgi.com > http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers -------------- next part -------------- A non-text attachment was scrubbed... Name: aron.vcf Type: text/x-vcard Size: 155 bytes Desc: not available URL: From mysql.jorge at decimal.pt Mon Jan 18 16:48:56 2010 From: mysql.jorge at decimal.pt (Jorge Bastos) Date: Mon, 18 Jan 2010 21:48:56 -0000 Subject: [FASTCGI] Newbit questions about PHP In-Reply-To: <4B54D4F7.70901@aron.ws> References: <3005.87.196.77.114.1263849263.squirrel@webmail.decimal.pt> <4B54D4F7.70901@aron.ws> Message-ID: <008001ca9888$09626ce0$1c2746a0$@jorge@decimal.pt> Hi Aron, Before going to the guide, let me ask two more questions: 1-the running PHP interpreter, can be set with just UID's and GID's? to match the files with the FTP users, has to be that way, since I don't use system users. 2-software's like joomla/moodle/etc etc, will complain about this, or they don't even know that they are being executed with fcgi? Jorge, > Hi! > > Well if you handle the incoming files with PHP using FastCGI than the > file will be created with the permissions of the running php > interpreter. > But you can can create a php script file like "avatar.uphp" and add a > handler for them. After that you can use spawn-fcgi. > > Check this guide out: > http://www.cyberciti.biz/tips/rhel-fedora-centos-apache2-external-php- > spawn.html > > So here: > > /usr/bin/spawn-fcgi -c /httpdjail -a 127.0.0.1 -p 9000 -P /var/run/php- > cgi.fastcgi.pid -u apache -g apache -- /usr/bin/php-cgi > > You have fcgi daemon that listens on port 9000 for requests. > > After that you have to set apache to send the request and receive > response from your fcgi daemon: > > AddHandler php5-fastcgi .uphp > FastCgiExternalServer /webroot/http -host 127.0.0.1:9000 > > > Aron Szabo > Pointless Software > http://pointless.hu/ > > On 01/18/2010 10:14 PM, Jorge Bastos wrote: > > Howdy, > > > > I'm new to FastCGI, and i'd like to know if it does what I need. > > > > I have several virtualhosts on my apache server, and I want that the > > files what are uploaded via HTTP stay with certain permissions per > > virtualhost, other than the user and group of the webserver. > > I've saw this and I don't know if it does the job for me. > > > > Can someone help me on this? > > > > Thanks, > > Jorge, > > > > _______________________________________________ > > FastCGI-developers mailing list > > FastCGI-developers at mailman.fastcgi.com > > http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers From Howard.May at dialogic.com Fri Jan 22 09:50:37 2010 From: Howard.May at dialogic.com (Howard May) Date: Fri, 22 Jan 2010 09:50:37 -0500 Subject: [FASTCGI] HTTP Status Code problem Message-ID: <3256B665A5FD30499BA25BFF2EB77F3F04D82530CF@MBX.dialogic.com> Hi, My fastCGI App is serving up small XML packets with MIME type application/xml. The problem is that my client is reporting an HTTP Status of 404 which I presume is being added by my Web Server (Abyss). Is there something I need to be doing in my fastCGI app to prevent this? Best Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: From aron at aron.ws Fri Jan 22 11:33:45 2010 From: aron at aron.ws (Aron Szabo) Date: Fri, 22 Jan 2010 17:33:45 +0100 Subject: [FASTCGI] HTTP Status Code problem In-Reply-To: <3256B665A5FD30499BA25BFF2EB77F3F04D82530CF@MBX.dialogic.com> References: <3256B665A5FD30499BA25BFF2EB77F3F04D82530CF@MBX.dialogic.com> Message-ID: <4B59D369.8010106@aron.ws> Hi! You get 404 and your XML packet is transferred ? Are you sure that your application receives the request? How do you connect your app with the webserver ? Header sould be sent out like this: FCGX_FPrintF(request.out, "Status: 200 OK\r\nContent-Type: application/xml\r\n\r\n"); But I think you have a server configuration problem... Aron Szabo Pointless Software http://pointless.hu On 01/22/2010 03:50 PM, Howard May wrote: > Hi, > > My fastCGI App is serving up small XML packets with MIME type application/xml. The problem is that my client is reporting an HTTP Status of 404 which I presume is being added by my Web Server (Abyss). Is there something I need to be doing in my fastCGI app to prevent this? > > Best Regards > > > > > _______________________________________________ > FastCGI-developers mailing list > FastCGI-developers at mailman.fastcgi.com > http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers -------------- next part -------------- A non-text attachment was scrubbed... Name: aron.vcf Type: text/x-vcard Size: 155 bytes Desc: not available URL: From Howard.May at dialogic.com Fri Jan 22 11:38:35 2010 From: Howard.May at dialogic.com (Howard May) Date: Fri, 22 Jan 2010 11:38:35 -0500 Subject: [FASTCGI] HTTP Status Code problem In-Reply-To: <4B59D369.8010106@aron.ws> References: <3256B665A5FD30499BA25BFF2EB77F3F04D82530CF@MBX.dialogic.com> <4B59D369.8010106@aron.ws> Message-ID: <3256B665A5FD30499BA25BFF2EB77F3F04D8253161@MBX.dialogic.com> I'm pretty sure it's not a server configuration problem as when I add FCGX_FPrintF(request.out, "Status: 200 OK\r\n As you suggested it works fine! I had presumed that Abyss would handle the HTTP header for me. Thanks for your help Regards > -----Original Message----- > From: fastcgi-developers- > bounces+howard.may=dialogic.com at mailman.fastcgi.com [mailto:fastcgi- > developers-bounces+howard.may=dialogic.com at mailman.fastcgi.com] On Behalf > Of Aron Szabo > Sent: 22 January 2010 16:34 > To: fastcgi-developers at mailman.fastcgi.com > Subject: Re: [FASTCGI] HTTP Status Code problem > > Hi! > > You get 404 and your XML packet is transferred ? Are you sure that your > application receives the request? How do you connect your app with the > webserver ? > > Header sould be sent out like this: > FCGX_FPrintF(request.out, "Status: 200 OK\r\nContent-Type: > application/xml\r\n\r\n"); > > But I think you have a server configuration problem... > > Aron Szabo > Pointless Software > http://pointless.hu > > On 01/22/2010 03:50 PM, Howard May wrote: > > Hi, > > > > My fastCGI App is serving up small XML packets with MIME type > application/xml. The problem is that my client is reporting an HTTP Status > of 404 which I presume is being added by my Web Server (Abyss). Is there > something I need to be doing in my fastCGI app to prevent this? > > > > Best Regards > > > > > > > > > > _______________________________________________ > > FastCGI-developers mailing list > > FastCGI-developers at mailman.fastcgi.com > > http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers From tarasove at list.ru Tue Jan 26 12:25:18 2010 From: tarasove at list.ru (=?koi8-r?Q?=F4=C1=D2=C1=D3=CF=D7_=E5=D7=C7=C5=CE=C9=CA?=) Date: Tue, 26 Jan 2010 20:25:18 +0300 Subject: [FASTCGI] very low performance Message-ID: Hello, Fastcgi Developers! I've just written small fastcgi program. It loads jpeg picture from file and sends it to client. 256 Kb picture is loaded in 2 sec in my machine. This picture as static file is loaded through apache2 in only 0.030 sec. I start the program in apache2 with mod_fastcgi. So, there is question, is fastcgi really so slow or I missed some configuration tricks? Best wishes, Tarasov Evgeny From jsprenkle at gmail.com Tue Jan 26 12:30:55 2010 From: jsprenkle at gmail.com (Jay Sprenkle) Date: Tue, 26 Jan 2010 11:30:55 -0600 Subject: [FASTCGI] very low performance In-Reply-To: References: Message-ID: <1b5f39a11001260930j390a9981q693a1d8278f9c9b1@mail.gmail.com> How did you write the code to read the file? What language did you write it in? You haven't provided enough information. On Tue, Jan 26, 2010 at 11:25 AM, ??????? ??????? wrote: > Hello, Fastcgi Developers! > > I've just written small fastcgi program. It loads jpeg picture from file > and sends it to client. 256 Kb picture is loaded in 2 sec in my machine. > This picture as static file is loaded through apache2 in only 0.030 sec. > > I start the program in apache2 with mod_fastcgi. > > So, there is question, is fastcgi really so slow or I missed some > configuration tricks? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From unique at idempot.net Tue Jan 26 12:36:59 2010 From: unique at idempot.net (Matthew Weigel) Date: Tue, 26 Jan 2010 17:36:59 +0000 Subject: [FASTCGI] very low performance In-Reply-To: References: Message-ID: On Tue, 26 Jan 2010 20:25:18 +0300, ??????? ??????? wrote: > Hello, Fastcgi Developers! > > I've just written small fastcgi program. It loads jpeg picture from file > and sends it to client. 256 Kb picture is loaded in 2 sec in my machine. > This picture as static file is loaded through apache2 in only 0.030 sec. > > I start the program in apache2 with mod_fastcgi. > > So, there is question, is fastcgi really so slow or I missed some > configuration tricks? FastCGI is not particularly appropriate for this task. Apache is most likely much more efficient at the fairly simple task of streaming files via HTTP, and doesn't incur the overhead that FastCGI does in performing that task. FastCGI is more appropriate for tasks that you would otherwise write a CGI program to do, and should be faster in those cases. It is also appropriate for tasks where you would consider loading mod_php, mod_perl, etc. into your Apache configuration; in those cases, the performance difference will probably be negligible, but you have a lot more control over the design in terms of load-balancing and security. -- Matthew Weigel hacker unique & idempot . ent From tarasove at list.ru Tue Jan 26 13:07:42 2010 From: tarasove at list.ru (=?koi8-r?Q?=F4=C1=D2=C1=D3=CF=D7_=E5=D7=C7=C5=CE=C9=CA?=) Date: Tue, 26 Jan 2010 21:07:42 +0300 Subject: [FASTCGI] =?koi8-r?b?dmVyeSBsb3cgcGVyZm9ybWFuY2U=?= Message-ID: Thanks for your answers! > How did you write the code to read the file? > What language did you write it in? You haven't provided enough information. I wrote it in haskell, just reading file and writting it out using ByteString: import Network.FastCGI import qualified Data.ByteString.Lazy as BL main = runFastCGIConcurrent 1000 (handleErrors cgiMain) cgiMain :: CGI CGIResult cgiMain = do setHeader "Content-type" "image/jpeg" b <- liftIO $ BL.readFile "/usr/lib/cgi-bin/pic.jpg" outputFPS b > FastCGI is not particularly appropriate for this task. Apache is most > likely much more efficient at the fairly simple task of streaming files via > HTTP, and doesn't incur the overhead that FastCGI does in performing that > task. I am planning to write complex content management system with storing pictures in dedicated storage, that's why I have to output pictures through the application. > FastCGI is more appropriate for tasks that you would otherwise write a CGI > program to do, and should be faster in those cases. It is also appropriate > for tasks where you would consider loading mod_php, mod_perl, etc. into > your Apache configuration; in those cases, the performance difference will > probably be negligible, but you have a lot more control over the design in > terms of load-balancing and security. So, I will use something different than fastcgi. From jsprenkle at gmail.com Tue Jan 26 13:18:11 2010 From: jsprenkle at gmail.com (Jay Sprenkle) Date: Tue, 26 Jan 2010 12:18:11 -0600 Subject: [FASTCGI] very low performance In-Reply-To: References: Message-ID: <1b5f39a11001261018p2f99ad65ue5233fea93a69785@mail.gmail.com> > FastCGI is not particularly appropriate for this task. Apache is most > likely much more efficient at the fairly simple task of streaming files via > HTTP, and doesn't incur the overhead that FastCGI does in performing that > task. FastCgi is overkill for serving static images or static pages. It's not for serving dynamic pages or images. The overhead should NOT be 2 seconds per page in any case. I don't know Haskell, but my guess would be that the file read and write is inefficient, or you're just seeing startup lag. There will be always be a lag when the first request is made using fastcgi. The web server must start the haskell program and then pass the request to it. As long as the web server keeps the program in memory all further requests will be much faster. Here's what I'd try: Profile the code or write to logs with timestamps Change the code to return a string instead and see if the string takes 2 seconds. This will tell if it's the image or the setup. On Tue, Jan 26, 2010 at 12:07 PM, ??????? ??????? wrote: > Thanks for your answers! > > > How did you write the code to read the file? > > What language did you write it in? You haven't provided enough > information. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tarasove at list.ru Tue Jan 26 13:45:56 2010 From: tarasove at list.ru (=?koi8-r?Q?=F4=C1=D2=C1=D3=CF=D7_=E5=D7=C7=C5=CE=C9=CA?=) Date: Tue, 26 Jan 2010 21:45:56 +0300 Subject: [FASTCGI] =?koi8-r?b?dmVyeSBsb3cgcGVyZm9ybWFuY2U=?= Message-ID: > FastCgi is overkill for serving static images or static pages. It's not for serving dynamic pages or images. \ And for what fastcgi is? > The overhead should NOT be 2 seconds per page in any case. I hope it is my mistake. > I don't know Haskell, but my guess would be that the file read and write is inefficient, > or you're just seeing startup lag. I did requests many times manualy and with ab tool, so it is not startup lag. > Here's what I'd try: > Profile the code or write to logs with timestamps > Change the code to return a string instead and see if the string takes 2 seconds. This will tell if it's the image or the > setup. I've tested such application that outputs simple html directly from string constant in programming language. This string should be in memory when program is working. But static html with similar content still 2 times faster than fastcgi program! I've tested it with ab. Although where is no 2 seconds, performance lost is evidently. From unique at idempot.net Tue Jan 26 14:14:43 2010 From: unique at idempot.net (Matthew Weigel) Date: Tue, 26 Jan 2010 19:14:43 +0000 Subject: [FASTCGI] very low performance In-Reply-To: References: Message-ID: <1c1e31edbef482ae88692f4cf31b1d8d@patience.idempot.net> On Tue, 26 Jan 2010 21:45:56 +0300, ??????? ??????? wrote: >> FastCgi is overkill for serving static images or static pages. It's not >> for serving dynamic pages or images. \ > > And for what fastcgi is? Handling dynamic requests. Not doing the simplest thing the web server itself does. >> Here's what I'd try: >> Profile the code or write to logs with timestamps >> Change the code to return a string instead and see if the string takes 2 >> seconds. This will tell if it's the image or the > setup. > > I've tested such application that outputs simple html directly from string > constant in programming language. This string should be in memory when > program is working. But static html with similar content still 2 times > faster than fastcgi program! I've tested it with ab. Although where is no 2 > seconds, performance lost is evidently. But you haven't profiled your program, so you don't actually know anything about where it spends all that time. A very, very brief Google search brought this link up: http://www.haskell.org/haskellwiki/Library/Streams#Speed . I wonder if you're using Handles, that sounds impressively inefficient. -- Matthew Weigel hacker unique & idempot . ent From sprog at online.ru Tue Jan 26 19:37:02 2010 From: sprog at online.ru (Igor Franchuk) Date: Wed, 27 Jan 2010 03:37:02 +0300 Subject: [FASTCGI] very low performance - explained In-Reply-To: References: Message-ID: <313631395.20100127033702@online.ru> Hello ???????, Tuesday, January 26, 2010, 9:07:42 PM, you wrote: I don't know haskell either. But I bet you have no FastCGI loop. It's a classic mistake leading to performance downgrade. http://mult.ifario.us/p/wiring-haskell-into-a-fastcgi-web-server http://hackage.haskell.org/packages/archive/fastcgi/3001.0.2.2/doc/html/Network-FastCGI.html FastCGI is made for performance, still one can easily downgrade with FastCGI like you did in your example below. In your particular task you should not read the file, instead you should just output: setHeader "Location: ./pic.jpg" to make Apache to do streaming. Not to mention that cgi-bin is not for images and most likely out-of-the-box Location: would fail. Yet, the way you handle images is not the cause of your problems, the cause is most likely the absence of CGI Loop. I'm not sure about the loop, still to make things clear I will give you some information to think about. FastCGI is a great technology that makes your application to function almost with the speed of Apache module with _low_ costs to achieve it. That technology gives power to the languages which are unable to integrate with Apache on module level. The tragic but not officially recognized failure of a famous Apache module extension like mod_php which proved that FastCGI is a better way to do fast things than pursing mod_language approach which has many many problems. It came to the point now that most of the hosters are running PHP as FastCGI and not as mod_php by various reason, the main reason, of course, the way PHP consumes the server's resources. Instead of consuming resources on demand, which pre PHP languages were using (like Perl), PHP pursuits "load all GNU libraries which I could port to function within PHP core" approach which looks cool to a noob user which can do just about anything, the question remains - do we need to do anything slow or fast. The PHP team though it's going to be fast. The PHP came to the world as a Fast alternative to Perl and, that speed came out of integration with Apache. PHP was always web oriented and many things were easier with it. As a practical example, out of the box PHP running as a mod_php in the real world would eat about 70Mb of memory, to be compared with a similar C++ program, running in FastCGI mode that would consume only 3Mb, with 3-4 times drop in processor usage. The performance gains are achieved by the ability of FastCGI to run your app as a daemon or process. Once loaded, your application is focused on processing the requests. Focusing on important things, a CGI application is working like: 1. Apache got request GET /your_script 2. Your CGI app is loaded, in case of say Perl it's compiled first then loaded. To compile/translate it, the perl would have to be started. When it starts it loads dynamic libraries, which when loaded are pulling other dynamic libraries (in most cases). 3. When all is settled with Perl, your script is translated. 4. Now we're ready to execute our script. 5. Your script pulls the data out of environment, does it's job and calls exit. 6. The memory used by perl is freed, your compiled code is wasted. the libraries are unloaded and now we're waiting for step 1, just to make another similar job. ----------------------------------------------------------------------- In fast CGI Mode your application works differently: User starts /your_script 1. Apache got request GET /your_script 2. Your CGI app is loaded, in case of say Perl it's compiled first then loaded. To compile/translate it, the perl would have to be started. When it starts it loads dynamic libraries, which when loaded, are pulling other dynamic libraries (in most cases). 3. When all is settled with Perl, your script is translated. 4. Now we're ready to execute our script. 5. Your script pulls the data out of environment, does it's job and it goes Back to step 4 You see, your fast cgi app just stays in the memory, loaded, armed and ready to process another request. When next request comes in, there are no steps 1,2,3,4,6. "Back to step 4" is a FasctCGI loop which should be programmed into your FastCGI app, in case of PHP that fastcgi loops stays outside of the user code yet in most languages it's programmed by user. In PHP you can't do "slow jobs" before entering FastCGI loop, so even in FastCGI mode php will fail to achieve the same performance as even Perl in FastCGI mode. So, what you're doing is making a FastCGI app to run thorough steps 1-6 over and over again, instead of Going back to step 4 you're calling EXIT, which makes your app to behave exactly like a normal CGI. And, unlike a normal CGI app, a FastCGI app has an overhead in starting a FasctCGI server for the first time and in stopping it. Since you've done very badly in programming your first FastCGI app, you're making the server to run through steps 1 to 6 PLUS FastCGI overhead which in the first time is significant. That's why you have such a bad performance out of a sound technology. Now to haskel, taking my fist glance at haskell: import Control.Concurrent import System.Posix.Process (getProcessID) import Network.FastCGI test :: CGI CGIResult test = do setHeader "Content-type" "text/plain" pid <- liftIO getProcessID threadId <- liftIO myThreadId let tid = concat $ drop 1 $ words $ show threadId output $ unlines [ "Process ID: " ++ show pid, "Thread ID: " ++ tid] main = runFastCGIConcurrent forkIO 10 test ^^^^^^^^^^^^^^^^ I would say that this is the FastCGI loop I may be mistaking but it looks like runFastCGIConcurrent would use forkIO to run test procedure with concurrent model. import Control.Concurrent import System.Posix.Process (getProcessID) import Network.FastCGI test :: CGI CGIResult test = do setHeader "Content-type" "text/plain" pid <- liftIO getProcessID threadId <- liftIO myThreadId let tid = concat $ drop 1 $ words $ show threadId output $ unlines [ "Hello, I'm Haskell what a purely logical language I am", "With a good concurrency too, now featuring FastCGI, ", "I've run out of +, they are all used for mathematics, and the point came to the", "complex floating point ops, so I'm kind of in need", "if you close your eyes you may imagine", "me as one huge but beautiful command line", "but I'm not a command line I'm equation", "of course I'm not as half as alien as Perl might be", "I am a gift to the scientists all around the world", "they now can have equations as long as they need", "Process ID: " ++ show pid, "Thread ID: " ++ tid] init = do //YOU DO ALL THE HEAVY STUFF HERE, LIKE DB CONNECTIONS, //INITIALIZATIONS, HASHING, B-TREES, ANYTHING, BEFORE ENTERING FASTCGI LOOP // // now we're entering FastCGI loop where we will reside till Apache // server is working and we do not exit on purpose or abnormally main = init runFastCGIConcurrent forkIO 10 test ??> Thanks for your answers! >> How did you write the code to read the file? >> What language did you write it in? You haven't provided enough information. ??> I wrote it in haskell, just reading file and writting it out using ByteString: ??> import Network.FastCGI ??> import qualified Data.ByteString.Lazy as BL ??> main = runFastCGIConcurrent 1000 (handleErrors cgiMain) ??> cgiMain :: CGI CGIResult ??> cgiMain = do ??> setHeader "Content-type" "image/jpeg" ??> b <- liftIO $ BL.readFile "/usr/lib/cgi-bin/pic.jpg" ??> outputFPS b >> FastCGI is not particularly appropriate for this task. Apache is most >> likely much more efficient at the fairly simple task of streaming files via >> HTTP, and doesn't incur the overhead that FastCGI does in performing that >> task. ??> I am planning to write complex content management system with storing pictures in dedicated storage, that's why I have to output pictures through the ??> application. >> FastCGI is more appropriate for tasks that you would otherwise write a CGI >> program to do, and should be faster in those cases. It is also appropriate >> for tasks where you would consider loading mod_php, mod_perl, etc. into >> your Apache configuration; in those cases, the performance difference will >> probably be negligible, but you have a lot more control over the design in >> terms of load-balancing and security. ??> So, I will use something different than fastcgi. ??> _______________________________________________ ??> FastCGI-developers mailing list ??> FastCGI-developers at mailman.fastcgi.com ??> http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers -- www.rol.ru Best regards, Igor mailto:sprog at online.ru From tarasove at list.ru Wed Jan 27 07:05:40 2010 From: tarasove at list.ru (Evgeny Tarasov) Date: Wed, 27 Jan 2010 15:05:40 +0300 Subject: [FASTCGI] =?koi8-r?b?dmVyeSBsb3cgcGVyZm9ybWFuY2U=?= Message-ID: Hello, Igor, thank you for detailed explanation! > Since you've done very badly in programming your first FastCGI app, > you're making the server to run through steps 1 to 6 PLUS FastCGI > overhead which in the first time is significant. That's why > you have such a bad performance out of a sound technology. But I'm afraid that my program has the loop. 'runFastCGIConcurrent' function listen webserver's requests and launches 'cgiMain' for each one. Network.FastCGI module uses not different processes for processing requests but posix threads. I have checked my program's behaviour, it can serve many requests in some time with 'FastCGIConfig -maxClassProcesses 1' option in webserver's config. There is only one myprogram.fcgi system process with immutable pid in that time. From sprog at online.ru Wed Jan 27 12:39:37 2010 From: sprog at online.ru (Igor) Date: Wed, 27 Jan 2010 20:39:37 +0300 Subject: [FASTCGI] very low performance In-Reply-To: References: Message-ID: <1941403516.20100127203937@online.ru> Hello Evgeny, Wednesday, January 27, 2010, 3:05:40 PM, you wrote: Hmm, make sure you have all requests coming to this process, instead streaming the picture print PID and the counter of requests. Make sure that the same PID serves as many requests as you want. The PID should stay the same but the request counter should increase. That's normal. What do you see in your case? When you do not load the picture, is there any performance change? Check out apche error log, is there any message related to crashing or sigterminate? If everything is OK, check out your compiler options, does it have the threading support? http://ozten.livejournal.com/ Try out this sample, FastCGI -- ghc -package fastcgi -threaded --make -o FCgiPlay.fcgi FCgiPlay.hs import Control.Concurrent import System.Posix.Process (getProcessID) import Network.FastCGI test :: CGI CGIResult test = do setHeader "Content-type" "text/plain" pid <- liftIO getProcessID threadId <- liftIO myThreadId let tid = concat $ drop 1 $ words $ show threadId output $ unlines [ "Process ID: " ++ show pid, "Thread ID: " ++ tid] main = runFastCGIConcurrent' forkIO 10 test does it work fast? ET> Hello, Igor, thank you for detailed explanation! >> Since you've done very badly in programming your first FastCGI app, >> you're making the server to run through steps 1 to 6 PLUS FastCGI >> overhead which in the first time is significant. That's why >> you have such a bad performance out of a sound technology. ET> But I'm afraid that my program has the loop. 'runFastCGIConcurrent' function listen webserver's requests and launches 'cgiMain' for each one. ET> Network.FastCGI module uses not different processes for processing requests but posix threads. ET> I have checked my program's behaviour, it can serve many requests in some time with 'FastCGIConfig -maxClassProcesses 1' option in webserver's config. ET> There is only one myprogram.fcgi system process with immutable pid in that time. ET> _______________________________________________ ET> FastCGI-developers mailing list ET> FastCGI-developers at mailman.fastcgi.com ET> http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers -- www.rol.ru Best regards, Igor mailto:sprog at online.ru From preston at bannister.us Sun Jan 31 15:33:20 2010 From: preston at bannister.us (Preston L. Bannister) Date: Sun, 31 Jan 2010 12:33:20 -0800 Subject: [FASTCGI] Has anyone used multiplexed connections with FastCGI? Message-ID: <7e91ba7e1001311233j4e099733y1359b94f3de0bebc@mail.gmail.com> Does anyone use multiplexed connections with FastCGI? Clearly this requires support from both the frontend (the FastCGI extension to the web server), and in the backend (the FastCGI application). Also clearly, most (all?) backends are not written for multiplexed connections (as this is much simpler). Apparently(?) the IIS frontend for FastCGI does not support multiplexed connections. Are there frontends that support multiplexed connections (which I could get from reading the sources, eventually), and do any work reliably (which may be harder to determine)? (Started writing a FastCGI application, putting in support for multiplexed connections, and wondering if this might be a bad idea.) -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists.drrngrvy at gmail.com Sun Jan 31 21:10:12 2010 From: lists.drrngrvy at gmail.com (Darren Garvey) Date: Mon, 1 Feb 2010 02:10:12 +0000 Subject: [FASTCGI] Has anyone used multiplexed connections with FastCGI? In-Reply-To: <7e91ba7e1001311233j4e099733y1359b94f3de0bebc@mail.gmail.com> References: <7e91ba7e1001311233j4e099733y1359b94f3de0bebc@mail.gmail.com> Message-ID: <4509b54b1001311810x170d4cefn2ab079b6e5e132a3@mail.gmail.com> Hi Preston, On 31 January 2010 20:33, Preston L. Bannister wrote: > Does anyone use multiplexed connections with FastCGI? I don't know of any servers - free or commercial - which support multiplexed requests concurrently over a single connection. Are there frontends that support multiplexed connections (which I could get > from reading the sources, eventually), and do any work reliably (which may > be harder to determine)? I'm developing a (c++) FastCGI library that's "supposed" to support multiplexed connections, but I've never been able to test this aspect of it (ie. multiplexing) so can't claim to support it either completely or reliably. That said, I am currently rewriting the docs for this library and hope to wrap a release shortly, free-time permitting. (Started writing a FastCGI application, putting in support for multiplexed > connections, and wondering if this might be a bad idea.) > Supporting multiplexing caused me some headaches with the unbuffered approach I took. I still wonder how much efficiency can be gained from supporting multiplexed connections and if it is worth it in the end. The Jury's out until there are some performance numbers against a multiplexing-enabled production server. I haven't found that supporting multiplexing causes any noticeable runtime overhead, but does add some complexity to the implementation because of multithreaded considerations. If you'd like to share your ideas / implementation, let me know (offline if you prefer). Cheers, Darren [1] If you are interested, code is available at https://svn.boost.org/trac/boost/browser/sandbox/SOC/2007/cgi/. Examples are in libs/cgi/example. -------------- next part -------------- An HTML attachment was scrubbed... URL: From preston at bannister.us Sun Jan 31 22:05:25 2010 From: preston at bannister.us (Preston L. Bannister) Date: Sun, 31 Jan 2010 19:05:25 -0800 Subject: [FASTCGI] Has anyone used multiplexed connections with FastCGI? In-Reply-To: <4509b54b1001311810x170d4cefn2ab079b6e5e132a3@mail.gmail.com> References: <7e91ba7e1001311233j4e099733y1359b94f3de0bebc@mail.gmail.com> <4509b54b1001311810x170d4cefn2ab079b6e5e132a3@mail.gmail.com> Message-ID: <7e91ba7e1001311905i12e7533ekd00103d29add7fc2@mail.gmail.com> Thanks, Darren. Was kind of afraid the answer might be similar to yours (few or no servers), given that searching did not turn up any evidence. :) Seems highly unlikely the Apache 1.x series (probably the biggest use of FastCGI, early on) could have supported multiplexed connections. Given a stable Apache module, and few/no FastCGI applications that can accept multiplexed connections, there would no reason to put in work in that area for Apache 2.x (even if feasible). My interest is a little different, as I am looking at solving C10K class problems. Can I build a massively scalable solution using server-side Javascript (the Google V8 engine), no threads, and strict non-blocking/asynchronous I/O? (Something like "node.js" but usable via FastCGI.) Javascript interpreters are very strong on sandboxing (due to the browser heritage), so keeping large numbers of per-request contexts is straightforward. I would guess that keeping down the number of connections (via multiplexing) could be an advantage, for very large numbers of connections. I have long been interested in both single-threaded/non-blocking servers, and in server-side Javascript. http://bannister.us/weblog/2009/12/30/almost-but-not-quite-server-side-javascript/ http://bannister.us/weblog/2006/12/19/revisiting-server-side-javascript/ Take this as an experiment. :) The current code is at: http://svn.bannister.us/public/cgi-1/ Don't bother looking, as it is far too early. On Sun, Jan 31, 2010 at 6:10 PM, Darren Garvey wrote: > Hi Preston, > > On 31 January 2010 20:33, Preston L. Bannister wrote: > >> Does anyone use multiplexed connections with FastCGI? > > > I don't know of any servers - free or commercial - which support > multiplexed requests concurrently over a single connection. > > Are there frontends that support multiplexed connections (which I could get >> from reading the sources, eventually), and do any work reliably (which may >> be harder to determine)? > > > > I'm developing a (c++) FastCGI library that's "supposed" to support > multiplexed connections, but I've never been able to test this aspect of it > (ie. multiplexing) so can't claim to support it either completely or > reliably. That said, I am currently rewriting the docs for this library and > hope to wrap a release shortly, free-time permitting. > > > (Started writing a FastCGI application, putting in support for multiplexed >> connections, and wondering if this might be a bad idea.) >> > > Supporting multiplexing caused me some headaches with the unbuffered > approach I took. I still wonder how much efficiency can be gained from > supporting multiplexed connections and if it is worth it in the end. The > Jury's out until there are some performance numbers against a > multiplexing-enabled production server. I haven't found that supporting > multiplexing causes any noticeable runtime overhead, but does add some > complexity to the implementation because of multithreaded considerations. > > If you'd like to share your ideas / implementation, let me know (offline if > you prefer). > > Cheers, > Darren > > [1] If you are interested, code is available at > https://svn.boost.org/trac/boost/browser/sandbox/SOC/2007/cgi/. Examples > are in libs/cgi/example. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jon+fastcgi-developers at unequivocal.co.uk Sun Jan 31 22:40:36 2010 From: jon+fastcgi-developers at unequivocal.co.uk (Jon Ribbens) Date: Mon, 1 Feb 2010 03:40:36 +0000 Subject: [FASTCGI] Has anyone used multiplexed connections with FastCGI? In-Reply-To: <4509b54b1001311810x170d4cefn2ab079b6e5e132a3@mail.gmail.com> References: <7e91ba7e1001311233j4e099733y1359b94f3de0bebc@mail.gmail.com> <4509b54b1001311810x170d4cefn2ab079b6e5e132a3@mail.gmail.com> Message-ID: <20100201034036.GA4709@snowy.squish.net> On Mon, Feb 01, 2010 at 02:10:12AM +0000, Darren Garvey wrote: > > I'm developing a (c++) FastCGI library that's "supposed" to support > multiplexed connections, but I've never been able to test this aspect of > it (ie. multiplexing) so can't claim to support it either completely or > reliably. That said, I am currently rewriting the docs for this library > and hope to wrap a release shortly, free-time permitting. > > > (Started writing a FastCGI application, putting in support for > multiplexed connections, and wondering if this might be a bad idea.) > > Supporting multiplexing caused me some headaches with the unbuffered > approach I took. I still wonder how much efficiency can be gained from > supporting multiplexed connections and if it is worth it in the end. The > Jury's out until there are some performance numbers against a > multiplexing-enabled production server. I haven't found that supporting > multiplexing causes any noticeable runtime overhead, but does add some > complexity to the implementation because of multithreaded considerations. > If you'd like to share your ideas / implementation, let me know (offline > if you prefer). My Python FastCGI client library at http://jonpy.sf.net/ supports multiplexing, but like you say it's never been tested really because I don't know of any server side libraries that use it. It was easy to fit in my design though so I put it in.