7

I have a pretty large node form for one of my content types. Let's say it has about 100 fields. A lot of these fields are text values with unlimited values, so the user uses an AJAX button to 'Add another item' to each of these. Visually, this form isn't all that intimidating, because I've used Field Groups to keep things reasonable.

Problem: Clicking 'Add another item' is freaking slow. Like really slow.

I figured it was server performance, but then I checked it out in Firebug - the request isn't actually taking that long, but WOW - client side CPU usage (in Chrome, Firefox and any other browser I've tried) hits 100% and stays there for up to 11-12 seconds, and then the AJAX request completes.

That's insane.

So at this point I'm not sure what my options are. Can I break the form apart somehow? Workflow-ng style? A lot of people mention Field Groups as a way to organize a ton of fields, but that doesn't help performance, obviously.

Any help appreciated.

2

I have exactly this problem and I can confirm answer #1 - using a multi-step form improved performance, although it was still slow.

The problem is that when the Ajax fires, the entire form is rebuilt in the background. This appears to make huge demands on the server CPU if the form is large.

A multi-step form is a good way of improving things but unfortunately will not always be appropriate - in my case, the client rejected it because they felt it was too annoying to have to progress through the form in a step-by-step linear way. They wanted to be able to jump from tab to tab without saving in between.

Other than fixing Drupal core so that rebuilding the form does not require 20 seconds of max CPU, the only solution I can think of is to try the site out on a high-CPU hosting package, e.g. on Amazon AWS. This will be my next step.

Without knowing much about Drupal core and Ajax, I would call this a bug of sorts. I have heard that the performance of Ajax is being improved in Drupal 8 so I seriously doubt much effort will go into resolving this in D7.

If I had known all this at the start of my project I might have tried solutions such as combining several node forms on one tabbed panel - to break up the server load in more creative ways.

1

You should probably use a multi-step form. This might be almost easily performed using the CTools modules suite.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.