如何在两个JVM实例之间共享内存? [英] How can I share memory between two JVM instances?

查看:185
本文介绍了如何在两个JVM实例之间共享内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在JVM(Scala)中构建了一个巨大的图形,我想重复使用它,调整算法。我不想每次都从磁盘重装它。有没有办法让它在一个JVM中连接时从另一个JVM开始算法?

I build a huge graph in JVM (Scala) which I want to use repeatedly, tweaking algorithms. I'd rather not reload it each time from disk. Is there a way to have it sit in one JVM while connecting from another, where the algorithms are being developed?

推荐答案

保存你的图形到磁盘,然后使用 MappedByteBuffer <将其映射到内存中/ A>。这两个进程都应该使用相同的内存,它将与页面缓存共享。

Save your graph to disk, then map it into memory with MappedByteBuffer. Both processes should use the same memory, which will be shared with the page cache.

这篇关于如何在两个JVM实例之间共享内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