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

data_block_manager_t::check_and_handle_empty_extent() is slow #1559

Closed
danielmewes opened this issue Oct 22, 2013 · 3 comments
Closed

data_block_manager_t::check_and_handle_empty_extent() is slow #1559

danielmewes opened this issue Oct 22, 2013 · 3 comments
Assignees
Milestone

Comments

@danielmewes
Copy link
Member

It takes up to 20% of the server's CPU time during inserts.
What's worse though is that it is called in data_block_manager_t::mark_garbage() which in turn is called heavily in log_serializer_t::index_write() in a section where we cannot yield. This often hogs the thread for something like 100ms, driving latency up.

We either have to make check_and_handle_empty_extent() faster or modify index_write() to be able to yield (probably by adding some lock).

Roughly half of the time in check_and_handle_empty_extent is spent on updating the priority queue (see the line entry->our_pq_entry->update(); at the end of the function). The profiler could not assign the reamining half to any part in particular. My current suspect is entry->all_garbage() which ends up performing a loop each time it is called.

@ghost ghost assigned danielmewes Oct 22, 2013
@danielmewes
Copy link
Member Author

Actually the priority queue code uses a comparison operator (gc_entry_less_t) which calls gc_entry_t::garbage_bytes() which similar to entry->all_garbage() has to loop over a list of block entries.
I'm hopeful that optimizing those operations might solve the issue altogether.

@danielmewes
Copy link
Member Author

A fix is in branch daniel_1559 and code review 989.

@danielmewes
Copy link
Member Author

Merged into next e9a0f6a

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

1 participant