Click here to Skip to main content
15,878,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have been working on a project which needs to write a lot of data at a high rate to a RAID drive. Each file size can be up to 50GB. We weren't achieving a high enough data rate so we used unbuffered write with a buffer size of 4MB, which is the max possible size for our system. This speeded the writes to what we needed. We also tried pre-allocating a large file size, but this made very little difference (we tried the whole file size of 50GB and also smaller of 1MB, which we thought was the max pre-allocation size which would make any difference).

I don't understand why the large buffer made more diffrence than the pre-allocation, since I thought the pre-allocation size would mean that the writes to disk are done in bigger chunks, whereas the larger buffer size means that more data can be written to the buffer before the writes start. If the writing is what slows things down, then the pre-allocation should make the most difference.

Can somebody explain this please.

Mnay thanks.
Posted
Comments
DaveAuld 9-Jul-12 6:35am    
What raid configuration are you using? What is your current write speed to the raid array from the machine? Is the raid array in the machine or connected externally? How is it connected if external (USB, Ethernet, Firewire etc.)?
DaveAuld 9-Jul-12 6:36am    
You said an unbuffered write with a buffer size of 4MB, do you you mean a block size of 4MB?
DaveAuld 9-Jul-12 7:54am    
Thought so, now if you give me an idea on the other things in the previous comment I might be able to further help.
Jackie Lloyd 9-Jul-12 7:04am    
yes I do mean block size, sorry, excuse me. I am new to this and I had not go the terminolgy correct.
ThatsAlok 9-Jul-12 7:35am    
what the max write speed your RAID file can handle or it customer dependent. See you can write at speed which supported by your device. however you can speed up this by buffering data in memory and at predefiend size write to the device.

Making pre-allocation doesn't help at time of writing theoretically, since if depend upon i/o device

1 solution

Unbuffered writes means that you are not using any of the operating systems file systems buffering techniques and writing the the raw file stream straight to the hardware.

The larger the block size means that you are making less frequent calls for data to be written.

One way to look at it is by comparing to money.

In your left hand you have a pile of coins, the block size is the denomination of the coin, a small block size is a penny, a large block size is a $1 coin.

You have to put $10 dollars into a machine. Which will do it quicker pennies or dollar coins?

Now, introduce a purse/wallet, that it your buffer, if you turn buffering on, each coin must be put into the purse before it can be then taken out and put into the machine.

As you are working with a large file and large block sizes, buffering doesn't help you. If you were using small files with small block sizes, the buffer allows the slow hard disk time to process each file and provides the faster software to offload its work to keep it moving.

Does that help?

Look at my two articles and you will see real world examples of the effect of block size;
QNAP NAS Memory Upgrade, Hardware Change and Performance Benefits[^]


The Hybrid Alternative - Did it make a difference?[^]

If you look at the graphs, the block size is along the X-axis, and in both benchmarks the buffering is disabled.
 
Share this answer
 
Comments
Jackie Lloyd 9-Jul-12 8:44am    
Thankyou, that makes the buffered / unbuffered effect very clear.

So, is there any point in pre-allocating?
DaveAuld 9-Jul-12 9:07am    
I think the main benefit of pre-allocation is that it prevents (or can limit) disk fragrmentation. particularly if done on a clean or defragmentated disk. IBM has some info on storage network stuff; http://publib.boulder.ibm.com/infocenter/tssfsv21/v1r0m0/index.jsp?topic=%2Fcom.ibm.sanfs222.doc%2Ffoe0_c_file_storage_preallocation.html
Jackie Lloyd 9-Jul-12 9:44am    
Thankyou, so pre-alloc is not going to speed up the write. I have no choice in the RAID type or connection, so I am leaving as is. We have achieved the speed we need but I just really wanted to understand the reasons why it worked. If I ever get involved in choosing RAID types or connections then i will definately refer to this - thankyou very much :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900