# Apache High performace Setup!!! SOLVED

## lordkur

Hello friends:

                    I am using gentoo on my productions servers and I've been looking for a good setup , so my server can run a very busy website. Our apps are based on PHP5 , therefore my install goes like a simple apache2 with PHP5 installed. I am looking for gurus opinnion since I have a slow performance and  and a bit of strange errors. My box goes like this:

    Dell 2850 

     - Dual sempron Processors  3GHZ

     - 4 Gigas of Ram

     - 1.8 Teras of SCSI HD.

I have installed :

PHP 5.1.1-gentoo (cli) (built: Feb 20 2006 17:47:55)

```
 USE='apache2 berkdb dba bzip2  calendar cdb cgi cli crypt ctype curl curlwrappers doc ftp gd gdbm gmp inifile jpeg -libedit memlimit mhash ming mysql mysqli ncurses nls pcre pear png posix readline session -sharedmem xml simplexml snmp sockets spell spl sqlite ssl threads tidy truetype tiff  xml2 xmlrpc zip zlib' emerge -v dev-lang/php
```

Server version: Apache/2.0.55 

 *Quote:*   

> USE='apache2 mpm-worker ssl threads' emerge -v apache
> 
> a piece of my httpd.conf 
> 
>    <IfModule worker.c>
> ...

 

 Any opinnions and suggestions are welcome friends, I need to rock the house with this server so Gentoo can be take as our official Linux Distro   :Very Happy:  !!!!!!!!!!!!!!

PD: If you'd like to see more configs just ask for it!!!!Last edited by lordkur on Fri Feb 24, 2006 3:39 am; edited 1 time in total

----------

## Catch-22

could you please post the output of

```
emerge --info
```

so we can see your CFLAGS, etc.

cheers

----------

## lordkur

 *Catch-22 wrote:*   

> could you please post the output of
> 
> ```
> emerge --info
> ```
> ...

 

Here you have my friend!  :Very Happy: 

```

Portage 2.0.51.22-r2 (default-linux/x86/2005.1, gcc-3.3.5-20050130, glibc-2.3.4.20041102-r1, 2.6.12-gentoo-r9 i686)

=================================================================

System uname: 2.6.12-gentoo-r9 i686 Intel(R) Xeon(TM) CPU 3.00GHz

Gentoo Base System version 1.6.13

dev-lang/python:     2.3.5-r2

sys-apps/sandbox:    1.2.11

sys-devel/autoconf:  2.13, 2.59-r6

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1

sys-devel/binutils:  2.15.92.0.2-r10

sys-devel/libtool:   1.5.18-r1

virtual/os-headers:  2.6.11-r2

ACCEPT_KEYWORDS="x86 ~x86"

AUTOCLEAN="yes"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O2 -march=i686 -pipe"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/bind /var/qmail/control"

CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"

CXXFLAGS="-O2 -march=i686 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="autoconfig distlocks sandbox sfperms strict"

GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/Linux/distributions/gentoo"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="x86 X alsa apm arts audiofile avi berkdb bitmap-fonts bzip2 cdb crypt cups curl eds emboss encode ethereal expat foomaticdb fortran gd gdbm gif gmp gnome gpm gstreamer gtk gtk2 idn imap imlib ipv6 jpeg kde lcms ldap libedit libg++ libwww mad maildir mhash mikmod ming mng motif mp3 mpeg mysql ncurses nls ogg oggvorbis opengl oss pam pcre pdflib perl php png postgres python qt quicktime readline sasl sdl snmp spell ssl tcpd tiff truetype truetype-fonts type1-fonts udev vda vorbis xml2 xmms xv zlib userland_GNU kernel_linux elibc_glibc"

Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY
```

----------

## smurfd

im not sure, but doesnt 4gb require enabling of high-memmory support in the kernel? 

what does "slow preformance" mean? what do you compare to? what errors are those?

haven't you got alot of gtk/gnome/qt/kde stuff in your USE flags for a server? (okey, you may be running some frontends and such, if not, ditch the X)

----------

## ecaz

Hi:

 Here's all the relevant info you requested. This machine is a LAMP server and their main duty is to serve PHP websites (vbulletin and others, so their PHP load and use is noticeable - databases are on other machine).

 This is all the relevant stuff you may need. Is a very similar machine (Dell PE 1425SC) 2x Xeon 2.8Ghz/1Mb & 2Gb RAM, SATA harddisks.

 - Apache 2.0.x

 - PHP 4.4.0

 - Eaccelerator 0.9.3 (this is PHP version dependant).

 Describe what's your problems and what's happening with this machine? High CPU loads, Low throughput, poor response?

 Tweaking a web server, specially when deals with PHP and possibly Databases, is a matter of knowing where's the real problem, is surely on the web server or is a bottleneck of the database or the application? unserialize bugs from 5.x versions come to my mind along other horror stories...

 Is PHP5 mandatory for your application?

emerge info:

```

Portage 2.0.54 (default-linux/x86/2005.1, gcc-3.3.6, glibc-2.3.5-r2, 2.6.13-gentoo-r5 i686)

=================================================================

System uname: 2.6.13-gentoo-r5 i686 Intel(R) Xeon(TM) CPU 2.80GHz

Gentoo Base System version 1.6.14

dev-lang/python:     2.3.5, 2.4.2

sys-apps/sandbox:    1.2.12

sys-devel/autoconf:  2.13, 2.59-r6

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1

sys-devel/binutils:  2.16.1

sys-devel/libtool:   1.5.22

virtual/os-headers:  2.6.11-r2

ACCEPT_KEYWORDS="x86"

AUTOCLEAN="yes"

CBUILD="i386-pc-linux-gnu"

CFLAGS="-O3 -march=nocona -fomit-frame-pointer -momit-leaf-frame-pointer -pipe"

CHOST="i386-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/alias /var/qmail/control"

CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"

CXXFLAGS="-O3 -march=nocona -fomit-frame-pointer -momit-leaf-frame-pointer -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="autoconfig distlocks sandbox sfperms strict"

GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"

LDFLAGS="-Wl,-O1"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="x86 alsa apache2 apm arts avi berkdb bitmap-fonts bzip2 crypt cups eds emboss encode expat foomaticdb fortran gd gdbm gif gnome gpm gstreamer gtk gtk2 idn imlib ipv6 jpeg libg++ libwww mad mhash mikmod motif mp3 mpeg mysql ncurses nls ogg oggvorbis opengl oss pam pdflib perl php png python quicktime readline sdl spell ssl tcpd truetype truetype-fonts type1-fonts udev vorbis xml xml2 xmms xv zlib userland_GNU kernel_linux elibc_glibc"

Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LINGUAS, PORTDIR_OVERLAY

```

----------

## Joffer

 *lordkur wrote:*   

> Dell 2850 
> 
>      - Dual sempron Processors  3GHZ

 

This does no exist. You probably mean Dual Intel Xeon 3GHz. Dell does not deliver AMD processors [yet], and even if it did, semprons are not dual capable.

----------

## think4urs11

some general thoughts

- check whether or not the machine is swapping

- disable HostnameLookups

- when using allow/deny statements, always use ip addresses, no dns names

- if content negotiation is needed use type-map files rather than Options MultiViews

- use KeepAlive

- if possible do not use SymLinksIfOwnerMatch

- use mod_deflate / mod_cache

----------

## InsaneHamster

 *lordkur wrote:*   

> Hello friends:
> 
> PD: If you'd like to see more configs just ask for it!!!!

 

can u post ur firewall settings and scripts

and if u dont mind i would use them or atleast their base for my server cause i suck at setting shit up

----------

## lordkur

 *Joffer wrote:*   

>  *lordkur wrote:*   Dell 2850 
> 
>      - Dual sempron Processors  3GHZ 
> 
> This does no exist. You probably mean Dual Intel Xeon 3GHz. Dell does not deliver AMD processors [yet], and even if it did, semprons are not dual capable.

 

yes, My mistake , I meant Dual XEON

----------

## lordkur

 *Think4UrS11 wrote:*   

> some general thoughts
> 
> - check whether or not the machine is swapping
> 
> - disable HostnameLookups
> ...

 

Hello, My issue is solved now. The problems magically Dissapeared When I just compiled back to mpm-prefork instead of mpm-worker   :Razz:  .... Now I am happy and the site run fast as hell!!!  :Very Happy: 

----------

## int2str

You solved your problems, great!

However, consider loosing some USE flags.

You have:

```
USE="x86 X alsa apm arts audiofile avi berkdb bitmap-fonts bzip2 cdb crypt cups curl eds emboss encode ethereal expat foomaticdb fortran gd gdbm gif gmp gnome gpm gstreamer gtk gtk2 idn imap imlib ipv6 jpeg kde lcms ldap libedit libg++ libwww mad maildir mhash mikmod ming mng motif mp3 mpeg mysql ncurses nls ogg oggvorbis opengl oss pam pcre pdflib perl php png postgres python qt quicktime readline sasl sdl snmp spell ssl tcpd tiff truetype truetype-fonts type1-fonts udev vda vorbis xml2 xmms xv zlib userland_GNU kernel_linux elibc_glibc" 
```

For a server I would definitely consider:

-X -alsa -arts -audiofila -cups -gnome -gtk -gtk2 -kde -ogg -oggvobis -opengl -oss -quicktime -vorbis -xv ...

If you don't use IP V6, also do:

 -ipv6

Cheers,

    Andre

----------

## lordkur

How could I clean out those flags?

----------

## int2str

 *lordkur wrote:*   

> How could I clean out those flags?

 

Uhm, check your make.conf?! :p

----------

## lordkur

 *int2str wrote:*   

>  *lordkur wrote:*   How could I clean out those flags? 
> 
> Uhm, check your make.conf?! :p

 

```
# These settings were set by the catalyst build script that automatically built this stage

# Please consult /etc/make.conf.example for a more detailed example

CFLAGS="-O2 -march=i686 -pipe"

CHOST="i686-pc-linux-gnu"

CXXFLAGS="${CFLAGS}"

MAKEOPTS="-j3"

ACCEPT_KEYWORDS="~x86"

USE='apache2 mysql innodb php mysqli vhost'

USE='vda postgres ssl sasl maildir libwww imap'

```

This is my Make.conf , I dont have any kde flag or so... What can I do to get rid of unnecessary flags??...

Thanks in advance!!!!!!!!!

----------

## m.b.j.

They are from your profile.

The profile is linked from /usr/portage/profiles/{$profile} to /etc/make.profile

The Gentoo default profile is a desktop profile, try looking around in /etc/portage/profiles, if there is a profile for you. (hardeded?)

If you can't find any, add all your unwanted useflags to /etc/make.conf with a "-" at the beggining

$USE="use1 use2 -unwated"

if this is unreadable (because there are a lot of flags), try so:

$NUSE="-unwated1 -unwated2 ..."

$USE="$NUSE use1 use1"

My englich is bad, im sorry...

----------

## lordkur

 *m.b.j. wrote:*   

> They are from your profile.
> 
> The profile is linked from /usr/portage/profiles/{$profile} to /etc/make.profile
> 
> The Gentoo default profile is a desktop profile, try looking around in /etc/portage/profiles, if there is a profile for you. (hardeded?)
> ...

   :Very Happy:   :Very Happy: 

Thanks for this advices!!!! Dont worry about ur english is easily understable!!!!!!!!!!

----------

