-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug#35019415 forwarding resultsets with lots of rows is slow
Profiling queries with many short rows showed that the large part of the execution time is spent encrypting rows. Currently, the rows of a resultset are processed in a loop of: a. read frame from server plain buffer b. encrypt frame to client socket buffer c. repeat until client buffer full d. send client socket buffer e. repeat with read frame until no more frames Moving the encrypt step out of the inner loop and encrypting only once: a. read frame from server plain buffer b. move frame to client plain buffer c. repeat until client plain buffer full d. encrypt client plain buffer to client socket buffer e. send client socket buffer f. repeat with read frame until no more frames shows a performances improvement, both in profiling and in benchmark. For a resultset with many (100k) short rows (~10 bytes): - throughput: +520% (PREFERRED__AS_CLIENT) - latency: -83% - throughput: +1200% (PREFERRED__DISABLED) - latency: -93% Before: [ RUN ] Spec/Benchmark.classic_protocol/many_short_rows name | query | fetch | throughput ------------------ no-ssl | ---------- | ---------- | ----------- DIRECT_DISABLED | 6.63 us | 13.36 ms | 34.90 MB/s DISABLED__DISABLED | 10.30 us | 24.06 ms | 19.38 MB/s DISABLED__REQUIRED | 12.14 us | 57.73 ms | 8.08 MB/s --------------------- ssl | ---------- | ---------- | ----------- DIRECT_PREFERRED | 8.19 us | 19.17 ms | 24.33 MB/s PASSTHROUGH__AS_CLIENT | 8.02 us | 19.52 ms | 23.88 MB/s PREFERRED__DISABLED | 6.03 us | 314.28 ms | 1.48 MB/s PREFERRED__AS_CLIENT | 6.15 us | 313.33 ms | 1.49 MB/s PREFERRED__PREFERRED | 6.29 us | 316.07 ms | 1.48 MB/s [ OK ] Spec/Benchmark.classic_protocol/many_short_rows (2188 ms) After: [ RUN ] Spec/Benchmark.classic_protocol/many_short_rows name | query | fetch | throughput ------------------ no-ssl | ---------- | ---------- | ----------- DIRECT_DISABLED | 6.57 us | 13.82 ms | 33.74 MB/s DISABLED__DISABLED | 7.59 us | 23.44 ms | 19.89 MB/s DISABLED__REQUIRED | 9.10 us | 49.63 ms | 9.40 MB/s --------------------- ssl | ---------- | ---------- | ----------- DIRECT_PREFERRED | 8.35 us | 19.34 ms | 24.10 MB/s PASSTHROUGH__AS_CLIENT | 8.77 us | 19.50 ms | 23.91 MB/s PREFERRED__DISABLED | 8.60 us | 23.55 ms | 19.80 MB/s PREFERRED__AS_CLIENT | 7.92 us | 50.36 ms | 9.26 MB/s PREFERRED__PREFERRED | 8.82 us | 50.18 ms | 9.29 MB/s [ OK ] Spec/Benchmark.classic_protocol/many_short_rows (1198 ms) Change ------ - added a send_plain_buffer() - moved SSL_write() from Channel::write_plain() to Channel::flush_to_send_buf() to encrypt only once. - removed unused Channel::write_encrypted() and Channel::read_encrypted() Change-Id: I08f105cd1d6aac2d3f96877337d3a10005a1f2a5
- Loading branch information
Showing
3 changed files
with
114 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.