EPiServer Find: Bulks, please!
Are you using Find and index lots of custom data? Improve performance by Indexing lists of objects, instead of one by one, as shown in the example below.
By doing this, you will significantly reduce the number of calls sent to the Find index, thus increase the general performance and decrease time taken to index.
This is fine as long as your list of objects isn’t too large, (depending on object size), but what if you have a list of 10 000 items? Or 100 000 items? Trying to index all of them at once will most likely result in a timeout error from the service. To solve this, you should split up the list and index the objects in bulks. A simple way to do this is to create an extension method, like so:
The extension accept a list of objects and a bulksize, and is used like this:
Indexing 1000 objects – time taken:
- One by one: 8 minutes, 13 seconds.
- Bulks of 50: 4 minutes, 29 seconds.
- Single large bulk : As expected, the service timed out.