Bad performance for server - Freebsd 8.1, apache 2.2.17, php 5.5.3, mysql 5 on amd64

Hello guys,

Sorry for my bad English but i need to solve this problem, I'm struggling with this alone almost 1 month but with no results :(

I have a dedicated server,
uname -a
Code:
8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:36:49 UTC 2010     
[email]root@mason.cse.buffalo.edu[/email]:/usr/obj/usr/src/sys/GENERIC  amd64

my CPU is
Code:
CPU: Intel(R) Pentium(R) CPU        G6950  @ 2.80GHz (2793.00-MHz K8-class CPU)

All servers I have compiled from sources, not using ports at all

then testing my web pages load time from many different sources - my 60kb index page is loading more than 5-6 seconds! Comparing with the same machine and a centos installation - there was 1.5 seconds load time for this page...

I have tried everything - turned off php, turned off mysql
experimenting with keepalive on/off, turning on/off mod deflate
hostnameslookup on/off, optimizing mysql, i have tried to install APC for php, then eaccelerator
then zend optimizer then turned off - all this WITHOUT any changes
even static pages loading 6-7 seconds for my machine

i have 4gb memory, 250GB hdd, 100mbit/sec internet port and i can't make my freebsd machine to give away pages faster..

Again I'm repeating - on the same machine then i'm installed a centos - with the default apache configuration - the pages are loading very fast and clean

But on freebsd - the loading time is between 5 and 7 seconds..
sometimes it's 10 seconds for a static page! with 60-70kb of content and a couple of images..

I'm just totally don't know what to do...
Please help. Thanks!
 
Why would you not use ports? Many of them contain FreeBSD-specific patches that are needed to make them work correctly on FreeBSD.
 
If you didn't use FreeBSD ports or packages you've actually lost the right to ask these questions here ... Ok, that was a joke, but I can assure you that if you choose not to use third-party software that was ported specifically to FreeBSD, you're really responsible for your own problems and most likely no one here will help you (other than telling you to install software properly: using ports or packages).
 
Hello

It's really strange to hear about ports and packages because I'm with Freebsd from year 1999 then I start to learn FreeBSD 3.2

I remember back in 1999, ports was really dangerous to use in production so i always use sources and build apache and mysql from source. I have installed more than 100 web server for my clients and maintain them. Even if a dedicated company don't have an option to use Freebsd i always ask them to bring a fresh freebsd installation for me because I'm always confident about Freebsd - it's a powerful and stable server platform. And I always used sources. But now on this new machine it's a new problem for me.

OK, using your tip I have installed clear apache from ports to another directory and I only changed the port to 8080 in httpd.conf. I've put a static site in data directory and... without any luck :(

Still 6-7 seconds for a static 70kb website.
 
Even though you say that you started using FreeBSD in 1999, you clearly have not read the handbook or homepage lately.

http://www.freebsd.org/ports/
http://www.freebsd.org/doc/handbook/ports.html

Since it takes you so long to open the static page:
1) Are you bandwidth limited?
2) What is taking so long? Are you having to perform hostname lookups that timeout or something similar
3) Is the server doing something wierd while fetching the page.

It seems that you are having problems with your setup.
 
grinocam said:
It's really strange to hear about ports and packages because I'm with Freebsd from year 1999 then I start to learn FreeBSD 3.2

I remember back in 1999, ports was really dangerous to use in production

According to who? I can't recall ever hearing it, and my usage of ports goes back at least that far.

You can build a generic application like Apache from source. Or you can build that same application from source that's been tested to compile and run correctly on FreeBSD, patched if necessary, and follows the FreeBSD standards for things like where it keeps config files.
 
grinocam said:
I have tried everything - turned off php, turned off mysql
experimenting with keepalive on/off, turning on/off mod deflate
hostnameslookup on/off, optimizing mysql, i have tried to install APC for php, then eaccelerator
then zend optimizer then turned off - all this WITHOUT any changes
even static pages loading 6-7 seconds for my machine

Hello ,

The information you provided is not enough even if you use packages or ports .
What versions did you install , what modules are compiled with the software , what modules are loaded , what version are dependies of your software installed from source - are they also from source installed or from packages or ports .

But for beginning you can start only with information about Apache . What is version , what is compilation options you used during install from source , what are version of its dependencies , are they are installed from source - it yes , what options did you use . What modules are loaded , are they builded as static modules or DSO . Also you can compare this with if you deinstall everything you installed from source and install apache22 from ports ( with its dependencies also from ports ) without any custom settings .

6-7 seconds for static page 70kb on 100Mb/s port is not normal at all which reminds me to ask when you open this static page what shows your browser - that connecting or that transferring data ? I ask you this because recently I noticed in Google Webmaster Tools my website has 11 seconds time to load ( ~50 ms to Google and 11 seconds to load ... ) , and the problem was with the internet connection of my primary DNS server which servers requests for this domain name . I didn't mention any OS-es or hardware or website content or software because my point is people can only guess what is your problem related , because with this small information it might be everywhere ...
 
First of all - read the Handbook:
http://www.freebsd.org/doc/handbook/
If doesn't help, read again.

And yes, you lost the right to ask the questions here, because you are using 3rd party software that's Apache, PHP and MySQL. You should remove the whole server and start from scratch.
Don't take this serious, just kidding:)

See my experience:
http://forums.freebsd.org/showthread.php?t=18943
And yes, be careful when using ports, it broke my machine as well.

I don't know why people here think that installing from ports something will change.

Now seriously.
1. Paste your PHP modules
Code:
> php -m | xargs
2.
Paste your php.ini configuration if you're using some debuggers:
Code:
> php -i | grep -e debug -e apc -e accelerator -e optimizer
3.
Paste your Apache compilation info:
Code:
> apachectl -V
4. Check number of debug symbols:
Code:
> nm `which httpd` `which php` | wc -l
5. Paste some tests (with urls which are the slowest):
Code:
> ab -n10 http://your_website/
 
kenorb said:
And yes, be careful when using ports, it broke my machine as well.

Ha!--good one!

I don't know why people here think that installing from ports something will change.

Many ports include patches, changes made from the original version of the software. Patches make software behave differently; it's what they do, their reason for being.

As an example, look at the multiple patches included in the Apache port: /usr/ports/www/apache22/files/. None of them are included with a bare-source Apache install; experts on Apache and FreeBSD have added them as required, and they've been tested by the tens of thousands of people installing, deinstalling, or upgrading the port.

All of that is free to the user, and actually easier to use than the bare-source alternative. Ports can be avoided, and occasionally there's a valid reason, but the average user can save themselves time and pain by taking advantage of all the ports structure.
 
Isolate your issue first

Seems to me that you need to determine where the bottleneck really is... what you want to do is figure out if its apache, PHP or mySQL that is causing the bottleneck. I'd suggest you do this:

1) how long does it take to load a 50K "static" page ? just a plain old index.html ?

if the timing seems good then then Apache is probably OK.​
if the timing is NOT good... you have an issue with Apache​

2) how long does it take to load a 50K dynamic page ? Create an index.php page that does NOT connect to your mySQL.

if the timing seems good then your PHP is probably ok.​
if the timing is NOT good... your problem is between PHP and Apache​

3) how long does it take to load a 50K dynamic PHP page with connections to mySQL ? modify your index.php to connect to mySQL and retrieve 50K of data.

if the timing seems good your problem is solved.​

if the timing is NOT good... your problem is somewhere between PHP and mySQL.​

Once you've actually isolated the problem... ask your questions in an appropriate forum [i.e: Apache, PHP or mySQL] as you probably don't really have a FreeBSD issue.
 
Back
Top