Date: Mon, 14 Mar 2005 08:47:43 +0100 (CET) From: Sten Spans <sten@blinkenlights.nl> To: ray@redshift.com Cc: Erich Dollansky <oceanare@pacific.net.sg> Subject: Re: performance modifications Message-ID: <Pine.SOC.4.61.0503140825430.18847@tea.blinkenlights.nl> In-Reply-To: <3.0.1.32.20050313190145.00a8db40@pop.redshift.com> References: <3.0.1.32.20050310193015.00a7e908@pop.redshift.com> <3.0.1.32.20050310180051.00a7e908@pop.redshift.com> <3.0.1.32.20050310180051.00a7e908@pop.redshift.com> <3.0.1.32.20050310193015.00a7e908@pop.redshift.com> <3.0.1.32.20050313190145.00a8db40@pop.redshift.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 13 Mar 2005 ray@redshift.com wrote: > Hi Erich, > > I wrote a small test program in C that just printed a single <html>test</html> > line and it was very slow when called as a cgi via apache. Much slower than > PHP. Is there something that needs to be done in order for Apache to run C > without having to shell out to the OS (?) or something. The main overhead should be fork/exec, this can be solved by running persistent cgi's through fastcgi, cgisock, etc. The main trick with tuning anything is to search for the bottlenecks, switching an entire site to another language solves nothing if the database server is the bottleneck. There are however a few easy tricks to speed things up a bit: 1- Move static content to a lightweight webserver, Apache with mod_php uses quite a bit of memory, which is wasted on static content. run thttpd/lighthttpd/etc for pictures.yourdomain.com 2- Database queries are another common bottleneck changing database layout, caching queries in sessions, etc usually helps quite a lot. 3- A simple brute-force solution is to cache generated content for short periods in squid/mod_proxy/etc or even cache it in the site code itself. Good luck. -- Sten Spans "There is a crack in everything, that's how the light gets in." Leonard Cohen - Anthem
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOC.4.61.0503140825430.18847>