Sunday, September 21, 2014

Re: Slow page load performance with a large number of formsets (over 25)

We have had the same problem, but with a large number of forms. I have profiled the situation and the load time is dominated by form rendering on the server. 

I remember vaguely something about caching forms so they don't need to be re-rendered, but can't find it now. And I don't understand the tradeoffs anyway. (Maybe somebody does?)

We're looking at moving away from Django forms to passing Json back and forth between Javascript thingies. Recently used http://handsontable.com/ to replace a formset. Much faster, much more flexible. You lose some of the niceties of model forms, need to do a lot of javascript validations which can be cranky, and of course need to do all of your updating in procedural code in views.  As always, tradeoffs.

On Friday, September 19, 2014 10:26:04 PM UTC-5, Jason wrote:

We are new to the Django framework and are currently building an application in PythonAnywhere. We have a couple of html pages where the volume of formsets that we are loading up varies from 25 to 100. We find that when we use a small number of formsets, the page loads very quickly. However, performance seems to degrade as the numbers increase. 

It's not an issue with our SQL queries as when we load the same data into a HTML table instead of using formsets, it loads very quickly. 

We need to load the data using formsets because we expect updates to each row from the user.

Has anyone encountered this problem? If so, is there a way to improve the performance of the formsets or are formsets not intended to be used with large volumes of data? If not, are there alternative options that we can use that allow users to modify the data in multiple rows returned by the query? Note - we don't want to send the user to a 'Pop-Up' or another screen to update data. Note 2 - We are using "Model" formsets, in particular "inlineformset_factory".

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3929fd47-cd26-40c2-a6d7-93483ad59b34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment