Re: NBD prefetch read
19.03.2018 17:39, Eric Blake wrote:
On 03/19/2018 05:01 AM, Vladimir Sementsov-Ogievskiy wrote:
Hi all.
We need a possibility to ask NBD server to prefetch some data, but do
not send it to the wire, something like readahead command.
Do other storage systems (such as ISCSI) support a readahead commands
separate from a normal read? What are the intended semantics, that a
client can issue a readahead command and get an instant response from
the server acknowledging the request, and then a later NBD_CMD_READ to
the same area might be serviced faster as a result of the server
preparing its caches from the initial readahead command? What
failures are possible, or would the command be completely advisory
(and thus never fail, but also never guarantee that it makes any speed
differences)? Would there be limits on how much you can readahead
without polluting the cache to the point that you are actually hurting
instead of helping performance?
SCSI has PRE-FETCH command, looking through the spec, I see the
following properties:
- IMMED flag: if unset, command returns only after the operation is
complete
return status distinguish the following situations:
- all OK
- not enough space in cache, so only subset of blocks was moved to the cache
- some error, other then not enough space
hmm. nothing said here about rewriting data in the cache, if there is no
more space, looks like PRE-FETCH should not rewrite cache.
We suggest to realize this possibility by adding a negotiated flag to
READ command. An alternative may be a separate PREFETCH (or
READAHEAD) command.
I'd prefer a separate command, rather than a flag to the existing
NBD_CMD_READ. In particular, if the client does not negotiate
structured reads, then having the presence or absence of a return
payload be based on the value of the flag makes it that much more
context-sensitive to parse the server's reply stream.
agree.
The actual case is the following: we need a managed copy-on-read
process, where third tool dictates the sequence of copying process,
but it don't set nor source neither destination.
Can you demonstrate an actual sequence of commands sent over the wire,
for how it would be useful?
- we initialize two drives A and B in qemu and setup copy-on-read for them.
- client send a sequence of READAHEAD commands, and data is copied from
A to B on read from B, in corresponding sequence.
So, here B is a cache in terms of the PRE-FETCH command.
What do you think?
--
Best regards,
Vladimir
Reply to: