Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

Add workers support #2

Open
3 tasks
mjp0 opened this issue Feb 16, 2019 · 1 comment
Open
3 tasks

Add workers support #2

mjp0 opened this issue Feb 16, 2019 · 1 comment
Assignees

Comments

@mjp0
Copy link
Owner

mjp0 commented Feb 16, 2019

Currently CDR uses libsodium directly in the event loop. This is completely fine for things like hashing, generating random strings and encrypting messages but when larger binary data is being encrypted, you will notice it.

The obvious next step is to add workers support. Few open questions with this.

  1. Should it use workers for everything? Is there a point where it's slower to create a worker than use the main loop?
  2. How should CDR deal with concurrency? Should it do some basic rudimentary thread scheduling to avoid creating 4+n workers at the same time on 4 core CPU?

Deliverables

  • automated worker support
  • ability to disable worker usage
  • ability to set worker concurrency
@mjp0 mjp0 self-assigned this Feb 16, 2019
@mjp0
Copy link
Owner Author

mjp0 commented Feb 21, 2019

Initial tests show that workers do increase total computing time a lot with smaller tasks like computing password hashes. On average it takes ~500ms to compute a secure password hash. If you do it in the worker, total time bounces up to ~900ms. I haven't done any deeper benchmarking but I'm willing to bet that ~400ms goes to setting up the worker and initializing sodium.

I need to think a bit how to go forward. Worker support might make sense only with the data encryption and decryption at first. Even with that CDR needs to check whether the incoming data is large enough that it makes sense to create a worker for it.

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

No branches or pull requests

1 participant