architectural guidance #88
-
Hello, I'm asking here for general architectural guidance. I'm developing an API that provides RDF data from a triple-store and calculations over such data performed with Eye. I'm using the eye-js distribution because the API is developed using node (but similar considerations may apply also if using the native Eye). The main overhead is that, for each API request, a new module is instantiated and it's necessary to parse not only the input data but also the rules, as well as a considerable amount of data coming from the database. For the latter, using I see two alternatives here: one is to create a PVM as suggested here (I tried and got excellent performance with the native Eye but I'm not sure if this is possible with eye-js), and the other is to avoid loading the database triples up-front and leveraging Another aspect is scalability: I haven't tried it yet but I'm afraid instantiating a new module for each request is not scalable (especially if each module includes a considerable amount of data). To sum it up, I hope you can provide some suggestions or simply point out some misconceptions. And thanks for your awesome work. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
eye-js is already using a pvm to start-up. All you would need to do is use functions like https://github.com/eyereasoner/eye-js/blob/b135f42f61f47673529f875bacd57ea48d8d23dc/lib/transformers.ts#L24-L38 and switch out the
Rest assured that node is pretty good at cleaning up memory when the module goes out of scope. This memory test is ensuring that NodeJS' memory consumption does not increase indefinitely when using the
Note that you will still need to load all of your data into the virtual WebAssembly file system up-front in order for it to be accessible to eye.
This depends on the kind of cleanup that eye does withing a single use so I'll defer to @josd on this one. You could also run your on perf tests here. (You can base it on https://github.com/eyereasoner/eye-js/blob/main/__tests_memory__/leakTest.js, but rather than calling |
Beta Was this translation helpful? Give feedback.
-
thanks @jeswr, I started looking at I could create a pvm with the native eye using a command like the folllowing:
|
Beta Was this translation helpful? Give feedback.
eye-js is already using a pvm to start-up. All you would need to do is use functions like https://github.com/eyereasoner/eye-js/blob/b135f42f61f47673529f875bacd57ea48d8d23dc/lib/transformers.ts#L24-L38 and switch out the
EYE_PVM
const for the contents of thepvm
that you generate. Happy to talk you through this in more detail if you go down that road.Rest assured …