Discussion:
Slow OpenBSD web server
Mark Farquaad
2005-01-06 13:22:55 UTC
Permalink
Hi all,

I'm new to OpenBSD and don't like being flamed at so
that's why I post here to the newbies list instead of another
one. :-)

I'm trying to set up an OpenBSD web server and actually
finally got Apache, PHP and MySQL up and running,
thanks to the instructions of Rev3rse:
http://revunix.mine.nu/document/apache_1.3/index.html
:-) (Compliment to him here! Great help, although not quite
perfect english ;-)

O.K. having said that, here's my problem:
The server seems to run fine, just extremely slow.
I am using very old hardware, a mainboard from about 1995,
a Pentium 1 MMX CPU at 233 MHz, 128MB of RAM, an old
hard disk with 3GB of space and old 10MB/s ethernet cards.

I'm wondering if this is the cause though becuase I was
using almost this exact same hardware before with a
Slackware Linux installation and I did not notice any
performance issues there at all!
(Although there I only tested pages from the Slackware
box itself, not from another computer on the LAN which
seems even worse.)

Now, when I download a very simple html page to my
browser on a windows box in the same LAN, the speed
is so slow, it's like a 56K dial up modem!
Downloading a simple html page with an image of
about 84KB over the LAN litterally takes about 5 seconds
and you can see the image slowly drizzling in...

This can't be normal or can it?

When I test the same page locally, from the OpenBSD box,
the speed is a little better, but still noticably slow.
Displaying the same image of 84KB in a simple html
page takes about 1-2 seconds there.

It's not the LAN either, I first had a switch in between
then I replaced that with a crossover link, no difference.

I also tried a php page with quite some calculations
in it and that takes about 3-4 minutes (!) to display!

I tried reverting to the default php-ini document and I
tried disabling mod_security and mod_php4 in the
httpd_conf file, but none of that made any difference for
the very slow image downloading in standard html docs.

Mind you, this is just a testing box for testing php scripts.
It's not on the internet, it does not get more requests than
those I send it from one other computer on the LAN and
there's noone else using it and nothing else running on it
than the standard OpenBSD stuff like ssh, ntp plus
additionally MySQL and PHP and mod_security.

Does anyone have some experience or knowledge about
this here? Shouldn't even old hardware perfom considerbly
better when only used as a test box for 1 single request?

I also noticed that the web page of Rev3rse seems to perform
quite slow too. Is this maybe a configuration bug or even an
OpenBSD thing, maybe with the chrooted Apache?

Any help is greatly appreciated!

Greetings,
Mark
Frank Bax
2005-01-06 15:12:17 UTC
Permalink
Post by Mark Farquaad
The server seems to run fine, just extremely slow.
I am using very old hardware, a mainboard from about 1995,
a Pentium 1 MMX CPU at 233 MHz, 128MB of RAM, an old
hard disk with 3GB of space and old 10MB/s ethernet cards.
I'm guessing the hardware is the problem. I have noticed significant
performance improvements each time my server was upgraded from P2 to P3 to
P4 from 2000 to 2004 - I remember emailing a friend with stats on a test
script each time, but I'm not sure I still have copies of those.
Post by Mark Farquaad
It's not the LAN either, I first had a switch in between
then I replaced that with a crossover link, no difference.
I sometimes use scp to test lan speed. Transfer a 10Meg file using:
scp -p testfile.tgz ***@target:
testfile.tgz 100% 10MB 908.5KB/s 00:13
testfile.tgz 100% 10MB 7.1MB/s 00:01

The first one (just under 1Meg/sec) is on 10Mbit lan. The second one (just
under 10Meg/sec) is on 100Mbit lan.
Post by Mark Farquaad
I also tried a php page with quite some calculations
in it and that takes about 3-4 minutes (!) to display!
At beginning of your php scipt add:
$t1 = explode( " ", microtime() );
At the end of your php script add:
$t2 = explode( " ", microtime() );
$secs = bcadd( bcsub($t2[0],$t1[0],4), bcsub($t2[1],$t1[1],4), 2 );
echo "<P>Page took $secs seconds to build.</P>";

This will tell you how much time the script took to perform the calculations.

Frank
Peter Hessler
2005-01-06 16:07:09 UTC
Permalink
On Thu, 6 Jan 2005 14:22:55 +0100
Mark Farquaad <***@gmail.com> wrote:

:O.K. having said that, here's my problem:
:The server seems to run fine, just extremely slow.
:I am using very old hardware, a mainboard from about 1995,
:a Pentium 1 MMX CPU at 233 MHz, 128MB of RAM, an old
:hard disk with 3GB of space and old 10MB/s ethernet cards.

Check to see if you are hitting swap (if top shows any amount of swap as
used, then you hit it). That would slow things down a ton. Also, do you
have reverse dns configured? (`dig +short -x [your ip address]` will tell
you if it is.) Apache does rdns checks for its logs, and that can explain
why it takes so long. (If that is the problem, you can fix it one of two
ways, by turning off the rdns checker in apache config, or by adding rdns to
your resolver. The latter is recommended, because it will solve that
problem for other network apps on your network.)
--
With all the fancy scientists in the world, why can't they just once
build a nuclear balm?
Mark Farquaad
2005-01-06 21:29:17 UTC
Permalink
Hi Frank and hi Peter!

Wow! Thanks, you both gave me lots of cool
leads to try out, these will keep me busiy for
a while. Especially the testing an php
code supplied by Frank. Thanks! :-)

Peter, I checked swap usage, according to "top",
swap is not used.
Can you elaborate about rDNS?
All I know is this:
http://www.webopedia.com/TERM/R/rDNS.html

I tried your command as follows on the OpenBSD box:
dig +short -x 168.1.10.5
(168.1.10.5 being my server's IP of the NIC to the LAN)
I got the output:
;; connection timed out; no servers could be reached

Then I also tried on the OpenBSD box:
dig +short -x 168.1.10.4
(168.1.10.4 being the IP of the NIC on the box I am
browsing at on the LAN)
This probably was what you ment, but I got the same
output:
;; connection timed out; no servers could be reached


The way I set up my LAN in order to enable me to access
a VirtualHost web page from within my LAN, was to
simply add a line with the IP number and hostname
of server and webpage to all "hosts" files of all computers
in the LAN. Is this not enough for RDNS?
Do I need a real DNS server (I hope not, never done it)?
If not, how can I add rdns to my "resolver"?

I found this file and took a quick look at it, but is there
an easy way of adding rdns to the resolver without setting
up a DNS server?
http://www.crucialparadigm.com/resources/tutorials/web-hosting/how-reverse-dns-works-rdns.php

Thanks a ton already both of you for your replies! :-)
Mark
Post by Peter Hessler
On Thu, 6 Jan 2005 14:22:55 +0100
:The server seems to run fine, just extremely slow.
:I am using very old hardware, a mainboard from about 1995,
:a Pentium 1 MMX CPU at 233 MHz, 128MB of RAM, an old
:hard disk with 3GB of space and old 10MB/s ethernet cards.
Check to see if you are hitting swap (if top shows any amount of swap as
used, then you hit it). That would slow things down a ton. Also, do you
have reverse dns configured? (`dig +short -x [your ip address]` will tell
you if it is.) Apache does rdns checks for its logs, and that can explain
why it takes so long. (If that is the problem, you can fix it one of two
ways, by turning off the rdns checker in apache config, or by adding rdns to
your resolver. The latter is recommended, because it will solve that
problem for other network apps on your network.)
--
With all the fancy scientists in the world, why can't they just once
build a nuclear balm?
Alec Berryman
2005-01-06 22:04:58 UTC
Permalink
Post by Mark Farquaad
I found this file and took a quick look at it, but is there
an easy way of adding rdns to the resolver without setting
up a DNS server?
http://www.crucialparadigm.com/resources/tutorials/web-hosting/how-reverse-dns-works-rdns.php
You have put the hosts in /etc/hosts? hosts(5) for more
Mark Farquaad
2005-01-07 09:30:07 UTC
Permalink
Post by Alec Berryman
You have put the hosts in /etc/hosts? hosts(5) for more
Yep. I did. Should that cover the "resolver" issue?
If it does, why do still get an error message when I do the:
dig +short -x 168.1.10.5 ?

