Re: HttpResponse, slow on apache
i checked out the toolbar, and i have a butt load of queries. Not for everything on the site, but for this particular page there are 300+ queries. They are small and are less than 1ms. I'll try to get this better :) However, in regards to Xaviers point, yes I'm sure all DB stuff has been done. I have the rendered HTML then i call time.clock(), then return the HttpResponse. As far as I know, nothing else in the db gets hit after that. The only middlewares I have ar GZip, Common, Auth, and Session. Im checking out the link you sent On Mar 22, 5:30 pm, Xavier Ordoquy wrote: > 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 wrote: > >> On Mar 22, 11:25 pm, TheIvIaxx 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 > > athttp://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.
Re: HttpResponse, slow on apache
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 wrote: >> On Mar 22, 11:25 pm, TheIvIaxx 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.
Re: HttpResponse, slow on apache
On Mar 22, 11:41 pm, TheIvIaxx wrote: > 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 Sorry, I misunderstood your first message, when you said your timing was from 'when Django receives the request'. Sounds like you've already done quite a bit of internal profiling. There's still quite a bit to be done after your return the response (presumably you're calling render separately, before your timing call, then returning the finished response afterwards). Most particularly, there's all the response middleware to call - do you have anything there? James Bennett once wrote a great article[1] about exactly how Django deals with a request - as you can see, there's lots to go through even after the view has finished its work. [1]:http://www.b-list.org/weblog/2006/jun/13/how-django-processes- request/ -- 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.
Re: HttpResponse, slow on apache
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 wrote: > On Mar 22, 11:25 pm, TheIvIaxx 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.
Re: HttpResponse, slow on apache
On Mar 22, 11:25 pm, TheIvIaxx 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.
HttpResponse, slow on apache
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 -- 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.