Re: [nodejs] Re: Crypto and the event loop

2014-09-02 Thread Sanjeev Koranga
I am using createCipheriv, createHash api's and on an average doing 4-5 crypt-decrypt per request. Major consumer of crypto in my app is session (SHA1 on session size ≈20-30k). What I am seeing is only 50-100 rps max and 90+% CPU in perf testing and I was suspecting heavy crypto use for it. Let

Re: [nodejs] Re: Crypto and the event loop

2014-09-02 Thread Alex Kocharin
 Yes, child processes or webworkers (which usually implemented using child processes anyway). Fibers run in the same thread, so this isn't really a solution.  It depends on the app though. Sometimes you can just spawn a lot of instances in a cluster using something like pm2, and while one blocks, c

[nodejs] Re: Crypto and the event loop

2014-09-02 Thread Floby
Yes, your best bet is probably to use a dedicated worker and communicate with it with worker.send() On Saturday, 30 August 2014 02:02:25 UTC+2, Sanjeev Koranga wrote: > > Hi > > When I use the node crypto module, does i

Re: [nodejs] Re: Crypto and the event loop

2014-09-02 Thread Matt
On Sun, Aug 31, 2014 at 2:28 PM, Sanjeev Koranga wrote: > So if an app is doing lot of crypto, would you advice using child > processes/fibers/webworkers for running crypto functionality? > It shouldn't really be necessary. What APIs are you going to use? -- Job board: http://jobs.nodejs.org/

Re: [nodejs] Re: Crypto and the event loop

2014-09-02 Thread Fedor Indutny
This totally depends on what kind of crypto are you going to be using. For example the 2048bit RSA decryption takes 1ms on my MBP, so using it on every request will limit your RPS to around 700-800. On Sun, Aug 31, 2014 at 10:28 PM, Sanjeev Koranga wrote: > So if an app is doing lot of crypto,

[nodejs] Re: Crypto and the event loop

2014-08-31 Thread Sanjeev Koranga
So if an app is doing lot of crypto, would you advice using child processes/fibers/webworkers for running crypto functionality? On Saturday, August 30, 2014 4:29:28 PM UTC-7, mscdex wrote: > > On Friday, August 29, 2014 8:02:25 PM UTC-4, Sanjeev Koranga wrote: >> >> When I use the node crypto mod

[nodejs] Re: Crypto and the event loop

2014-08-30 Thread mscdex
On Friday, August 29, 2014 8:02:25 PM UTC-4, Sanjeev Koranga wrote: > > When I use the node crypto module, does it block the event loop while > processing or spawn a different thread in C++? > Currently there are no non-blocking counterparts to the existing functions in the built-in crypto modul