"Jeremy Dunck" <[EMAIL PROTECTED]> writes:
On 1/5/07, David Abrahams <[EMAIL PROTECTED]> wrote:
...
> Most likely, KeepAlive is holding processes unavailable while
> sitting idle.
How would I tell if that was happening?
Turn it off and see if performance suddenly becomes rediculously good. :)
Tried that; it's hard to tell if it makes a difference. Naturally
just after the server restarts performance is bad. It eventually
becomes very good, but it does that too when KeepAlive is on. As I
said earlier, I usually experience this slowness when I've been away
from the site for a while. I could leave it off for a while and see
if that changes things, but it might take a day or more to get a good
sense of whether it makes a difference.
If you want more evidence, perhaps the status module would interest you.
Apache status module? I could look at it, thanks.
> Next most likely is # of child processes. Try fiddling with Min and
> MaxSpareServers.
> http://httpd.apache.org/docs/2.0/mod/prefork.html
According to the docs that should only be necessary if I have very
heavy traffic. I don't; far from it. So I'm reluctant to mess with
those.
Except that KeepAlive ties up processes waiting for further requests
from a client, which may never come (and certainly won't if you run
media separately as recommended.
So you're saying that basically the docs are wrong (not questioning
you; just trying to understand better)?
The thing to remember is that apache+modpython+django+your app is a
very large process, and you should try to keep it busy doing Django
where possible. Otherwise, you're wasting resources... swatting flies
with hammers, so to speak.
Sure. If the traffic demands were high I could understand why we'd
like to dedicate the process to Apache. But I don't think they're
high yet. I am running quite a few services off this machine (Trac
servers, Mailing lists, SVN) but they have relatively few users.
> Next most likely is that you're serving media and django on the
> save httpd.
I definitely am. However, on a relatively low-traffic server like
mine it's hard to imagine that it's causing the kind of slow responses
I sometimes see. Maybe I'm deluding myself?
If your processes are tied up listening to a client that's not
talking, your server will sit completely idle doing nothing for as
long as KeepAlive makes them.
Want to see ridiculously bad performance? Make 1 server process, set
KeepAlive, and server media from it. It'll take (timeout * # of http
request seconds) to serve if your client doesn't actually utilize the
keepalive feature.
Okay, I get that.
I could probably install lighthttpd, although getting that running
alongside Apache seems like a minefield (just a feeling; I have no
data).
There's no need at all to run a separate machine for media. Lightty
serving media files is crazy-fast. As long as you have a separate IP
(and Apache is doing IP-based, rather than name-based, service),
I'm somewhat unschooled in the IP-based/name-based distinction. I
read the docs, but I'm not sure they connected. My server has one IP
address. I am running several Apache virtual servers on that IP
address. My configuration contains
NameVirtualHost: *:80
so is that name-based?
it's quite simple.
In your lighttpd.conf:
=======
server.port = 80
server.bind = "your.media.ip"
Yeah, I don't have a separate IP for media. I don't know what that
would cost me, either.
server.username = "same as apache"
server.groupname = "same as apache"
server.pid-file = "/var/run/lighttpd.pid"
server.dir-listing = "disable"
server.document-root = "/path/to/media_root/"
server.errorlog = "/var/log/lighttpd/error.log"
accesslog.filename = "/var/log/lighttpd/access.log"
#mime support if you want it:
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
=============
Then set MEDIA_URL = media.yourdomain.com
and make a DNS entry pointing media.yourdomain.com to your.media.ip.
The LightHttpd docs make it sound like it
would be better than apache for all _my_ webserver needs, but using it
that way with Django sounds like it's still pretty experimental at
best.
Apparently a fair number of people are using fcgi, though I'm not one of them.
Did you see this?
http://www.djangoproject.com/documentation/fastcgi/#lighttpd-setup
Hmm, I guess I did once. I guess that means it isn't as experimental
as I thought, thanks.
In any case, you seem reluctant to make changes,
Well, I'm just running out of time for experimentation, but maybe I
have to bite the bullet.
but IMHO, the best
thing you can do is keep a copy of your existing (bad) conf and do a
series of A/B performance tests, starting with the suggestions here
and in Jacob's post. :)
Not a bad plan.
To help future suggestions, what apache and OS versions are you running?
Apache 2.2 on FreeBSD 6.1
Thanks again for your attention.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---