-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MemoryMapping example to Annoy tutorial #891
Comments
I did prepared the code to save and fetch the model from disk by 2 parallel processes. What do we mean by mmap the same index file? What is the use case for this scenario? I will add description too. |
@harshul1610 Thanks for taking this up. Could you please move Also, it would be more professional to choose a less controversial word example instead of 'army'. |
sure. I will do it. |
added snippet for arallel processes to load the saved model and sharing the memory mapped index piskvorky#891
Is it good? |
To be more explicit Each process should have its own indexer |
Is it good? |
Hi @harshul1610 The code looks good. |
Also, no need to create new pr to update code. you can just keep pushing to existing branch |
@tmylk It is the time that surely increases when we don't use memory mapped index. But, memory space used by processes is approximately the same. when Index file not memory mapped
Process Id: 9681 Index file memory mapped:
Resuts: One thing is for sure when we are not loading index file from memory, there is an drastic increase in the shared memory that is shared by process. |
Let me understand correctly what you are saying: It is RAM together by 2 processes, not sepately by each one. I don't see this statistics in your log above. That means mmaping claim by Annoy is not true: "It also creates large read-only file-based data structures that are mmapped into memory so that many processes may share the same data." |
@tmylk updated the statistics |
Thanks, that is more clear now. So it is using less memory in total, as it is shared. Shared memory is included in RSS so it was confusing before. Please add some text and this output to the notebook. |
Thanks for the pr! |
Add example to AnnoyTutorial where 2 parallel processes load the same model from disk and mmap the same index file.
The text was updated successfully, but these errors were encountered: