CHANGELOG revision 82f3bcef
12018-04-19 2 3 - [BUGFIX] Add connection to Tickable Queue on stream write 4 - cmake: use MSVC variable instead of trying to detect 5 - engine: improve connection incref/decref logging 6 - stream: don't ignore errors that may occur on triggered flush 7 - connection: remove obsolete method 8 - engine: indicate connection as tickable if previous call went 9 over threshold 10 112018-04-09 12 13 [API Change, OPTIMIZATION] Only process conns that need to be processed 14 15 The API is simplified: do not expose the user code to several 16 queues. A "connection queue" is now an internal concept. 17 The user processes connections using the single function 18 lsquic_engine_process_conns(). When this function is called, 19 only those connections are processed that need to be processed. 20 A connection needs to be processed when: 21 22 1. New incoming packets have been fed to the connection. 23 2. User wants to read from a stream that is readable. 24 3. User wants to write to a stream that is writeable. 25 4. There are buffered packets that can be sent out. (This 26 means that the user wrote to a stream outside of the 27 lsquic library callback.) 28 5. A control frame (such as BLOCKED) needs to be sent out. 29 6. A stream needs to be serviced or delayed stream needs to 30 be created. 31 7. An alarm rings. 32 8. Pacer timer expires. 33 34 To achieve this, the library places the connections into two 35 priority queues (min heaps): 36 37 1. Tickable Queue; and 38 2. Advisory Tick Time queue (ATTQ). 39 40 Each time lsquic_engine_process_conns() is called, the Tickable 41 Queue is emptied. After the connections have been ticked, they are 42 queried again: if a connection is not being closed, it is placed 43 either in the Tickable Queue if it is ready to be ticked again or 44 it is placed in the Advisory Tick Time Queue. It is assumed that 45 a connection always has at least one timer set (the idle alarm). 46 47 The connections in the Tickable Queue are arranged in the least 48 recently ticked order. This lets connections that have been quiet 49 longer to get their packets scheduled first. 50 51 This change means that the library no longer needs to be ticked 52 periodically. The user code can query the library when is the 53 next tick event and schedule it exactly. When connections are 54 processed, only the tickable connections are processed, not *all* 55 the connections. When there are no tick events, it means that no 56 timer event is necessary -- only the file descriptor READ event 57 is active. 58 59 The following are improvements and simplifications that have 60 been triggered: 61 62 - Queue of connections with incoming packets is gone. 63 - "Pending Read/Write Events" Queue is gone (along with its 64 history and progress checks). This queue has become the 65 Tickable Queue. 66 - The connection hash no longer needs to track the connection 67 insertion order. 68 692018-04-02 70 71 - [FEATURE] Windows support 72 73 - Reduce stack use -- outgoing packet batch is now allocated on the heap. 74 752018-03-09 76 77 - [OPTIMIZATION] Merge series of ACKs if possible 78 79 Parsed single-range ACK frames (that is the majority of frames) are 80 saved in the connection and their processing is deferred until the 81 connection is ticked. If several ACKs come in a series between 82 adjacent ticks, we check whether the latest ACK is a strict superset 83 of the saved ACK. If it is, the older ACK is not processed. 84 85 If ACK frames can be merged, they are merged and only one of them is 86 either processed or saved. 87 88 - [OPTIMIZATION] Speed up ACK verification by simplifying send history. 89 90 Never generate a gap in the sent packet number sequence. This reduces 91 the send history to a single number instead of potentially a series of 92 packet ranges and thereby speeds up ACK verification. 93 94 By default, detecting a gap in the send history is not fatal: only a 95 single warning is generated per connection. The connection can continue 96 to operate even if the ACK verification code is not able to detect some 97 inconsistencies. 98 99 - [OPTIMIZATION] Rearrange the lsquic_send_ctl struct 100 101 The first part of struct lsquic_send_ctl now consists of members that 102 are used in lsquic_send_ctl_got_ack() (in the absense of packet loss, 103 which is the normal case). To speed up reads and writes, we no longer 104 try to save space by using 8- and 16-bit integers. Use regular integer 105 width for everything. 106 107 - [OPTIMIZATION] Cache size of sent packet. 108 109 - [OPTIMIZATION] Keep track of the largest ACKed in packet_out 110 111 Instead of parsing our own ACK frames when packet has been acked, 112 use the value saved in the packet_out structure when the ACK frame 113 was generated. 114 115 - [OPTIMIZATION] Take RTT sampling conditional out of ACK loop 116 117 - [OPTIMIZATION] ACK processing: only call clock_gettime() if needed 118 119 - [OPTIMIZATION] Several code-level optimizations to ACK processing. 120 121 - Fix: http_client: fix -I flag; switch assert() to abort() 122 1232018-02-26 124 - [API Change] lsquic_engine_connect() returns pointer to the connection 125 object. 126 - [API Change] Add lsquic_conn_get_engine() to get engine object from 127 connection object. 128 - [API Change] Add lsquic_conn_status() to query connection status. 129 - [API Change] Add add lsquic_conn_set_ctx(). 130 - [API Change] Add new timestamp format, e.g. 2017-03-21 13:43:46.671345 131 - [OPTIMIZATION] Process handshake STREAM frames as soon as packet 132 arrives. 133 - [OPTIMIZATION] Do not compile expensive send controller sanity check 134 by default. 135 - [OPTIMIZATION] Add fast path to gquic_be_gen_reg_pkt_header. 136 - [OPTIMIZATION] Only make squeeze function call if necessary. 137 - [OPTIMIZATION] Speed up Q039 ACK frame parsing. 138 - [OPTIMIZATION] Fit most used elements of packet_out into first 64 bytes. 139 - [OPTIMIZATION] Keep track of scheduled bytes instead of calculating. 140 - [OPTIMIZATION] Prefetch next unacked packet when processing ACK. 141 - [OPTIMIZATION] Leverage fact that ACK ranges and unacked list are. 142 ordered. 143 - [OPTIMIZATION] Reduce function pointer use for STREAM frame generation 144 - Fix: reset incoming streams that arrive after we send GOAWAY. 145 - Fix: delay client on_new_conn() call until connection is fully set up. 146 - Fixes to buffered packets logic: splitting, STREAM frame elision. 147 - Fix: do not dispatch on_write callback if no packets are available. 148 - Fix WINDOW_UPDATE send and resend logic. 149 - Fix STREAM frame extension code. 150 - Fix: Drop unflushed data when stream is reset. 151 - Switch to tracking CWND using bytes rather than packets. 152 - Fix TCP friendly adjustment in cubic. 153 - Fix: do not generate invalid STOP_WAITING frames during high packet 154 loss. 155 - Pacer fixes. 156 1572017-12-18 158 159 - Fix: better follow cubic curve after idle period 160 - Fix: add missing parts to outgoing packet splitting code 161 - Fix: compilation using gcc 4.8.4 162 1632017-10-31 164 165 - Add APIs.txt -- describes LSQUIC APIs 166 1672017-10-31 168 169 - [API Change] Sendfile-like functionality is gone. The stream no 170 longer opens files and deals with file descriptors. (Among other 171 things, this makes the code more portable.) Three writing functions 172 are provided: 173 174 lsquic_stream_write 175 lsquic_stream_writev 176 lsquic_stream_writef (NEW) 177 178 lsquic_stream_writef() is given an abstract reader that has function 179 pointers for size() and read() functions which the user can implement. 180 This is the most flexible way. lsquic_stream_write() and 181 lsquic_stream_writev() are now both implemented as wrappers around 182 lsquic_stream_writef(). 183 184 - [OPTIMIZATION] When writing to stream, be it within or without the 185 on_write() callback, place data directly into packet buffer, 186 bypassing auxiliary data structures. This reduces amount of memory 187 required, for the amount of data that can be written is limited 188 by the congestion window. 189 190 To support writes outside the on_write() callback, we keep N 191 outgoing packet buffers per connection which can be written to 192 by any stream. One half of these are reserved for the highest 193 priority stream(s), the other half for all other streams. This way, 194 low-priority streams cannot write instead of high-priority streams 195 and, on the other hand, low-priority streams get a chance to send 196 their packets out. 197 198 The algorithm is as follows: 199 200 - When user writes to stream outside of the callback: 201 - If this is the highest priority stream, place it onto the 202 reserved N/2 queue or fail. 203 (The actual size of this queue is dynamic -- MAX(N/2, CWND) -- 204 rather than N/2, allowing high-priority streams to write as 205 much as can be sent.) 206 - If the stream is not the highest priority, try to place the 207 data onto the reserved N/2 queue or fail. 208 - When tick occurs *and* more packets can be scheduled: 209 - Transfer packets from the high N/2 queue to the scheduled 210 queue. 211 - If more scheduling is allowed: 212 - Call on_write callbacks for highest-priority streams, 213 placing resulting packets directly onto the scheduled queue. 214 - If more scheduling is allowed: 215 - Transfer packets from the low N/2 queue to the scheduled 216 queue. 217 - If more scheduling is allowed: 218 - Call on_write callbacks for non-highest-priority streams, 219 placing resulting packets directly onto the scheduled queue 220 221 The number N is currently 20, but it could be varied based on 222 resource usage. 223 224 - If stream is created due to incoming headers, make headers readable 225 from on_new. 226 227 - Outgoing packets are no longer marked non-writeable to prevent placing 228 more than one STREAM frame from the same stream into a single packet. 229 This property is maintained via code flow and an explicit check. 230 Packets for stream data are allocated using a special function. 231 232 - STREAM frame elision is cheaper, as we only perform it if a reset 233 stream has outgoing packets referencing it. 234 235 - lsquic_packet_out_t is smaller, as stream_rec elements are now 236 inside a union. 237 2382017-10-12 239 240 - Do not send RST_STREAM when stream is closed for reading 241 - Raise maximum header size from 4K to 64K 242 - Check header name and value lengths against maximum imposed by HPACK 243 - Fix NULL dereference in stream flow controller 244 2452017-10-09 246 247 - Hide handshake implementation behind a set of function pointers 248 - Use monotonically increasing clock 249 - Make sure that retx delay is not larger than the max of 60 seconds 250 2512017-09-29 252 253 - A few fixes to code and README 254 2552017-09-28 256 257 - Add support for Q041; drop support for Q040 258 2592017-09-27 260 261 - Fix CMakeLists.txt: BoringSSL include and lib was mixed up 262 2632017-09-26 264 265 - Add support for Mac OS 266 - Add support for Raspberry Pi 267 - Fix BoringSSL compilation: include <openssl/hmac.h> explicitly 268 2692017-09-22 270 271 - Initial release 272