Skip to content
Browse files

Reducing memory-related defaults

Split apart max instance limit for CC and NC. That reduces the
memory footprint of the NC, which grew with addition of sensor
subsystem memory.
  • Loading branch information...
1 parent e23c33a commit ebead4ef3e8c788804862f5fc3e7854e33c9b535 @dmitrii dmitrii committed Oct 8, 2012
Showing with 30 additions and 24 deletions.
  1. +12 −12 cluster/handlers.c
  2. +3 −3 cluster/handlers.h
  3. +7 −2 node/handlers.c
  4. +3 −2 util/eucalyptus.h
  5. +1 −1 util/sensor.c
  6. +3 −3 util/sensor.h
  7. +1 −1 util/windows-bundle.h
View
24 cluster/handlers.c
@@ -97,7 +97,7 @@
#include <eucalyptus.h>
#define SUPERUSER "eucalyptus"
-#define MAX_SENSOR_RESOURCES MAXINSTANCES
+#define MAX_SENSOR_RESOURCES MAXINSTANCES_PER_CC
// Globals
@@ -1911,7 +1911,7 @@ int doDescribeInstances(ncMetadata *ccMeta, char **instIds, int instIdsLen, ccIn
unlock_exit(1);
}
- for (i=0; i<MAXINSTANCES; i++) {
+ for (i=0; i<MAXINSTANCES_PER_CC; i++) {
if (instanceCache->cacheState[i] == INSTVALID) {
if (count >= instanceCache->numInsts) {
logprintfl(EUCAWARN, "found more instances than reported by numInsts, will only report a subset of instances\n");
@@ -4307,7 +4307,7 @@ int checkActiveNetworks() {
bzero(activeNetworks, sizeof(int) * NUMBER_OF_VLANS);
logprintfl(EUCADEBUG, "checkActiveNetworks(): maintaining active networks\n");
- for (i=0; i<MAXINSTANCES; i++) {
+ for (i=0; i<MAXINSTANCES_PER_CC; i++) {
if ( instanceCache->cacheState[i] != INSTINVALID ) {
if ( strcmp(instanceCache->instances[i].state, "Teardown") ) {
int vlan = instanceCache->instances[i].ccnet.vlan;
@@ -4780,7 +4780,7 @@ int free_instanceNetwork(char *mac, int vlan, int force, int dolock) {
inuse=0;
if (!force) {
// check to make sure the mac isn't in use elsewhere
- for (i=0; i<MAXINSTANCES && !inuse; i++) {
+ for (i=0; i<MAXINSTANCES_PER_CC && !inuse; i++) {
if (!strcmp(instanceCache->instances[i].ccnet.privateMac, mac) && strcmp(instanceCache->instances[i].state, "Teardown")) {
inuse++;
}
@@ -4906,7 +4906,7 @@ int map_instanceCache(int (*match)(ccInstance *, void *), void *matchParam, int
sem_mywait(INSTCACHE);
- for (i=0; i<MAXINSTANCES; i++) {
+ for (i=0; i<MAXINSTANCES_PER_CC; i++) {
if (!match(&(instanceCache->instances[i]), matchParam)) {
if (operate(&(instanceCache->instances[i]), operateParam)) {
logprintfl(EUCAWARN, "failed to operate at index %d\n", i);
@@ -4923,7 +4923,7 @@ void print_instanceCache(void) {
int i;
sem_mywait(INSTCACHE);
- for (i=0; i<MAXINSTANCES; i++) {
+ for (i=0; i<MAXINSTANCES_PER_CC; i++) {
if ( instanceCache->cacheState[i] == INSTVALID ) {
logprintfl(EUCADEBUG,"\tcache: %d/%d %s %s %s %s\n", i, instanceCache->numInsts, instanceCache->instances[i].instanceId, instanceCache->instances[i].ccnet.publicIp, instanceCache->instances[i].ccnet.privateIp, instanceCache->instances[i].state);
}
@@ -5002,7 +5002,7 @@ void invalidate_instanceCache(void) {
int i;
sem_mywait(INSTCACHE);
- for (i=0; i<MAXINSTANCES; i++) {
+ for (i=0; i<MAXINSTANCES_PER_CC; i++) {
// if instance is in teardown, free up network information
if ( !strcmp(instanceCache->instances[i].state, "Teardown") ) {
free_instanceNetwork(instanceCache->instances[i].ccnet.privateMac, instanceCache->instances[i].ccnet.vlan, 0, 0);
@@ -5027,7 +5027,7 @@ int refresh_instanceCache(char *instanceId, ccInstance *in){
sem_mywait(INSTCACHE);
done=0;
- for (i=0; i<MAXINSTANCES && !done; i++) {
+ for (i=0; i<MAXINSTANCES_PER_CC && !done; i++) {
if (!strcmp(instanceCache->instances[i].instanceId, instanceId)) {
// in cache
// give precedence to instances that are in Extant/Pending over expired instances, when info comes from two different nodes
@@ -5059,7 +5059,7 @@ int add_instanceCache(char *instanceId, ccInstance *in){
sem_mywait(INSTCACHE);
done=0;
- for (i=0; i<MAXINSTANCES && !done; i++) {
+ for (i=0; i<MAXINSTANCES_PER_CC && !done; i++) {
if ( (instanceCache->cacheState[i] == INSTVALID ) && (!strcmp(instanceCache->instances[i].instanceId, instanceId))) {
// already in cache
logprintfl(EUCADEBUG, "'%s/%s/%s' already in cache\n", instanceId, in->ccnet.publicIp, in->ccnet.privateIp);
@@ -5085,7 +5085,7 @@ int del_instanceCacheId(char *instanceId) {
int i;
sem_mywait(INSTCACHE);
- for (i=0; i<MAXINSTANCES; i++) {
+ for (i=0; i<MAXINSTANCES_PER_CC; i++) {
if ( (instanceCache->cacheState[i] == INSTVALID) && (!strcmp(instanceCache->instances[i].instanceId, instanceId))) {
// del from cache
bzero(&(instanceCache->instances[i]), sizeof(ccInstance));
@@ -5110,7 +5110,7 @@ int find_instanceCacheId(char *instanceId, ccInstance **out) {
sem_mywait(INSTCACHE);
*out = NULL;
done=0;
- for (i=0; i<MAXINSTANCES && !done; i++) {
+ for (i=0; i<MAXINSTANCES_PER_CC && !done; i++) {
if (!strcmp(instanceCache->instances[i].instanceId, instanceId)) {
// found it
*out = malloc(sizeof(ccInstance));
@@ -5141,7 +5141,7 @@ int find_instanceCacheIP(char *ip, ccInstance **out) {
sem_mywait(INSTCACHE);
*out = NULL;
done=0;
- for (i=0; i<MAXINSTANCES && !done; i++) {
+ for (i=0; i<MAXINSTANCES_PER_CC && !done; i++) {
if ((instanceCache->instances[i].ccnet.publicIp[0] != '\0' || instanceCache->instances[i].ccnet.privateIp[0] != '\0')) {
if (!strcmp(instanceCache->instances[i].ccnet.publicIp, ip) || !strcmp(instanceCache->instances[i].ccnet.privateIp, ip)) {
// found it
View
6 cluster/handlers.h
@@ -202,9 +202,9 @@ typedef struct ccResourceCache_t {
} ccResourceCache;
typedef struct ccInstanceCache_t {
- ccInstance instances[MAXINSTANCES];
- time_t lastseen[MAXINSTANCES];
- int cacheState[MAXINSTANCES];
+ ccInstance instances[MAXINSTANCES_PER_CC];
+ time_t lastseen[MAXINSTANCES_PER_CC];
+ int cacheState[MAXINSTANCES_PER_CC];
int numInsts;
int instanceCacheUpdate;
int dirty;
View
9 node/handlers.c
@@ -107,7 +107,7 @@
#define MAX_CREATE_TRYS 5
#define CREATE_TIMEOUT_SEC 15
#define PER_INSTANCE_BUFFER_MB 20 // by default reserve this much extra room (in MB) per instance (for kernel, ramdisk, and metadata overhead)
-#define MAX_SENSOR_RESOURCES MAXINSTANCES
+#define MAX_SENSOR_RESOURCES MAXINSTANCES_PER_NC
#define SEC_PER_MB ((1024*1024)/512)
#ifdef EUCA_COMPILE_TIMESTAMP
@@ -1316,8 +1316,13 @@ static int init (void)
// adjust the values based on configuration parameters, if any
if (nc_state.config_max_mem && nc_state.config_max_mem < nc_state.mem_max)
nc_state.mem_max = nc_state.config_max_mem;
- if (nc_state.config_max_cores)
+ if (nc_state.config_max_cores) {
nc_state.cores_max = nc_state.config_max_cores;
+ if (nc_state.cores_max > MAXINSTANCES_PER_NC) {
+ nc_state.cores_max = MAXINSTANCES_PER_NC;
+ logprintfl (EUCAWARN, "ignoring excessive MAX_CORES value (leaving at %d)\n", nc_state.cores_max);
+ }
+ }
logprintfl(EUCAINFO, "physical memory available for instances: %lldMB\n", nc_state.mem_max);
logprintfl(EUCAINFO, "virtual cpu cores available for instances: %lld\n", nc_state.cores_max);
View
5 util/eucalyptus.h
@@ -186,10 +186,11 @@
/* system limit defaults */
#define MAXNODES 1024
-#define MAXINSTANCES 2048
+#define MAXINSTANCES_PER_CC 2048
+#define MAXINSTANCES_PER_NC 256
#define MAXLOGFILESIZE 10485760
#define EUCA_MAX_GROUPS 64
-#define EUCA_MAX_VOLUMES 64
+#define EUCA_MAX_VOLUMES 27
#define EUCA_MAX_VBRS 64
#define EUCA_MAX_PATH 4096
#define EUCA_MAX_PARTITIONS 32 // partitions per disk
View
2 util/sensor.c
@@ -38,7 +38,7 @@
#include "sensor.h"
#include "ipc.h"
-#define MAX_SENSOR_RESOURCES MAXINSTANCES
+#define MAX_SENSOR_RESOURCES MAXINSTANCES_PER_CC // used for resource name cache
static useconds_t next_sleep_duration_usec = DEFAULT_SENSOR_SLEEP_DURATION_USEC;
static sensorResourceCache * sensor_state = NULL;
View
6 util/sensor.h
@@ -28,10 +28,10 @@
#ifndef _UNIT_TEST
#define MAX_SENSOR_NAME_LEN 64
-#define MAX_SENSOR_VALUES 32 // by default 20
-#define MAX_SENSOR_DIMENSIONS 32 // root, ephemeral[0-1], vol-XYZ
+#define MAX_SENSOR_VALUES 15 // by default 10 on CLC
+#define MAX_SENSOR_DIMENSIONS (5 + EUCA_MAX_VOLUMES) // root, ephemeral[0-1], vol-XYZ
#define MAX_SENSOR_COUNTERS 2 // we only have two types of counters (summation|average) for now
-#define MAX_SENSOR_METRICS 16 // currently 9 are implemented
+#define MAX_SENSOR_METRICS 10 // currently 9 are implemented
#else
#define MAX_SENSOR_NAME_LEN 64
#define MAX_SENSOR_VALUES 5 // smaller sizes, for easier testing of limits
View
2 util/windows-bundle.h
@@ -66,7 +66,7 @@
#include <eucalyptus.h>
#include <data.h>
-#define MAXBUNDLES MAXINSTANCES
+#define MAXBUNDLES MAXINSTANCES_PER_NC
typedef struct bundleTask_t {
char instanceId[CHAR_BUFFER_SIZE];

0 comments on commit ebead4e

Please sign in to comment.
Something went wrong with that request. Please try again.