summaryrefslogtreecommitdiffstats
path: root/sys/sys/sf_buf.h
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2016-01-08 20:34:57 +0000
committerglebius <glebius@FreeBSD.org>2016-01-08 20:34:57 +0000
commitaaa09777e1d9fde5591814af536025be01a0182f (patch)
treeffa24924b5fa8fa8a6a9433a56b73c595e5d33b6 /sys/sys/sf_buf.h
parentad8ebc35bb92f3a458fcde1049b19656ef5e614d (diff)
downloadFreeBSD-src-aaa09777e1d9fde5591814af536025be01a0182f.zip
FreeBSD-src-aaa09777e1d9fde5591814af536025be01a0182f.tar.gz
New sendfile(2) syscall. A joint effort of NGINX and Netflix from 2013 and
up to now. The new sendfile is the code that Netflix uses to send their multiple tens of gigabits of data per second. The new implementation features asynchronous I/O, when I/O operations are launched, but not awaited to be complete. An explanation of why such behavior is beneficial compared to old one is going to be too long for a commit message, so we will skip it here. Additional features of new syscall are extra flags, which provide an application more control over data sent. The SF_NOCACHE flag tells kernel that data shouldn't be cached after it was sent. The SF_READAHEAD() macro allows to specify readahead size in pages. The new syscalls is a drop in replacement. No modifications are required to applications. One can take nginx binary for stable/10 and run it successfully on head. Although SF_NODISKIO lost its original sense, as now sendfile doesn't block, and now means something completely different (tm), using the new sendfile the old way is absolutely safe. Celebrates: Netflix global launch! Sponsored by: Nginx, Inc. Sponsored by: Netflix Relnotes: yes
Diffstat (limited to 'sys/sys/sf_buf.h')
-rw-r--r--sys/sys/sf_buf.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/sys/sf_buf.h b/sys/sys/sf_buf.h
index d3bb037..b5970d9 100644
--- a/sys/sys/sf_buf.h
+++ b/sys/sys/sf_buf.h
@@ -31,7 +31,14 @@
#define _SYS_SF_BUF_H_
struct sfstat { /* sendfile statistics */
+ uint64_t sf_syscalls; /* times sendfile was called */
+ uint64_t sf_noiocnt; /* times sendfile didn't require I/O */
uint64_t sf_iocnt; /* times sendfile had to do disk I/O */
+ uint64_t sf_pages_read; /* pages read as part of a request */
+ uint64_t sf_pages_valid; /* pages were valid for a request */
+ uint64_t sf_rhpages_requested; /* readahead pages requested */
+ uint64_t sf_rhpages_read; /* readahead pages read */
+ uint64_t sf_busy; /* times aborted on a busy page */
uint64_t sf_allocfail; /* times sfbuf allocation failed */
uint64_t sf_allocwait; /* times sfbuf allocation had to wait */
};
OpenPOWER on IntegriCloud