-
Notifications
You must be signed in to change notification settings - Fork 1.1k
slow loading of media files #517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If I disable Static files panel, the problem disappears. Strangely the static files themselves does not seem to be influenced if the panel is enabled. This is the code to serve media files:
|
@jezdez — what do you think? |
Huh, will look into this. |
Same problem with Django 1.7b1 and latest django-debug-toolbar: from django.conf.urls.static import static
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |
I think I have tracked this down: The slowness can be eliminated by removing the call to A further problem is that this expensive method is run for every request, including ones that will never need it, because they don't return HTML - including requests for the media files themselves. So, for media heavy sites (where the total number of media files is large, and the number per page is likely to be large), you get hit on both counts. Digging deeper, So it seems that for most of the panels, the |
@spookylukey Nice digging! That makes sense (yikes, 3k files!), your proposed API changes make sense to me, too. |
Bump! Running in to this on a rather large site, wondering if it's slated to be fixed any time soon? |
It probably won't be any time soon, but I'll try to get a solution together the next time I spend a large chunk of time on the project. |
@spookylukey When you said most of the panels' The reasoning is that if we change the purpose of |
@tim-schilling it's exactly because of the compatibility problem with 3rd parties that I made the suggestion that way round. Existing With my suggestion, those 3rd party panels wouldn't be affected - they would be using How you want to handle this is entirely up to you, though. |
Ah, gotcha. That makes sense, thank you for clarifying! |
Can someone test out #731 to verify that it's improved the loading of media files before I merge it in? |
Closing as #731 was merged. |
generate_stats is not always called. It will only be called when the toolbar is going to insert itself into the response. The method process_response will always be called and should be used for panels that need to interrupt the request such as the RedirectsPanel. This update is to address issue django-commons#517.
Hey,
upgrading to 1.0 seems to cause slow downloading of media files into browser. They are loaded in batches of aprox. six images and there is always a long pause between loading of each batch. Here is screenshot from chrome developer tools:
With debug toolbar disabled, this doesn't happen and images are all loaded almost immediatelly.
I am always cleaning the browser cache between individual tries to get the results.
The text was updated successfully, but these errors were encountered: