Re: [Catalyst] FastCGI deployment - slow to complete request
On 15/02/10 15:59, Steve Rippl wrote: Hi, I have a small Catalyst app, the production version of which has been running pretty well using the built in server as there haven't been too many user at once. I'm trying to anticipate higher concurrent usage and switch to FastCGI (as that seems to be recommended in the book) and I have the following running in Apache FastCgiServer /srv/WsdSis/script/wsdsis_fastcgi.pl -processes 5 Alias / /srv/WsdSis/script/wsdsis_fastcgi.pl/ VirtualHost *:80 ServerName sis.woodlandschools.org ServerAdmin webmas...@woodlandschool.org DocumentRoot /srv/WsdSis/root Alias /static /srv/WsdSis/root/static /VirtualHost Now this works, it's serving up the application, but each request is really slow to complete! The obvious effect of this is that a page with JavaScript waiting for a complete page before it does it's thing looks dreadful for a while, the html has arrived but the browser is still spinning, then eventually the page completes and the JS runs. (I know about graceful failure for JS, but I have an app that is going to depend on it!). If I switch this back to the built in server then the page is completed faster than I can notice and the page renders correctly immediately. Back on FastCGI and even a simple page request is taking ~10 seconds to complete (again, that html arrives straight away, but then the browser keeps spinning as if it's still waiting on something). This is running on a Debian 5 machine using libapache2-mod-fastcgi. You can get good performance out of catalyst by just running the PREFORK standalone server*, with a reverse-proxy cache sitting in front of it. (eg. Varnish http://varnish-cache.org/) [* http://search.cpan.org/dist/Catalyst-Engine-HTTP-Prefork/ ] I've never been satisfied by either of the FastCGI implementations available to Apache. I do like the one for Lighttpd, but some other aspects of lighty can be annoying. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] FastCGI deployment - slow to complete request
On 15/02/10 04:59, Steve Rippl wrote: Now this works, it's serving up the application, but each request is really slow to complete! The obvious effect of this is that a page with JavaScript waiting for a complete page before it does it's thing looks dreadful for a while, the html has arrived but the browser is still spinning, then eventually the page completes and the JS runs. I think there's a strong chance you have the same problem that I have with my production app, and have not yet had a chance to investigate. I am using the built-in server for development, and FastCGI in production. A good Mozilla hacker who is using my software tracked it down to the following: Catalyst or Apache is sending the wrong Content-Length and so the browser is spinning waiting for the rest of the data. It is sending the Content-Length of the uncompressed data, but then the server is applying a Content-Encoding of gzip. Now, calculating Content-Length correctly would require doing the compression before sending any headers, which would use a lot of memory if the entity body was large. However, my understanding (RFC 2616 section 4.4) is that you either have to do that or use chunked Transfer-Encoding. I solved the problem by disabling mod_deflate. I don't know what a proper fix would be. Gerv ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] FastCGI deployment - slow to complete request
Andrew Rodland wrote: Fix: Use a current snapshot version of mod_fastcgi. Source tarballs can be found in http://www.fastcgi.com/dist/ or if you'd like a deb, I've built http://cleverdomain.org/libapache2-mod-fastcgi_2.4.6.99~snap20081109_i386.deb (for Debian 5.0 i386). Andrew Thanks for providing this, but when I install it and restart apache I get wsdsis:~# /etc/init.d/apache2 start Starting web server: apache2apache2: Syntax error on line 185 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/fastcgi.load: Cannot load /usr/lib/apache2/modules/mod_fastcgi.so into server: /usr/lib/apache2/modules/mod_fastcgi.so: wrong ELF class: ELFCLASS64 failed! and I'm on a 32bit kernel (in case that's what ELFCLASS64 is referring to?) wsdsis:~# uname -m i686 Would using the source version solve this or is something else going on? For now I've disabled mod_deflate and that helps, I presume if I wasn't using DEFLATE anywhere I'm not loosing anything here? Anyway, thanks for the help! Steve -- Steve Rippl Technology Director Woodland Public Schools 360 225 9451 x326 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] FastCGI deployment - slow to complete request
Steve Rippl wrote: Andrew Rodland wrote: Fix: Use a current snapshot version of mod_fastcgi. Source tarballs can be found in http://www.fastcgi.com/dist/ or if you'd like a deb, I've built http://cleverdomain.org/libapache2-mod-fastcgi_2.4.6.99~snap20081109_i386.deb (for Debian 5.0 i386). Andrew Thanks for providing this, but when I install it and restart apache I get wsdsis:~# /etc/init.d/apache2 start Starting web server: apache2apache2: Syntax error on line 185 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/fastcgi.load: Cannot load /usr/lib/apache2/modules/mod_fastcgi.so into server: /usr/lib/apache2/modules/mod_fastcgi.so: wrong ELF class: ELFCLASS64 failed! and I'm on a 32bit kernel (in case that's what ELFCLASS64 is referring to?) wsdsis:~# uname -m i686 Would using the source version solve this or is something else going on? Your machine / packaging system etc is seriously broken in some way, or you're trying to use a .deb built for a system you're not running. So yes - compiling the source version yourself would imply that you compile it on the right machine, ergo it's more likely to work. :) Personally, I'd just remove mod_deflate, use the mod_fastcgi in your distribution (which will then work fine), and add Catalyst::Plugin::Compress.. Cheers t0m ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] FastCGI deployment - slow to complete request
On Monday 15 February 2010 10:47:45 am Steve Rippl wrote: Andrew Rodland wrote: Fix: Use a current snapshot version of mod_fastcgi. Source tarballs can be found in http://www.fastcgi.com/dist/ or if you'd like a deb, I've built http://cleverdomain.org/libapache2-mod-fastcgi_2.4.6.99~snap20081109_i38 6.deb (for Debian 5.0 i386). Andrew Thanks for providing this, but when I install it and restart apache I get wsdsis:~# /etc/init.d/apache2 start Starting web server: apache2apache2: Syntax error on line 185 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/fastcgi.load: Cannot load /usr/lib/apache2/modules/mod_fastcgi.so into server: /usr/lib/apache2/modules/mod_fastcgi.so: wrong ELF class: ELFCLASS64 failed! and I'm on a 32bit kernel (in case that's what ELFCLASS64 is referring to?) Apologies, somehow I had uploaded a bad build -- it says i386 in the filename but it was actually amd64. Fixed one is uploaded (at the same address, so just pull it again and install it again). Andrew ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] FastCGI deployment - slow to complete request
Andrew Rodland wrote: Apologies, somehow I had uploaded a bad build -- it says i386 in the filename but it was actually amd64. Fixed one is uploaded (at the same address, so just pull it again and install it again). Andrew That worked - thanks! -- Steve Rippl Technology Director Woodland Public Schools 360 225 9451 x326 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] FastCGI deployment - slow to complete request
Hi, I have a small Catalyst app, the production version of which has been running pretty well using the built in server as there haven't been too many user at once. I'm trying to anticipate higher concurrent usage and switch to FastCGI (as that seems to be recommended in the book) and I have the following running in Apache FastCgiServer /srv/WsdSis/script/wsdsis_fastcgi.pl -processes 5 Alias / /srv/WsdSis/script/wsdsis_fastcgi.pl/ VirtualHost *:80 ServerName sis.woodlandschools.org ServerAdmin webmas...@woodlandschool.org DocumentRoot /srv/WsdSis/root Alias /static /srv/WsdSis/root/static /VirtualHost Now this works, it's serving up the application, but each request is really slow to complete! The obvious effect of this is that a page with JavaScript waiting for a complete page before it does it's thing looks dreadful for a while, the html has arrived but the browser is still spinning, then eventually the page completes and the JS runs. (I know about graceful failure for JS, but I have an app that is going to depend on it!). If I switch this back to the built in server then the page is completed faster than I can notice and the page renders correctly immediately. Back on FastCGI and even a simple page request is taking ~10 seconds to complete (again, that html arrives straight away, but then the browser keeps spinning as if it's still waiting on something). This is running on a Debian 5 machine using libapache2-mod-fastcgi. Thanks, Steve -- Steve Rippl Technology Director Woodland Public Schools 360 225 9451 x326 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] FastCGI deployment - slow to complete request
On Sunday 14 February 2010 10:59:54 pm Steve Rippl wrote: If I switch this back to the built in server then the page is completed faster than I can notice and the page renders correctly immediately. Back on FastCGI and even a simple page request is taking ~10 seconds to complete (again, that html arrives straight away, but then the browser keeps spinning as if it's still waiting on something). It's a bug in mod_fastcgi that mangles the Content-Length header when it's used together with output filters (almost always mod_deflate), and there are a couple of ways to deal with it. Workaround: Disable mod_deflate, or at least prevent it from activating on anything that might come from mod_fastcgi. Fix: Use a current snapshot version of mod_fastcgi. Source tarballs can be found in http://www.fastcgi.com/dist/ or if you'd like a deb, I've built http://cleverdomain.org/libapache2-mod-fastcgi_2.4.6.99~snap20081109_i386.deb (for Debian 5.0 i386). Andrew ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/