diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2010-09-27 11:17:21 +0100 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2010-09-27 11:17:21 +0100 |
| commit | bf2f47c8bbb351e1d92f3a0d28162e580c682c08 (patch) | |
| tree | 44fc2e0adf92360e989de730b23f520dc9001adf /src | |
| parent | 146b3f12ad4c57da3285784a5725c1227ed2708b (diff) | |
| download | rabbitmq-server-git-bf2f47c8bbb351e1d92f3a0d28162e580c682c08.tar.gz | |
only create read_ahead buffers for reading segment files
The buffers are a few hundred k in size, which is a significant
cost. And there is no point having them when writing to
segment/journal files, and they are of limited benefit when reading
the journal file (which, in any case, only happens on startup).
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_queue_index.erl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl index d6b8bb2889..98e73af9c0 100644 --- a/src/rabbit_queue_index.erl +++ b/src/rabbit_queue_index.erl @@ -159,7 +159,7 @@ -define(PUB, {_, _}). %% {Guid, IsPersistent} --define(READ_MODE, [binary, raw, read, {read_ahead, ?SEGMENT_TOTAL_SIZE}]). +-define(READ_MODE, [binary, raw, read]). %%---------------------------------------------------------------------------- @@ -785,7 +785,8 @@ segment_entries_foldr(Fun, Init, load_segment(KeepAcked, #segment { path = Path }) -> case filelib:is_file(Path) of false -> {array_new(), 0}; - true -> {ok, Hdl} = file_handle_cache:open(Path, ?READ_MODE, []), + true -> Mode = [{read_ahead, ?SEGMENT_TOTAL_SIZE} | ?READ_MODE], + {ok, Hdl} = file_handle_cache:open(Path, Mode, []), {ok, 0} = file_handle_cache:position(Hdl, bof), Res = load_segment_entries(KeepAcked, Hdl, array_new(), 0), ok = file_handle_cache:close(Hdl), |
