I am not objecting for the idea of small-memory-footprint but I do have
a few questions:

Why are those values hardcoded in the first place?

Wouldn't be a better long term investment to have them configurable?

(Not having investigated what all does values mean)

What happens if one normal corosync build is executed on machine A and a
small-memory on machine B? Will they be able to work properly together
or can we expect issues because B might have a performance hit?

+#define MESSAGE_SIZE_MAX       1024*64

What if node A is sending a bigger message to node B? wouldn't that
break on-wire compatibility for applications?

Fabio

On Wed, 2009-09-09 at 13:16 +1200, Angus Salkeld wrote:
> > Ideally configure.ac would set CONFIG_SMALL_MEMORY_FOOTPRINT as defined.
> > The C code would check the define, not needing any cflags at all.  I am
> > not a big fan of Cflags for define overrides.  Prefer it be in config.h.
> >
> > Regards
> > -steve
> >
> Here is a patch along those lines.
> 
> -Angus
> 
> Index: include/corosync/corodefs.h
> ===================================================================
> --- include/corosync/corodefs.h       (revision 2408)
> +++ include/corosync/corodefs.h       (working copy)
> @@ -60,7 +60,11 @@
>       AMF_V2_SERVICE = 17
>  };
> 
> -#define PROCESSOR_COUNT_MAX  384
> +#ifdef HAVE_SMALL_MEMORY_FOOTPRINT
> +#define PROCESSOR_COUNT_MAX 16
> +#else
> +#define PROCESSOR_COUNT_MAX 384
> +#endif /* HAVE_SMALL_MEMORY_FOOTPRINT */
> 
>  #define TOTEMIP_ADDRLEN (sizeof(struct in6_addr))
> 
> Index: include/corosync/totem/totem.h
> ===================================================================
> --- include/corosync/totem/totem.h    (revision 2408)
> +++ include/corosync/totem/totem.h    (working copy)
> @@ -36,15 +36,16 @@
>  #define TOTEM_H_DEFINED
>  #include "totemip.h"
> 
> -#ifndef MESSAGE_SIZE_MAX
> +#ifdef HAVE_SMALL_MEMORY_FOOTPRINT
> +#define PROCESSOR_COUNT_MAX  16
> +#define MESSAGE_SIZE_MAX     1024*64
> +#define MESSAGE_QUEUE_MAX    512
> +#else
> +#define PROCESSOR_COUNT_MAX  384
>  #define MESSAGE_SIZE_MAX     1024*1024 /* (1MB) */
> -#endif /* MESSAGE_SIZE_MAX */
> +#define MESSAGE_QUEUE_MAX    MESSAGE_SIZE_MAX / totem_config->net_mtu
> +#endif /* HAVE_SMALL_MEMORY_FOOTPRINT */
> 
> -#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               10000
>  #define TRANSMITS_ALLOWED    16
>  #define SEND_THREADS_MAX     16
> Index: include/corosync/engine/coroapi.h
> ===================================================================
> --- include/corosync/engine/coroapi.h (revision 2408)
> +++ include/corosync/engine/coroapi.h (working copy)
> @@ -65,17 +65,18 @@
> 
>  #define TOTEMIP_ADDRLEN (sizeof(struct in6_addr))
> 
> -#define PROCESSOR_COUNT_MAX 384
>  #define INTERFACE_MAX 2
> 
> -#ifndef MESSAGE_SIZE_MAX
> +#ifdef HAVE_SMALL_MEMORY_FOOTPRINT
> +#define PROCESSOR_COUNT_MAX  16
> +#define MESSAGE_SIZE_MAX     1024*64
> +#define MESSAGE_QUEUE_MAX    512
> +#else
> +#define PROCESSOR_COUNT_MAX  384
>  #define MESSAGE_SIZE_MAX     1024*1024 /* (1MB) */
> -#endif /* MESSAGE_SIZE_MAX */
> +#define MESSAGE_QUEUE_MAX    MESSAGE_SIZE_MAX / totem_config->net_mtu
> +#endif /* HAVE_SMALL_MEMORY_FOOTPRINT */
> 
> -#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
> 
> Index: configure.ac
> ===================================================================
> --- configure.ac      (revision 2408)
> +++ configure.ac      (working copy)
> @@ -192,6 +192,10 @@
>       [  --enable-coverage       : coverage analysis of the codebase. ],
>       [ default="no" ])
> 
> +AC_ARG_ENABLE([small-memory-footprint],
> +     [  --enable-small-memory-footprint : Use small message queues and
> small messages sizes. ],
> +     [ default="no" ])
> +
>  AC_ARG_ENABLE([nss],
>       [  --enable-nss            : Network Security Services encryption. ],,
>       [ enable_nss="yes" ])
> @@ -353,6 +357,12 @@
>       COVERAGE_LDFLAGS=""
>  fi
> 
> +
> +if test "x${enable_small_memory_footprint}" = xyes ; then
> +     AC_DEFINE_UNQUOTED([HAVE_SMALL_MEMORY_FOOTPRINT], 1, [have
> small_memory_footprint])
> +     PACKAGE_FEATURES="$PACKAGE_FEATURES small-memory-footprint"
> +fi
> +
>  if test "x${enable_ansi}" = xyes && \
>               cc_supports_flag -std=iso9899:199409 ; then
>       AC_MSG_NOTICE([Enabling ANSI Compatibility])
> Index: lib/util.h
> ===================================================================
> --- lib/util.h        (revision 2408)
> +++ lib/util.h        (working copy)
> @@ -53,8 +53,14 @@
>       }                                                       \
>  }
> 
> +#ifdef HAVE_SMALL_MEMORY_FOOTPRINT
> +#define IPC_REQUEST_SIZE        1024*64
> +#define IPC_RESPONSE_SIZE       1024*64
> +#define IPC_DISPATCH_SIZE       1024*64
> +#else
>  #define IPC_REQUEST_SIZE        8192*128
>  #define IPC_RESPONSE_SIZE       8192*128
>  #define IPC_DISPATCH_SIZE       8192*128
> +#endif /* HAVE_SMALL_MEMORY_FOOTPRINT */
> 
>  #endif /* AIS_UTIL_H_DEFINED */
> _______________________________________________
> Openais mailing list
> [email protected]
> https://lists.linux-foundation.org/mailman/listinfo/openais

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to