Skip to content

[JS wrapper] Performance issues when used intensively #76

@genaris

Description

@genaris

As part of the integration of Askar with Aries Framework JavaScript, I'm running a test where I set up two Aries JavaScript Agents based on either Indy SDK or Askar and make them connect and exchange a few simple messages.

In that scenario I noticed a very big performance gap: when using two Indy-based agents, the test takes around 300 ms while it takes almost 40 seconds for two Askar agents. When running with a profiler (v8-profiler-next) in both situations I got the following results:

afj-e2e-test-askar

afj-e2e-test-indy

As you can see, in Askar case the CPU spends 80% of its time in Garbage Collector and almost 15% of the time dereferencing pointers and other wrapper-related-stuff.

An interesting issue in ref-napi came after an initial research on this topic. And after applying the patch proposed in a PR and running the tests again, this problem completely disappeared and actually the Askar Agent performed better than the Indy one (as expected).

The problem is that this fix is not working in Node 14.x and 16.x, as it seems that some fixes in v8 engine related to a "Check failed: result.second." (not sure which ones exactly) were not backported and, as a result, this only works in Node 18.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions