Thanks Graham,

Regarding the authentication, I am behind a basic auth because this is
a development server so I need to enter a username/password to access
it. I also use -C (although I didn't write it here) to pass a cookie
on pages that have session info associated with them. However for the
time being I'm trying to figure out the static issues. The database
optimisation is the next hurdle... :-)

Thanks for the info regarding the webserver. However, even just using
a simple view with no context drops the number of requests by a factor
of 6. When just running Django without any app on it, I get 300req/s,
but when I do an extremely straightforward view (no context dictionary
etc), it knocks it down to 52req/s. I thus suspect that the middleware
I'm importing is having a signficant impact on performance. I was
initially worried that it was the ProfileMiddleware causing the issue,
but after taking it out, it made no impact. This is what I'm currently
importing:

MIDDLEWARE_CLASSES = (
    'django.middleware.gzip.GZipMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.middleware.doc.XViewMiddleware',
    'popjam.ProfileMiddleware.ProfileMiddleware',
)

I'm still pretty stumped...are there any other issues of my app that
may be causing this slowdown, even something obvious that I may have
missed?

Thanks again,

Mike.


On Oct 3, 9:52 am, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> [EMAIL PROTECTED] wrote:
> > Hi guys,
>
> > Firstly, I want to say that I've had some great help from you guys so
> > far - you've really helped me solve a lot of problems. I'm looking
> > forward to the time when I have enough experience to answer other
> > questions!
>
> > Anyway...I'm having quite a bit of difficulty figuring out what is
> > making my site so slow.
>
> > The site is running off of a combination of Nginx and Apache. Nginx
> > handles all media requests and Apache handles anything dynamic.
> > However, regardless of whether I use Nginx/Apache or the Django
> > development server (!) I still seem to get the same number of requests
> > when I use ApacheBench to hit the server.
>
> > Right now, I'm getting about 10 requests/second using these
> > parameters:
> > ab -A user:pass -c 10 -t 30http://myservername.com/
>
> The -A option only does HTTP Basic authentication. Normally if using
> authentication for Django it it form authenticated sessions and so
> something completely different. Thus this may not be doing what you
> think it is.
>
> Also, ab will only request the page for that specific URL, it does not
> do sub requests for inline images, styles sheets etc. So your comments
> about static files isn't relevant.
>
> Finally, the underlying web server is generally not the bottleneck,
> but your application and database are. Because Django has quite a bit
> of overhead, often you may not see much difference in performance when
> you use different hosting mechanisms.
>
> Graham
>
> > Where, obviously, user/pass and myservername.com are correct for my
> > server.
>
> > Now I realise that ab is not a one size fits all performance tester,
> > but I am interested in why the "ballpark" figures given from it are
> > slow.
>
> > If I remove all static content from the page, but still load the HTML
> > template and an image, it jumps to ~35 req/s. If I comment out the
> > WHOLE template, but still run the view (which does nothing more than
> > pass an empty context to the response handler), it goes to ~52 req/s.
> > When I run Django without ANY of my code (i.e. just with the "It
> > worked!" message), I get around 300 req/s.
>
> > Firstly, could somebody tell me why am I seeing the same performance
> > with the Django dev server as I am on the Nginx/Apache combo?
> > Especially since I know that the dev server CRAWLS when serving media.
>
> > I've been looking at previous posts on the user group on the subject
> > of site slowdown and a common theme seems to be keeping "KeepAlive"
> > on. I tried turning that off in Apache and it made no difference
> > whatsoever. Part of me is concerned my Nginx/Apache config is not up
> > to scratch. I definitely know that Nginx is handling the media because
> > I can turn Apache off and then point the browser directly to a media
> > file and it is served. However, I'm completely at a loss as to how to
> > begin. I've installed the Profiling Middleware, but it just tells me
> > that the majority of time is spent here:
>
> > 47.8%   0.022 /usr/lib/python2.5/site-packages/django/template/
> > __init__.py
> > 32.6%   0.015 **/**/**/**/site/templatetags/common.py
>
> > Is there anything really obvious that I may be missing? Any debug
> > settings I may have forgotten to turn off? I've set
> > MaxRequestsPerChild to 100000 so I don't think that it's that.
> > PythonDebug is off in httpd.conf.
>
> > If you would like any config files to help you assess the problem,
> > I'll gladly post them here.
>
> > Thanks for all your help so far and the time taken to read this! It's
> > very much appreciated.
>
> > Regards,
>
> > Mike.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to