I have found some problem with body parsing for chunked encoded messages: https://github.com/benoitc/hackney/issues/690#issuecomment-1321799256
I have understood parsing logic and optimized it. The main point of it to wait necessary portion of data instead of parsing each packet.
My results:
before fix
no chunks:
100 requests, total time: 0.663915s
100 requests, total time: 0.677419s
100 requests, total time: 0.678405s
Total data: 1301.7705078125KB, chunk size: 4096, total chunks: 326
100 requests, total time: 0.742954s
100 requests, total time: 0.727678s
100 requests, total time: 0.709221s
Total data: 1301.7705078125KB, chunk size: 40960, total chunks: 33
100 requests, total time: 0.74006s
100 requests, total time: 0.717082s
100 requests, total time: 0.719162s
Total data: 1301.7705078125KB, chunk size: 409600, total chunks: 4
100 requests, total time: 3.619821s
100 requests, total time: 3.608936s
100 requests, total time: 3.611868s
Total data: 13096.701171875KB, chunk size: 4096000, total chunks: 4
10 requests, total time: 49.382239s
after fix
no chunks:
100 requests, total time: 0.597693s
100 requests, total time: 0.609578s
100 requests, total time: 0.595912s
Total data: 1301.7705078125KB, chunk size: 4096, total chunks: 326
100 requests, total time: 0.694447s
100 requests, total time: 0.690872s
100 requests, total time: 0.668783s
Total data: 1301.7705078125KB, chunk size: 40960, total chunks: 33
100 requests, total time: 0.552928s
100 requests, total time: 0.559099s
100 requests, total time: 0.583001s
Total data: 1301.7705078125KB, chunk size: 409600, total chunks: 4
100 requests, total time: 0.605153s
100 requests, total time: 0.620267s
100 requests, total time: 0.601012s
Total data: 13096.701171875KB, chunk size: 4096000, total chunks: 4
10 requests, total time: 0.604024s
I have found some problem with body parsing for chunked encoded messages: https://github.com/benoitc/hackney/issues/690#issuecomment-1321799256 I have understood parsing logic and optimized it. The main point of it to wait necessary portion of data instead of parsing each packet. My results:
before fix
after fix
before:
after:
i have also checked tests\dialyzer on OTP 25.1.1