I need to exchange data between two Java applications running on the same computer (two different JVMs). I clearly understand that the data for sharing is large (about 7 GB). Applications must access data very quickly because they must respond to incoming requests at a very high speed. I do not want applications to hold every copy of the data.
I saw that one option is to use memory mapped files. Appendix A receives data from somewhere (say, a database) and saves it in files. Application B can then access these files with java.nio. I don’t know exactly how files with memory work, I only know that the data is stored in a file and that this file (or part of it) is displayed in the memory area (virtual memory?). Thus, these two applications can read and write data in memory, and changes are automatically (I think?) Transferred to the file. I also don't know if there is a maximum size for a fully displayed file in memory.
My first question is what are the different possibilities for the two applications to exchange data in this scenario (I mean that the amount of data is very large and access to this data should be very fast)? I clarify that this issue is not related to I / O with memory, it just needs to know what other methods of solving the same problem are.
My second question: what are the pros and cons of using memory mapped files?
thank
source
share