Commit 6322fc43 authored by Ramon Nou's avatar Ramon Nou
Browse files

Add calibrated random slicing storage weighting

parent a51e38da
Loading
Loading
Loading
Loading
Loading
+6 −0
Changes for include/common/env.hpp: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -58,6 +58,12 @@ static constexpr auto DISTRIBUTION_STRATEGY =
        ADD_PREFIX("DISTRIBUTION_STRATEGY");
static constexpr auto RANDOM_SLICING_CUTSHIFT =
        ADD_PREFIX("RANDOM_SLICING_CUTSHIFT");
static constexpr auto RANDOM_SLICING_CALIBRATION =
        ADD_PREFIX("RANDOM_SLICING_CALIBRATION");
static constexpr auto RANDOM_SLICING_CALIBRATION_SECONDS =
        ADD_PREFIX("RANDOM_SLICING_CALIBRATION_SECONDS");
static constexpr auto RANDOM_SLICING_CALIBRATION_MIN_MBPS =
        ADD_PREFIX("RANDOM_SLICING_CALIBRATION_MIN_MBPS");
static constexpr auto EXPAND_ON_DEMAND = ADD_PREFIX("EXPAND_ON_DEMAND");
static constexpr auto NUM_REPL = ADD_PREFIX("NUM_REPL");
static constexpr auto CREATE_CHECK_PARENTS = ADD_PREFIX("CREATE_CHECK_PARENTS");
+4 −0
Changes for include/common/hostfile_management.hpp: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -135,6 +135,10 @@ get_marker(const std::string& line);
HostfileMarkers
parse_hostfile_markers(const std::string& path);

/** Return per-host RS weights in the same sorted order as hostfile_pairs(). */
std::vector<float>
hostfile_rs_weights(const std::string& path);

/**
 * @brief Validate a marker-based hostfile topology.
 * @param markers Parsed hostfile markers
+7 −0
Changes for include/common/rpc/random_slicing_distributor.hpp: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@ private:
    host_t localhost_;
    unsigned int hosts_size_{0};
    std::vector<host_t> all_hosts_;
    std::vector<float> weights_;
    std::vector<Partition> partitions_;
    IntervalIndex interval_idx_;

@@ -166,6 +167,8 @@ private:
public:
    explicit RandomSlicingDistributor(host_t localhost,
                                      unsigned int hosts_size);
    RandomSlicingDistributor(host_t localhost, unsigned int hosts_size,
                             const std::vector<float>& weights);
    RandomSlicingDistributor() = default;

    // Distributor interface
@@ -202,6 +205,10 @@ public:
    bool
    set_intervals(const std::vector<Interval>& intervals);

    /** @brief Set per-host relative capacities and rebuild the layout. */
    void
    set_weights(const std::vector<float>& weights);

    /** @brief Return the current flat interval table. */
    std::vector<Interval>
    get_intervals() const;
+1 −0
Changes for include/daemon/env.hpp: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ namespace gkfs::env {

static constexpr auto METADATA_DB_PATH = ADD_PREFIX("METADATA_DB_PATH");
static constexpr auto HOSTS_FILE = COMMON_ENV_PREFIX "HOSTS_FILE";
static constexpr auto DAEMON_2ND_ROOT = ADD_PREFIX("2ND_ROOT");
static constexpr auto DAEMON_CREATE_EXIST_CHECK =
        ADD_PREFIX("CREATE_EXIST_CHECK");
static constexpr auto KEEP_HOSTS_FILE = ADD_PREFIX("KEEP_HOSTS_FILE");
+8 −0
Changes for include/daemon/util.hpp: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -45,6 +45,14 @@
#define GEKKOFS_DAEMON_UTIL_HPP

namespace gkfs::utils {
/** Select the optional secondary storage root after calibration. */
void
prepare_storage_root();

/** Return the calibrated weight for the selected storage root. */
float
storage_calibration_weight();

/**
 * @brief Registers the daemon's RPC address to the shared hosts file.
 * @param expand_mode If true, prepend '+' marker to the line
Loading