Another question perhaps:
Is there some simple program available for OpenBSD which
displays CPU load? That way I could see if it's the CPU
which is too slow or if other issues are making a bottleneck.

Greetings,
Mark
Alec Berryman
2005-01-07 09:50:50 UTC
Permalink
Post by Mark Farquaad
Is there some simple program available for OpenBSD which
displays CPU load? That way I could see if it's the CPU
which is too slow or if other issues are making a bottleneck.
top
Salvador Sabaini
2005-01-07 19:04:30 UTC
Permalink
Post by Mark Farquaad
Post by Alec Berryman
You have put the hosts in /etc/hosts? hosts(5) for more
Yep. I did. Should that cover the "resolver" issue?
dig +short -x 168.1.10.5 ?
Is there some simple program available for OpenBSD which
displays CPU load? That way I could see if it's the CPU
which is too slow or if other issues are making a bottleneck.
You should read systat(1).
Hope it helps.

-ssf
Mark Farquaad
2005-01-09 19:58:23 UTC
Permalink
Please help! Help direly needed!

Hi all,

*sorry*, my nerves are slowly tearing I fear... ;-/

I found out a lot more about my really weird problem
and it just gets weirder and weirder!!
:-(

Aparently, I only get this bottelneck only one way
and not the other!
When I downolad a file from the OpenBSD box to the
windows box through Apache (via http), I get an average
speed of a meger 5 KB/sec (measured with a 1,5MB file).
When I download the same file from OpenBSD to windows
with drag & drop through Samba, I get an average speed
of a meger 10.5 KB / sec.
At the same time I was monitoring system resources, with "top",
and found the OpenBSD CPU had an avarage load of about 0.3%
and idle of 99.7%. Free memory was at 47MB, Swap at 0!
So it's not the CPU, memory or hard disk braking!

But guess what?
When I upload the same file, from windows to OpenBSD
through Samba, I get a mindbogling 1000+ KB/sec !!!
(1.5MB file was uploaded faster than in 1.5 seconds!!!)

So it's probably not the (old) network cards.

What could be causing this??

Some more details:
The network cards are old RealTek RTL-8029 based
cards (maker unknown).

I tried Frank Bax's script and found one of my bigger
PHP scripts actually takes a whooping 133 seconds to create
a html document. At the same time "top" reveals almost
no CPU or memory usage at all (CPU load 99.7% idle)!
Isn't that really weird??

I am unsure about the "resolver" issue Peter mentioned,
I did read the man pages "man resolv.conf" and "man resolver",
but wasn't quite sure what to do.
I tried this: I edited the file /etc/resolv.conf and added the
lines:
nameserver 127.0.0.1
nameserver 168.1.10.4 (my windows box)

But this didn't change anything at all (I did reboot after editing).

Has anyone ever heard of anything like this before?
I believe it is not a hardware based problem as I used the
same hardware (except a different graphic card) with a Slackware
Linux setup and did not see this problem there.

Please, any ideas & help greatly appreciated!

Mark
Daniel Staal
2005-01-10 22:51:09 UTC
Permalink
--As of Sunday, January 9, 2005 8:58 PM +0100, Mark Farquaad is alleged to
Post by Mark Farquaad
I am unsure about the "resolver" issue Peter mentioned,
I did read the man pages "man resolv.conf" and "man resolver",
but wasn't quite sure what to do.
I tried this: I edited the file /etc/resolv.conf and added the
nameserver 127.0.0.1
nameserver 168.1.10.4 (my windows box)
But this didn't change anything at all (I did reboot after editing).
Has anyone ever heard of anything like this before?
I believe it is not a hardware based problem as I used the
same hardware (except a different graphic card) with a Slackware
Linux setup and did not see this problem there.
--As for the rest, it is mine.

It really does sound like a nameserver issue. Does your windows box run a
nameserver? If not, then find out what your local nameserver is and put
it's address in /etc/resolv.conf.

Basically, it looks like your OpenBSD box is busy trying to get some
information that you haven't given it enough info to get. *Until* it does,
it runs the network slowly. Provide it with the basics, and it will work.

Either you have a nameserver someplace, or you have access to DHCP which
will tell you where the nameserver is at the moment. Figure out which one
it is, and we'll help set up the box accordingly. ;)

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

Loading...