diff options
| author | Matthew Sackman <matthew@lshift.net> | 2009-05-27 13:11:23 +0100 |
|---|---|---|
| committer | Matthew Sackman <matthew@lshift.net> | 2009-05-27 13:11:23 +0100 |
| commit | 07a45e744d24384e3b2a1667d4b98650e83f671d (patch) | |
| tree | 1aa80fec10f205ee9841859021a4ff9baff5b701 /src | |
| parent | 54dd5c0194db230b8bd73e244529b539b51fc0fe (diff) | |
| download | rabbitmq-server-git-07a45e744d24384e3b2a1667d4b98650e83f671d.tar.gz | |
Brought out starting the persister to rabbit.erl. Also, reduced the file size limit to 25MB. The reason is that it was observed that start up was taking a long time simply because the files were large (100MB). Given that the file being written to is never GC'd, reducing the file size limit forces new files to be created more frequently, thus increasing the use of GC and thereby keeping file utilisation higher. As a result, less time is wasted at startup scanning over delivered but not-yet-GC'd messages.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit.erl | 5 | ||||
| -rw-r--r-- | src/rabbit_disk_queue.erl | 9 | ||||
| -rw-r--r-- | src/rabbit_mixed_queue.erl | 4 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index 0de93e9971..3a15e6b07c 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -155,6 +155,11 @@ start(normal, []) -> fun () -> ok = start_child(rabbit_persister) end}, + {"disk queue", + fun () -> + ok = start_child(rabbit_disk_queue), + ok = rabbit_disk_queue:to_ram_disk_mode() %% TODO, CHANGE ME + end}, {"guid generator", fun () -> ok = start_child(rabbit_guid) diff --git a/src/rabbit_disk_queue.erl b/src/rabbit_disk_queue.erl index b73e456c22..d13b6eb620 100644 --- a/src/rabbit_disk_queue.erl +++ b/src/rabbit_disk_queue.erl @@ -33,7 +33,7 @@ -behaviour(gen_server). --export([start_link/1]). +-export([start_link/0]). -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). @@ -63,6 +63,7 @@ -define(SERVER, ?MODULE). -define(MAX_READ_FILE_HANDLES, 256). +-define(FILE_SIZE_LIMIT, (25*1024*1024)). -record(dqstate, {msg_location_dets, %% where are messages? msg_location_ets, %% as above, but for ets version @@ -226,7 +227,7 @@ -type(seq_id() :: non_neg_integer()). -type(seq_id_or_next() :: { seq_id() | 'next' }). --spec(start_link/1 :: (non_neg_integer()) -> +-spec(start_link/0 :: () -> {'ok', pid()} | 'ignore' | {'error', any()}). -spec(publish/3 :: (queue_name(), msg_id(), binary()) -> 'ok'). -spec(publish_with_seq/4 :: (queue_name(), msg_id(), seq_id_or_next(), binary()) -> 'ok'). @@ -255,9 +256,9 @@ %% ---- PUBLIC API ---- -start_link(FileSizeLimit) -> +start_link() -> gen_server:start_link({local, ?SERVER}, ?MODULE, - [FileSizeLimit, ?MAX_READ_FILE_HANDLES], []). + [?FILE_SIZE_LIMIT, ?MAX_READ_FILE_HANDLES], []). publish(Q, MsgId, Msg) when is_binary(Msg) -> gen_server:cast(?SERVER, {publish, Q, MsgId, Msg}). diff --git a/src/rabbit_mixed_queue.erl b/src/rabbit_mixed_queue.erl index b807fce20f..6a8f30979a 100644 --- a/src/rabbit_mixed_queue.erl +++ b/src/rabbit_mixed_queue.erl @@ -46,11 +46,7 @@ } ). --define(FILE_SIZE_LIMIT, (100*1024*1024)). - start_link(Queue, Mode) when Mode =:= disk orelse Mode =:= mixed -> - rabbit_disk_queue:start_link(?FILE_SIZE_LIMIT), - rabbit_disk_queue:to_ram_disk_mode(), %% TODO, CHANGE ME {ok, #mqstate { mode = Mode, msg_buf = queue:new(), next_write_seq = 1, queue = Queue }}. msg_to_bin(Msg = #basic_message { content = Content }) -> |
