Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[leo_storage][leo_object_storage] Refactor slow processing notification to avoid bottlenecks #976

Closed
mocchira opened this issue Jan 19, 2018 · 2 comments

Comments

@mocchira
Copy link
Member

As reported on #966 (comment), the current erlang process structure to handle slow processing notification doesn't scale well so need to refactor (ex: getting rid of intermediate gen_server(s). instead directly CRUD the specific ets talbe created with {write_concurrency, true} and logging through a library module)

@mocchira
Copy link
Member Author

I'm going to deprecate leo_object_storage_event_notifier/leo_object_storage_event in leo_object_storage and leo_storage_msg_collector in leo_storage. Instead add the following module to realize the same functionality while scaling pretty well even in case many slow processing/timeout(s) happen.

-module(leo_object_storage_msg_collector).

%% @doc Init the module (create the ets table for collecting messages)
%% Being invoked from leo_storage application startup phase
-spec(init(Enabled) -> ok | {error, any()}).

%% @doc Clear all messages
%%  Being invoked from https://github.com/leo-project/leofs/blob/develop/apps/leo_storage/src/leo_storage_watchdog_msgs.erl
-spec(clear() -> ok | {error, any()}).

%% @doc Retrieve all messages
%%  Being invoked from https://github.com/leo-project/leofs/blob/develop/apps/leo_storage/src/leo_storage_watchdog_msgs.erl
-spec(get() -> {ok, list()} | {error, any()}).

%% @doc Notify the timeout request
%%  Being invoked from leo_storage_replicator and leo_storage_repairer
-spec(notify(Msg, Method, Key) ->
             ok | {error, any()} when Msg::atom(),
                                      Method::put|get|delete,
                                      Key::binary()).

%% @doc Notify the slow processing request
%%  Being invoked from leo_object_storage_server
-spec(notify(Msg, Method, Key, ProcessingTime) ->
             ok | {error, any()} when Msg::atom(),
                                      Method::put|get|delete,
                                      Key::binary(),
                                      ProcessingTime::non_neg_integer()).

@yosukehara Take a look for review. Once the review finished, I will get to implement.

@yosukehara
Copy link
Member

@mocchira I've reviewed your proposal and agreed to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants