ns_writer - Manage files with writer thread
This command allows to submit data or file to be returned to the client connection using writer thread instead of current connection thread. Writer thread processes multiple sockets using async socket operations which consumes less resources than returning multiple files to the slow clients in separate thread.
Returns list of all currently submitted files. Every list entry contains the start time of the initiating request, name of the thread, driver, the ip-address of the requestor, the file descriptor, the remaining size and the bytes already sent, and the client data as provided via [ns_conn clientdata]. If -server is specified, only the submitted file entries from the specified server are returned.
Submit arbitrary data to be returned via writer thread, data can be binary.
Submits file to be returned via writer thread. For parital requests, ns_writer does NOT change status code or sets content-range. Optionally the following arguments can be used:
-headers Tells the writer to provide required HTTP headers, like content size, type and status.
-offset If specified, file will be returned starting with this offset.
-size If not specified, the whole file will be retuned, otherwise only given part. Can be combined with -offset.
Query or set configuration parameter writersize of the writer(s) of the specified driver.
Query or set configuration parameter writerstreaming of the writer(s) of the specified driver.
Basic configuration options:
writerthreads parameter specified how many writer threads will be used, multiple threads will be rotated to spread the load across all threads
writersize specifies the minimal size of the file to be considered for writer thread, this parameter is used by connection thread when returning file and if size exceeds configured value, file will be returned via writer thread and connection thread will be released to handle other requests.
writerstreaming specifies whether or not streaming HTML output (e.g. sent via ns_write) should be sent via the writer. When sending server responses over slow connections, this option reduces the blocking time of the connection threads and can therfore reduce the damage of slow-read attacks.
ns_writer submitfile /tmp/biglist.txt