-
Notifications
You must be signed in to change notification settings - Fork 155
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
Object counting during startup (without .state files) is slow #974
Comments
@vstax Thanks for reporting in detail. AS IS
TO BE
I will try this idea and share the result the next working day. |
@vstax Just in case, can you do the same experiment and run leofs_doctor during that time? the result might tell us other possible culprit. |
@mocchira I see, thanks for looking.
|
@vstax I see. if possible, would you like to do the same experiment with the following patch applied to leo_storage? This will make leofs_doctor work even during node startup. (after experiments, please rollback the original one without the patch) diff --git a/apps/leo_storage/src/leo_storage_app.erl b/apps/leo_storage/src/leo_storage_app.erl
index 161158e..290a179 100644
--- a/apps/leo_storage/src/leo_storage_app.erl
+++ b/apps/leo_storage/src/leo_storage_app.erl
@@ -148,6 +148,7 @@ after_proc(Error) ->
%% @private
after_proc_1(true, Pid, Managers) ->
try
+ ensure_started(rex, rpc, start_link, worker, 2000),
%% Launch servers
%% launch_object_storage after checking if managers are alive
%% to fix slow down startup problem. Details can be found on
@@ -171,7 +172,6 @@ after_proc_1(true, Pid, Managers) ->
[leo_storage_handler_del_directory]}),
%% After processing
- ensure_started(rex, rpc, start_link, worker, 2000),
ok = leo_storage_api:register_in_monitor(first),
%% Launch leo-rpc |
@mocchira No compactions in either case. |
@vstax Thanks! looks exactly what I expected. (iterator_move consumes almost CPU time in erlang runtime) so implementing count on C/C++ is likely to improve the boot time. I get to implement and would like to ask you test again once it's finished. |
TODO
OPTIONAL
|
I confirmed this fix actually improves the boot time of leo_storage without .state files. This fix will be shipped with 1.4.0-rc2 today so please give it a try if you have a chance > @vstax |
@windkit Can you compare the boot time without .state files for metadata between 1.3.8 and 1.4.0-rc2 on RIT? (the number of records would be at least 10,000,000 on one node) |
@mocchira noted, let me check it |
Test Case8 AVS, SSD
Test 1.3.8
Test 1.4.0-rc2
|
@windkit Thanks for testing. LGTM. |
@mocchira |
Originally mentioned as part of #966.
I did experiment with startup after removing state files - and yes, that was the culprit of long startup times. On our system, lacking .state files adds ~11 seconds to opening of each container. This process seems to be CPU bound (by single core, that is). Disk read is around 11 MB/s (or 2200-2400 op/s) but it's not IO-starved (figures, given that .sst files aren't fragmented).
Per-thread top output during this process:
Unfortunately, parallel open doesn't improve anything here as well, object counting seem to process containers sequentially.
Total size of .sst files for each container is ~132 MB, total amount of objects in each container is ~700,000. 11 seconds to count 700,000, hard to say if that's a lot or not. There are numbers at leo-project/leo_backend_db#10 (comment) but I feel like they don't quite tell the full story; current implementation, with sleeps removed can open containers - when no compaction is required - really fast (around 25 containers per second here when they are in disk cache, around 2 containers per second with empty cache, after boot). But counting objects from state files is quite slow. It's probably not a major problem, just that I didn't have an understanding that node holding 178 M objects can spend ~40 minutes counting them.
So the questions are: are these numbers expected? Can they be improved (e.g. by some kind of parallelization)? Or this should just be documented, that node startup can take a very long time, when storing lots of objects and previous shutdown wasn't successful.
The text was updated successfully, but these errors were encountered: