So the scenario is as follows: I have a 2-3 gb large files of binary serialized objects, I also have an index file which contains the id of each object and their offset in the file.
I need to write a method that given a set of id's deserializes them into memory. Performance is the most important benchmark and keeping the memory requirements reasonable is the second.
Using MemoryMappedFile seems the way to go, however I'm a bit unsure on how to handle the large file. I can't create a MemoryMappedViewAccessor for the entire file since it's so large. Can I simultaneously have several MemoryMappedViewAccessor's of different segments open without affecting memory too much, in that case how large should those segments be?
The views might be kept in memory a while if the data is accessed much and then disposed of
A perhaps naive method would be to order the objects to be fetched by offset and simply call CreateViewAccessor for each offset with a small buffer. Another would be to try and figure out the least amount of different MemoryMappedViewAccessor needed and their size.. but I'm unsure of the overhead in creating CreateViewAccessor and how much space you can safely access in one go. I can do some testing but if someone has a better idea... :)
I guess another way to go would to split the large datafile into several but I'm not sure that would do any good in this case...