Hi,

I'm not sure you give enough details or evidences on HttpResponse being slow.
Are you 100% sure that DB access have been made ? Don't forget query sets are 
lazy, ie database accesses are not done when you define your queryset.

I got a website with something like 4 (small) DB queries. Without cache, I get 
around 150 requests per second on 2GHz Pentium.
Page wait time reported by Safari is 57ms, download take 27ms which is far from 
your measures.
Also notice that of 57ms, 29 are due to network latency (ping).
On another site of mine where I have around 20 DB requests but table entries 
are much larger (around 30 fields per row) and it take 225ms before getting the 
first byte and another 246ms to get the full result.

In either case I find it hard to say that it could be on django itself.
What sort of server are you running your site on ? What option did you choose 
for using apache with python ?
I had dreadful results on a shared hosting calling python code (Django) through 
cgi scripts (around 1 sec before the first byte is send).

Xavier.

Le 23 mars 2010 à 00:41, TheIvIaxx a écrit :

> im not about to say my code is prefect :)  I'll check out the toolbar
> thing.
> 
> my problem though is that timing it to the point where it's completely
> out of my hands is .72 sec and then my browser doesn't get byte #1
> until 1.46 sec.  There is a big discrepancy and i'm not sure what is
> causing it.
> 
> The .72 is after all views have be ran, all DB access has been made,
> and templates have been rendered to the HTML.  I get my last
> time.clock() right before returning the HttpResponse object
> 
> On Mar 22, 4:37 pm, Daniel Roseman <dan...@roseman.org.uk> wrote:
>> On Mar 22, 11:25 pm, TheIvIaxx <theivi...@gmail.com> wrote:
>> 
>> 
>> 
>> 
>> 
>>> Not sure whose jurisdiction this falls under, but from my findings,
>>> this is what i have:
>> 
>>> Firebug reports 1.46/.055 sec waiting/downloading.  I need the
>>> "waiting" part to be less than 1 sec.
>> 
>>> It looks like sending the response is very fast, but preparing it is
>>> not.
>> 
>>> So i investigated as to where the slowdown is.  Using time.clock(),
>>> from the time django received the request to the time the response
>>> HTML is ready to ship its .72 sec.  So now i am wondering why it's
>>> taking django or apache another ~.72 seconds to get the html ready and
>>> fired off.
>> 
>>> Chrome reports similar results.
>> 
>>> Am i interpreting these times incorrectly?
>> 
>>> Thanks
>> 
>> Why do you think it should be faster than this? Django isn't just
>> 'serving HTML', it's running a whole stack within which your code is
>> presumably calling views, accessing the database, and rendering
>> templates. Depending on the complexity of your app, .72 seconds could
>> well be a perfectly reasonable amount of time to do all that.
>> 
>> That said, there will almost certainly be areas within your code that
>> can be made more efficient - the Django debug toolbar is a great place
>> to start finding those slowdowns.
>> --
>> DR.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to