From owner-freebsd-performance@FreeBSD.ORG Mon Mar 14 07:47:46 2005 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BDC9516A4CE for ; Mon, 14 Mar 2005 07:47:46 +0000 (GMT) Received: from ford.blinkenlights.nl (ford.blinkenlights.nl [213.204.211.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4009143D2F for ; Mon, 14 Mar 2005 07:47:46 +0000 (GMT) (envelope-from sten@blinkenlights.nl) Received: from tea.blinkenlights.nl (tea.blinkenlights.nl [192.168.1.21]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ford.blinkenlights.nl (Postfix) with ESMTP id 8A0BF3F294; Mon, 14 Mar 2005 08:47:44 +0100 (CET) Received: by tea.blinkenlights.nl (Postfix, from userid 101) id 212E727C; Mon, 14 Mar 2005 08:47:44 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by tea.blinkenlights.nl (Postfix) with ESMTP id 0DB78265; Mon, 14 Mar 2005 08:47:44 +0100 (CET) Date: Mon, 14 Mar 2005 08:47:43 +0100 (CET) From: Sten Spans To: ray@redshift.com In-Reply-To: <3.0.1.32.20050313190145.00a8db40@pop.redshift.com> Message-ID: 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> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed cc: freebsd-performance@freebsd.org cc: Erich Dollansky Subject: Re: performance modifications X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Mar 2005 07:47:46 -0000 On Sun, 13 Mar 2005 ray@redshift.com wrote: > Hi Erich, > > I wrote a small test program in C that just printed a single test > 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