Hi,
I'm writing a file in two different formats onto a network share using CIFS. The first is a simple ASCII-TXT Format using a PrintWriter,
the second is a XML-Format using a XMLStreamWriter. Writing the XML-Format is extreamly slow compared to the ASCII-Format (only
writing over network, not localy). Since I got the same behavior writing from a Linux-System or a Windows-System to a Linux SMB-Server
or a Windows file share I used a network sniffer to take a look at the network traffic. The result was this:
A: PrintWriter.write()
636 96.374675 192.168.0.39 192.168.0.200 SMB NT Create AndX Request, FID: 0x2216, Path: //weser/../Test.psg
637 96.375152 192.168.0.200 192.168.0.39 SMB NT Create AndX Response, FID: 0x2216
[...]
643 96.421806 192.168.0.39 192.168.0.200 SMB Write AndX Request, FID: 0x2216, 8192 bytes at offset 0
[...]
648 96.423008 192.168.0.200 192.168.0.39 SMB Write AndX Response, FID: 0x2216, 8192 bytes
[...]
650 96.491589 192.168.0.39 192.168.0.200 SMB Write AndX Request, FID: 0x2216, 8192 bytes at offset 8192
[...]
663 96.510346 192.168.0.39 192.168.0.200 SMB Write AndX Request, FID: 0x2216, 8192 bytes at offset 24576
B: XMLStreamWriter.write()
761 102.802819 192.168.0.39 192.168.0.200 SMB NT Create AndX Request, FID: 0x2217, Path: //weser/../Test.xyo
762 102.803363 192.168.0.200 192.168.0.39 SMB NT Create AndX Response, FID: 0x2217
[...]
767 102.808980 192.168.0.39 192.168.0.200 SMB Write AndX Request, FID: 0x2217, 1 byte at offset 0
768 102.809379 192.168.0.200 192.168.0.39 SMB Write AndX Response, FID: 0x2217, 1 byte
769 102.809481 192.168.0.39 192.168.0.200 SMB Write AndX Request, FID: 0x2217, 2 bytes at offset 0
770 102.809774 192.168.0.200 192.168.0.39 SMB Write AndX Response, FID: 0x2217, 2 bytes
771 102.809859 192.168.0.39 192.168.0.200 SMB Write AndX Request, FID: 0x2217, 3 bytes at offset 0
772 102.810085 192.168.0.200 192.168.0.39 SMB Write AndX Response, FID: 0x2217, 3 bytes
[...]
14373 105.289670 192.168.0.39 192.168.0.200 SMB Write AndX Request, FID: 0x2217, 4096 bytes at offset 0
[...]
14376 105.290347 192.168.0.200 192.168.0.39 SMB Write AndX Response, FID: 0x2217, 4096 bytes
14377 105.290425 192.168.0.39 192.168.0.200 SMB Write AndX Request, FID: 0x2217, 1 byte at offset 4096
14378 105.290779 192.168.0.200 192.168.0.39 SMB Write AndX Response, FID: 0x2217, 1 byte
14379 105.290846 192.168.0.39 192.168.0.200 SMB Write AndX Request, FID: 0x2217, 2 bytes at offset 4096
14380 105.291071 192.168.0.200 192.168.0.39 SMB Write AndX Response, FID: 0x2217, 2 bytes
14381 105.291148 192.168.0.39 192.168.0.200 SMB Write AndX Request, FID: 0x2217, 3 bytes at offset 4096
14382 105.291446 192.168.0.200 192.168.0.39 SMB Write AndX Response, FID: 0x2217, 3 bytes
Which means that using the XMLStreamWriter the first byte is send 4096 times, the second byte is send 4095 times ... till the next
block starts at the next offset. My question is why and what to do about it ...
Yours,
Andreas