From 19160b646b8ee79872c455900625287a1bbda59c Mon Sep 17 00:00:00 2001 From: sage Date: Mon, 27 Feb 2006 05:08:55 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@685 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/Makefile | 1 - ceph/client/Client.cc | 4 ++-- ceph/config.cc | 14 ++++++++++---- ceph/config.h | 8 ++++++-- ceph/mds/MDBalancer.cc | 17 +++++++++-------- ceph/mds/MDCache.cc | 7 ++++++- ceph/mds/mdstypes.h | 15 ++++++++++++--- 7 files changed, 45 insertions(+), 21 deletions(-) diff --git a/ceph/Makefile b/ceph/Makefile index eb296b4a0747c..0aa1e9c2160c2 100644 --- a/ceph/Makefile +++ b/ceph/Makefile @@ -50,7 +50,6 @@ OSD_OBJS= \ COMMON_OBJS= \ msg/Messenger.o\ msg/Dispatcher.o\ - msg/error.o\ msg/HostMonitor.o\ osd/Filer.o\ osd/OSDMap.o\ diff --git a/ceph/client/Client.cc b/ceph/client/Client.cc index 424936dfc7c5f..09d83c9c9ff55 100644 --- a/ceph/client/Client.cc +++ b/ceph/client/Client.cc @@ -432,7 +432,7 @@ MClientReply *Client::make_request(MClientRequest *req, // pick the actual auth (as best we can) if (item) { mds = item->authority(mdcluster); - } else if (diri->dir_hashed) { + } else if (diri->dir_hashed && missing_dn >= 0) { mds = diri->dentry_authority(req->get_filepath()[missing_dn].c_str(), mdcluster); } else { @@ -440,7 +440,7 @@ MClientReply *Client::make_request(MClientRequest *req, } } else { // balance our traffic! - if (diri->dir_hashed) + if (diri->dir_hashed && missing_dn >= 0) mds = diri->dentry_authority(req->get_filepath()[missing_dn].c_str(), mdcluster); else diff --git a/ceph/config.cc b/ceph/config.cc index d524fe52e15d5..7990940c04b27 100644 --- a/ceph/config.cc +++ b/ceph/config.cc @@ -111,16 +111,19 @@ md_config_t g_conf = { mds_log_before_reply: true, mds_log_flush_on_shutdown: true, - mds_bal_replicate_threshold: 8000, - mds_bal_unreplicate_threshold: 1000, - mds_bal_hash_threshold: 1000,//2000, - mds_bal_unhash_threshold: 250, + mds_bal_replicate_threshold: 4000, + mds_bal_unreplicate_threshold: 500, + mds_bal_hash_rd: 1500, + mds_bal_unhash_rd: 500, + mds_bal_hash_wr: 2000, + mds_bal_unhash_wr: 250, mds_bal_interval: 30, // seconds mds_bal_hash_interval: 5, // seconds mds_bal_idle_threshold: .1, mds_bal_max: -1, mds_bal_max_until: -1, + mds_bal_mode: 0, mds_bal_min_start: .2, // if we need less than this, we don't do anything mds_bal_need_min: .8, // take within this range of what we need mds_bal_need_max: 1.2, @@ -395,6 +398,8 @@ void parse_config_options(vector& args) else if (strcmp(args[i], "--mds_bal_max_until") == 0) g_conf.mds_bal_max_until = atoi(args[++i]); + else if (strcmp(args[i], "--mds_bal_mode") == 0) + g_conf.mds_bal_mode = atoi(args[++i]); else if (strcmp(args[i], "--mds_bal_min_start") == 0) g_conf.mds_bal_min_start = atoi(args[++i]); else if (strcmp(args[i], "--mds_bal_need_min") == 0) @@ -405,6 +410,7 @@ void parse_config_options(vector& args) g_conf.mds_bal_midchunk = atoi(args[++i]); else if (strcmp(args[i], "--mds_bal_minchunk") == 0) g_conf.mds_bal_minchunk = atoi(args[++i]); + else if (strcmp(args[i], "--client_cache_size") == 0) g_conf.client_cache_size = atoi(args[++i]); diff --git a/ceph/config.h b/ceph/config.h index f85dc77a36589..af047a4ba0d25 100644 --- a/ceph/config.h +++ b/ceph/config.h @@ -83,13 +83,17 @@ struct md_config_t { float mds_bal_replicate_threshold; float mds_bal_unreplicate_threshold; - float mds_bal_hash_threshold; - float mds_bal_unhash_threshold; + float mds_bal_hash_rd; + float mds_bal_unhash_rd; + float mds_bal_hash_wr; + float mds_bal_unhash_wr; int mds_bal_interval; int mds_bal_hash_interval; float mds_bal_idle_threshold; int mds_bal_max; int mds_bal_max_until; + + int mds_bal_mode; float mds_bal_min_start; float mds_bal_need_min; float mds_bal_need_max; diff --git a/ceph/mds/MDBalancer.cc b/ceph/mds/MDBalancer.cc index a4242cbabafdb..c9770addb9a01 100644 --- a/ceph/mds/MDBalancer.cc +++ b/ceph/mds/MDBalancer.cc @@ -390,7 +390,7 @@ void MDBalancer::do_rebalance(int beat) if (amount < MIN_OFFLOAD) continue; - dout(5) << " sending " << amount << " to " << target << endl; + dout(5) << " sending " << amount << " to mds" << target << endl; show_imports(); @@ -553,7 +553,7 @@ void MDBalancer::find_exports(CDir *dir, it != smaller.rend(); it++) { - dout(7) << " taking (much) smaller " << *(*it).second << endl; + dout(7) << " taking (much) smaller " << it->first << " " << *(*it).second << endl; exports.push_back((*it).second); already_exporting.insert((*it).second); @@ -580,7 +580,7 @@ void MDBalancer::hit_inode(CInode *in, int type) // hit auth up to import CDir *dir = in->get_parent_dir(); - if (dir) hit_recursive(dir, type); + if (dir) hit_dir(dir, type); } @@ -590,14 +590,15 @@ void MDBalancer::hit_dir(CDir *dir, int type) float v = dir->popularity[MDS_POP_JUSTME].pop[type].hit(); // hit modify counter, if this was a modify - if (type == META_POP_WR && - g_conf.num_mds > 1 && - dir->is_auth()) { + if (g_conf.num_mds > 1 && + dir->is_auth() && + !dir->inode->is_root()) { // not root (for now at least) // hash this dir? (later?) - if (v > g_conf.mds_bal_hash_threshold && + if (((v > g_conf.mds_bal_hash_rd && type == META_POP_RD) || + (v > g_conf.mds_bal_hash_wr && type == META_POP_WR)) && !(dir->is_hashed() || dir->is_hashing()) && hash_queue.count(dir->ino()) == 0) { - dout(0) << "hit_dir WR pop is " << v << ", putting in hash_queue: " << *dir << endl; + dout(0) << "hit_dir " << type << " pop is " << v << ", putting in hash_queue: " << *dir << endl; hash_queue.insert(dir->ino()); } } diff --git a/ceph/mds/MDCache.cc b/ceph/mds/MDCache.cc index 32bdbb6ec2682..f59e41742384a 100644 --- a/ceph/mds/MDCache.cc +++ b/ceph/mds/MDCache.cc @@ -7849,7 +7849,12 @@ public: } void finish(int r) { CInode *in = 0; - if (r >= 0) in = trace[trace.size()-1]->get_inode(); + if (r >= 0) { + if (trace.size()) + in = trace[trace.size()-1]->get_inode(); + else + in = mdc->get_root(); + } mdc->handle_hash_dir_discover_2(m, in, r); } }; diff --git a/ceph/mds/mdstypes.h b/ceph/mds/mdstypes.h index 4ab8ae27ac7fd..00902d47b8f2e 100644 --- a/ceph/mds/mdstypes.h +++ b/ceph/mds/mdstypes.h @@ -6,6 +6,7 @@ #include using namespace std; +#include "config.h" #include "common/DecayCounter.h" @@ -83,9 +84,17 @@ class mds_load_t { req_rate(0), cache_hit_rate(0), queue_len(0) { } double mds_load() { - return root.pop[META_POP_RD].get() - + root.pop[META_POP_WR].get() - + 100*queue_len; + switch(g_conf.mds_bal_mode) { + case 0: + return root.pop[META_POP_RD].get() + + 2.0*root.pop[META_POP_WR].get() + + 10.0*queue_len; + + case 1: + return req_rate + 10.0*queue_len; + + } + return 0; } }; -- 2.39.5