Home > Back-end > Mechanical drive 4 k is not random, speaking, reading and writing very slow? Why do I have more than
Mechanical drive 4 k is not random, speaking, reading and writing very slow? Why do I have more than
Time:04-30
My code has a problem? Long blockSize=(long) 2 & lt; <10; Long totalSize=4 l & lt; <30; Long totalCount=totalSize/blockSize; SeekableByteChannel outputStream=Files. NewByteChannel (Paths. The get (" D: \ \ test "), StandardOpenOption. WRITE, StandardOpenOption. CREATE, StandardOpenOption. DELETE_ON_CLOSE); ByteBuffer data=https://bbs.csdn.net/topics/ByteBuffer.allocate ((int) blockSize); The Random Random=new Random (System. CurrentTimeMillis ()); Long startTime=System. CurrentTimeMillis (); For (long I=0; I & lt; TotalCount; I++) { OutputStream. Position (Math. Abs (random nextInt ())); OutputStream. Write (data); } outputStream.close(); Long stopTime=System. CurrentTimeMillis (); System. Out.println (totalSize * 1000.0/(stopTime - startTime)/(1 & lt; <20));
CodePudding user response:
More than 100 M/s normal ah, if can not reach this speed, or some other place to have a bottleneck that code, I've tested,
CodePudding user response:
The cache is used up you will find more slowly
CodePudding user response:
The original poster is to compare? Even the mechanical drive, the read and write speed of 100 m/S is normal, the original poster should run a on SSD, to see the effect, but there is no point in having a mechanical drive slow, no comparison, no damage,
CodePudding user response:
https://www.baidu.com/s? Wd=9 BA c % % % % E6 E6 A1 A2 E7 B0 % % % % % % AC E7 9 b % % % % % 984 k % E8 AF BB E5 E9 86% % 99% % 80% BA E5 9 f % % % A6 & amp; RSF=64050023 & amp; RSP=0 & amp; F=1 & amp; Oq=9 BA c % % % % E6 E6 A1 A2 E7 B0 % % % % % % AC E7 E9%9 b % 984 k % % % a % 8 of 9 f % E6 9 BB AF E8 BA c % % % % % E5 E9 86% % 99% % 80% BA E5 9 f % % % A6 & amp; Tn=58025142 _5_oem_dg & amp; Ie=utf-8 & amp; Rsv_pq=87 edea5200045a89 & amp; Rsv_t=76 b9qylkptjcxs4qjuti1df3tivyk2bgoyh8ct2l3ut1qbewcv4e7zdgevdfxi1oyjso8dsieky & amp; Rqlang=cn& rs_src=https://bbs.csdn.net/topics/0
http://tieba.baidu.com/p/4869119339
http://tieba.baidu.com/p/2883354675
The somebody else SSD 4 k is random, speaking, reading and writing to more than 20 M/s
CodePudding user response:
Now ordinary SATA serial hard drives are at least 150 m/s speed, SATA 3.0 peak can reach 600 m/s, but because the other hardware or PC status limit cannot be achieved, if your SSD is SATA interface, 3.0 in theory can reach 6 g/s but is actually up to 700 m/s, with m. 2 interface will be a lot faster,