I've got a django site that servers matplotlib images produced from amounts saved inside a mysql database.
Among the sights displays as much as 5 images. The src value for that images don't connect to static files but rather to django sights which will generate png images. The pictures can require 5 seconds to load. Exactly the same django view function isn't being known as frequently. 5 images match various kinds of plotting techniques, each features its own function in django view.
When multiple demands for that images are sent, the server freezes up. I'm developing the website with xampp. I am unable to load the website in another tab, or the php sites I've running on a single server.
Basically attempt to load all of the images using the initial page load the server freezes. Basically load the page then request the pictures individually using jquery/ajax (and wait with patience) then there's not a problem. Basically rapidly make two ajax demands then your server freezes.
Can anybody explain what might cause the issue?
Can One pressure the serialized execution from the demands around the server?
Or can one put a period limit around the demands to kill these hang ups around the server?
Thanks. It might be a large help if a person may help me resolve this.
You could utilize a 2 stage process to create these pages:
- Around the initial request, push the look generation tasks right into a queuing system for example celery. Make use of a separate process to complete these tasks, and tune it to operate as much as the body will deal with in parallel.
- Around the client side, use ajax to poll the server to find out once the image generation jobs are complete, and finalise the display.
Are you currently serving your images with apache? in the event that so why not consider a lighter server for the media like nginx, lighttpd, Tuxedo, Cherokee or perhaps a A removed-lower version of Apache.
to have the ability to do that you could lay aside your image inside a tmp directory and serve it there if you don't desire to save the look.
You can observe some extended documentation on https://docs.djangoproject.com/en/dev/howto/static-files/
The issue i believe its happening is the fact that apache stays serving media (heavy media) and also you get free from open connections. There's whenever a lighter server might help since its in a position to manage much more connections than apache could.