openssl/openssl

Consider enabling read_ahead by default

Aperta

#6233 aperta il 11 mag 2018

 (9 commenti) (0 reazioni) (0 assegnatari)C (11.262 fork)batch import
backlog fixbranch: masterhelp wantedtriaged: feature

Metriche repository

Star
 (30.157 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

At least s_client does not read the full packet from the kernel, but instead does multiple read() calls to read 1 packet. This is suboptimal and it would be better than we do this in 1 read call. Note that on the write side we actually do everything in 1 write() call.

This is what the connection with s_server looks like:

write(3, "\26\3\1\1(\1\0\1$\3\3i\375\310F`56\22\263\"FC\255E\2209\317\20\r\274\224"..., 301) = 301
read(3, "\26\3\3\0z", 5)                = 5
read(3, "\2\0\0v\3\3\267\\\16\250\374\261dQ:R\266\271\0326\337\275*\335N\22\374\231O\242L\35"..., 122) = 122
read(3, "\24\3\3\0\1", 5)               = 5
read(3, "\1", 1)                        = 1
read(3, "\27\3\3\0\27", 5)              = 5
read(3, "\231\351\224k\350\260Y\257\376\337F\247\220\262\226\267\360S\210gL0\244", 23) = 23
read(3, "\27\3\3\4\376", 5)             = 5
read(3, "\340K\335@\276\320\265-\255\7\237\264\212y\262\267\215!\31-\\\27\323\f\1tU\225\236pW\215"..., 1278) = 1278
read(3, "\27\3\3\2\31", 5)              = 5
read(3, "\327E\347ByO{2\374\243\335\315\221+\243\nO\332q\226\355\261\203M\342\265Eh~X^\25"..., 537) = 537
read(3, "\27\3\3\0E", 5)                = 5
read(3, "\37@N\5\374\304\272\f\0250\22\272\251\224\4\272\272\330%i\334\2619oa\303'\352\33\366\244-"..., 69) = 69
write(3, "\24\3\3\0\1\1\27\3\3\0E\37\370\20\226\310\305R\234\36c\226W\334\356<\221^7M\334D"..., 80) = 80
read(3, "\27\3\3\1\3", 5)               = 5
read(3, "\374\25@#\350:H\270\325\0107\244\216-\253x\34rR\0#\32\303\352\34O\361/\216\311L\214"..., 259) = 259

The server sends 6 records back, for each record we first read the first 5 bytes, then the rest of the record. We could have done this with 1 syscall instead of 12.

Guida contributor