Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High memory usage #301

Open
JGiter opened this issue Jul 14, 2022 · 6 comments
Open

High memory usage #301

JGiter opened this issue Jul 14, 2022 · 6 comments

Comments

@JGiter
Copy link

JGiter commented Jul 14, 2022

Using either prepareIssuePresentation or completeIssuePresentation from @spruceid/didkit-wasm-node in class definition increases memory usage by 500 mb. Issue can be reproduced with simple class

const didkit = require('@spruceid/didkit-wasm-node');

class Verifier {
  prepareIssuePresentation(
    presentation,
    linked_data_proof_options,
    public_key
  ) {
    return didkit.prepareIssuePresentation(
      presentation,
      linked_data_proof_options,
      public_key
    );
  }
}

This happens only once - during the first reading of the class and lasts about 10 seconds

@sbihel
Copy link
Member

sbihel commented Jul 18, 2022

I can't reproduce it locally. Could you give us the Node version you're using, the environment, and an example VP?

@JGiter
Copy link
Author

JGiter commented Jul 18, 2022

I am using Node 16 on Ubuntu 20.04.4. To reproduce it I don't even create VP, just run script with code above

@jrhender
Copy link

jrhender commented Jul 21, 2022

@sbihel

I can't reproduce it locally.

Which Node version were you using when trying to reproduce? Perhaps we can try with your version

@sbihel
Copy link
Member

sbihel commented Jul 21, 2022

Sorry for not keeping you updated. I was previously looking at the heap, but indeed the RSS is large. Although my observation is that it's the instantiation (import) of didkit that's causing the increase in memory, and it never goes down.

Node 18 performs noticeably better. Otherwise, I'm still trying to figure out if it's the compiled code, or the embedded data that's the issue -- but I'm not very hopeful I'll be able to change anything in that regard. Other options include compiling to ASM or making a custom build of ssi/didkit which includes only what you need.

@jrhender
Copy link

Thanks @sbihel

Although my observation is that it's the instantiation (import) of didkit that's causing the increase in memory, and it never goes down.

I guess you observed this when using a Node version lower than v18? Do you recall what the magnitude of RSS when doing this test with a lower version? Was it around the "500 mb" that @JGiter and I have observed?

We are trying with Node v18 and will report back.

@sbihel
Copy link
Member

sbihel commented Jul 26, 2022

I guess you observed this when using a Node version lower than v18?

All of them actually.

Do you recall what the magnitude of RSS when doing this test with a lower version?

Indeed, it was around 500MB with v16 and v17. With v18 it was around 200MB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants