intel / intel-ipsec-mb

Intel(R) Multi-Buffer Crypto for IPSec
BSD 3-Clause "New" or "Revised" License
288 stars 87 forks source link

Why all my requests get distributed in a single core in a scenario when I have 4 cores availble?Is that a IPSec bottleneck? #61

Closed kleirama closed 3 years ago

kleirama commented 4 years ago

Hei, I am using this repository for a multi-threaded application. When I disable IPSec and send requests from a client to the server the requests got distributed (not uniformly though) to all the cores. Let say if I initiate 4 cores in server side then requests got distributed in all cores. When I do the same but with IPSec enabled all requests get distributed to a single core and the 3 other cores get no requests. Now my guess is that in a client side where I use IPsec gateway I have configured it with a single tunnel and that may be the reason why I get all my requests distributed to a single core. I am not very familiar with IPSec but I assume that if I configure my IPSec gateway with multiple tunnel then my requests get distributed to all the cores I have initiated or is this simply a IPSec bottleneck in Linux distributions?

mdcornu commented 3 years ago

Hi,

This behavior will depend on the application implementation.
The MB_MGR and the associated functions are not thread safe. To safely support multiple threads, each thread will need to allocate its own MB_MGR instance. If this is an "off the shelf" application, then it may be only support a single thread per tunnel.
If you are implementing your own application, please have a look at our performance application as an example of how to allocate multiple MB_MGR's per thread.

Regards, Marcel

tkanteck commented 3 years ago

In other words, in depends on ipsec stack as to how to distribute crypto operations among cores. This functionality is not part of the library.

I am going to close this issue. Feel free to re-open if you have more questions or more clarification is required.

Thanks, Tomasz