Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: kostja@tarantool.org
Subject: [tarantool-patches] [PATCH 1/1] swim: optimize memory layout of struct swim_member
Date: Wed, 24 Apr 2019 23:05:57 +0300	[thread overview]
Message-ID: <1aa402d982fd6b8da46abfba78196c94f455ecbd.1556136325.git.v.shpilevoy@tarantool.org> (raw)

Struct swim_member describes attributes of one remote member of
a SWIM cluster. It is relatively often accessed. And it has two
huge structures - struct swim_packet ping/ack_task. Each is 1500
bytes. When these tasks are in the middle of the structure, they
split and spoil cache lines.

This patch moves the whole failure detection attribute family to
the bottom of the structure, and moves these two tasks to the
end of layout.
---
Branch: https://github.com/tarantool/tarantool/tree/gerold103/swim-struct-member-layout

 src/lib/swim/swim.c | 68 ++++++++++++++++++++++-----------------------
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/src/lib/swim/swim.c b/src/lib/swim/swim.c
index 230ec52d4..7c4685a9f 100644
--- a/src/lib/swim/swim.c
+++ b/src/lib/swim/swim.c
@@ -231,40 +231,6 @@ struct swim_member {
 	 * Position in a queue of members in the current round.
 	 */
 	struct rlist in_round_queue;
-	/**
-	 *
-	 *               Failure detection component
-	 */
-	/**
-	 * A monotonically growing number to refute old member's
-	 * state, characterized by a triplet
-	 * {incarnation, status, address}.
-	 */
-	uint64_t incarnation;
-	/**
-	 * How many recent pings did not receive an ack while the
-	 * member was in the current status. When this number
-	 * reaches a configured threshold the instance is marked
-	 * as dead. After a few more unacknowledged it is removed
-	 * from the member table. This counter is reset on each
-	 * acknowledged ping, status or incarnation change.
-	 */
-	int unacknowledged_pings;
-	/**
-	 * A deadline when we stop expecting a response to the
-	 * ping and account it as unacknowledged.
-	 */
-	double ping_deadline;
-	/** Ready at hand regular ACK task. */
-	struct swim_task ack_task;
-	/** Ready at hand regular PING task. */
-	struct swim_task ping_task;
-	/**
-	 * Position in a queue of members waiting for an ack.
-	 * A member is added to the queue when we send a ping
-	 * message to it.
-	 */
-	struct heap_node in_wait_ack_heap;
 	/**
 	 *
 	 *                 Dissemination component
@@ -344,6 +310,40 @@ struct swim_member {
 	 * time.
 	 */
 	struct rlist in_dissemination_queue;
+	/**
+	 *
+	 *               Failure detection component
+	 */
+	/**
+	 * A monotonically growing number to refute old member's
+	 * state, characterized by a triplet
+	 * {incarnation, status, address}.
+	 */
+	uint64_t incarnation;
+	/**
+	 * How many recent pings did not receive an ack while the
+	 * member was in the current status. When this number
+	 * reaches a configured threshold the instance is marked
+	 * as dead. After a few more unacknowledged it is removed
+	 * from the member table. This counter is reset on each
+	 * acknowledged ping, status or incarnation change.
+	 */
+	int unacknowledged_pings;
+	/**
+	 * A deadline when we stop expecting a response to the
+	 * ping and account it as unacknowledged.
+	 */
+	double ping_deadline;
+	/**
+	 * Position in a queue of members waiting for an ack.
+	 * A member is added to the queue when we send a ping
+	 * message to it.
+	 */
+	struct heap_node in_wait_ack_heap;
+	/** Ready at hand regular ACK task. */
+	struct swim_task ack_task;
+	/** Ready at hand regular PING task. */
+	struct swim_task ping_task;
 };
 
 #define mh_name _swim_table
-- 
2.20.1 (Apple Git-117)

             reply	other threads:[~2019-04-24 20:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24 20:05 Vladislav Shpilevoy [this message]
2019-04-25 10:53 ` [tarantool-patches] " Konstantin Osipov
2019-04-25 13:51   ` Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1aa402d982fd6b8da46abfba78196c94f455ecbd.1556136325.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 1/1] swim: optimize memory layout of struct swim_member' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox