Provide a way to configure (at compile time) message and queue sizes.

This patch makes it possible to override the following #defines:
MESSAGE_SIZE_MAX
MESSAGE_QUEUE_MAX
SIZEQUEUE
FLOW_CONTROL_ENTRIES_ENABLE

If MESSAGE_SIZE_MAX is defined as 1024*64 (64K) and
MESSAGE_QUEUE_MAX defined as 512 you can change corosync's
memory footprint from ~48M to ~8M

So if you define MESSAGE_QUEUE_MAX, the queue size will
not be based on the message size any more.

To use this define the defines on the command line:
make CFLAGS="-DMESSAGE_SIZE_MAX=1024*64 -DMESSAGE_QUEUE_MAX=512"



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1656 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Angus Salkeld 2008-08-20 00:57:40 +00:00
parent 94a523702f
commit 31aa88aefb
6 changed files with 22 additions and 4 deletions

View File

@ -99,7 +99,9 @@ LOGSYS_DECLARE_SUBSYS ("IPC", LOG_INFO);
/*
* When there are this many entries left in a queue, turn on flow control
*/
#ifndef FLOW_CONTROL_ENTRIES_ENABLE
#define FLOW_CONTROL_ENTRIES_ENABLE 400
#endif /* FLOW_CONTROL_ENTRIES_ENABLE */
/*
* When there are this many entries in a queue, turn off flow control

View File

@ -48,7 +48,9 @@
* Size of the queue (entries) for I/O's to the API over socket IPC.
*/
#ifndef SIZEQUEUE
#define SIZEQUEUE 800
#endif /* SIZEQUEUE */
#define SOCKET_SERVICE_INIT 254

View File

@ -528,9 +528,9 @@ int totem_config_validate (
totem_config->net_mtu = 1500;
}
if ((MESSAGE_SIZE_MAX / totem_config->net_mtu) < totem_config->max_messages) {
if ((MESSAGE_QUEUE_MAX) < totem_config->max_messages) {
sprintf (local_error_reason, "The max_messages parameter (%d messages) may not be greater then (%d messages).",
totem_config->max_messages, MESSAGE_SIZE_MAX / totem_config->net_mtu);
totem_config->max_messages, MESSAGE_QUEUE_MAX);
goto parse_error;
}

View File

@ -822,7 +822,7 @@ int totemsrp_initialize (
* Must have net_mtu adjusted by totemrrp_initialize first
*/
queue_init (&instance->new_message_queue,
(MESSAGE_SIZE_MAX / (totem_config->net_mtu - 25) /* for totempg_mcat header */),
MESSAGE_QUEUE_MAX,
sizeof (struct message_item));
return (0);

View File

@ -52,7 +52,14 @@ struct corosync_tpg_group {
#define PROCESSOR_COUNT_MAX 384
#define INTERFACE_MAX 2
#define MESSAGE_SIZE_MAX 1024*1024 /* (1MB) */
#ifndef MESSAGE_SIZE_MAX
#define MESSAGE_SIZE_MAX 1024*1024 /* (1MB) */
#endif /* MESSAGE_SIZE_MAX */
#ifndef MESSAGE_QUEUE_MAX
#define MESSAGE_QUEUE_MAX MESSAGE_SIZE_MAX / totem_config->net_mtu
#endif /* MESSAGE_QUEUE_MAX */
#define TOTEM_AGREED 0
#define TOTEM_SAFE 1

View File

@ -36,7 +36,14 @@
#define TOTEM_H_DEFINED
#include "totemip.h"
#ifndef MESSAGE_SIZE_MAX
#define MESSAGE_SIZE_MAX 1024*1024 /* (1MB) */
#endif /* MESSAGE_SIZE_MAX */
#ifndef MESSAGE_QUEUE_MAX
#define MESSAGE_QUEUE_MAX MESSAGE_SIZE_MAX / totem_config->net_mtu
#endif /* MESSAGE_QUEUE_MAX */
#define PROCESSOR_COUNT_MAX 384
#define FRAME_SIZE_MAX 9000
#define TRANSMITS_ALLOWED 16