Skip to content

Implement per arena caching. #148

Open

Description

@jasone

Thread caches (tcaches) serve well for amortizing mutex overhead, but they do not provide adequate hysteresis for applications with large short-term swings in usage unless tcache size is dynamic. Dynamic tcache sizing introduces a whole extra set of issues though, because the total amount of memory dedicated to tcaches needs to be limited (even though there can be many extant threads), thus requiring some sort of centralized tcache sizing logic, yet tcaches want to operate independently. Furthermore, dynamically sized tcaches still don't address all common usage patterns; in particular they perform poorly for applications which produce (allocate) memory in one thread and consume (process and then deallocate) memory in other threads.

Dynamically sized per arena caches (acaches) are easier to size because the number of extant arenas tends to be fixed at a relatively low number. Furthermore, producer/consumer usage patterns can be satisfied by acache without any special effort.

Like tcaches, acaches should support manual flushing, e.g. via a arena.<i>.flush mallctl. Details of how to dynamically size acaches remain to be worked out.

Activity

  1. self-assigned this
    on Oct 14, 2014
  2. added this to the 4.0.0 milestone on Oct 14, 2014
  3. modified the milestones: 4.1.0, 4.0.0 on May 2, 2015
  4. dhruba commented on Jul 16, 2015

    @dhruba

    our use-case is with a pub-sub framework called rocketspeed that typically allocates a msg on one thread and frees it on another thread. It would be great if we can have a memory pool per cpu rather than per thread.

  5. modified the milestones: 4.2.0, 4.1.0 on Feb 21, 2016
  6. modified the milestones: 5.0.0, 4.2.0 on May 4, 2016
  7. removed their assignment
    on Jun 8, 2016
  8. interwq commented on Jul 1, 2016

    @interwq
    Contributor

    A version of implementation here: interwq@ff4c5fb

    Will add GC, stats next.

  9. modified the milestones: 5.1.0, 5.0.0 on Jan 20, 2017
  10. modified the milestones: 5.1.0, 5.2.0 on Apr 11, 2018
  11. interwq commented on Apr 3, 2019

    @interwq
    Contributor

    @djwatson has page cache in #1455.

  12. modified the milestones: 5.2.0, 6.0 on Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions