Hermes
0.9.5-beta
Hierarchical Distributed I/O Buffering System
|
#include <buffer_pool.h>
Public Attributes | |
ptrdiff_t | headers_offset |
ptrdiff_t | devices_offset |
ptrdiff_t | targets_offset |
ptrdiff_t | free_list_offsets [kMaxDevices] |
ptrdiff_t | slab_unit_sizes_offsets [kMaxDevices] |
ptrdiff_t | slab_buffer_sizes_offsets [kMaxDevices] |
ptrdiff_t | buffers_available_offsets [kMaxDevices] |
TicketMutex | ticket_mutex |
std::atomic< i64 > | capacity_adjustments [kMaxDevices] |
i32 | block_sizes [kMaxDevices] |
i32 | num_slabs [kMaxDevices] |
u32 | num_headers [kMaxDevices] |
i32 | num_devices |
i32 | num_targets |
u32 | total_headers |
f32 | min_device_bw_mbps |
f32 | max_device_bw_mbps |
Contains information about the layout of the buffers, BufferHeaders, and Devices in shared memory.
Some terminology: block - A contiguous range of buffer space of the smallest unit for a given Device. The size for each Device is specified by Config::block_sizes[device_id]. RAM is typically 4K, for example. buffer - Made up of 1 or more blocks: 1-block buffer, 4-block buffer, etc. slab - The collection of all buffers of a particular size. e.g., the 4-block slab is made up of all the 4-block buffers.
When Hermes initializes, the BufferPool is created and initialized in a shared memory segment, which is then closed when Hermes shuts down. A pointer to the BufferPool can be retrieved with the function GetBufferPoolFromContext. All pointer values are stored as offsets from the beginning of shared memory. The layout of the BufferPool is determined by the Config struct that is passed to InitBufferPool. Multiple BufferPools can be instantiated, but each must have a different buffer_pool_shmem_name, which is a member of Config. Each BufferPool will then exist in its own shared memory segment.
ptrdiff_t hermes::BufferPool::headers_offset |
The offset from the base of shared memory where the BufferHeader array begins.
ptrdiff_t hermes::BufferPool::devices_offset |
The offset from the base of shared memory where the Device array begins.
ptrdiff_t hermes::BufferPool::targets_offset |
The offset from the targets
ptrdiff_t hermes::BufferPool::free_list_offsets[kMaxDevices] |
ptrdiff_t hermes::BufferPool::slab_unit_sizes_offsets[kMaxDevices] |
ptrdiff_t hermes::BufferPool::slab_buffer_sizes_offsets[kMaxDevices] |
The offset from the base of shared memory where each Device's list of slab buffer sizes is stored. Each offset can be converted to a pointer to an array of N ints where N is the number of slabs in that Device. A slab's buffer size (in bytes) is the slab's unit size multiplied by the Device's block size.
ptrdiff_t hermes::BufferPool::buffers_available_offsets[kMaxDevices] |
The offset from the base of shared memory where each Device's list of available buffers per slab is stored. Each offset can be converted to a pointer to an arry of N (num_slabs[device_id]) std::atomic<u32>.
TicketMutex hermes::BufferPool::ticket_mutex |
A ticket lock to syncrhonize access to free lists
std::atomic<i64> hermes::BufferPool::capacity_adjustments[kMaxDevices] |
capacity adjustment for each device
i32 hermes::BufferPool::block_sizes[kMaxDevices] |
The block size for each Device.
i32 hermes::BufferPool::num_slabs[kMaxDevices] |
The number of slabs for each Device.
u32 hermes::BufferPool::num_headers[kMaxDevices] |
The number of BufferHeaders for each Device.
i32 hermes::BufferPool::num_devices |
The total number of Devices.
i32 hermes::BufferPool::num_targets |
total number of targets
u32 hermes::BufferPool::total_headers |
The total number of BufferHeaders in the header array.
f32 hermes::BufferPool::min_device_bw_mbps |
minimum device bandwidth in Megabits per second
f32 hermes::BufferPool::max_device_bw_mbps |
maximum device bandwidth in Megabits per second