Patch for slow smbclient performance
James Turner
turnerjh at pattern.net
Thu Jun 24 04:19:42 GMT 1999
I sent this to the list a while back, but I don't think it made it
through for some reason, so here it is again.
Below is a patch against samba 2.0.4b that adds a switch to
smbclient. I've found that using smbclient to access some Win95
machines is incredibly slow -- 10k/second or worse. The problem
doesn't seem to occur when the access occur through smbd. Using
strace and gdb revealed the problem to be in the network read/write
size. This patch sets it ot be configurable via '-b'.
Experimentation has shown some quite peculiar results. Basically the
breakpoint is around 1200 bytes for -b. Above it, and you get
10k/sec. Below and you get 400-900k/sec(!). It's not a continuous
change; it's quite a jump for a change in one byte. I don't know what
value this might have for fixing the poor Win98 performance, but it
would seem that Win95 has problems with some patch sizes.
Without further adieu, the patch.
diff -u --recursive --new-file samba-2.0.4b/source/client/client.c samba-2.0.4b-patched/source/client/client.c
--- samba-2.0.4b/source/client/client.c Mon May 17 18:28:10 1999
+++ samba-2.0.4b-patched/source/client/client.c Thu May 27 22:05:57 1999
@@ -41,6 +41,7 @@
static pstring workgroup;
static char *cmdstr;
static BOOL got_pass;
+static int io_bufsize = 65520;
extern struct in_addr ipzero;
extern pstring scope;
@@ -635,7 +636,7 @@
BOOL newhandle = False;
char *data;
struct timeval tp_start;
- int read_size = 65520;
+ int read_size = io_bufsize;
uint16 attr;
size_t size;
off_t nread = 0;
@@ -966,7 +967,7 @@
FILE *f;
int nread=0;
char *buf=NULL;
- int maxwrite=65520;
+ int maxwrite=io_bufsize;
struct timeval tp_start;
GetTimeOfDay(&tp_start);
@@ -1951,6 +1952,7 @@
DEBUG(0,("\t-T<c|x>IXFqgbNan command line tar\n"));
DEBUG(0,("\t-D directory start from directory\n"));
DEBUG(0,("\t-c command string execute semicolon separated commands\n"));
+ DEBUG(0,("\t-b xmit/send buffer changes the transmit/send buffer (default: 65520)\n"));
DEBUG(0,("\n"));
}
@@ -2236,7 +2238,7 @@
}
while ((opt =
- getopt(argc, argv,"s:B:O:R:M:i:Nn:d:Pp:l:hI:EU:L:t:m:W:T:D:c:")) != EOF) {
+ getopt(argc, argv,"s:B:O:R:M:i:Nn:d:Pp:l:hI:EU:L:t:m:W:T:D:c:b:")) != EOF) {
switch (opt) {
case 's':
pstrcpy(servicesf, optarg);
@@ -2338,6 +2340,9 @@
cmdstr = optarg;
got_pass = True;
break;
+ case 'b':
+ io_bufsize = MAX(1, atoi(optarg));
+ break;
default:
usage(pname);
exit(1);
--
Chip Turner turnerjh at pattern.net
Programmer, ZFx, Inc. www.zfx.com
PGP/GPG key available at wwwkeys.us.pgp.net
More information about the samba-technical
mailing list