[Samba] TCP/IP block size

Tom Peters tpeters at mixcom.com
Tue Aug 5 01:16:26 GMT 2008

At 08:11 PM 8/4/2008 -0400, Jeremy M wrote:

>don't know if this is a Samba question or an OS question. I'm

Or neither?  How robust is your TCP/IP stack implementation? Is it possible 
it's reacting to response times by reducing block sizes? Is this sliding 
windows? Samba on Linux should do that since the TCP/IP stack on linux is 
pretty smart.

>working on an embedded project (microcontroller, limited RAM)
>that reads files from a FreeBSD/Samba (FreeNAS) box using TCP/IP transport 
>on port 445.  They're MP3 files so they're
>several MB at least. If I request 512 or 1024 bytes each time, I get
>1024 bytes back from Samba every time. That's good.
>But, if I request more, say for example 1300 bytes, I get 1300 bytes
>returned for the 1st three requests, then the 4th 1300 bytes request is
>returned by Samba as two messages, one 196 bytes long and
>the other is 1104 bytes long.

If it returns 1300 bytes for a few times, then reduces the block size, then 
I'm going to guess that the TCP/IP stack on your microcontroller is giving 
Samba some clue that it's having trouble keeping up.

>It appears that Samba is transmitting data in chunks of 4K, and if I

How does it appear so? You have Wireshark on it? If Samba/Linux is sending 
4k, then why did you say you're getting 512, 1024, or 1104? I'm not sure I 
understand your question.

>request an even fraction of that, such as 512 or 1024 bytes at a time,
>I always get that amount in the response. I wish I could request 2048
>bytes, but this exceeds my ethernet controller buffer and TCP/IP 
Yup. 140-some bytes, maximum, without jumbo frames support on both ends. 
Even at that, specifications seem to vary. I have a switch that "supports" 
jumbo frames, but there's that pesky asterisk in the specs. At the bottom 
of the page it says "4096 bytes/frame, less overhead, maximum."

>Is there a way to change this? In summary, I would like Samba to always
>return the number of bytes I request and not split it up between two
>messages. I know I can combine the two response messages, but this
>causes performance problems for the microcontroller.

I don't know if you can. You can set the no-fragment flag on transmit, but 
the other system (Samba) will still split up frames if it thinks it should. 
Perhaps there's different implementation of the driver for your NIC (in the 
Samba box) that behaves differently, or has more options for fine-grained 
control. Maybe a 10/100/1000 NIC would allow jumbo frames on 100mb. I know 
we had some HP NICs at one time that did, and as we were backing up servers 
on a separate backup VLAN, 2048 bytes packets seemed to be the way to go. 
Ulimately, the performance gain was pretty small. We did better by 
isolating the backup VLANs to their own switches.

>Get Windows Live and get whatever you need, wherever you are.  Start here.
>To unsubscribe from this list go to the following URL and read the
>instructions:  https://lists.samba.org/mailman/listinfo/samba

547. [Love] An absence, the decline of a dinner invitation, an unintentional
coldness, can accomplish more than all the cosmetics and beautiful dresses
in the world. --Marcel Proust (1871-1922)
--... ...--  -.. .  -. ----. --.- --.- -...
tpeters at nospam.mixcom.com   (remove "nospam") N9QQB (amateur radio)
"HEY YOU" (loud shouting)    WEB: http://www.mixweb.com/tpeters
43° 7' 17.2" N by 88° 6' 28.9" W,  Elevation 815',  Grid Square EN53wc
WAN/LAN/Telcom Analyst, Tech Writer, MCP, CCNA, Registered Linux User 385531

More information about the samba mailing list