Skip to contentSkip to conversation

SimpleMessenger dispatching: cause of performance problems?

DISCUSSION Andreas Bluemle 6 participants 18 messages Aug 16, 2012 – Sep 4, 2012

lore
Share & tools
lore
#0 lore raw

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance problems?

In detail:

In order to find out more about this problem, I have added profiling to the ceph code in various place; for write operations to the primary or the secondary, timestamps are recorded for OSD object, offset and length of the such a write request.

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication operation is acknowledged.

What I believe is happening: dispatching requests from SimpleMessenger to OSD worker threads seems to consume a fair amount of time. This ends up in a widening gap between subsequent receipts of requests and the start of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating OSD also suffers from the same problem - and hence causes additional delays at the primary OSD when it waits for the commit from the replicating OSD.

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading the message header until enqueuing the completely decoded message into the SImpleMessenger dispatch queue.

The green bar represents the time required for local processing, i.e. dispatching the the OSD worker, writing to filesystem and journal, send out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a commit back to the primary OSD and the original write request can be committed to the client.

The green bar is interrupted by a black bar: the left end represents the time when the request has been enqueued on the OSD worker queue. The right end gives the time when the request is taken off the OSD worker queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write request.

Note that the dispatching of a later request in all cases relates to the enqueue time at the OSD worker queue of the previous write request: the left end of a black bar relates nicely to the beginning of a green bar above it.

Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
#1 lore raw

Can you provide more details about where you pulled this measurement data from? There are already a number of timestamps saved to track stuff like this and in our own (admittedly still incomplete) work on this subject we haven't seen any delays from the SimpleMessenger. We've had several guys doing a lot of performance work this week, and they've been narrowing in on problems with the commit to disk (rather than the journal) taking long enough that client data starts getting (deliberately) throttled as it comes in. This could be some of the gaps you're seeing and attributing to the SimpleMessenger. -Greg

Quoted 81 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance problems?

In detail:

In order to find out more about this problem, I have added profiling to the ceph code in various place; for write operations to the primary or the secondary, timestamps are recorded for OSD object, offset and length of the such a write request.

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication operation is acknowledged.

What I believe is happening: dispatching requests from SimpleMessenger to OSD worker threads seems to consume a fair amount of time. This ends up in a widening gap between subsequent receipts of requests and the start of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating OSD also suffers from the same problem - and hence causes additional delays at the primary OSD when it waits for the commit from the replicating OSD.

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading the message header until enqueuing the completely decoded message into the SImpleMessenger dispatch queue.

The green bar represents the time required for local processing, i.e. dispatching the the OSD worker, writing to filesystem and journal, send out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a commit back to the primary OSD and the original write request can be committed to the client.

The green bar is interrupted by a black bar: the left end represents the time when the request has been enqueued on the OSD worker queue. The right end gives the time when the request is taken off the OSD worker queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write request.

Note that the dispatching of a later request in all cases relates to the enqueue time at the OSD worker queue of the previous write request: the left end of a black bar relates nicely to the beginning of a green bar above it.

--

Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

#2 lore raw
In reply to Andreas Bluemle
Quoted 24 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance problems?

In detail:

In order to find out more about this problem, I have added profiling to the ceph code in various place; for write operations to the primary or the secondary, timestamps are recorded for OSD object, offset and length of the such a write request.

Quoted 5 lines

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication operation is acknowledged.

Did you make any code changes? We'd love to see those.

Quoted 12 lines

What I believe is happening: dispatching requests from SimpleMessenger to OSD worker threads seems to consume a fair amount of time. This ends up in a widening gap between subsequent receipts of requests and the start of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating OSD also suffers from the same problem - and hence causes additional delays
at the primary OSD when it waits for the commit from the replicating OSD.

Quoted 6 lines

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading the message header until enqueuing the completely decoded message into the SImpleMessenger dispatch queue.

Could it be that messages were throttled here?
There's a configurable that can be set (ms dispatch throttle bytes), might affect that.

Quoted 23 lines

The green bar represents the time required for local processing, i.e. dispatching the the OSD worker, writing to filesystem and journal, send out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a commit
back to the primary OSD and the original write request can be committed to the client.

The green bar is interrupted by a black bar: the left end represents the time when the request has been enqueued on the OSD worker queue. The right end gives the time when the request is taken off the OSD worker queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write request.

Quoted 7 lines

Note that the dispatching of a later request in all cases relates to the enqueue time at the OSD worker queue of the previous write request: the left
end of a black bar relates nicely to the beginning of a green bar above it.

Thanks,
Yehuda

#3 lore raw

Hi,

please find attached for ceph-0.48argonaut which adds the timestamp code. The only binary which utilizes these timestamps is the ceph-osd daemon.

Timestamps are kept in-memory.
Configuration and extraction of timestamps is
achieved through the "ceph osd tell" interface.

Timestamps are only recorded for objects which match a filtering string.

ceph tell osd.0 code_profile help
profiling data
code_profile operations:
info: get summary info
setfilter <regex>: set filter for object IDs
completed-oids: object IDS for which complete profiling data is available
pending-oids: object IDS for which incomplete profiling data is available get-completed [prefix]: get profiling data for completed objects get-primary-writes [prefix]: get condensed profiling data for primary write operations get-secondary-writes [prefix]: get condensed profiling data for replica write operations get-pending [prefix]: get profiling data for pending operations
clear: free storage of profiled data and clear the object ID filter

In order to collect data for an object in a rados block device, the object ID filter can be set like:

ceph tell osd.0 code_profile setfilter rb.0.0.*

The timestamp code adds it's own logging susbsystem and hence is configurable via ceph.conf, like:

debug ITX = 2

From where a timestamp is recorded is specified in the src/common/ITX.h:enum itx_checkpoint.

Note that the patch reflects a just a snapshot in the current process of anlysis. Example: checkpoints ITX_OSD_DISPATCH4 and ITX_OSD_DISPATCH5 have been used in

OSD::ms_dispatch(Message *m)

just around the call to _dispatch() and show that
the most of the computing time required for dispatching is spent in this routine.

I threrefore don't believe that throttling is causing the delays.

Best Regards

Andreas

Quoted 97 lines · On Thu, 16 Aug 2012 09:44:23 -0700 Yehuda Sadeh <[email protected]> wrote:
Quoted 24 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance problems?

In detail:

In order to find out more about this problem, I have added profiling to the ceph code in various place; for write operations to the primary or the secondary, timestamps are recorded for OSD object, offset and length of the such a write request.

Quoted 5 lines

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication
operation is acknowledged.

Did you make any code changes? We'd love to see those.

Quoted 13 lines

What I believe is happening: dispatching requests from SimpleMessenger to OSD worker threads seems to consume a fair amount of time. This ends up in a widening gap between subsequent receipts of requests and the start of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating OSD also suffers from the same problem - and hence causes additional delays
at the primary OSD when it waits for the commit from the replicating OSD.

Quoted 6 lines

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading the message header until enqueuing the completely decoded message into the SImpleMessenger dispatch queue.

Could it be that messages were throttled here?
There's a configurable that can be set (ms dispatch throttle bytes), might affect that.

Quoted 23 lines

The green bar represents the time required for local processing, i.e. dispatching the the OSD worker, writing to filesystem and journal, send out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a commit
back to the primary OSD and the original write request can be committed to the client.

The green bar is interrupted by a black bar: the left end represents the time when the request has been enqueued on the OSD worker queue. The right end gives the time when the request is taken off the OSD worker queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the graphics: the bar to the bottom of the graphics shows an earlier write request.

Quoted 7 lines

Note that the dispatching of a later request in all cases relates to the enqueue time at the OSD worker queue of the previous write
request: the left
end of a black bar relates nicely to the beginning of a green bar above it.

Thanks,
Yehuda
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
#4 lore raw
In reply to Yehuda Sadeh

Hi,

sorry: forgot the attachment in my previous reply....

Andreas

Quoted 97 lines · On Thu, 16 Aug 2012 09:44:23 -0700 Yehuda Sadeh <[email protected]> wrote:
Quoted 24 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance problems?

In detail:

In order to find out more about this problem, I have added profiling to the ceph code in various place; for write operations to the primary or the secondary, timestamps are recorded for OSD object, offset and length of the such a write request.

Quoted 5 lines

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication
operation is acknowledged.

Did you make any code changes? We'd love to see those.

Quoted 13 lines

What I believe is happening: dispatching requests from SimpleMessenger to OSD worker threads seems to consume a fair amount of time. This ends up in a widening gap between subsequent receipts of requests and the start of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating OSD also suffers from the same problem - and hence causes additional delays
at the primary OSD when it waits for the commit from the replicating OSD.

Quoted 6 lines

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading the message header until enqueuing the completely decoded message into the SImpleMessenger dispatch queue.

Could it be that messages were throttled here?
There's a configurable that can be set (ms dispatch throttle bytes), might affect that.

Quoted 23 lines

The green bar represents the time required for local processing, i.e. dispatching the the OSD worker, writing to filesystem and journal, send out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a commit
back to the primary OSD and the original write request can be committed to the client.

The green bar is interrupted by a black bar: the left end represents the time when the request has been enqueued on the OSD worker queue. The right end gives the time when the request is taken off the OSD worker queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the graphics: the bar to the bottom of the graphics shows an earlier write request.

Quoted 7 lines

Note that the dispatching of a later request in all cases relates to the enqueue time at the OSD worker queue of the previous write
request: the left
end of a black bar relates nicely to the beginning of a green bar above it.

Thanks,
Yehuda
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
BUILD/ceph-0.48/./src/os/JournalingObjectStore.cc +2 -0
@@ -1,3 +1,4 @@
+#include "common/ITX.h"
 
 #include "JournalingObjectStore.h"
 
@@ -286,6 +287,7 @@
   assert(journal_lock.is_locked());
   dout(10) << "op_journal_transactions " << op << " " << tls << dendl;
     
