guys- i just uploaded a new 3.0.0 snapshot to http://matt-massie.com/ganglia/ganglia-3.0.0.200410211518.tar.gz
if you diff this snapshot with a previous snapshot you will see significant code change. the new in-memory filesystem uses string tables (hashes) instead of linked-lists now for improved performance (much faster lookup times) and the code has been simplified and cleaned up. the new code also allows the creation of anonymous filesystems which can then be attached/detached to another filesystem. this is necessary to correctly trend data that is collected. (explained below) here is a more in-depth explanation of how gangliad will work given these new capabilities. if you look at ./gangliad/gangliad.c, around line 32 you'll see the module_thread() function. this is the heart of how gangliad will process data. in pseudo-code each module thread looks like... ------------------- start module thread ------------------------- gangliaDir current_data = NULL; gangliaDir previous_data = NULL; gangliaDir new_data = NULL; gangliaDir timechange_data = NULL; gangliaDir valuechange_data = NULL; gangliaDir lost_data = NULL; for(;;) { if(current_data) { /* We have data from our last collection so detach/disconnect it from the exported data tree. The data is not deleted just detached. */ gangliaDirOrphan( current_data ); if( previous_data ) { /* Delete all the data from our last last collection. */ gangliaDirFree( previous_data ); } /* Save the pointer to the last data we collected */ previous_data = current_data; } /* Create a fresh "anonymous" data structure */ current_data = gangliaDirCreate( NULL ); /* Call the module and pass the pointer to this fresh structure */ module_function( current_data ); /* The current data now holds all the latest metrics as populated by the module. This data is a hierarchical filesystem. */ if( current_data && previous_data ) { /* Delete all the data from the last diff we did */ gangliaDirFree( new_data ); gangliaDirFree( timechange_data ); gangliaDirFree( valuechange_data ); gangliaDirFree( lost_data ); /* We compare the current data to the previously collected data and pass these diffs to our alert modules */ /* All data in current that is not in previous */ new_data = find_all_new_data( current_data, previous_data ); /* All data that has changed in value significantly since last collection */ valuechange_data = find_all_value_change_data( current_data, previous_data ); /* All data that has change in time significantly since last collection */ timechange_data = find_all_time_change_data( current_data, previous_data ); /* All data in previous that is not in current */ lost_data = find_all_lost_data( current_data, previous_data); /* At this point, we run any alert modules that are defined */ for( module = alert_new_modules; module; module = module->next ) { module->function( new_data ); } /* etc etc etc for value/time threshold and lost data */ for(...) for(...) } /* Connect our current data (which is currently not attached) to the exported filesystem */ gangliaDirAdopt( exported_filesystem, current_data ); } /* end for(;;) loop */ -------------------- end module thread pseudo-code --------------------- i hope this code is pretty clear. it over simplifies things a bit but it you look at the code in ./gangliad/gangliad.c you'll see it's not much different really. i think in my mind of a 3D molecular model. what gangliad does is analyze the molecular structure.... compare it to what the structure last was and act on those changes (jokes about heisenberg aside). each module is responsible for processing a particular branch/chain of the overall structure. you'll see that this snapshot also has a mod_ganglia2_xml module. i'll clean up the code a bit more and build some alert modules to show you how they will work very soon. -matt -- PGP fingerprint 'A7C2 3C2F 8445 AD3C 135E F40B 242A 5984 ACBC 91D3' They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety. --Benjamin Franklin, Historical Review of Pennsylvania, 1759
signature.asc
Description: This is a digitally signed message part