comparison src/core/ngx_connection.h @ 7985:ec2e6893caaa

Simplified sendfile(SF_NODISKIO) usage. Starting with FreeBSD 11, there is no need to use AIO operations to preload data into cache for sendfile(SF_NODISKIO) to work. Instead, sendfile() handles non-blocking loading data from disk by itself. It still can, however, return EBUSY if a page is already being loaded (for example, by a different process). If this happens, we now post an event for the next event loop iteration, so sendfile() is retried "after a short period", as manpage recommends. The limit of the number of EBUSY tolerated without any progress is preserved, but now it does not result in an alert, since on an idle system event loop iteration might be very short and EBUSY can happen many times in a row. Instead, SF_NODISKIO is simply disabled for one call once the limit is reached. With this change, sendfile(SF_NODISKIO) is now used automatically as long as sendfile() is enabled, and no longer requires "aio on;".
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 27 Dec 2021 19:48:33 +0300
parents fdc3d40979b0
children 32b0ba4855a6 eaf356a35f5d
comparison
equal deleted inserted replaced
7984:ae992b5a27b2 7985:ec2e6893caaa
183 unsigned tcp_nodelay:2; /* ngx_connection_tcp_nodelay_e */ 183 unsigned tcp_nodelay:2; /* ngx_connection_tcp_nodelay_e */
184 unsigned tcp_nopush:2; /* ngx_connection_tcp_nopush_e */ 184 unsigned tcp_nopush:2; /* ngx_connection_tcp_nopush_e */
185 185
186 unsigned need_last_buf:1; 186 unsigned need_last_buf:1;
187 187
188 #if (NGX_HAVE_AIO_SENDFILE || NGX_COMPAT) 188 #if (NGX_HAVE_SENDFILE_NODISKIO || NGX_COMPAT)
189 unsigned busy_count:2; 189 unsigned busy_count:2;
190 #endif 190 #endif
191 191
192 #if (NGX_THREADS || NGX_COMPAT) 192 #if (NGX_THREADS || NGX_COMPAT)
193 ngx_thread_task_t *sendfile_task; 193 ngx_thread_task_t *sendfile_task;