Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decrease CPU usage caused by exmpp_tls:send with large data.
Sending one large chunk of data with exmpp_tls:send eats lots of CPU power and blocks whole Erlang emulator. This is caused by the fact that encrypted output is read from memory BIO in 1k chunks. Memory BIO, after reading data, shifts the remaining part. If large chunks of data (few MB) is sent and then read in 1k chunks, then a _lot_ of shifting is performed eating CPU. The solution is to simply allocate binary of the needed size (amount of data in memory BIO can be retrieved with BIO_ctrl_pending) and then issue only one read that reads the whole data.
- Loading branch information