Skip to content

Alt Cache status #1642

Closed
Closed

Description

@srh

The "alt" cache is in branch sam_97_alt.

The current status is that the "alt" cache is finished enough to be integrated with the rest of the codebase. The following parts have been changed to use the alt cache:

  • The disk backed queue.
  • blob_t (in a separate type, alt::blob_t)
  • update: most btree code and memcache code.
  • update: all of the code, modulo some aspects and features of the alt cache that aren't supported yet, such as soft durability, subtree snapshotting, perfmons, order tokens.

After migrating the rest of the codebase to the cache is done, some other changes to the cache will need to be made (perfmons, integration with issue #97, throttling?, soft durability support, etc).

Activity

  1. ghost assigned on Nov 13, 2013
  2. srh commented on Nov 18, 2013

    @srh
    ContributorAuthor

    Update: Most or all of the btree code and memcache code is updated to the alt cache -- compilation errors are pushed up to the rdb protocol code.

  3. mlucy commented on Nov 18, 2013

    @mlucy
    Member

    You may want to merge from next if you haven't already; there have been some API changes in the rdb_protocol directory.

  4. srh commented on Nov 26, 2013

    @srh
    ContributorAuthor

    The alt cache has been integrated into the btree code such that, if SLICE_ALT is defined as 1 in btree/slice.hpp, the alt cache is used and all the code compiles. Also, all of the unit tests pass except some that start with R, which apparently deadlock.

  5. coffeemug commented on Nov 26, 2013

    @coffeemug
    Contributor

    If I had the capacity to express emotion in an unimpeded way, I would be jumping with joy and excitement. As things stand, I'll merely say I'm really, really happy about the new cache and can't wait to play with it in next!

  6. mlucy commented on Nov 26, 2013

    @mlucy
    Member

    Do we have any preliminary notions of how its performance compares to the old one?

  7. srh commented on Nov 26, 2013

    @srh
    ContributorAuthor

    Do we have any preliminary notions of how its performance compares to the old one?

    No.

  8. srh commented on Dec 4, 2013

    @srh
    ContributorAuthor

    An update: Some problems with the way the alt cache was integrated have been fixed, those that made the RDBBtree.* tests hang. The RDBProtocolBackfill.* tests either take too long or fail.

    When running the actual server, creating a table usually doesn't complete and wait_for_rdb_table_readiness spins claiming that the master is inaccessible. Usually this happens without any store_view_t methods hanging. I don't know yet what that problem is. Creating a table is more likely to work successfully if you lower the CPU_SHARD_FACTOR from 4 to 1.

  9. srh commented on Dec 5, 2013

    @srh
    ContributorAuthor

    I have changed things such that creating a table seems to complete successfully all the time.

    The problem observed after planting debugfs everywhere was that the page_txn_t destructor was sometimes hanging saying that flushing was not completed.

    This problem went away when I commented out the use of the merger serializer in file_based_svs_by_namespace.cc.

    It might be the case now that everything is working correctly or it might be the case that there's something technically wrong with the way the page cache is talking to the serializer or it might be a problem with the merger serializer. I will investigate this further...

  10. srh commented on Dec 6, 2013

    @srh
    ContributorAuthor

    The problem related to the merger serializer was one that happens when several empty index write operations are sent to the merger serializer. The regular buffer cache does not do this and this issue does not affect v1.11.x. (As far as I know, no btree users create write transactions without modifying any blocks, because almost all will modify the metainfo in the superblock. But also, even if that did happen, the buffer cache only calls do_writes when (!state.serializer_writes.empty()) is true.)

    The alt cache only experienced this issue because for now it doesn't distinguish between read transactions and write transactions, and read transactions merrily result in an empty index write being performed. (This is obviously going to be changed.)

    The merger serializer has been changed in this branch to allow empty index writes.

  11. srh commented on Dec 10, 2013

    @srh
    ContributorAuthor

    A bug where the alt cache was accessing its eviction bags from the serializer thread has been fixed and right now I don't know of any bugs (besides incomplete features). It fails the same set of rql tests that next fails, except sometimes it also gives a few errors where a secondary index was accessed before its construction was finished. Those errors seem to be not-a-bug -- the secondary index might be slow in being reconstructed due to incomplete features of the cache (such as the fact that every read transaction still performs an empty index write). The reql tests which fail (and which fail in next) are regression-46-2-CPP and regression-370-3-CPP.

  12. srh commented on Feb 12, 2014

    @srh
    ContributorAuthor

    Currently this is implemented in branch sam_alt and in code review 1204.

  13. srh commented on Feb 12, 2014

    @srh
    ContributorAuthor

    There are a few serious TODOs in the branch marked as "LSI" comments (KSI = keep surgical implements, and LSI = KSI + 1), but they weren't enough reason to block a code review. They'll be done in separate code reviews.

  14. coffeemug commented on Feb 12, 2014

    @coffeemug
    Contributor

    Dude, congratulations in getting the new cache into CR! This is super-duper-awesome, if Siskel and Ebert were still around and did software reviews, they'd give it two thumbs up 👍 👍

  15. srh commented on Feb 18, 2014

    @srh
    ContributorAuthor

    The branch sam_alt has been merged to next. It is sprinkled with LSI and KSI comments. The LSI comments are mandatory tasks (or wrong).

    Here's what's next:

    • Move some stuff out of page.hpp and page.cc, into separate files.
    • User-specified cache priorities should be actually used, not ignored.
    • Make it so that when the user specifies a smaller block size, a smaller block gets flushed to disk.
    • Add reasonable perfmon variables.

    Also requested by @danielmewes (but maybe technically out of the scope of this issue):

    • Allow maybe 2 or 3 simultaneous index_write calls to be dispatched instead of just 1.
  16. danielmewes commented on Feb 18, 2014

    @danielmewes
    Member

    Allow maybe 2 or 3 simultaneous index_write calls to be dispatched instead of just 1.

    Why 2 or 3? Just allow an unbounded number. The total number will be limited by the SOFT_UNWRITTEN_CHANGES_LIMIT anyway.

  17. danielmewes commented on Feb 18, 2014

    @danielmewes
    Member

    Or well, maybe impose some limit to limit the number of coroutines. But it should be in the 100s.

  18. srh commented on Feb 18, 2014

    @srh
    ContributorAuthor

    Move some stuff out of page.hpp and page.cc, into separate files.

    This is done in branch sam_alt_separate_files, review 1216.

  19. srh commented on Feb 18, 2014

    @srh
    ContributorAuthor

    One other unmentioned thing:

    • The profile_t information is inaccurate.
  20. srh commented on Feb 19, 2014

    @srh
    ContributorAuthor

    Update:

    • User-specified cache priorities should be actually used, not ignored. (in code review) (in next)
    • New: Make buf_lock_t construction not force page loading in snapshots. (in next)
    • Make it so that when the user specifies a smaller block size, a smaller block gets flushed to disk. (in next)
    • Add reasonable perfmon variables. (tracked in Perfmons for the alt cache. #2125)
    • Simultaneous index_write calls. (in next)
    • The profile_t information is inaccurate. (not pressing, or even, not a bug)
    • New: Make get_all_recencies() not hog the CPU without blocking. (in next)
  21. srh commented on Mar 13, 2014

    @srh
    ContributorAuthor

    I have updated the comment above. Making buf_lock_t construction not force page loading in snapshots is now in next. That was the hard change to make. Specifying smaller serializer buf sizes is a pretty small and simple change, waiting on reviews 1312 and 1314.

    Next is supporting simultaneous index_write calls, so that they can be merged, and such.

  22. srh commented on Mar 20, 2014

    @srh
    ContributorAuthor

    Currently simultaneous index_write calls is implemented and awaiting code review (after some iterations).

    I will make a separate issue tracking the problem of having block writes be a bit more combined since that is why benchmarks have gone from 7k in v1.11.x to 5k.

    I am currently working on fixing the "RSP" comments, replacing std::vectors with segmented_vector_t's and such. Much of that is awaiting code review. Some is not.

  23. srh commented on Mar 20, 2014

    @srh
    ContributorAuthor

    Simultaneous index writes are in next. All the "RSP" comments worth resolving, or worth resolving before 1.12, are in code review.

    The only thing I really want now is putting some coro_t::yield statements into get_all_recencies().

  24. srh commented on Mar 20, 2014

    @srh
    ContributorAuthor

    sam_get_all_recencies (forked off next) is in review 1343. I am waiting for three code reviews to be completed. Other changes to the alt cache will be tracked in separate issues.

  25. srh commented on Mar 22, 2014

    @srh
    ContributorAuthor

    All the code reviews in progress have been completed.

    Further alt cache related enhancements are tracked here:

    #2141 Bump unsaved data limit to ~128 MB
    #2137 current_page_ts should be deleted when no longer needed
    #2136 Data structure memory usage optimization in the cache.
    #2131 Make btree operations not take excessively large snapshots.
    #2130 Allocate pages of smaller-than-max_block_size() size in the page cache. tp:enhancement
    #2129 Include data structure overhead when tracking cache memory usage.
    #2128 Avoid excessive copy-on-write copying of memory buffers in the cache when flushing.
    #2127 Combine block writes better in the cache.
    #2126 Optimize alt cache soft durability throughput more tp:performance
    #2125 Perfmons for the alt cache.

  26. coffeemug commented on Mar 22, 2014

    @coffeemug
    Contributor

    If there were industry pundits who still understood things like caches, they'd say it's a historic moment. But there aren't, so I'll say it instead. This is a historic moment. Congrats!

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions