OPTION(mon_osd_cache_size, OPT_INT, 10) // the size of osdmaps cache, not to rely on underlying store's cache
OPTION(mon_cpu_threads, OPT_INT, 4)
+OPTION(mon_osd_mapping_pgs_per_chunk, OPT_INT, 4096)
OPTION(mon_tick_interval, OPT_INT, 5)
OPTION(mon_session_timeout, OPT_INT, 300) // must send keepalive or subscribe
OPTION(mon_subscribe_interval, OPT_DOUBLE, 24*3600) // for legacy clients only
<< ").osd e" << osdmap.get_epoch() << " ";
}
-OSDMonitor::OSDMonitor(CephContext *cct, Monitor *mn, Paxos *p, const string& service_name)
+OSDMonitor::OSDMonitor(
+ CephContext *cct,
+ Monitor *mn,
+ Paxos *p,
+ const string& service_name)
: PaxosService(mn, p, service_name),
cct(cct),
+ mapper(mn->cct, &mn->cpu_tp),
inc_osd_cache(g_conf->mon_osd_cache_size),
full_osd_cache(g_conf->mon_osd_cache_size),
last_attempted_minwait_time(utime_t()),
}
}
+void OSDMonitor::_calc_mapping(const OSDMap& osdmap, OSDMapMapping *mapping)
+{
+ utime_t start = ceph_clock_now();
+ if (g_conf->mon_cpu_threads) {
+ auto job = mapper.queue(osdmap, mapping,
+ g_conf->mon_osd_mapping_pgs_per_chunk);
+ job->wait();
+ } else {
+ mapping->update(osdmap);
+ }
+ utime_t end = ceph_clock_now();
+ dout(10) << __func__ << " in " << (end - start) << dendl;
+}
+
void OSDMonitor::on_active()
{
update_logger();
}
// FIXME: hacky synchronous blocking mapping update
- utime_t start = ceph_clock_now();
- mapping.update(osdmap);
- utime_t end = ceph_clock_now();
- dout(10) << __func__ << " updated mapping in " << (end - start) << dendl;
+ _calc_mapping(osdmap, mapping.get());
}
void OSDMonitor::on_shutdown()
} else {
dout(10) << __func__ << " " << osds.size() << " interesting osds" << dendl;
for (auto osd : osds) {
- const vector<pg_t>& pgs = mapping.get_osd_acting_pgs(osd);
+ const vector<pg_t>& pgs = mapping->get_osd_acting_pgs(osd);
dout(20) << __func__ << " osd." << osd << " " << pgs << dendl;
for (auto pgid : pgs) {
if (!pg_map->creating_pgs.count(pgid)) {
if (pending_inc.new_pg_temp.count(pgid))
return;
vector<int> old_acting;
- mapping.get(pgid, nullptr, nullptr, &old_acting, nullptr);
+ mapping->get(pgid, nullptr, nullptr, &old_acting, nullptr);
vector<int> up, acting;
int up_primary, acting_primary;
next.pg_to_up_acting_osds(pgid, &up, &up_primary, &acting, &acting_primary);