I have a csv file that I'm trying to import with 30,000+ records of a data, spread across 40 or so fields, half of which are taxonomy terms. The initial import takes something like 12 hours to complete even though the mysql cpu resource rarely goes above 10% utilisation.
Subsequent updates are generally fine because only a few records are ever updated and the feeds hash seems to do the job nicely - the problem comes when new fields need to be added or the same field for every record updates.
After looking through the module code, I can't see where I would need to apply a patch to speed up the import - would someone be able to advise? Is this even possible, or should I be looking at the Migrate module instead?
Thanks in advance.
Comments
Comment #1
attiks commentedWe ran into the same problem, while trying to import 10.000 users with 30+ fields, meaning on average 60+ insert per user. We solved it by writing our own importer that converts all inserts into one stored procedures, bringing down the number of inserts per user to 2: 1 plain user_save to save name + email and to get a uid, 1 call to the stored procedures. I can not remember the speed improvement but it was huge.
Only other solution is to do it in plain sql, we used this approach for the initial import of 500.000 users.
PS: I think migrate (and any other module) will suffer the same problems.
Comment #2
zeezhao commentedHi - please any tips for increasing performance if loading csv file with 500,000+ rows? Seems to do about 30,000/hr.
Comment #3
attiks commented30,000/hr sounds pretty fast already so there's now easy way to speed this, things you can try:
Comment #4
sukh.singh commentedAttiks, can you please elaborate how you did this? If possible please share you code as well.
Comment #5
twistor commentedYou can try setting the $conf['feeds_process_limit'] in settings.php to something much larger than the default, which is 50. What this means is that a new batch process will be spawned after every 50 items. For taxonomy terms, you should be able to get this much larger.
Comment #6
attiks commented#5 the limit isn't the problem, the problem is that there're a lot of inserts, and each insert is send as a separate db_query from the php side.
The following code shows how you can create a stored proc, it uses a mapping ($importer->mappings) to map column names from the csv to the right field.
The created stored proc has 2 extra parameters (p_start AND p_end) to limit the amount of records processed in one go. We use queues to loop over all values.
Comment #7
internetdevels commentedif revisions are not necessary u can use http://drupal.org/project/field_sql_norevisions
it will give 20-25% speed improvement
Comment #8
bluegeek9 commentedDrupal 7 reached end of life and the D7 version of Feeds is no longer being developed. To keep the issue queue focused on supported versions, we’re closing older D7 issues.
If you still have questions about using Feeds on Drupal 7, feel free to ask. While we won’t fix D7 bugs anymore, we’re happy to offer guidance to help you move forward. You can do so by opening (or reopening) a D7 issue, or by reaching out in the #feeds channel on Drupal Slack.
If this issue is still relevant for Drupal 10+, please open a follow-up issue or merge request with proposed changes. Contributions are always welcome!