Re: Why does the heartbeat packet have 122 bytes of messages?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/16/2017 06:50 AM, qi Shi wrote:
[..snip..]
But when i look at the code, heartbeat packet is only 9 bytes.
Here is the code:
------------------------------------------------------------------------------------------------------------
int Pipe::write_keepalive2(char tag, const utime_t& t)
{
  ldout(msgr->cct,10) << "write_keepalive2 " << (int)tag << " " << t << dendl;
  struct ceph_timespec ts;
  t.encode_timeval(&ts);
  struct msghdr msg;
  memset(&msg, 0, sizeof(msg));
  struct iovec msgvec[2];
  msgvec[0].iov_base = &tag;
  msgvec[0].iov_len = 1;
  msgvec[1].iov_base = &ts;
  msgvec[1].iov_len = sizeof(ts);
  msg.msg_iov = msgvec;
  msg.msg_iovlen = 2;

  if (do_sendmsg(&msg, 1 + sizeof(ts)) < 0)
    return -1;
  return 0;
}
-----------------------------------------------------------------------------------------------------------------
"ts" is 8 bytes, and "1+sizeof(ts)" == 9 bytes.


My question is why the packet will appear 122 bytes of the message,
this message is heartbeat message?

The packet that contains ping data is defined in MOSDPing.h, and the code to build it looks like this:

  void encode_payload(uint64_t features) override {
    ::encode(fsid, payload);
    ::encode(map_epoch, payload);
    ::encode(peer_as_of_epoch, payload);
    ::encode(op, payload);
    ::encode(peer_stat, payload);
    ::encode(stamp, payload);
  }

fsid is 16 bytes, map_epoch and peer_as_of_epoch is 4 bytes each, op is 1 byte, peer_stat is 14 bytes (8 bytes data + 6 bytes for extra encoding header) and stamp is 8 bytes. This makes 47 bytes of data for MODSDPing alone, and you need to include encoding header and probably a bunch of other things required by Ceph protocol. Note that there's also MDS heartbeat (defined in MHeartbeat.h) that at first glance looks even larger than the one above. Try capturing some packet data, you'll be able to find out what is actually transmitted and why it takes that space.

--
Piotr Dalek
piotr.dalek@xxxxxxxxxxxx
https://www.ovh.com/us/
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux