I have a large, complex content type with around 80 fields, several of which are address, location, or multivalue CCK fields. I also have a number of rules and ubercart conditional actions that execute custom code on node save or order save. I was getting 30 to 40 second page load times when viewing the Edit and Payment tabs on the order.
I enabled the devel performance logging module and turned on query logging. On the payment tab, there were very few individual long queries, nearly all of which were under 30ms. However, there were a large number of 20ms updates that were executed numerous times (123 times per set of location field updates, 41 times per set of content type table updates, and both of these appeared 4 or 5 times with minor differences, but the same number of executions and approximately the same execution times - I did not analyze the differences).
Sadly, I cannot provide a copy of the query log for analysis.
In the node checkout settings for the content type, I disabled the Order status field, Order ID field, and Product ID field settings, and page load times returned to the 2 to 3 second range.
I have rules and conditional actions setting values in these fields at appropriate times, so the problem is resolved for me, but I figured someone else might benefit from the information, even if this is a "won't fix" issue.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | uc_node_checkout-change-only-when-different-1432220-3.patch | 1.44 KB | stewart.adam |
Comments
Comment #1
tr commentedNot sure what I can do with such limited information ... If there are queries that are causing long page load times on your system I will at a minimum need to know which queries are taking a long time or are executed many times.
Comment #2
stewart.adam commentedI believe this is because uc_node_checkout_update_content_fields() to update the node whenever uc_order_load() is called. This in return causes a node_save() so hook_nodeapi() get triggered for all modules every time any order is loaded, which could easily be a few times per page depending on which Ubercart modules are enabled.
Comment #3
stewart.adam commentedAttached patch should resolve the issue by only attempting a node_save() when the field on the node does not match the current value instead of updating whenever the field on the node is present (i.e., all the time). Only lightly tested.
Comment #4
retorque commentedThanks! I finally got the deployment done, so hopefully I will have an opportunity to test the patch in dev sometime this week.
Comment #5
stewart.adam commentedIt should work on the latest stable release too, I just changed the version to dev because I could confirm that this issue is still present in dev.
Comment #6
retorque commentedI applied the patch in #3 manually to 6.x-2.0-beta8 since the line numbers don't match up there. On the first load of the Payments tab, it took 15 seconds. After that, it only took 2 to 3 seconds each time. Behavior was the same for multiple orders.
Since the first save should actually occur at order creation, not when loading the Payments tab, this fixes the problem.
Thanks!
Comment #7
stewart.adam commentedGreat! Marking this as RTBC.