What are the benefits of this approach?
- Speed, because of the parallelization in 16-byte blocks, the latency for the encryption is very low.
- Although the CPU consumption is higher than with the previous example, the throughput is also high.
Which approach to use?
It depends on the requirement of the user: if what the user needs is power, then the event-loop pipelining can be used and if what the user is looking for low latency, then the data multiplexer parallelization is a better option.
The benchmark application
The encryption performance benchmark consists of:
- Use of the Rijndael Algorithm.
- Google benchmarks to measure the performance.
- This application consists of randomly generated strings that will be encrypted with variations on:
- Size of the string
- Publication rate of the strings
The Rijndael Algorithm is quite simple: a plain text is divided in 16-byte blocks, and each block is encrypted separately.
The benchmark results
Klepsydra uses the CPU in a more linear way as the data to process increases. Morevoer, this optimised algorithm can encrypt up to four times more data in real time with respect to more traditional techniques.
The implementation of the algorithm does not change, and it is quite simple to adapt to Klepsydra Streaming. The main change required is that the API of the Rijndael encryption goes from synchronous to asynchronous.
Implementing encryption with Klepsydra has a lot of benefits:
- High efficiency and navigation of the algorithm. Latency and CPU consumption can be lower, whereas throughput can be higher.
- Full control of the CPU resources dedicated to encryption. Launching an encryption and using all the resources of the computer maxing it out is not necessary anymore.
- With Klepsydra API, the migration or the integration of existing algorithm requires minor effort, thus can be achieved in relatively short time.