My current project I am pulling data from a remote database and saving it locally. During some stress test we are seeing horrible results with writing to a database. To give you some perspective:
- Our stress test made ~9000 actions, which saves off about 54,000 records. (1 action = 6 records)
- By 6 records, I mean 6 rows in 4 different tables in a database.
- Heroku took 15-20 minutes to write all of these records.
- Locally, I'm going on 45 minutes still writing.
I'm not sure what's fast/slow, but obviously we can't let the web-page hang around like that. My next thought would be a CRON job, but heroku only allows 1 cron job an hour. That would be a start but we could eventually need more.
The way I'm pulling the data from the remote is:
- Querying the remote
- Matching the remote fields with the local fields
- Save the record
- Loop through to the next record.
Maybe theres a faster way with ruby?