+  itx_profile.write_checkpoint("JournalingObjectStore::_op_journal_transactions: ", ITX_JOURNAL_PROCESS_TRANSACTION_START, op, tls);
   if (journal && journal->is_writeable()) {
     bufferlist tbl;
     unsigned data_len = 0, data_align = 0;
BUILD/ceph-0.48/./src/os/ObjectStore.h +3 -0
@@ -197,6 +197,9 @@
     uint32_t get_data_length() {
       return largest_data_len;
     }
+    uint32_t get_largest_data_off() {
+      return largest_data_off;
+    }
     uint32_t get_data_offset() {
       if (largest_data_off_in_tbl) {
 	return largest_data_off_in_tbl +
BUILD/ceph-0.48/./src/msg/SimpleMessenger.cc +15 -1
@@ -29,6 +29,7 @@
 #include "global/global_init.h"
 
 #include "messages/MGenericMessage.h"
+#include "common/ITX.h"
 
 #include <netdb.h>
 
@@ -307,6 +308,7 @@
       pipe->pipe_lock.Lock();
       list<Message *>& m_queue = pipe->in_q[priority];
       Message *m = m_queue.front();
+      int qlen = m_queue.size();
       m_queue.pop_front();
 
       if (m_queue.empty()) {
@@ -351,7 +353,7 @@
 	  uint64_t msize = m->get_dispatch_throttle_size();
 	  m->set_dispatch_throttle_size(0);  // clear it out, in case we requeue this message.
 
-	  ldout(cct,1) << "<== " << m->get_source_inst()
+	  ldout(cct,1) << "<== " << "[prio: " << priority << ", qsize: " << qlen << "] " << m->get_source_inst()
 		  << " " << m->get_seq()
 		  << " ==== " << *m
 		  << " ==== " << m->get_payload().length() << "+" << m->get_middle().length()
@@ -360,6 +362,7 @@
 		  << " " << m->get_footer().data_crc << ")"
 		  << " " << m << " con " << m->get_connection()
 		  << dendl;
+          itx_profile.write_checkpoint("SimpleMessenger::dispatch_entry", ITX_DISPATCH_OP, m);
 	  ms_deliver_dispatch(m);
 
 	  dispatch_throttle_release(msize);
@@ -555,6 +558,7 @@
     msgr->dispatch_queue.lock.Unlock();
   } else {
     // just queue message under pipe lock.
+    ldout(msgr->cct,1) << "queue_received: queue len: " << queue.size() << ", in_qlen: " << in_qlen+1 << dendl;
     queue.push_back(m);
   }
   
@@ -1639,6 +1643,7 @@
 	       << m->get_seq() << " " << m << " " << *m
 	       << dendl;
       queue_received(m);
+      itx_profile.write_checkpoint("SimpleMessenger::read_message", ITX_MSG_SM_QUEUED, m);
     } 
     
     else if (tag == CEPH_MSGR_TAG_CLOSE) {
@@ -1869,8 +1874,11 @@
   int aborted;
   Message *message;
   utime_t recv_stamp = ceph_clock_now(msgr->cct);
+  utime_t complete_stamp;
+  utime_t decoded_stamp;
   bool waited_on_throttle = false;
 
+
   uint64_t message_size = header.front_len + header.middle_len + header.data_len;
   if (message_size) {
     if (policy.throttler) {
@@ -1985,12 +1993,18 @@
 
   ldout(msgr->cct,20) << "reader got " << front.length() << " + " << middle.length() << " + " << data.length()
 	   << " byte message" << dendl;
+  complete_stamp = ceph_clock_now(msgr->cct);
   message = decode_message(msgr->cct, header, footer, front, middle, data);
+  decoded_stamp = ceph_clock_now(msgr->cct);
   if (!message) {
     ret = -EINVAL;
     goto out_dethrottle;
   }
 
+ itx_profile.write_checkpoint("SimpleMessenger::read_message", ITX_RECEIVED, message, recv_stamp);
+ itx_profile.write_checkpoint("SimpleMessenger::read_message", ITX_MSG_COMPLETE, message, complete_stamp, data_len);
+ itx_profile.write_checkpoint("SimpleMessenger::read_message", ITX_MSG_DECODED, message, decoded_stamp);
+
   message->set_throttler(policy.throttler);
 
   // store reservation size in message, so we don't get confused
BUILD/ceph-0.48/./src/os/FileStore.cc +12 -0
@@ -48,6 +48,8 @@
 #include <fstream>
 #include <sstream>
 
+#include "common/ITX.h"
+
 #include "FileStore.h"
 #include "common/BackTrace.h"
 #include "include/types.h"
@@ -2143,6 +2145,7 @@
 
   op_tp.unlock();
 
+  itx_profile.write_checkpoint("FileStore::queue_op:", ITX_FS_QUEUE_OP, o->op, o->tls);
   dout(5) << "queue_op " << o << " seq " << o->op
 	  << " " << *osr
 	  << " " << o->bytes << " bytes"
@@ -2205,7 +2208,11 @@
   Op *o = osr->peek_queue();
 
   dout(5) << "_do_op " << o << " seq " << o->op << " " << *osr << "/" << osr->parent << " start" << dendl;
+
+  itx_profile.write_checkpoint("_do_op: do_transactions begin :", ITX_FS_PROCESS_TRANSACTION_START, o->op, o->tls);
   int r = do_transactions(o->tls, o->op);
+  itx_profile.write_checkpoint("_do_op: do_transactions end:", ITX_FS_PROCESS_TRANSACTION_DONE, o->op, o->tls);
+
   op_apply_finish(o->op);
   dout(10) << "_do_op " << o << " seq " << o->op << " r = " << r
 	   << ", finisher " << o->onreadable << " " << o->onreadable_sync << dendl;
@@ -2292,6 +2299,7 @@
       dump_transactions(o->tls, o->op, osr);
 
     if (m_filestore_journal_parallel) {
+      itx_profile.write_checkpoint("FileStore::parallel: queue_transactions start", ITX_QUEUE_TRANSACTION_START, o->op, o->tls);
       dout(5) << "queue_transactions (parallel) " << o->op << " " << o->tls << dendl;
       
       _op_journal_transactions(o->tls, o->op, ondisk, osd_op);
@@ -2299,6 +2307,7 @@
       // queue inside journal lock, to preserve ordering
       queue_op(osr, o);
     } else if (m_filestore_journal_writeahead) {
+      itx_profile.write_checkpoint("FileStore::writeahead: queue_transactions start", ITX_QUEUE_TRANSACTION_START, o->op, o->tls);
       dout(5) << "queue_transactions (writeahead) " << o->op << " " << o->tls << dendl;
       
       osr->queue_journal(o->op);
@@ -2310,11 +2319,13 @@
       assert(0);
     }
     op_submit_finish(o->op);
+    itx_profile.write_checkpoint("FileStore::queue_transactions done", ITX_QUEUE_TRANSACTION_END, o->op);
     return 0;
   }
 
   uint64_t op = op_submit_start();
   dout(5) << "queue_transactions (trailing journal) " << op << " " << tls << dendl;
+  itx_profile.write_checkpoint("FileStore::trailing: queue_transactions start", ITX_QUEUE_TRANSACTION_START, op, tls);
 
   if (m_filestore_do_dump)
     dump_transactions(tls, op, osr);
@@ -3185,6 +3196,7 @@
   }
 
  out:
+  itx_profile.write_checkpoint("FileStore::_write done writing to filesystem", ITX_FS_WRITE_DONE, cid, oid, offset, len);
   dout(10) << "write " << cid << "/" << oid << " " << offset << "~" << len << " = " << r << dendl;
   return r;
 }
BUILD/ceph-0.48/./src/osd/ReplicatedPG.cc +26 -2
@@ -39,6 +39,7 @@
 #include "mds/inode_backtrace.h" // Ugh
 
 #include "common/config.h"
+#include "common/ITX.h"
 #include "include/compat.h"
 
 #include "json_spirit/json_spirit_value.h"
@@ -549,6 +550,8 @@
 				       CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK); 
   reply->set_data(outdata);
   reply->set_result(result);
+  itx_profile.write_checkpoint("ReplicatedPG::do_pg_op: commit", ITX_PG_OP_COMMIT, m);
+  itx_profile.write_checkpoint("ReplicatedPG::do_pg_op: commit", ITX_OP_FINISHED, m);
   osd->client_messenger->send_message(reply, m->get_connection());
   delete filter;
 }
@@ -950,6 +953,8 @@
     reply->set_version(info.last_update);
     ctx->reply = NULL;
     reply->add_flags(CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK);
+    itx_profile.write_checkpoint("ReplicatedPG::do_op: commit read", ITX_OP_READ_COMMIT, m);
+    itx_profile.write_checkpoint("ReplicatedPG::do_op: commit read", ITX_OP_FINISHED, m);
     osd->client_messenger->send_message(reply, m->get_connection());
     delete ctx;
     put_object_context(obc);
@@ -3379,6 +3384,10 @@
   repop->applying = false;
   repop->applied = true;
 
+  if (repop->ctx->op) {
+    itx_profile.write_checkpoint("ReplicatedPG::op_applied: ", ITX_PG_OP_LOCAL_APPLIED, repop->ctx->op->request);
+  }
+
   // (logical) local ack.
   int whoami = osd->get_nodeid();
 
@@ -3430,6 +3439,9 @@
   if (repop->ctx->op)
     repop->ctx->op->mark_event("op_commit");
 
+  if (repop->ctx->op) {
+    itx_profile.write_checkpoint("ReplicatedPG::op_commit: ", ITX_PG_OP_LOCAL_COMMIT, repop->ctx->op->request);
+  }
   if (repop->aborted) {
     dout(10) << "op_commit " << *repop << " -- aborted" << dendl;
   } else if (repop->waitfor_disk.count(osd->get_nodeid()) == 0) {
@@ -3508,6 +3520,7 @@
 	reply->add_flags(CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK);
 	dout(10) << " sending commit on " << *repop << " " << reply << dendl;
 	assert(entity_name_t::TYPE_OSD != m->get_connection()->peer_type);
+        itx_profile.write_checkpoint("ReplicatedPG::eval_repop: commit", ITX_OP_COMMIT, m);
 	osd->client_messenger->send_message(reply, m->get_connection());
 	repop->sent_disk = true;
       }
@@ -3525,6 +3538,7 @@
 	reply->add_flags(CEPH_OSD_FLAG_ACK);
 	dout(10) << " sending ack on " << *repop << " " << reply << dendl;
         assert(entity_name_t::TYPE_OSD != m->get_connection()->peer_type);
+        itx_profile.write_checkpoint("ReplicatedPG::eval_repop: ack", ITX_OP_ACK, m);
 	osd->client_messenger->send_message(reply, m->get_connection());
 	repop->sent_ack = true;
       }
@@ -3541,7 +3555,9 @@
   // done.
   if (repop->waitfor_ack.empty() && repop->waitfor_disk.empty()) {
     repop->done = true;
-
+    if (m) {
+      itx_profile.write_checkpoint("ReplicatedPG::eval_repop: ack", ITX_OP_FINISHED, m);
+    }
     calc_min_last_complete_ondisk();
 
     // kick snap_trimmer if necessary
@@ -3626,6 +3642,9 @@
     }
     
     wr->pg_trim_to = pg_trim_to;
+    if ((i == 1) && (ctx->op) && (ctx->op->request)) {
+      itx_profile.write_checkpoint("ReplicatedPG::issue_repop", ITX_PG_SEND_REPOP, ctx->op->request);
+    }
     osd->cluster_messenger->send_message(wr, get_osdmap()->get_cluster_inst(peer));
 
     // keep peer_info up to date
@@ -4162,7 +4181,7 @@
   else
     opname = "trans";
 
-  dout(10) << "sub_op_modify " << opname 
+  dout(10) << "sub_op_modify " << opname
            << " " << soid 
            << " v " << m->version
 	   << (m->noop ? " NOOP" : "")
@@ -4249,6 +4268,7 @@
 
     rm->bytes_written = rm->opt.get_encoded_bytes();
 
+
   } else {
     // just trim the log
     if (m->pg_trim_to != eversion_t()) {
@@ -4279,6 +4299,7 @@
     // send ack to acker only if we haven't sent a commit already
     MOSDSubOpReply *ack = new MOSDSubOpReply(m, 0, get_osdmap()->get_epoch(), CEPH_OSD_FLAG_ACK);
     ack->set_priority(CEPH_MSG_PRIO_HIGH); // this better match commit priority!
+    itx_profile.write_checkpoint("ReplicatedPG::sub_op_modify_applied: ACK", ITX_SUBOP_ACK, rm->opt);
     osd->cluster_messenger->send_message(ack, get_osdmap()->get_cluster_inst(rm->ackerosd));
   }
 
@@ -4298,6 +4319,7 @@
 
   unlock();
   if (done) {
+	itx_profile.write_checkpoint("ReplicatedPG::sub_op_modify_commit", ITX_OP_FINISHED, rm->opt);
     delete rm->ctx;
     delete rm;
     put();
@@ -4321,6 +4343,7 @@
     MOSDSubOpReply *commit = new MOSDSubOpReply((MOSDSubOp*)rm->op->request, 0, get_osdmap()->get_epoch(), CEPH_OSD_FLAG_ONDISK);
     commit->set_last_complete_ondisk(rm->last_complete);
     commit->set_priority(CEPH_MSG_PRIO_HIGH); // this better match ack priority!
+    itx_profile.write_checkpoint("ReplicatedPG::sub_op_modify_commit: ONDISK", ITX_SUBOP_COMMIT, rm->opt);
     osd->cluster_messenger->send_message(commit, get_osdmap()->get_cluster_inst(rm->ackerosd));
   }
   
@@ -4329,6 +4352,7 @@
 
   unlock();
   if (done) {
+	itx_profile.write_checkpoint("ReplicatedPG::sub_op_modify_commit", ITX_OP_FINISHED, rm->opt);
     delete rm->ctx;
     delete rm;
     put();
BUILD/ceph-0.48/./src/osd/OSD.cc +16 -0
@@ -92,6 +92,7 @@
 #include "common/safe_io.h"
 #include "common/HeartbeatMap.h"
 #include "common/admin_socket.h"
+#include "common/ITX.h"
 
 #include "global/signal_handler.h"
 #include "global/pidfile.h"
@@ -2529,6 +2530,11 @@
     ss << "reset pg recovery stats";
     pg_recovery_stats.reset();
   }
+  else if (cmd[0] == "code_profile") {
+    stringstream s;
+    itx_profile.cmd_handler(cmd, s);
+    ss << " profiling data" << s.str();
+  }
 
   else {
     ss << "unrecognized command! " << cmd;
@@ -2700,16 +2706,22 @@
 bool OSD::ms_dispatch(Message *m)
 {
   // lock!
+  itx_profile.write_checkpoint("OSD::ms_dispatch", ITX_OSD_DISPATCH1, m);
   osd_lock.Lock();
+  itx_profile.write_checkpoint("OSD::ms_dispatch", ITX_OSD_DISPATCH2, m);
   while (dispatch_running) {
     dout(10) << "ms_dispatch waiting for other dispatch thread to complete" << dendl;
     dispatch_cond.Wait(osd_lock);
   }
   dispatch_running = true;
 
+  itx_profile.write_checkpoint("OSD::ms_dispatch", ITX_OSD_DISPATCH3, m);
   do_waiters();
+  itx_profile.write_checkpoint("OSD::ms_dispatch", ITX_OSD_DISPATCH4, m);
   _dispatch(m);
+  itx_profile.write_checkpoint("OSD::ms_dispatch", ITX_OSD_DISPATCH5, m);
   do_waiters();
+  itx_profile.write_checkpoint("OSD::ms_dispatch", ITX_OSD_DISPATCH6, m);
 
   dispatch_running = false;
   dispatch_cond.Signal();
@@ -5265,7 +5277,9 @@
   }
 
   // we don't need encoded payload anymore
+  itx_profile.write_checkpoint("OSD::handle_op: clear start", ITX_OSD_HANDLE_OP_CLEAR_START, m);
   m->clear_payload();
+  itx_profile.write_checkpoint("OSD::handle_op: clear done", ITX_OSD_HANDLE_OP_CLEAR_DONE, m);
 
   // require same or newer map
   if (!require_same_or_newer_map(op, m->get_map_epoch()))
@@ -5573,6 +5587,7 @@
   dout(15) << *pg << " enqueue_op " << op->request << " "
            << *(op->request) << dendl;
   assert(pg->is_locked());
+  itx_profile.write_checkpoint("OSD::enqueue_op", ITX_OSD_ENQUEUE, pg, op->request);
 
   switch (op->request->get_type()) {
   case CEPH_MSG_OSD_OP:
@@ -5682,6 +5697,7 @@
     pg->op_queue.pop_front();
     
     dout(10) << "dequeue_op " << *op->request << " pg " << *pg << dendl;
+    itx_profile.write_checkpoint("OSD::dequeue_op", ITX_OSD_DEQUEUE, pg, op->request);
 
     // share map?
     //  do this preemptively while we hold osd_lock and pg->lock
BUILD/ceph-0.48/./src/Makefile.am +9 -1
@@ -970,7 +970,7 @@
 libcommon_la_SOURCES = $(libcommon_files)
 libcommon_la_CFLAGS= ${CRYPTO_CFLAGS} ${AM_CFLAGS}
 libcommon_la_CXXFLAGS= ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
-libcommon_la_LDFLAGS = -lrt
+libcommon_la_LDFLAGS = -lrt -lboost_regex
 noinst_LTLIBRARIES += libcommon.la
 
 libglobal_la_SOURCES = \
@@ -1041,6 +1041,7 @@
 	msg/Message.cc \
 	msg/Messenger.cc \
 	msg/SimpleMessenger.cc \
+	common/ITX.cc \
 	msg/msg_types.cc \
 	msg/tcp.cc \
 	os/hobject.cc \
@@ -1106,6 +1107,12 @@
 libmon_a_CXXFLAGS= ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
 noinst_LIBRARIES += libmon.a
 
+libITX_la_SOURCES = \
+	common/ITX.cc
+libITX_la_CXXFLAGS= ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
+libITX_la_LIBADD =
+noinst_LTLIBRARIES += libITX.la
+
 libmds_a_SOURCES = \
 	mds/Dumper.cc \
 	mds/Resetter.cc \
@@ -1553,6 +1560,7 @@
         msg/Message.h\
         msg/Messenger.h\
         msg/SimpleMessenger.h\
+        common/ITX.h\
         msg/msg_types.h\
         msg/tcp.h\
 	objclass/objclass.h\
BUILD/ceph-0.48/./src/common/ITX.cc +1074 -0

1,074 lines not on this page · raw message

BUILD/ceph-0.48/./src/common/ITX.h +423 -0

423 lines not on this page · raw message

BUILD/ceph-0.48/./src/common/config_opts.h +1 -0
@@ -68,6 +68,7 @@
 SUBSYS(optracker, 0, 5)
 SUBSYS(objclass, 0, 5)
 SUBSYS(filestore, 1, 5)
+SUBSYS(ITX, 1, 5)
 SUBSYS(journal, 1, 5)
 SUBSYS(ms, 0, 5)
 SUBSYS(mon, 1, 5)
#5 lore raw
In reply to Yehuda Sadeh

Hi Yehuda,

I don't think throttling is the issue here.
The default thottle count is 100 MByte (100 << 20), it I read the source correctly.

My simple sequential write writes 40 MBytes in total.
Spread over 4 OSDs with 2 replicas this should amount to roughly 20 MBytes per OSD.

Also I encounter the described behaviour already at the very beginning of the test.

Currently I am trying to use perf (as Sage suggested). However, this is causing some funny effect, too: I run

perf record -g -- /usr/bin/ceph-osd -f -i 2 --pid-file
/var/run/ceph/osd.2.pid -c /tmp/ceph.conf.7278

on one the OSDs (osd.2). When I start the test, then the client system panics within the kernel client - but the client is on a physically different system than osd.2.

[  405.139931] Call Trace:
[  405.145497]  [<ffffffffa05be3c3>] __send_request+0xb3/0x100 [libceph]
[  405.159848]  [<ffffffffa05be463>] send_queued+0x53/0x90 [libceph]
[  405.173429]  [<ffffffffa05c0730>] ceph_osdc_handle_map+0x290/0x530 [libceph]
[  405.189133]  [<ffffffffa05bcdef>] dispatch+0xdf/0x120 [libceph]
[  405.202332]  [<ffffffffa05b6fd9>] process_message+0x89/0x1a0 [libceph]
[  405.216886]  [<ffffffffa05b9d68>] try_read+0x478/0x680 [libceph]
[  405.230273]  [<ffffffffa05bab1e>] con_work+0x6e/0x240 [libceph]
[  405.244876]  [<ffffffff81073f2c>] process_one_work+0x16c/0x350
[  405.257897]  [<ffffffff81076aba>] worker_thread+0x17a/0x410
[  405.270346]  [<ffffffff8107ade6>] kthread+0x96/0xa0
[  405.281248]  [<ffffffff8144a4c4>] kernel_thread_helper+0x4/0x10
[  405.295035] DWARF2 unwinder stuck at kernel_thread_helper+0x4/0x10

I don't see this panic when I start the osd without perf. This looks as if perf affects the osd performance such that this causes some different code on the client side to be executed.

The kernel modules on the client side report:
CIBDB1:~ # modinfo ceph

filename:       /lib/modules/3.0.34-0.7-default/weak-updates/updates/ceph-kmp/fs/ceph/ceph.ko
license:        GPL
description:    Ceph filesystem for Linux
author:         Patience Warnick <[email protected]>
author:         Yehuda Sadeh <[email protected]>
author:         Sage Weil <[email protected]>
srcversion:     104662BE3ADB1ED236E1E83
depends:        libceph
supported:      yes
vermagic:       3.0.13-0.27-default SMP mod_unload modversions
CIBDB1:~ # modinfo rbd
filename:       /lib/modules/3.0.34-0.7-default/weak-updates/updates/ceph-kmp/rbd.ko
license:        GPL
author:         Jeff Garzik <[email protected]>
description:    rados block device
author:         Yehuda Sadeh <[email protected]>
author:         Sage Weil <[email protected]>
srcversion:     0A1B0E7CE75C7F733B74137
depends:        libceph
supported:      yes
vermagic:       3.0.13-0.27-default SMP mod_unload modversions
CIBDB1:~ # modinfo libceph
filename:       /lib/modules/3.0.34-0.7-default/weak-updates/updates/ceph-kmp/net/ceph/libceph.ko
license:        GPL
description:    Ceph filesystem for Linux
author:         Patience Warnick <[email protected]>
author:         Yehuda Sadeh <[email protected]>
author:         Sage Weil <[email protected]>
srcversion:     B31E02E58425C6E7487CA22
depends:        libcrc32c
supported:      yes
vermagic:       3.0.13-0.27-default SMP mod_unload modversions

Best Regards

Andreas

Quoted 100 lines · Yehuda Sadeh
Quoted 23 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance problems?

In detail:

In order to find out more about this problem, I have added profiling to the ceph code in various place; for write operations to the primary or the secondary, timestamps are recorded for OSD object, offset and length of the such a write request.

Quoted 6 lines

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication operation is acknowledged.

Did you make any code changes? We'd love to see those.

Quoted 11 lines

What I believe is happening: dispatching requests from SimpleMessenger to OSD worker threads seems to consume a fair amount of time. This ends up in a widening gap between subsequent receipts of requests and the start of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating OSD also suffers from the same problem - and hence causes additional delays
at the primary OSD when it waits for the commit from the replicating OSD.

Quoted 7 lines

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading the message header until enqueuing the completely decoded message into the SImpleMessenger dispatch queue.

Could it be that messages were throttled here?
There's a configurable that can be set (ms dispatch throttle bytes), might affect that.

Quoted 22 lines

The green bar represents the time required for local processing, i.e. dispatching the the OSD worker, writing to filesystem and journal, send out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a commit
back to the primary OSD and the original write request can be committed to the client.

The green bar is interrupted by a black bar: the left end represents the time when the request has been enqueued on the OSD worker queue. The right end gives the time when the request is taken off the OSD worker queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write request.

Quoted 8 lines

Note that the dispatching of a later request in all cases relates to the enqueue time at the OSD worker queue of the previous write request: the left
end of a black bar relates nicely to the beginning of a green bar above it.

Thanks,
Yehuda
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
#6 lore raw
In reply to Andreas Bluemle

Hi Andreas,

Quoted 7 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

Quoted 7 lines

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance problems?

There is a single 'dispatch' thread that's processing this queue, and conveniently perf lets you break down its profiling data on a per-thread basis. Once you've ruled out the throttler as the culprit, you might try running the daemon with 'perf record -g -- ceph-osd ...' and then look specifically at where that thread is spending its time. We shouldn't be burning that much CPU just doing the sanity checks and then handing requests off to PGs...

sage

Quoted 68 lines

In detail:

In order to find out more about this problem, I have added profiling to the ceph code in various place; for write operations to the primary or the secondary, timestamps are recorded for OSD object, offset and length of the such a write request.

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication operation is acknowledged.

What I believe is happening: dispatching requests from SimpleMessenger to OSD worker threads seems to consume a fair amount of time. This ends up in a widening gap between subsequent receipts of requests and the start of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating OSD also suffers from the same problem - and hence causes additional delays at the primary OSD when it waits for the commit from the replicating OSD.

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading the message header until enqueuing the completely decoded message into the SImpleMessenger dispatch queue.

The green bar represents the time required for local processing, i.e. dispatching the the OSD worker, writing to filesystem and journal, send out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a commit back to the primary OSD and the original write request can be committed to the client.

The green bar is interrupted by a black bar: the left end represents the time when the request has been enqueued on the OSD worker queue. The right end gives the time when the request is taken off the OSD worker queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write request.

Note that the dispatching of a later request in all cases relates to the enqueue time at the OSD worker queue of the previous write request: the left end of a black bar relates nicely to the beginning of a green bar above it.

Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
#7 lore raw

Hi Sage,

Quoted 16 lines · Sage Weil

Hi Andreas,

Quoted 12 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Quoted 10 lines
Quoted 3 lines

Question: is it possible that this dispatching is causing performance problems?

There is a single 'dispatch' thread that's processing this queue, and conveniently perf lets you break down its profiling data on a per-thread basis. Once you've ruled out the throttler as the culprit, you might try running the daemon with 'perf record -g -- ceph-osd ...' and then look specifically at where that thread is spending its time. We shouldn't be burning that much CPU just doing the sanity checks and then handing requests off to PGs...

sage

The effect, which I am seeing, may be related to some locking issue. As I read the code, there are multiple dispatchers running: one per SimpleMessenger.

On a typical OSD node, there is

- the instance of the SimpleMessenger processing input from the client (primary writes)
- other instances of SimpleMessenger, which process input from neighbor OSD nodes

the latter generate replication writes to the OSD I am looking at.

On the other hand, there is a single instance of the OSD object within the ceph-osd daemon. When dispatching messages to the OSD, then the OSD::osd_lock is held for the complete process of dispatching; see code below.

When the write load increases, then multiple SimpleMessenger instances start to congest on the OSD::osd_lock.
And this may cause delays in the individual dispatch process.

bool OSD::ms_dispatch(Message *m)
{
// lock!
osd_lock.Lock();

while (dispatch_running) {
dout(10) << "ms_dispatch waiting for other dispatch thread to complete" << dendl; dispatch_cond.Wait(osd_lock);
}
dispatch_running = true;

do_waiters();
_dispatch(m);
do_waiters();

dispatch_running = false;
dispatch_cond.Signal();

osd_lock.Unlock();
return true;
}

Quoted 70 lines
Quoted 67 lines

In detail:

In order to find out more about this problem, I have added profiling to the ceph code in various place; for write operations to the primary or the secondary, timestamps are recorded for OSD object, offset and length of the such a write request.

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication operation is acknowledged.

What I believe is happening: dispatching requests from SimpleMessenger to OSD worker threads seems to consume a fair amount of time. This ends up in a widening gap between subsequent receipts of requests and the start of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating OSD also suffers from the same problem - and hence causes additional delays at the primary OSD when it waits for the commit from the replicating OSD.

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading the message header until enqueuing the completely decoded message into the SImpleMessenger dispatch queue.

The green bar represents the time required for local processing, i.e. dispatching the the OSD worker, writing to filesystem and journal, send out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a commit back to the primary OSD and the original write request can be committed to the client.

The green bar is interrupted by a black bar: the left end represents the time when the request has been enqueued on the OSD worker queue. The right end gives the time when the request is taken off the OSD worker queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write request.

Note that the dispatching of a later request in all cases relates to the enqueue time at the OSD worker queue of the previous write request: the left end of a black bar relates nicely to the beginning of a green bar above it.

Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
#8 lore raw
Quoted 54 lines · Andreas Bluemle

Hi Sage,

Quoted 28 lines · Sage Weil

Hi Andreas,

Quoted 7 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

Quoted 8 lines

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance problems?

There is a single 'dispatch' thread that's processing this queue, and conveniently perf lets you break down its profiling data on a per-thread basis. Once you've ruled out the throttler as the culprit, you might try running the daemon with 'perf record -g -- ceph-osd ...' and then look specifically at where that thread is spending its time. We shouldn't be burning that much CPU just doing the sanity checks and then handing requests off to PGs...

Quoted 3 lines

sage

The effect, which I am seeing, may be related to some locking issue. As I read the code, there are multiple dispatchers running: one per SimpleMessenger.

On a typical OSD node, there is

- the instance of the SimpleMessenger processing input from the client (primary writes)
- other instances of SimpleMessenger, which process input from neighbor OSD nodes

the latter generate replication writes to the OSD I am looking at.

On the other hand, there is a single instance of the OSD object within the ceph-osd daemon.
When dispatching messages to the OSD, then the OSD::osd_lock is held for the complete
process of dispatching; see code below.

Quoted 4 lines

When the write load increases, then multiple SimpleMessenger instances start to
congest on the OSD::osd_lock.
And this may cause delays in the individual dispatch process.

This is definitely possible, yes, although it would surprise me if it's happening here (unless your workload is all small writes). Just to confirm, are you actually observing osd_lock contention, or speculating about what is causing the delays you're seeing?

I'm not sure what the best tool is to measure lock contention. Mark was playing with a 'poor man's wall clock profiler' using stack trace sampling from gdb. That would tell us whether threads were really blocking while obtaining the osd_lock...

Can you tell us a bit more about what your workload is?

sage

Quoted 116 lines

bool OSD::ms_dispatch(Message *m)
{
// lock!
osd_lock.Lock();

while (dispatch_running) {
dout(10) << "ms_dispatch waiting for other dispatch thread to complete" << dendl;
dispatch_cond.Wait(osd_lock);
}
dispatch_running = true;

do_waiters();
_dispatch(m);
do_waiters();

dispatch_running = false;
dispatch_cond.Signal();

osd_lock.Unlock();
return true;
}

Quoted 74 lines
Quoted 71 lines

In detail:

In order to find out more about this problem, I have added profiling to the ceph code in various place; for write operations to the primary or the secondary, timestamps are recorded for OSD object, offset and length of the such a write request.

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication operation is acknowledged.

What I believe is happening: dispatching requests from SimpleMessenger to OSD worker threads seems to consume a fair amount of time. This ends up in a widening gap between subsequent receipts of requests and the start of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating OSD also suffers from the same problem - and hence causes additional delays
at the primary OSD when it waits for the commit from the replicating OSD.

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading the message header until enqueuing the completely decoded message into the SImpleMessenger dispatch queue.

The green bar represents the time required for local processing, i.e. dispatching the the OSD worker, writing to filesystem and journal, send out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a commit
back to the primary OSD and the original write request can be committed to the client.

The green bar is interrupted by a black bar: the left end represents the time when the request has been enqueued on the OSD worker queue. The right end gives the time when the request is taken off the OSD worker queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write request.

Note that the dispatching of a later request in all cases relates to the enqueue time at the OSD worker queue of the previous write request: the left
end of a black bar relates nicely to the beginning of a green bar above it.

Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
Signature · 11 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw

Hi Sage,

as mentioned, the workload is a single sequential write on the client. The write is not O_DIRECT; and consequently the messages arrive at the OSD with 124 KByte per write request.

The attached pdf shows a timing diagram of two concurrent write operations (one primary and one replication / secondary).

The time spent on the primary write to get the OSD.:osd_lock releates nicely with the time when this lock is released by the secondary write.

Hope this helps

Andreas

Quoted 193 lines · Sage Weil
Quoted 57 lines · Andreas Bluemle

Hi Sage,

Quoted 29 lines · Sage Weil

Hi Andreas,

Quoted 7 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

Quoted 9 lines

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance problems?

There is a single 'dispatch' thread that's processing this queue, and conveniently perf lets you break down its profiling data on a per-thread basis. Once you've ruled out the throttler as the culprit, you might try running the daemon with 'perf record -g -- ceph-osd ...' and then look specifically at where that thread is spending its time. We shouldn't be burning that much CPU just doing the sanity checks and then handing requests off to PGs...

Quoted 4 lines

sage

The effect, which I am seeing, may be related to some locking issue. As I read the code, there are multiple dispatchers running: one per SimpleMessenger.

On a typical OSD node, there is

- the instance of the SimpleMessenger processing input from the client (primary writes)
- other instances of SimpleMessenger, which process input from neighbor OSD nodes

the latter generate replication writes to the OSD I am looking at.

On the other hand, there is a single instance of the OSD object within the ceph-osd daemon.
When dispatching messages to the OSD, then the OSD::osd_lock is held for the complete
process of dispatching; see code below.

Quoted 5 lines

When the write load increases, then multiple SimpleMessenger instances start to
congest on the OSD::osd_lock.
And this may cause delays in the individual dispatch process.

This is definitely possible, yes, although it would surprise me if it's happening here (unless your workload is all small writes). Just to confirm, are you actually observing osd_lock contention, or speculating about what is causing the delays you're seeing?

I'm not sure what the best tool is to measure lock contention. Mark was playing with a 'poor man's wall clock profiler' using stack trace sampling from gdb. That would tell us whether threads were really blocking while obtaining the osd_lock...

Can you tell us a bit more about what your workload is?

sage

Quoted 114 lines

bool OSD::ms_dispatch(Message *m)
{
// lock!
osd_lock.Lock();

while (dispatch_running) {
dout(10) << "ms_dispatch waiting for other dispatch thread to complete" << dendl;
dispatch_cond.Wait(osd_lock);
}
dispatch_running = true;

do_waiters();
_dispatch(m);
do_waiters();

dispatch_running = false;
dispatch_cond.Signal();

osd_lock.Unlock();
return true;
}

Quoted 74 lines
Quoted 72 lines

In detail:

In order to find out more about this problem, I have added profiling to the ceph code in various place; for write operations to the primary or the secondary, timestamps are recorded for OSD object, offset and length of the such a write request.

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication operation is acknowledged.

What I believe is happening: dispatching requests from SimpleMessenger to OSD worker threads seems to consume a fair amount of time. This ends up in a widening gap between subsequent receipts of requests and the start of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating OSD also suffers from the same problem - and hence causes additional delays
at the primary OSD when it waits for the commit from the replicating OSD.

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading the message header until enqueuing the completely decoded message into the SImpleMessenger dispatch queue.

The green bar represents the time required for local processing, i.e. dispatching the the OSD worker, writing to filesystem and journal, send out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a commit
back to the primary OSD and the original write request can be committed to the client.

The green bar is interrupted by a black bar: the left end represents the time when the request has been enqueued on the OSD worker queue. The right end gives the time when the request is taken off the OSD worker queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write request.

Note that the dispatching of a later request in all cases relates to the enqueue time at the OSD worker queue of the previous write request: the left
end of a black bar relates nicely to the beginning of a green bar above it.

Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
Signature · 11 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
#10 lore raw

Hi Andreas,

Most of the performance work that Sam, Mike, and I have been doing over the past week has been looking directly at the filestore. I actually haven't done any wallclock profiling with the messenger yet.

So just to make sure I've got a good idea of what you are doing / seeing:

- 4 OSD cluster with 2 replicas, kernel client.
- client is issuing 40MB worth of single sequential 128k buffered writes.
- Contention seems to appear immediately and only grows as the test runs.

Out of curiosity, have you tried your test with replication set to 1? It would be good to just do a quick sanity check to make sure this eliminates the problem if it's contention between primary/secondary simplemessenger instances.

Mark

Quoted 226 lines · Andreas Bluemle

Hi Sage,

as mentioned, the workload is a single sequential write on the client. The write is not O_DIRECT; and consequently the messages arrive at the OSD with 124 KByte per write request.

The attached pdf shows a timing diagram of two concurrent write operations (one primary and one replication / secondary).

The time spent on the primary write to get the OSD.:osd_lock releates nicely with the time when this lock is released by the secondary write.

Hope this helps

Andreas

Quoted 203 lines · Sage Weil
Quoted 56 lines · Andreas Bluemle

Hi Sage,

Quoted 28 lines · Sage Weil

Hi Andreas,

Quoted 7 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

Quoted 7 lines

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance problems?

There is a single 'dispatch' thread that's processing this queue, and conveniently perf lets you break down its profiling data on a per-thread
basis. Once you've ruled out the throttler as the culprit, you might try
running the daemon with 'perf record -g -- ceph-osd ...' and then look specifically at where that thread is spending its time. We shouldn't be burning that much CPU just doing the sanity checks and then handing requests
off to PGs...

Quoted 3 lines

sage

The effect, which I am seeing, may be related to some locking issue. As I read the code, there are multiple dispatchers running: one per SimpleMessenger.

On a typical OSD node, there is

- the instance of the SimpleMessenger processing input from the client (primary writes)
- other instances of SimpleMessenger, which process input from neighbor OSD
nodes

the latter generate replication writes to the OSD I am looking at.

On the other hand, there is a single instance of the OSD object within the
ceph-osd daemon.
When dispatching messages to the OSD, then the OSD::osd_lock is held for the
complete
process of dispatching; see code below.

Quoted 5 lines

When the write load increases, then multiple SimpleMessenger instances start
to
congest on the OSD::osd_lock.
And this may cause delays in the individual dispatch process.

This is definitely possible, yes, although it would surprise me if it's happening here (unless your workload is all small writes). Just to confirm, are you actually observing osd_lock contention, or speculating about what is causing the delays you're seeing?

I'm not sure what the best tool is to measure lock contention. Mark was playing with a 'poor man's wall clock profiler' using stack trace sampling from gdb. That would tell us whether threads were really blocking while obtaining the osd_lock...

Can you tell us a bit more about what your workload is?

sage

Quoted 122 lines

bool OSD::ms_dispatch(Message *m)
{
// lock!
osd_lock.Lock();

while (dispatch_running) {
dout(10) << "ms_dispatch waiting for other dispatch thread to complete" <<
dendl;
dispatch_cond.Wait(osd_lock);
}
dispatch_running = true;

do_waiters();
_dispatch(m);
do_waiters();

dispatch_running = false;
dispatch_cond.Signal();

osd_lock.Unlock();
return true;
}

Quoted 80 lines
Quoted 80 lines

In detail:

In order to find out more about this problem, I have added profiling to
the ceph code in various place; for write operations to the primary or the
secondary, timestamps are recorded for OSD object, offset and length of
the such a write request.

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication operation is acknowledged.

What I believe is happening: dispatching requests from SimpleMessenger to
OSD worker threads seems to consume a fair amount of time. This ends up in a widening gap between subsequent receipts of requests and the start
of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating
OSD also suffers from the same problem - and hence causes additional delays
at the primary OSD when it waits for the commit from the replicating OSD.

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading the message header until enqueuing the completely decoded message into the SImpleMessenger dispatch queue.

The green bar represents the time required for local processing, i.e. dispatching the the OSD worker, writing to filesystem and journal, send
out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a commit
back to the primary OSD and the original write request can be committed to
the client.

The green bar is interrupted by a black bar: the left end represents the time when the request has been enqueued on the OSD worker queue. The
right end gives the time when the request is taken off the OSD worker queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write request.

Note that the dispatching of a later request in all cases relates to the
enqueue time at the OSD worker queue of the previous write request:
the
left
end of a black bar relates nicely to the beginning of a green bar above
it.

--
Andreas Bluemle mailto:[email protected] ITXperts GmbH http://www.itxperts.de
Balanstrasse 73, Geb. 08 Phone: (+49) 89 89044917 D-81541 Muenchen (Germany) Fax: (+49) 89 89044910

Quoted 3 lines
Quoted 3 lines

Company details: http://www.itxperts.de/imprint.htm

--
Andreas Bluemle mailto:[email protected] ITXperts GmbH http://www.itxperts.de
Balanstrasse 73, Geb. 08 Phone: (+49) 89 89044917 D-81541 Muenchen (Germany) Fax: (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw
In reply to Andreas Bluemle
Quoted 6 lines · Andreas Bluemle

Hi Sage,

as mentioned, the workload is a single sequential write on the client. The write is not O_DIRECT; and consequently the messages arrive at the OSD with 124 KByte per write request.

Quoted 6 lines

The attached pdf shows a timing diagram of two concurrent write operations (one primary and one replication / secondary).

The time spent on the primary write to get the OSD.:osd_lock releates nicely with the time when this lock is released by the secondary write.

Ah, I see.

There isn't a trivial way to pull osd_lock out of the picture; there are several data structures it's protecting (pg_map, osdmaps, peer epoch map, etc.). Before we try going down that road, I suspect it might be more fruitful to see where cpu time is being spent while osd_lock is held.

How much of an issue does it look like this specific contention is for you? Does it go away with larger writes?

sage

Quoted 232 lines

Hope this helps

Andreas

Quoted 212 lines · Sage Weil
Quoted 58 lines · Andreas Bluemle

Hi Sage,

Quoted 29 lines · Sage Weil

Hi Andreas,

Quoted 7 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

Quoted 8 lines

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance problems?

There is a single 'dispatch' thread that's processing this queue, and conveniently perf lets you break down its profiling data on a per-thread basis. Once you've ruled out the throttler as the culprit, you might try
running the daemon with 'perf record -g -- ceph-osd ...' and then look specifically at where that thread is spending its time. We shouldn't be burning that much CPU just doing the sanity checks and then handing requests
off to PGs...

Quoted 4 lines

sage

The effect, which I am seeing, may be related to some locking issue.
As I read the code, there are multiple dispatchers running: one per SimpleMessenger.

On a typical OSD node, there is

- the instance of the SimpleMessenger processing input from the client (primary writes)
- other instances of SimpleMessenger, which process input from neighbor OSD
nodes

the latter generate replication writes to the OSD I am looking at.

On the other hand, there is a single instance of the OSD object within the ceph-osd daemon.
When dispatching messages to the OSD, then the OSD::osd_lock is held for the
complete
process of dispatching; see code below.

Quoted 6 lines

When the write load increases, then multiple SimpleMessenger instances start
to
congest on the OSD::osd_lock.
And this may cause delays in the individual dispatch process.

This is definitely possible, yes, although it would surprise me if it's happening here (unless your workload is all small writes). Just to confirm, are you actually observing osd_lock contention, or speculating about what is causing the delays you're seeing?

I'm not sure what the best tool is to measure lock contention. Mark was playing with a 'poor man's wall clock profiler' using stack trace sampling from gdb. That would tell us whether threads were really blocking while obtaining the osd_lock...

Can you tell us a bit more about what your workload is?

sage

Quoted 125 lines

bool OSD::ms_dispatch(Message *m)
{
// lock!
osd_lock.Lock();

while (dispatch_running) {
dout(10) << "ms_dispatch waiting for other dispatch thread to complete" << dendl;
dispatch_cond.Wait(osd_lock);
}
dispatch_running = true;

do_waiters();
_dispatch(m);
do_waiters();

dispatch_running = false;
dispatch_cond.Signal();

osd_lock.Unlock();
return true;
}

Quoted 85 lines
Quoted 84 lines

In detail:

In order to find out more about this problem, I have added profiling to
the ceph code in various place; for write operations to the primary or the
secondary, timestamps are recorded for OSD object, offset and length of
the such a write request.

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication operation is acknowledged.

What I believe is happening: dispatching requests from SimpleMessenger to
OSD worker threads seems to consume a fair amount of time. This ends up in a widening gap between subsequent receipts of requests and the start
of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating
OSD also suffers from the same problem - and hence causes additional delays
at the primary OSD when it waits for the commit from the replicating OSD.

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading the message header until enqueuing the completely decoded message into the SImpleMessenger dispatch queue.

The green bar represents the time required for local processing, i.e. dispatching the the OSD worker, writing to filesystem and journal, send
out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a commit
back to the primary OSD and the original write request can be committed to
the client.

The green bar is interrupted by a black bar: the left end represents the time when the request has been enqueued on the OSD worker queue. The
right end gives the time when the request is taken off the OSD worker queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write request.

Note that the dispatching of a later request in all cases relates to the
enqueue time at the OSD worker queue of the previous write request:
the
left
end of a black bar relates nicely to the beginning of a green bar above
it.

Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
Signature · 11 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
#12 lore raw
Quoted 7 lines · Sage Weil
Quoted 6 lines · Andreas Bluemle

Hi Sage,

as mentioned, the workload is a single sequential write on the client. The write is not O_DIRECT; and consequently the messages arrive at the OSD with 124 KByte per write request.

Quoted 6 lines
Quoted 6 lines

The attached pdf shows a timing diagram of two concurrent write operations (one primary and one replication / secondary).

The time spent on the primary write to get the OSD.:osd_lock releates nicely with the time when this lock is released by the secondary write.

Looking again at this diagram, I'm a bit confused. Is the Y access the thread id or something? And the X axis is time in seconds?

The big question for me is what on earth the secondary write (or primary, for that matter) is doing with osd_lock for a full 3 ms... If my reading of the units is correct, *that* is the real problem. It shouldn't be doing anything that takes that long. The exception is osdmap handling, which can do more work, but request processing should be very fast.

Thanks-
sage

Quoted 247 lines

Ah, I see.

There isn't a trivial way to pull osd_lock out of the picture; there are several data structures it's protecting (pg_map, osdmaps, peer epoch map, etc.). Before we try going down that road, I suspect it might be more fruitful to see where cpu time is being spent while osd_lock is held.

How much of an issue does it look like this specific contention is for you? Does it go away with larger writes?

sage

Quoted 232 lines

Hope this helps

Andreas

Quoted 212 lines · Sage Weil
Quoted 58 lines · Andreas Bluemle

Hi Sage,

Quoted 29 lines · Sage Weil

Hi Andreas,

Quoted 7 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

Quoted 8 lines

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance problems?

There is a single 'dispatch' thread that's processing this queue, and conveniently perf lets you break down its profiling data on a per-thread basis. Once you've ruled out the throttler as the culprit, you might try
running the daemon with 'perf record -g -- ceph-osd ...' and then look specifically at where that thread is spending its time. We shouldn't be burning that much CPU just doing the sanity checks and then handing requests
off to PGs...

Quoted 4 lines

sage

The effect, which I am seeing, may be related to some locking issue.
As I read the code, there are multiple dispatchers running: one per SimpleMessenger.

On a typical OSD node, there is

- the instance of the SimpleMessenger processing input from the client (primary writes)
- other instances of SimpleMessenger, which process input from neighbor OSD
nodes

the latter generate replication writes to the OSD I am looking at.

On the other hand, there is a single instance of the OSD object within the ceph-osd daemon.
When dispatching messages to the OSD, then the OSD::osd_lock is held for the
complete
process of dispatching; see code below.

Quoted 6 lines

When the write load increases, then multiple SimpleMessenger instances start
to
congest on the OSD::osd_lock.
And this may cause delays in the individual dispatch process.

This is definitely possible, yes, although it would surprise me if it's happening here (unless your workload is all small writes). Just to confirm, are you actually observing osd_lock contention, or speculating about what is causing the delays you're seeing?

I'm not sure what the best tool is to measure lock contention. Mark was playing with a 'poor man's wall clock profiler' using stack trace sampling from gdb. That would tell us whether threads were really blocking while obtaining the osd_lock...

Can you tell us a bit more about what your workload is?

sage

Quoted 125 lines

bool OSD::ms_dispatch(Message *m)
{
// lock!
osd_lock.Lock();

while (dispatch_running) {
dout(10) << "ms_dispatch waiting for other dispatch thread to complete" << dendl;
dispatch_cond.Wait(osd_lock);
}
dispatch_running = true;

do_waiters();
_dispatch(m);
do_waiters();

dispatch_running = false;
dispatch_cond.Signal();

osd_lock.Unlock();
return true;
}

Quoted 85 lines
Quoted 84 lines

In detail:

In order to find out more about this problem, I have added profiling to
the ceph code in various place; for write operations to the primary or the
secondary, timestamps are recorded for OSD object, offset and length of
the such a write request.

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication operation is acknowledged.

What I believe is happening: dispatching requests from SimpleMessenger to
OSD worker threads seems to consume a fair amount of time. This ends up in a widening gap between subsequent receipts of requests and the start
of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating
OSD also suffers from the same problem - and hence causes additional delays
at the primary OSD when it waits for the commit from the replicating OSD.

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading the message header until enqueuing the completely decoded message into the SImpleMessenger dispatch queue.

The green bar represents the time required for local processing, i.e. dispatching the the OSD worker, writing to filesystem and journal, send
out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a commit
back to the primary OSD and the original write request can be committed to
the client.

The green bar is interrupted by a black bar: the left end represents the time when the request has been enqueued on the OSD worker queue. The
right end gives the time when the request is taken off the OSD worker queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write request.

Note that the dispatching of a later request in all cases relates to the
enqueue time at the OSD worker queue of the previous write request:
the
left
end of a black bar relates nicely to the beginning of a green bar above
it.

Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
Signature · 11 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
#13 lore raw

Was the cluster complete healthy at the time that those traces were taken? If there were osds going in/out/up/down, it would trigger osdmap updates which would tend to hold the osd_lock for an extended period of time.

v0.50 included some changes that drastically reduce the purview of osd_lock. In particular, pg op handling no longer grabs the osd_lock and handle_osd_map can proceed independently of the pg worker threads. Trying that might be interesting.

-Sam

Quoted 279 lines · Sage Weil
Quoted 7 lines · Sage Weil
Quoted 6 lines · Andreas Bluemle

Hi Sage,

as mentioned, the workload is a single sequential write on the client. The write is not O_DIRECT; and consequently the messages arrive at the OSD with 124 KByte per write request.

Quoted 6 lines
Quoted 6 lines

The attached pdf shows a timing diagram of two concurrent write operations (one primary and one replication / secondary).

The time spent on the primary write to get the OSD.:osd_lock releates nicely with the time when this lock is released by the secondary write.

Looking again at this diagram, I'm a bit confused. Is the Y access the thread id or something? And the X axis is time in seconds?

The big question for me is what on earth the secondary write (or primary, for that matter) is doing with osd_lock for a full 3 ms... If my reading of the units is correct, *that* is the real problem. It shouldn't be doing anything that takes that long. The exception is osdmap handling, which can do more work, but request processing should be very fast.

Thanks-
sage

Quoted 8 lines

Ah, I see.

There isn't a trivial way to pull osd_lock out of the picture; there are several data structures it's protecting (pg_map, osdmaps, peer epoch map, etc.). Before we try going down that road, I suspect it might be more fruitful to see where cpu time is being spent while osd_lock is held.

Quoted 239 lines

How much of an issue does it look like this specific contention is for you? Does it go away with larger writes?

sage

Quoted 232 lines

Hope this helps

Andreas

Quoted 72 lines · Sage Weil
Quoted 58 lines · Andreas Bluemle

Hi Sage,

Quoted 29 lines · Sage Weil

Hi Andreas,

Quoted 7 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

Quoted 8 lines

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance problems?

There is a single 'dispatch' thread that's processing this queue, and conveniently perf lets you break down its profiling data on a per-thread basis. Once you've ruled out the throttler as the culprit, you might try
running the daemon with 'perf record -g -- ceph-osd ...' and then look specifically at where that thread is spending its time. We shouldn't be burning that much CPU just doing the sanity checks and then handing requests
off to PGs...

Quoted 4 lines

sage

The effect, which I am seeing, may be related to some locking issue.
As I read the code, there are multiple dispatchers running: one per SimpleMessenger.

On a typical OSD node, there is

- the instance of the SimpleMessenger processing input from the client (primary writes)
- other instances of SimpleMessenger, which process input from neighbor OSD
nodes

the latter generate replication writes to the OSD I am looking at.

On the other hand, there is a single instance of the OSD object within the ceph-osd daemon.
When dispatching messages to the OSD, then the OSD::osd_lock is held for the
complete
process of dispatching; see code below.

Quoted 6 lines

When the write load increases, then multiple SimpleMessenger instances start
to
congest on the OSD::osd_lock.
And this may cause delays in the individual dispatch process.

This is definitely possible, yes, although it would surprise me if it's happening here (unless your workload is all small writes). Just to confirm, are you actually observing osd_lock contention, or speculating about what is causing the delays you're seeing?

Quoted 140 lines

I'm not sure what the best tool is to measure lock contention. Mark was playing with a 'poor man's wall clock profiler' using stack trace sampling from gdb. That would tell us whether threads were really blocking while obtaining the osd_lock...

Can you tell us a bit more about what your workload is?

sage

Quoted 125 lines

bool OSD::ms_dispatch(Message *m)
{
// lock!
osd_lock.Lock();

while (dispatch_running) {
dout(10) << "ms_dispatch waiting for other dispatch thread to complete" << dendl;
dispatch_cond.Wait(osd_lock);
}
dispatch_running = true;

do_waiters();
_dispatch(m);
do_waiters();

dispatch_running = false;
dispatch_cond.Signal();

osd_lock.Unlock();
return true;
}

Quoted 80 lines
Quoted 80 lines

In detail:

In order to find out more about this problem, I have added profiling to
the ceph code in various place; for write operations to the primary or the
secondary, timestamps are recorded for OSD object, offset and length of
the such a write request.

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication operation is acknowledged.

What I believe is happening: dispatching requests from SimpleMessenger to
OSD worker threads seems to consume a fair amount of time. This ends up in a widening gap between subsequent receipts of requests and the start
of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating
OSD also suffers from the same problem - and hence causes additional delays
at the primary OSD when it waits for the commit from the replicating OSD.

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading the message header until enqueuing the completely decoded message into the SImpleMessenger dispatch queue.

The green bar represents the time required for local processing, i.e. dispatching the the OSD worker, writing to filesystem and journal, send
out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a commit
back to the primary OSD and the original write request can be committed to
the client.

The green bar is interrupted by a black bar: the left end represents the time when the request has been enqueued on the OSD worker queue. The
right end gives the time when the request is taken off the OSD worker queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write request.

Note that the dispatching of a later request in all cases relates to the
enqueue time at the OSD worker queue of the previous write request:
the
left
end of a black bar relates nicely to the beginning of a green bar above
it.

--

Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910
Quoted 5 lines
Quoted 4 lines

Company details: http://www.itxperts.de/imprint.htm

--

Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--

Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#14 lore raw

Hi,

Quoted 5 lines · Samuel Just

Was the cluster complete healthy at the time that those traces were taken? If there were osds going in/out/up/down, it would trigger osdmap updates which would tend to hold the osd_lock for an extended period of time.

The cluster was completely healthy.

Quoted 6 lines

v0.50 included some changes that drastically reduce the purview of osd_lock. In particular, pg op handling no longer grabs the osd_lock and handle_osd_map can proceed independently of the pg worker threads. Trying that might be interesting.

I'll grab v0.50 and take a look.

Quoted 25 lines

-Sam

Quoted 21 lines · Sage Weil
Quoted 8 lines · Sage Weil
Quoted 6 lines · Andreas Bluemle

Hi Sage,

as mentioned, the workload is a single sequential write on the client. The write is not O_DIRECT; and consequently the messages arrive at the OSD with 124 KByte per write request.

Quoted 7 lines
Quoted 7 lines

The attached pdf shows a timing diagram of two concurrent write operations (one primary and one replication / secondary).

The time spent on the primary write to get the OSD.:osd_lock releates nicely with the time when this lock is released by the secondary write.

Looking again at this diagram, I'm a bit confused. Is the Y access the thread id or something? And the X axis is time in seconds?

X-Axis is time, Y Axis is absolute offset of the write request on the rados block device.

Quoted 270 lines
Quoted 267 lines

The big question for me is what on earth the secondary write (or primary, for that matter) is doing with osd_lock for a full 3 ms... If my reading of the units is correct, *that* is the real problem. It shouldn't be doing anything that takes that long. The exception is osdmap handling, which can do more work, but request processing should be very fast.

Thanks-
sage

Quoted 7 lines

Ah, I see.

There isn't a trivial way to pull osd_lock out of the picture; there are several data structures it's protecting (pg_map, osdmaps, peer epoch map, etc.). Before we try going down that road, I suspect it might be more fruitful to see where cpu time is being spent while osd_lock is held.

Quoted 244 lines

How much of an issue does it look like this specific contention is for you? Does it go away with larger writes?

sage

Quoted 237 lines

Hope this helps

Andreas

Quoted 77 lines · Sage Weil
Quoted 62 lines · Andreas Bluemle

Hi Sage,

Quoted 31 lines · Sage Weil

Hi Andreas,

Quoted 7 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

Quoted 9 lines

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance problems?

There is a single 'dispatch' thread that's processing this queue, and conveniently perf lets you break down its profiling data on a per-thread basis. Once you've ruled out the throttler as the culprit, you might try
running the daemon with 'perf record -g -- ceph-osd ...' and then look specifically at where that thread is spending its time. We shouldn't be burning that much CPU just doing the sanity checks and then handing requests
off to PGs...

Quoted 5 lines

sage

The effect, which I am seeing, may be related to some locking issue.
As I read the code, there are multiple dispatchers running: one per SimpleMessenger.

On a typical OSD node, there is

- the instance of the SimpleMessenger processing input from the client (primary writes)
- other instances of SimpleMessenger, which process input from neighbor OSD
nodes

the latter generate replication writes to the OSD I am looking at.

On the other hand, there is a single instance of the OSD object within the ceph-osd daemon.
When dispatching messages to the OSD, then the OSD::osd_lock is held for the
complete
process of dispatching; see code below.

Quoted 7 lines

When the write load increases, then multiple SimpleMessenger instances start
to
congest on the OSD::osd_lock.
And this may cause delays in the individual dispatch process.

This is definitely possible, yes, although it would surprise me if it's happening here (unless your workload is all small writes). Just to confirm, are you actually observing osd_lock contention, or speculating about what is causing the delays you're seeing?

Quoted 142 lines

I'm not sure what the best tool is to measure lock contention. Mark was playing with a 'poor man's wall clock profiler' using stack trace sampling from gdb. That would tell us whether threads were really blocking while obtaining the osd_lock...

Can you tell us a bit more about what your workload is?

sage

Quoted 127 lines

bool OSD::ms_dispatch(Message *m)
{
// lock!
osd_lock.Lock();

while (dispatch_running) {
dout(10) << "ms_dispatch waiting for other dispatch thread to complete" << dendl;
dispatch_cond.Wait(osd_lock);
}
dispatch_running = true;

do_waiters();
_dispatch(m);
do_waiters();

dispatch_running = false;
dispatch_cond.Signal();

osd_lock.Unlock();
return true;
}

Quoted 80 lines
Quoted 80 lines

In detail:

In order to find out more about this problem, I have added profiling to
the ceph code in various place; for write operations to the primary or the
secondary, timestamps are recorded for OSD object, offset and length of
the such a write request.

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication operation is acknowledged.

What I believe is happening: dispatching requests from SimpleMessenger to
OSD worker threads seems to consume a fair amount of time. This ends up in a widening gap between subsequent receipts of requests and the start
of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating
OSD also suffers from the same problem - and hence causes additional delays
at the primary OSD when it waits for the commit from the replicating OSD.

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading the message header until enqueuing the completely decoded message into the SImpleMessenger dispatch queue.

The green bar represents the time required for local processing, i.e. dispatching the the OSD worker, writing to filesystem and journal, send
out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a commit
back to the primary OSD and the original write request can be committed to
the client.

The green bar is interrupted by a black bar: the left end represents the time when the request has been enqueued on the OSD worker queue. The
right end gives the time when the request is taken off the OSD worker queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write request.

Note that the dispatching of a later request in all cases relates to the
enqueue time at the OSD worker queue of the previous write request:
the
left
end of a black bar relates nicely to the beginning of a green bar above
it.

--

Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910
Quoted 5 lines
Quoted 5 lines

Company details: http://www.itxperts.de/imprint.htm

--

Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--

Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
#15 lore raw

What rbd block size were you using?
-Sam

Quoted 399 lines · Andreas Bluemle

Hi,

Quoted 7 lines · Samuel Just

Was the cluster complete healthy at the time that those traces were taken? If there were osds going in/out/up/down, it would trigger osdmap updates which
would tend to hold the osd_lock for an extended period of time.

The cluster was completely healthy.

Quoted 8 lines

v0.50 included some changes that drastically reduce the purview of osd_lock.
In particular, pg op handling no longer grabs the osd_lock and handle_osd_map
can proceed independently of the pg worker threads. Trying that might be interesting.

I'll grab v0.50 and take a look.

Quoted 29 lines

-Sam

Quoted 25 lines · Sage Weil
Quoted 10 lines · Sage Weil
Quoted 7 lines · Andreas Bluemle

Hi Sage,

as mentioned, the workload is a single sequential write on the client. The write is not O_DIRECT; and consequently the messages arrive at the OSD with 124 KByte per write request.

Quoted 7 lines
Quoted 7 lines

The attached pdf shows a timing diagram of two concurrent write operations (one primary and one replication / secondary).

The time spent on the primary write to get the OSD.:osd_lock releates nicely with the time when this lock is released by the secondary write.

Looking again at this diagram, I'm a bit confused. Is the Y access the thread id or something? And the X axis is time in seconds?

X-Axis is time, Y Axis is absolute offset of the write request on the rados block device.

Quoted 320 lines
Quoted 320 lines

The big question for me is what on earth the secondary write (or primary, for that matter) is doing with osd_lock for a full 3 ms... If my reading of the units is correct, *that* is the real problem. It shouldn't be doing anything that takes that long. The exception is osdmap handling, which can do more work, but request processing should be very fast.

Thanks-
sage

Quoted 308 lines

Ah, I see.

There isn't a trivial way to pull osd_lock out of the picture; there are several data structures it's protecting (pg_map, osdmaps, peer epoch map,
etc.). Before we try going down that road, I suspect it might be more fruitful to see where cpu time is being spent while osd_lock is held.

How much of an issue does it look like this specific contention is for you? Does it go away with larger writes?

sage

Quoted 292 lines

Hope this helps

Andreas

Quoted 107 lines · Sage Weil
Quoted 78 lines · Andreas Bluemle

Hi Sage,

Quoted 40 lines · Sage Weil

Hi Andreas,

Quoted 8 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

Quoted 10 lines

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance
problems?

There is a single 'dispatch' thread that's processing this queue, and
conveniently perf lets you break down its profiling data on a per-thread
basis. Once you've ruled out the throttler as the culprit, you might
try
running the daemon with 'perf record -g -- ceph-osd ...' and then look
specifically at where that thread is spending its time. We shouldn't be
burning that much CPU just doing the sanity checks and then handing requests
off to PGs...

Quoted 5 lines

sage

The effect, which I am seeing, may be related to some locking
issue.
As I read the code, there are multiple dispatchers running: one per SimpleMessenger.

On a typical OSD node, there is

- the instance of the SimpleMessenger processing input from the client
(primary writes)
- other instances of SimpleMessenger, which process input from neighbor
OSD
nodes

the latter generate replication writes to the OSD I am looking at.

On the other hand, there is a single instance of the OSD object within the
ceph-osd daemon.
When dispatching messages to the OSD, then the OSD::osd_lock is held for
the
complete
process of dispatching; see code below.

Quoted 8 lines

When the write load increases, then multiple SimpleMessenger instances
start
to
congest on the OSD::osd_lock.
And this may cause delays in the individual dispatch process.

This is definitely possible, yes, although it would surprise me if it's
happening here (unless your workload is all small writes). Just to confirm,
are you actually observing osd_lock contention, or speculating about what is
causing the delays you're seeing?

I'm not sure what the best tool is to measure lock contention. Mark was
playing with a 'poor man's wall clock profiler' using stack trace sampling
from gdb. That would tell us whether threads were really blocking while
obtaining the osd_lock...

Quoted 165 lines

Can you tell us a bit more about what your workload is?

sage

Quoted 154 lines

bool OSD::ms_dispatch(Message *m)
{
// lock!
osd_lock.Lock();

while (dispatch_running) {
dout(10) << "ms_dispatch waiting for other dispatch thread to complete" <<
dendl;
dispatch_cond.Wait(osd_lock);
}
dispatch_running = true;

do_waiters();
_dispatch(m);
do_waiters();

dispatch_running = false;
dispatch_cond.Signal();

osd_lock.Unlock();
return true;
}

Quoted 102 lines
Quoted 102 lines

In detail:

In order to find out more about this problem, I have added profiling
to
the ceph code in various place; for write operations to the primary or
the
secondary, timestamps are recorded for OSD object, offset and length
of
the such a write request.

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication
operation
is acknowledged.

What I believe is happening: dispatching requests from SimpleMessenger
to
OSD worker threads seems to consume a fair amount of time. This ends
up in a widening gap between subsequent receipts of requests and the
start
of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating
OSD also suffers from the same problem - and hence causes additional
delays
at the primary OSD when it waits for the commit from the replicating
OSD.

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading
the message header until enqueuing the completely decoded message into
the SImpleMessenger dispatch queue.

The green bar represents the time required for local processing, i.e.
dispatching the the OSD worker, writing to filesystem and journal, send
out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished
and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a
commit
back to the primary OSD and the original write request can be committed to
the client.

The green bar is interrupted by a black bar: the left end represents
the time when the request has been enqueued on the OSD worker queue.
The
right end gives the time when the request is taken off the OSD worker
queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write
request.

Note that the dispatching of a later request in all cases relates to
the
enqueue time at the OSD worker queue of the previous write request:
the
left
end of a black bar relates nicely to the beginning of a green bar above
it.

--
Andreas Bluemle
mailto:[email protected]

ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910
Quoted 5 lines
Quoted 5 lines

Company details: http://www.itxperts.de/imprint.htm

--
Andreas Bluemle
mailto:[email protected]

ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--

Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

Quoted 9 lines
Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--

Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

#16 lore raw

Hi,

the size of the rbd data objects on the OSD is 4 MByte (default).

Best Regards

Andreas

Quoted 409 lines · Samuel Just

What rbd block size were you using?
-Sam

Quoted 400 lines · Andreas Bluemle

Hi,

Quoted 7 lines · Samuel Just

Was the cluster complete healthy at the time that those traces were taken? If there were osds going in/out/up/down, it would trigger osdmap updates which
would tend to hold the osd_lock for an extended period of time.

The cluster was completely healthy.

Quoted 9 lines

v0.50 included some changes that drastically reduce the purview of osd_lock.
In particular, pg op handling no longer grabs the osd_lock and handle_osd_map
can proceed independently of the pg worker threads. Trying that might be interesting.

I'll grab v0.50 and take a look.

Quoted 30 lines

-Sam

Quoted 25 lines · Sage Weil
Quoted 9 lines · Sage Weil
Quoted 6 lines · Andreas Bluemle

Hi Sage,

as mentioned, the workload is a single sequential write on the client. The write is not O_DIRECT; and consequently the messages arrive at the OSD with 124 KByte per write request.

Quoted 8 lines
Quoted 8 lines

The attached pdf shows a timing diagram of two concurrent write operations (one primary and one replication / secondary).

The time spent on the primary write to get the OSD.:osd_lock releates nicely with the time when this lock is released by the secondary write.

Looking again at this diagram, I'm a bit confused. Is the Y access the thread id or something? And the X axis is time in seconds?

X-Axis is time, Y Axis is absolute offset of the write request on the rados block device.

Quoted 319 lines
Quoted 319 lines

The big question for me is what on earth the secondary write (or primary, for that matter) is doing with osd_lock for a full 3 ms... If my reading of the units is correct, *that* is the real problem. It shouldn't be doing anything that takes that long. The exception is osdmap handling, which can do more work, but request processing should be very fast.

Thanks-
sage

Quoted 307 lines

Ah, I see.

There isn't a trivial way to pull osd_lock out of the picture; there are several data structures it's protecting (pg_map, osdmaps, peer epoch map,
etc.). Before we try going down that road, I suspect it might be more fruitful to see where cpu time is being spent while osd_lock is held.

How much of an issue does it look like this specific contention is for you? Does it go away with larger writes?

sage

Quoted 291 lines

Hope this helps

Andreas

Quoted 106 lines · Sage Weil
Quoted 77 lines · Andreas Bluemle

Hi Sage,

Quoted 39 lines · Sage Weil

Hi Andreas,

Quoted 7 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

Quoted 11 lines

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance
problems?

There is a single 'dispatch' thread that's processing this queue, and
conveniently perf lets you break down its profiling data on a per-thread
basis. Once you've ruled out the throttler as the culprit, you might
try
running the daemon with 'perf record -g -- ceph-osd ...' and then look
specifically at where that thread is spending its time. We shouldn't be
burning that much CPU just doing the sanity checks and then handing requests
off to PGs...

Quoted 6 lines

sage

The effect, which I am seeing, may be related to some locking
issue.
As I read the code, there are multiple dispatchers running: one per SimpleMessenger.

On a typical OSD node, there is

- the instance of the SimpleMessenger processing input from the client
(primary writes)
- other instances of SimpleMessenger, which process input from neighbor
OSD
nodes

the latter generate replication writes to the OSD I am looking at.

On the other hand, there is a single instance of the OSD object within the
ceph-osd daemon.
When dispatching messages to the OSD, then the OSD::osd_lock is held for
the
complete
process of dispatching; see code below.

Quoted 9 lines

When the write load increases, then multiple SimpleMessenger instances
start
to
congest on the OSD::osd_lock.
And this may cause delays in the individual dispatch process.

This is definitely possible, yes, although it would surprise me if it's
happening here (unless your workload is all small writes). Just to confirm,
are you actually observing osd_lock contention, or speculating about what is
causing the delays you're seeing?

I'm not sure what the best tool is to measure lock contention. Mark was
playing with a 'poor man's wall clock profiler' using stack trace sampling
from gdb. That would tell us whether threads were really blocking while
obtaining the osd_lock...

Quoted 165 lines

Can you tell us a bit more about what your workload is?

sage

Quoted 154 lines

bool OSD::ms_dispatch(Message *m)
{
// lock!
osd_lock.Lock();

while (dispatch_running) {
dout(10) << "ms_dispatch waiting for other dispatch thread to complete" <<
dendl;
dispatch_cond.Wait(osd_lock);
}
dispatch_running = true;

do_waiters();
_dispatch(m);
do_waiters();

dispatch_running = false;
dispatch_cond.Signal();

osd_lock.Unlock();
return true;
}

Quoted 101 lines
Quoted 101 lines

In detail:

In order to find out more about this problem, I have added profiling
to
the ceph code in various place; for write operations to the primary or
the
secondary, timestamps are recorded for OSD object, offset and length
of
the such a write request.

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication
operation
is acknowledged.

What I believe is happening: dispatching requests from SimpleMessenger
to
OSD worker threads seems to consume a fair amount of time. This ends
up in a widening gap between subsequent receipts of requests and the
start
of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating
OSD also suffers from the same problem - and hence causes additional
delays
at the primary OSD when it waits for the commit from the replicating
OSD.

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading
the message header until enqueuing the completely decoded message into
the SImpleMessenger dispatch queue.

The green bar represents the time required for local processing, i.e.
dispatching the the OSD worker, writing to filesystem and journal, send
out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished
and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a
commit
back to the primary OSD and the original write request can be committed to
the client.

The green bar is interrupted by a black bar: the left end represents
the time when the request has been enqueued on the OSD worker queue.
The
right end gives the time when the request is taken off the OSD worker
queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write
request.

Note that the dispatching of a later request in all cases relates to
the
enqueue time at the OSD worker queue of the previous write request:
the
left
end of a black bar relates nicely to the beginning of a green bar above
it.

--
Andreas Bluemle
mailto:[email protected]

ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910
Quoted 6 lines
Quoted 6 lines

Company details: http://www.itxperts.de/imprint.htm

--
Andreas Bluemle
mailto:[email protected]

ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--

Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

Quoted 9 lines
Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--

Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
#17 lore raw

Hi,

I have run tests with v0.50 and see the same symptom.

However: I have also the impression that the problem is related to the frequency at which requests arrive at the OSD.

I have run tests with rbd kernel client using 126 KByte and 512 KByte size for write requests. In the 2nd case, the average time to dispatch a message from SM to OSD is
in the range of 0.2 ms, without too much of a variance. In first case the time to dispatch has a large variance and at an average is in the range of 2 ms (i.e. a factor of 10 higher).

The difference between the two cases is the rate at which requests arrive at the OSD.

So it looks that the dispatching code itself is efficient, but collapses on the locks if the request rate for a single OSD hits some threshold.

Best Regards

Andreas Bluemle

Quoted 421 lines · Andreas Bluemle

Hi,

the size of the rbd data objects on the OSD is 4 MByte (default).

Best Regards

Andreas

Quoted 409 lines · Samuel Just

What rbd block size were you using?
-Sam

Quoted 400 lines · Andreas Bluemle

Hi,

Quoted 7 lines · Samuel Just

Was the cluster complete healthy at the time that those traces were taken? If there were osds going in/out/up/down, it would trigger osdmap updates which
would tend to hold the osd_lock for an extended period of time.

The cluster was completely healthy.

Quoted 9 lines

v0.50 included some changes that drastically reduce the purview of osd_lock.
In particular, pg op handling no longer grabs the osd_lock and handle_osd_map
can proceed independently of the pg worker threads. Trying that might be interesting.

I'll grab v0.50 and take a look.

Quoted 30 lines

-Sam

Quoted 25 lines · Sage Weil
Quoted 9 lines · Sage Weil
Quoted 6 lines · Andreas Bluemle

Hi Sage,

as mentioned, the workload is a single sequential write on the client. The write is not O_DIRECT; and consequently the messages arrive at the OSD with 124 KByte per write request.

Quoted 8 lines
Quoted 8 lines

The attached pdf shows a timing diagram of two concurrent write operations (one primary and one replication / secondary).

The time spent on the primary write to get the OSD.:osd_lock releates nicely with the time when this lock is released by the secondary write.

Looking again at this diagram, I'm a bit confused. Is the Y access the thread id or something? And the X axis is time in seconds?

X-Axis is time, Y Axis is absolute offset of the write request on the rados block device.

Quoted 328 lines
Quoted 325 lines

The big question for me is what on earth the secondary write (or primary, for that matter) is doing with osd_lock for a full 3 ms... If my reading of the units is correct, *that* is the real problem. It shouldn't be doing anything that takes that long. The exception is osdmap handling, which can do more work, but request processing should be very fast.

Thanks-
sage

Quoted 307 lines

Ah, I see.

There isn't a trivial way to pull osd_lock out of the picture; there are several data structures it's protecting (pg_map, osdmaps, peer epoch map,
etc.). Before we try going down that road, I suspect it might be more fruitful to see where cpu time is being spent while osd_lock is held.

How much of an issue does it look like this specific contention is for you? Does it go away with larger writes?

sage

Quoted 291 lines

Hope this helps

Andreas

Quoted 271 lines · Sage Weil
Quoted 77 lines · Andreas Bluemle

Hi Sage,

Quoted 39 lines · Sage Weil

Hi Andreas,

Quoted 7 lines · Andreas Bluemle

Hi,

I have been trying to migrate a ceph cluster (ceph-0.48argonaut) to a high speed cluster network and encounter scalability problems:
the overall performance of the ceph cluster does not scale well with an increase in the underlying networking speed.

Quoted 11 lines

In short:

I believe that the dispatching from SimpleMessenger to OSD worker queues causes that scalability issue.

Question: is it possible that this dispatching is causing performance
problems?

There is a single 'dispatch' thread that's processing this queue, and
conveniently perf lets you break down its profiling data on a per-thread
basis. Once you've ruled out the throttler as the culprit, you might
try
running the daemon with 'perf record -g -- ceph-osd ...' and then look
specifically at where that thread is spending its time. We shouldn't be
burning that much CPU just doing the sanity checks and then handing requests
off to PGs...

Quoted 6 lines

sage

The effect, which I am seeing, may be related to some locking
issue.
As I read the code, there are multiple dispatchers running: one per SimpleMessenger.

On a typical OSD node, there is

- the instance of the SimpleMessenger processing input from the client
(primary writes)
- other instances of SimpleMessenger, which process input from neighbor
OSD
nodes

the latter generate replication writes to the OSD I am looking at.

On the other hand, there is a single instance of the OSD object within the
ceph-osd daemon.
When dispatching messages to the OSD, then the OSD::osd_lock is held for
the
complete
process of dispatching; see code below.

Quoted 9 lines

When the write load increases, then multiple SimpleMessenger instances
start
to
congest on the OSD::osd_lock.
And this may cause delays in the individual dispatch process.

This is definitely possible, yes, although it would surprise me if it's
happening here (unless your workload is all small writes). Just to confirm,
are you actually observing osd_lock contention, or speculating about what is
causing the delays you're seeing?

I'm not sure what the best tool is to measure lock contention. Mark was
playing with a 'poor man's wall clock profiler' using stack trace sampling
from gdb. That would tell us whether threads were really blocking while
obtaining the osd_lock...

Can you tell us a bit more about what your workload is?

sage

Quoted 154 lines

bool OSD::ms_dispatch(Message *m)
{
// lock!
osd_lock.Lock();

while (dispatch_running) {
dout(10) << "ms_dispatch waiting for other dispatch thread to complete" <<
dendl;
dispatch_cond.Wait(osd_lock);
}
dispatch_running = true;

do_waiters();
_dispatch(m);
do_waiters();

dispatch_running = false;
dispatch_cond.Signal();

osd_lock.Unlock();
return true;
}

Quoted 107 lines
Quoted 107 lines

In detail:

In order to find out more about this problem, I have added profiling
to
the ceph code in various place; for write operations to the primary or
the
secondary, timestamps are recorded for OSD object, offset and length
of
the such a write request.

Timestamps record:
- receipt time at SimpleMessenger
- processing time at osd
- for primary write operations: wait time until replication
operation
is acknowledged.

What I believe is happening: dispatching requests from SimpleMessenger
to
OSD worker threads seems to consume a fair amount of time. This ends
up in a widening gap between subsequent receipts of requests and the
start
of OSD processing them.

A primary write suffers twice from this problem: first because the delay happens on the primary OSD and second because the replicating
OSD also suffers from the same problem - and hence causes additional
delays
at the primary OSD when it waits for the commit from the replicating
OSD.

In the attached graphics, the x-axis shows the time (in seconds) The y-axis shows the offset where a request to write happened.

The red bar represents the SimpleMessenger receive, i.e. from reading
the message header until enqueuing the completely decoded message into
the SImpleMessenger dispatch queue.

The green bar represents the time required for local processing, i.e.
dispatching the the OSD worker, writing to filesystem and journal, send
out the replication operation to the replicating OSD. It right end of the green bar is the time when locally everything has finished
and a commit could happen.

The blue bar represents the time until the replicating OSD has sent a
commit
back to the primary OSD and the original write request can be committed to
the client.

The green bar is interrupted by a black bar: the left end represents
the time when the request has been enqueued on the OSD worker queue.
The
right end gives the time when the request is taken off the OSD worker
queue and actual OSD processing starts.

The test was a simple sequential write to a rados block device.

Receiption of the write requests at the OSD is also sequential in the
graphics: the bar to the bottom of the graphics shows an earlier write
request.

Note that the dispatching of a later request in all cases relates to
the
enqueue time at the OSD worker queue of the previous write request:
the
left
end of a black bar relates nicely to the beginning of a green bar above
it.

Signature · 7 lines
Andreas Bluemle
mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
Signature · 13 lines
Andreas Bluemle
mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm

-- 
To unsubscribe from this list: send the line "unsubscribe ceph-devel"
in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm
Signature · 6 lines
Andreas Bluemle                     mailto:[email protected]
ITXperts GmbH                       http://www.itxperts.de
Balanstrasse 73, Geb. 08            Phone: (+49) 89 89044917
D-81541 Muenchen (Germany)          Fax:   (+49) 89 89044910

Company details: http://www.itxperts.de/imprint.htm