[erlang-questions] Crypto and ensure_loaded (maybe NIFs?)

Fred Hebert mononcqc@REDACTED
Mon Oct 15 17:46:46 CEST 2012


While running some benchmarks and simulations on code that tends to use 
crypto's sha functions quite a lot (in R15B02), I've noticed that code 
that used them a lot tended to have bottlenecks within code_server.

After a bit of tracing, I've found that code_server was receiving a 
bunch of messages of the form:

(<0.24.0>) in {code_server,loop,1} (Timestamp: {1350,315353,243397})
(<0.24.0>) <0.227.0> ! {code_server,{module,crypto}} (Timestamp: {1350,315353,
                                                                   243432})

(<0.24.0>) out {code_server,loop,1} (Timestamp: {1350,315353,243438})
(<0.24.0>) << {code_call,<0.227.0>,{ensure_loaded,crypto}} (Timestamp: {1350,
                                                                         315353,
                                                                         243451})

Which happened thousands of times per second. The crypto application was 
indeed started, and a bunch of fresh processes would do many sha calls 
per second.

I'm wondering what's the underlying need for the code to do so many 
calls to the code server to make sure it's loaded -- is it related to 
NIFs in any way? If there's a way to work around that, it would help me 
greatly.

Regards,
Fred.



More information about the erlang-questions mailing list