Grace delay feature added

`proxy -g8000,3,10`

First parameter is average read size we want to keep, second parameter is
minimal number of packets in the same direction to apply algorythm,
last value is delay added after polling and prior to reading data.
An example above adds 10 millisecond delay before reading data if average
polling size is below 8000 bytes and 3 read operations are made in the same
direction. It's specially usefule with splice. `logdump 1 1` is useful
to see how grace delays work, choose delay value to avoid filling the read
pipe/buffer (typically 64K) but keep the request sizes close to chosen average
on large file upload/download.
This commit is contained in:
Vladimir Dubrovin committed 2022-05-19 18:51:02 +03:00
1 parent 8a8622b30f
commit 55d1bbe155
8 files changed
+49 -2

No files matched your search

+4
View File
@@ -223,6 +223,7 @@ int MODULEMAINFUNC (int argc, char** argv){
#ifdef WITHSLICE
" -s Use slice() - faster proxing, but no filtering for data\n"
#endif
"-g(GRACE_TRAFF,GRACE_NUM,GRACE_DELAY) - delay GRACE_DELAY milliseconds before polling if average polling size below GRACE_TRAFF bytes and GRACE_NUM read operations in single directions are detected within 1 second to minimize polling\n"
" -fFORMAT logging format (see documentation)\n"
" -l log to stderr\n"
" -lFILENAME log to FILENAME\n"
@@ -428,6 +429,9 @@ int MODULEMAINFUNC (int argc, char** argv){
case 'a':
srv.anonymous = 1 + atoi(argv[i]+2);
break;
case 'g':
sscanf(argv[i]+2, "%d,%d,%d", &srv.gracetraf, &srv.gracenum, &srv.gracedelay);
break;
case 's':
#ifdef WITHSPLICE
if(isudp || srv.service == S_ADMIN)