"Jeremy Dunck" <[EMAIL PROTECTED]> writes:
On 1/5/07, David Abrahams <[EMAIL PROTECTED]> wrote:
..
> 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 docs aren't wrong, per se-- KeepAlive generally does result in a
performance improvement.
I didn't mean that. I meant the part about the default settings being
good unless traffic is very high.
KeepAlive allows multiple HTTP request/response cycles to run
through the same TCP connection, avoiding the TCP setup cost.
Typically, requests made on external resources benefit most from
KeepAlive (e.g. stylesheets fetched due to a reference from an
HTML).
But you have to weigh that cost with alternatives. The downside of
KeepAlive is that it's based on time, so you'll almost certainly
have processes sitting idle. If you run a separate media server,
KeepAlive is generally a waste, since subsequent requests go to a
separate process, and instead if just ties up the original process
for no gain.
In general, it's unusual to have such a heavy apache process with no
subsequent requests, so the docs weren't written with it in mind.
I see.
... another poke in the dark... are you serving flatpages and/or
static media via Django?
I'm not using the flatpages app if that's what you mean.
Most of my content is static in nature, generated on-demand from ReST
sources. For those pages, the model checks the mod time of a
directory in the filesystem before deciding if the content in the
locmem cache is up-to-date.
Your settings.py and urls.py (leaving out sensitive stuff, of
course) would also help.
I can't thank you enough for being willing to crawl through my code
and configs. BTW, I'm not posting my httpd.conf (yet) because (a)
it's spread across many files and (b) I don't feel very confident that
I wouldn't be making a security blunder.
Voil�:
---- settings.py ---
ADMINS = (
('Dave Abrahams', 'myemail')
# ('Your Name', '[EMAIL PROTECTED]'),
)
MANAGERS = ADMINS
#
# prepare settings that depend on where the project is being run.
#
from site_context import *
TEMPLATE_DEBUG = DEBUG
CACHE_BACKEND = 'locmem:///'
# A default for the view cache, etc.
CACHE_MIDDLEWARE_SECONDS = 60*10
# Local time zone for this installation. All choices can be found here:
#
http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
TIME_ZONE = 'US/Pacific'
# Language code for this installation. All choices can be found here:
# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
# http://blogs.law.harvard.edu/tech/stories/storyReader$15
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''
# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com"
MEDIA_URL = ''
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = <elided>
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)
MIDDLEWARE_CLASSES = (
# 'django.middleware.cache.CacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
)
ROOT_URLCONF = 'boost_consulting.urls'
APPEND_SLASH = False
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates".
# Always use forward slashes, even on Windows.
'templates'
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.comments',
'boost_consulting.testimonials',
'boost_consulting.news',
'boost_consulting.pages',
)
---------- urls.py --------
from django.conf.urls.defaults import *
from news.models import News
from news.feeds import NewsFeed
from boost_consulting.settings import serve_media
feeds = {
'news': NewsFeed
}
urlpatterns = patterns('',
# Uncomment this for admin:
(r'^admin/', include('django.contrib.admin.urls')),
(r'^comments/', include('django.contrib.comments.urls.comments')),
(r'^feed/(?P<url>[-\w]+)', 'django.contrib.syndication.views.feed',
{'feed_dict': feeds}),
)
if serve_media:
# Debug only - http://www.djangoproject.com/documentation/static_files/
# explains why we shouldn't serve media from django in a release server.
#
# For some reason I haven't yet discovered, the media/ URL seems to be
# reserved for media used by django's admin module, so we use site-media
urlpatterns += patterns(
'',
(r'^site-media/(?P<path>.*)$',
'django.views.static.serve', {'document_root': 'media/'}))
# Generic views
news_parameters = {
'queryset': News.objects.all(),
'date_field': 'date'
}
urlpatterns += patterns(
'django.views.generic.date_based',
(r'^news/(?P<year>\d{4})/(?P<month>[A-Za-z]{3})/(?P<day>\d{1,2})/(?P<slug>(?:-|\w)+)$',
'object_detail', dict(news_parameters, slug_field='slug')),
(r'^news/(?P<year>\d{4})/(?P<month>[A-Za-z]{3})/(?P<day>\d{1,2})$',
'archive_day', news_parameters),
(r'^news/(?P<year>\d{4})/(?P<month>[A-Za-z]{3})$',
'archive_month', news_parameters),
(r'^news/(?P<year>\d{4})$',
'archive_year', dict(news_parameters, make_object_list=True)),
(r'^news$',
'archive_index', dict(news_parameters, num_latest=4)),
)
urlpatterns += patterns('django.views.generic',
(r'^$', 'simple.direct_to_template', {'template': 'homepage.html'}),
(r'^admin(.*[^/])$', 'simple.redirect_to', {'url': r'admin\1/'}),
# (r'^news$', 'list_detail.object_list', {'queryset': news_set}),
# (r'^news/(?P<object_id>\d+)$', 'list_detail.object_detail', {'queryset':
# news_set}),
(r'^(?P<base>.*)/$', 'simple.redirect_to', {'url': r'/%(base)s'})
)
urlpatterns += patterns(
'boost_consulting',
(r'(.*[^/])$', 'pages.views.page'))
--
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
-~----------~----~----~----~------~----~------~--~---