如何保存数据结构在内存中的G-婉与Java /斯卡拉 [英] How to hold data structures in memory G-wan with Java / Scala
问题描述
我在看金桂冠为更高的性能的方式来运行我们的应用程序斯卡拉。我们的用例涉及使用Scala的数据结构保存在内存中的数据量好。这是一个比一个简单的HashMap更复杂一点,所以我希望避免试图把它楔进随金桂冠在K / V存储。
也有许多C-库,这将是伟大的接口。好奇使用第三方C语言库与金桂冠Scala的应用程序的过程将是什么。
谢谢!
使用Scala的数据结构的数据保持一个良好的数额在内存
块引用>Scala的数据结构连接到G-WAN的servlet最简单的方法是使用G-WAN的持久性指针,看到的 persistence.c 例子。
有关讨论的缘故,G-WAN KV存储不使用哈希表(也不由任何方式哈希,避免出现大的未使用的内存和入门碰撞)。
什么使用第三方C语言库与金桂冠Scala的应用程序的进程将是
块引用>如果你想调用C函数(或者从一个servlet或从pre-编译的C库)从Scala的G-WAN脚本,那么你可以随便挑函数指针(例如一个处理器)通过将其连接到G-WAN持续指针寄存器它,然后再调用它(从斯卡拉脚本)。
或者你可以动态地从你的斯卡拉脚本加载pre-编译的C库(在启动时仅一次)解析函数的名称,然后调用了很多次。
I am looking at Gwan as a higher performance way to run our Scala application. Our use-case involves keeping a good amount of data in memory using Scala data structures. This is a bit more complex than a simple hashmap so I would want to avoid trying to wedge it into the K/V store that comes with Gwan.
Also there are a number of C-libraries that would be great to interface with. Curious what the process of using a third party C-library with a Scala app on Gwan would be.
Thanks!
解决方案keeping a good amount of data in memory using Scala data structures
The easiest way to attach Scala data structures to G-WAN servlets is to use the G-WAN persistence pointers, see the persistence.c example.
For the sake of the discussion, G-WAN KV store is not using hash tables (nor any hashing by the way, to avoid large unused memory and entry collisions).
what the process of using a third party C-library with a Scala app on Gwan would be
If you want to call a C function (either from a servlet or from a pre-compiled C library) from a Scala G-WAN script then you can just pick the function pointer (from a handler for example), register it by attaching it to a G-WAN persistent pointer, and then invoke it later (from your Scala scripts).
Or you can dynamically load a pre-compiled C library from your Scala scripts, resolve the function name (only once at startup), and then call it many times.
这篇关于如何保存数据结构在内存中的G-婉与Java /斯卡拉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!