2

我将 Gwan 视为运行 Scala 应用程序的一种更高性能的方式。我们的用例涉及使用 Scala 数据结构在内存中保存大量数据。这比简单的 hashmap 稍微复杂一些,所以我想避免尝试将其插入 Gwan 附带的 K/V 存储中。

还有许多 C 库可以很好地与之交互。好奇在 Gwan 上使用第三方 C 库和 Scala 应用程序的过程是什么。

谢谢!

4

1 回答 1

1

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.

于 2013-06-25T11:43:55.430 回答