Commit 27a9b736 authored by rswindell's avatar rswindell
Browse files

Improve send-file performance on Windows (over Gb Ethernet LAN) from about 1...

Improve send-file performance on Windows (over Gb Ethernet LAN) from about 1 MBytes/second to 25+ MBytes/second by increasing the size of the ringbuffer (from 20 -> 256 KBytes) and the size of the file-read buffer in sock_sendfile().
Also log the through-put (in cps) when a file is sent.
parent 1fe68664
......@@ -104,7 +104,7 @@ static int len_503 = 0;
(Including terminator )*/
#define MAX_REDIR_LOOPS 20 /* Max. times to follow internal redirects for a single request */
#define MAX_POST_LEN (4*1048576) /* Max size of body for POSTS */
#define OUTBUF_LEN 20480 /* Size of output thread ring buffer */
#define OUTBUF_LEN (256*1024) /* Size of output thread ring buffer */
enum {
CLEANUP_SSJS_TMP_FILE
......@@ -1451,7 +1451,7 @@ static off_t sock_sendfile(http_session_t *session,char *path,unsigned long star
int file;
off_t ret=0;
ssize_t i;
char buf[2048]; /* Input buffer */
char buf[OUTBUF_LEN]; /* Input buffer */
unsigned long remain;
if(startup->options&WEB_OPT_DEBUG_TX)
......@@ -6059,6 +6059,7 @@ static void respond(http_session_t * session)
}
if(session->req.send_content) {
off_t snt=0;
time_t start = time(NULL);
lprintf(LOG_INFO,"%04d Sending file: %s (%"PRIuOFF" bytes)"
,session->socket, session->req.physical_path, flength(session->req.physical_path));
snt=sock_sendfile(session,session->req.physical_path,session->req.range_start,session->req.range_end);
......@@ -6067,9 +6068,13 @@ static void respond(http_session_t * session)
snt=0;
session->req.ld->size=snt;
}
if(snt>0)
lprintf(LOG_INFO,"%04d Sent file: %s (%"PRIuOFF" bytes)"
,session->socket, session->req.physical_path, snt);
if(snt>0) {
time_t e = time(NULL) - start;
if(e < 1)
e = 1;
lprintf(LOG_INFO, "%04d Sent file: %s (%"PRIuOFF" bytes, %d cps)"
,session->socket, session->req.physical_path, snt, snt / e);
}
}
session->req.finished=TRUE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment