Faster IO500

Add some optimizations.

  1. With write inlined, mdtest inneficciently gets all the 4k data for all the request. A stringview optimizes the feature.
  2. batching mmetadata request at the client (LIBGKFS_METADATA_BATCH=ON/OFF and LIBGKFS_METADATA_BATCH_THRESHOLD=64).

Merge request reports

Loading
+4 −0
Changes for include/client/rpc/forward_metadata.hpp: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -63,6 +63,10 @@ namespace rpc {
int
forward_create(const std::string& path, mode_t mode, const int copy);

int
forward_batch_create(uint64_t host_id, const std::vector<std::string>& paths,
                     const std::vector<uint32_t>& modes);

int
forward_create_write_inline(const std::string& path, mode_t mode,
                            const std::string& data, uint64_t count,
+3 −0
Changes for include/client/env.hpp: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -95,6 +95,9 @@ static constexpr auto CREATE_WRITE_OPTIMIZATION =
        ADD_PREFIX("CREATE_WRITE_OPTIMIZATION");
static constexpr auto READ_INLINE_PREFETCH = ADD_PREFIX("READ_INLINE_PREFETCH");
static constexpr auto ENABLE_FORK = ADD_PREFIX("ENABLE_FORK");
static constexpr auto METADATA_BATCH = ADD_PREFIX("METADATA_BATCH");
static constexpr auto METADATA_BATCH_THRESHOLD =
        ADD_PREFIX("METADATA_BATCH_THRESHOLD");

} // namespace gkfs::env

+29 −0
Changes for include/client/preload_context.hpp: 29 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
#define GEKKOFS_PRELOAD_CTX_HPP

#include <map>
#include <unordered_map>
#include <thallium.hpp>
#include <memory>
#include <vector>
@@ -156,6 +157,12 @@ private:
    std::shared_ptr<thallium::engine> rpc_engine_;
    std::shared_ptr<thallium::engine> ipc_engine_;

    bool use_metadata_batch_{false};
    size_t metadata_batch_threshold_{64};
    std::unordered_map<uint64_t, std::vector<std::pair<std::string, mode_t>>>
            metadata_batch_buffer_;
    mutable std::mutex metadata_batch_mutex_;


public:
    static PreloadContext*
@@ -375,6 +382,28 @@ public:

    void
    ipc_engine(std::shared_ptr<thallium::engine> engine);

    bool
    use_metadata_batch() const;

    void
    use_metadata_batch(bool use_metadata_batch);

    size_t
    metadata_batch_threshold() const;

    void
    metadata_batch_threshold(size_t threshold);

    void
    flush_metadata_batches();

    void
    flush_metadata_batch(uint64_t host_id);

    void
    add_metadata_batch_entry(uint64_t host_id, const std::string& path,
                             mode_t mode);
};

} // namespace preload
+22 −0
Changes for include/common/rpc/rpc_types_thallium.hpp: 22 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -73,6 +73,28 @@ struct rpc_mk_node_in_t {
    }
};

struct rpc_batch_mk_node_in_t {
    std::vector<std::string> paths;
    std::vector<uint32_t> modes;

    template <class Archive>
    void
    serialize(Archive& ar) {
        ar(paths, modes);
    }
};

struct rpc_batch_mk_node_out_t {
    int32_t err;
    std::vector<int32_t> errs;

    template <class Archive>
    void
    serialize(Archive& ar) {
        ar(err, errs);
    }
};

struct rpc_path_only_in_t {
    std::string path;
    bool include_inline;
+1 −0
Changes for include/common/common_defs.hpp: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ constexpr auto get_dirents_extended = "rpc_srv_get_dirents_extended";
constexpr auto get_dirents_filtered = "rpc_srv_get_dirents_filtered";
constexpr auto mk_symlink = "rpc_srv_mk_symlink";
constexpr auto rename = "rpc_srv_rename";
constexpr auto batch_create = "rpc_srv_batch_mk_node";

constexpr auto write = "rpc_srv_write_data";
constexpr auto read = "rpc_srv_read_data";
Loading
Loading