News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Disk block size

Started by Danesh, August 08, 2006, 01:09:09 PM

Previous topic - Next topic

Danesh

Hi all,

I am writing a program to write a user defined memory block to disk and read it many times later. I want to make read/write from/to disk as efficient as possible. To do this, I need to write blocks to disk as same as disk block or (N x disk block size). I have assumed that disk block size is 1024 and I have devided memory blocks to 2x1024 bytes to make it as efficient as possbile. Is it the correct number for disk block size? Is it also efficient to use (N x disk block size) since the size of memory block is user defined?

Thanks,

D.

evlncrn8

disk block size can vary, use DeviceIoControl to get the right data GET_DISK_GEOMETRY or something

P1

Don't forget that Windows has it's own buffers as well for file writes/reads.

The minimum is the disk cluster size, regardless of other buffers.  i.e.  SCSI Hardware buffers.

Regards,  P1  :8)

johnsa

This is a good question,

I was looking at building a custom database server a while ago, maybe I'll restart thinking about this project. Obviously one of the most critical aspects of the core of it would be to have the fastest disk read/write possible. Anyone have any ideas what would be the best way to read/write files?

Memory Mapped, using the right size chunks to read/write as discussed here, etc ?

Danesh

Johnsa,

In database servers the most critical part of disk access in when a full scan (usually read) happens. Otherwise, B-Trees have very few disk read and writes. I have gathered information from MySQL experts (and employees) and they said that MySQL uses clustered indexes for B-Tree and they have defined disk block size 1024 as base number which can be multiplied by any factor. I think Memory mapped files, duplicating handles, reading files in large blocks, define size of block correctly (disk block sizexN) to minimize disk access, use memory caché and using B-Tree structure (as MyISAM engine uses) for indexed columns is best solution to speed up disk access in database servers. If you have not implemeted B-Tree for your database you should know that it is extremly complex to be implemented. If you needed any resource on net, let me know.