i have problem want pull discrete chunks of data disk queue, , dequeue them process. data randomly located on disk, not benefit substantially sequential reads. it's alot of data can't load @ once, nor efficient pull in block @ time.
i'd consumer able operate @ own speed, keep healthy queue of data ready i'm not waiting on disk reads process chunks.
is there established way this? i.e jobs framework or safetyvalve? implementing feels reinventing wheel slow consumer operating on disk data common problem.
any suggestions how best tackle erlang way?
you can use {read_ahead, bytes} option on file:open/2:
{read_ahead, size}this option activates read data buffering. if
read/2calls lesssizebytes, read operations towards operating system still performed blocks ofsizebytes. data buffered , returned in subsequentread/2calls, giving performance gain since number of operating system calls reduced.the
read_aheadbuffer highly utilizedread_line/1function inrawmode, why option recommended (for performance reasons) when accessing raw files using function.if
read/2calls sizes not less than, or greatersizebytes, no performance gain can expected.
you've been vague on sizes mentioned using, seems toying buffer size should decent start implementing need.
Comments
Post a Comment