0

We have thousands of users, each with 1000 records. Both users and records are represented by models in our application.

Saving 1000 records individually per user takes ages (30+ seconds). However, considering all of these records belong to the same user, can be save them all in one go?

As I understand it, using Entity Groups, it could be all done in one transaction, but can't find any clear documentation on how to do this.

Any suggestions?

Community
  • 1
  • 1
Gaurav Sharma
  • 2,680
  • 3
  • 26
  • 36
  • and you want that because you are running out of the hard limit of 30 seconds per request? or you just wanted to speed up the whole thing? – Lipis Aug 04 '14 at 04:31
  • Just do it with TaskQueue. – Dmytro Sadovnychyi Aug 04 '14 at 07:14
  • @DmitrySadovnychyi We're looking at Tasks, but it just fundamentally doesn't seem to make sense for, say, 300KB of data to take 30 seconds to save, and then use Tasks as a workaround instead of solving the original problem (slow saves). It can be done on SQL box in a fraction of a second. Is this a NoSQL limitation? – Gaurav Sharma Aug 04 '14 at 16:54

1 Answers1

5

Transactions do not make processing faster. If anything, they are slower.

You can speed up processing by saving entities in batches (up to 1,000 entities per call).

Andrei Volgin
  • 40,755
  • 6
  • 49
  • 58