mod_xfer
The mod_xfer
module handles most of the FTP commands related to
file transfers.
<VirtualHost>
, <Global>
, <Anonymous>
The TransferPriority
directive is used to tweak the process
priority (a la nice(1)
) of the session during data
transfers. For example, large (or anonymous) data transfers can be configured
to have lower priorities, so as to get lower priority than other applications
from the kernel.
The priority parameter can one of the convenient "high", "medium", or
"low" keywords, or it can be an explicit number. As per the
nice(1)
man page, the higher the number, the lower the priority;
the highest priority is -20, and the lower priority is 19.
Examples:
# All data transfers get a low priority TransferPriority APPE,RETR,STOR lowOr maybe only downloads should have lower priorities, but uploads should be fine:
TransferPriority RETR low
<VirtualHost>
, <Global>
, <Anonymous>
, <Directory>
, .ftpaccess
The TransferRate
directive is used to set transfer rate limits
on the transfer of data. This directive allows for transfer rates to be set
in a wide variety of contexts, on a per-command basis, and for certain subsets
of users (via
mod_ifsession
).
Note that these limits only apply to an individual session, and
do not apply to the overall transfer rate of the entire daemon.
The cmd-list parameter may be an comma-separated list of any of the
following commands: APPE
, RETR
, STOR
,
and STOU
.
The kbytes-per-sec parameter is the actual transfer rate to be applied.
The free-bytes parameter, if configured, allows that number of bytes to be transferred before the rate limit is applied. This allows for clients transferring small files to be unthrottled, but for larger files, such as MP3s and ISO images, to be throttled.
Here are some examples:
# Limit downloads for everyone TransferRate RETR 1.5 # Limit uploads (and appends!) to the prolific users in the # lotsofuploadfiles.net domain. This presumes that a Class has been defined # for that domain, and that that Class has been named "uploaders". Let them # upload small files without throttling, though. <IfClass uploaders> TransferRate APPE,STOR 8.0:1024 </IfClass>
<VirtualHost>
, <Global>
, <Anonymous>
, <Directory>
, .ftpaccess
The UseSendfile
directive controls use of sendfile(2)
functionality, which is an optimization for sending files to clients. Use of
sendfile(2)
functionality avoids separate read and send kernel
operations, and buffer allocations. Read this
howto for more details.
mod_xfer
module is always installed.