Welcome to the Linux Foundation Forum!

Troubleshooting, limit speed of USB3 device on USB2 computer.

Since the USB3 memory sticks are really fast I expect they would maximize the speed of the USB2 port (480Mbit/s). I tried two sticks. With Disk Utility I got a sustained read speed of 40Mbyte/s but when I tried the write I only got around 10Mbyte/s. During write the speed frequently went down to very low after starting at 35Mbyte/s. I tried several of the latest distros and the result were the same.

The plan was to try to set a hard limit on the speed to and from the USB3 device. I didnt find any such commands. Could I tunnel the USB traffic trough a simulated network device I then can traffic shape?

Comments

  • mfillpot
    mfillpot Posts: 2,177
    It looks like disk utility is a gui for hdparm and some other tools. have you attempted to use any of the common hard drive benchmarking software on the drive?
  • perrabyte
    perrabyte Posts: 20
    edited January 2012
    I think its accurate the result with file copy gets the same mean speed. Could you help me with usbnet driver under debian squeeze. I don’t know how to get usb0.
  • woboyle
    woboyle Posts: 501
    You need to understand that flash devices (thumb drives, SD cards, memory sticks) are MUCH faster at reading than writing. For SD cards, there are 10 classes of card (less actually, but they go from 1 to 10). The slowest you can get in the market is a class 2, and the fastest is a class 10. Most are class 6. The difference in write speeds is considerable. The difference in read speeds is not so much. So, just because a USB thumb drive is a USB 3.0 device and can read back data at 40MBps (320mbps) on a USB 2.0 port, it does NOT mean you can write at 320mbps on a USB 2.0, or even a USB 3.0, port at that speed! My experience is that 100mbps (12.5MBps) is about as fast as you are going to see. Isn't advertising/marketing great? :rolleyes:
  • If you look at the graph you see that write isnt stable. From 35MB/s down to 1 MB/s. What I would like to do is to limit the speed somehow to see at what speed it is stable.
  • marc
    marc Posts: 647
    Try the tests after:
    sysctl vm.dirty_background_ratio = 10
    
  • woboyle
    woboyle Posts: 501
    There is also the mount settings. Mostly, USB/SD devices are mounted with the flush option. As a result, the buffered data is flushed to device more frequently, resulting in the "stuttering" behavior you are seeing. I experience this myself when copying big data sets to flash devices. Personally, I don't think there is much you can do about it. Flash discs on the other hand, have controllers that help level the I/O, especially when writing to disc/device.
  • woboyle
    woboyle Posts: 501
    Finally, I have several 32GB class 10 SD cards, and when I start to copy a large data set to them, they run incredibly fast! After awhile, they start to exhibit the behavior you are seeing, leveling out at about 100mbps (mega bits, not bytes per second), 12.5MBps. If I copy a smaller (but still sizable) data set, that will fit into cache, the copy is immediate, but then I notice that the device is still busy as the system flushes the cache. I think the lesson here is "Don't believe everything you see!"... or think you see. :-)
  • perrabyte
    perrabyte Posts: 20
    [Possibly closer to a solution]

    For the fun of it I made a RAID0 volume of two 15GB partitions both on the 32GB USB3 memorystick. ( Use mdadm ). This seems to have solved the speed problem. I got a mean speed of 31MB/s write and 35MB/s read on the USB2 port. The file was over 4GB.

    Any thoughts why?
  • woboyle
    woboyle Posts: 501
    There are a lot of factors at play here - the amount of RAM in your system that can be used as cache, the type of device (class 2...10), the interface (USB 3.0 in this case, assuming the system also has a USB 3.0 port), how new the device is, ... Try writing not 4GB, but 10+ GB to the device, and then run the sync command and see how long it takes before it finishes. THAT is the salient factor here. Even in your example, write 4GB, and then run sync and see how long it takes to finish flushing the data to the device so that it is removable.
  • perrabyte
    perrabyte Posts: 20
    I did the same tests with a 11.5GB file. RAID0 was not necessary, an ordinary volume with FAT or NTFS got the same results. Due to some update? I don't know. However the transfer of 1000+ music or image files were crippled, below 5MB/s. I don't have USB3 on this computer. Could you check the average speed you get when copying a folder with 1000+ images.

    Because of the many problems with flash memory sticks I wonder if its not better to abandon them as a recommended portable storage for larger devices. Now that we have SSD that are dropping in price couldn't we just buy SSD's in the form of a memory stick?

    I kind of liked but haven't tested those dual eSata/USB interface SSD that looks like memory sticks. If they perform well and get cheaper we could easily spread the use of Linux through teaching a detachable dualboot configuration.
  • perrabyte
    perrabyte Posts: 20
    Searched around a little and found the Supertalent USB 3.0 Express RC8. It has a SSD controller. Im happy to see that they also posted the USB2 benchmark. It seem to max out the USB2 port at over 35 MB/s even for small files which is what I wanted in the first place. So I guess you need to select more carefully among the cheap memorysticks even if you only have a USB2 port.

Categories

Upcoming Training