megajob
authorAleš Křenek <ljocha@ics.muni.cz>
Fri, 26 May 2006 13:48:46 +0000 (13:48 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Fri, 26 May 2006 13:48:46 +0000 (13:48 +0000)
org.glite.lb.proxy/Makefile
org.glite.lb.proxy/src/lbproxy.c
org.glite.lb.server/Makefile
org.glite.lb.server/interface/srv_perf.h [new file with mode: 0644]
org.glite.lb.server/src/bkserverd.c
org.glite.lb.server/src/db_store.c
org.glite.lb.server/src/stored_master.c

index c435469..282052f 100644 (file)
@@ -115,6 +115,9 @@ glite_lb_proxy: lbproxy.o fake_write2rgma.o ${STATIC_LIB_BK}
        @echo DEBUG: shell: x$(shell echo ${mysql_version} | cut -d. -f1,2)x
        ${LINK} -o $@ lbproxy.o fake_write2rgma.o ${LB_PROXY_LIBS}
 
+glite_lb_proxy_perf: lbproxy.o fake_write2rgma.o ${STATIC_LIB_BK}
+       ${LINK} -o $@ lbproxy.o fake_write2rgma.o ${LB_PROXY_LIBS}
+
 default all: compile
 
 compile: glite_lb_proxy
index 2d8cfaa..892b305 100644 (file)
@@ -29,6 +29,9 @@
 #include "glite/lb/context-int.h"
 #ifdef LB_PERF
 #include "glite/lb/lb_perftest.h"
+#include "glite/lb/srv_perf.h"
+
+enum lb_srv_perf_sink sink_mode;
 #endif
 
 extern int edg_wll_DBCheckVersion(edg_wll_Context);
@@ -90,10 +93,17 @@ static struct option opts[] = {
        {"pidfile",             1, NULL,        'i'},
        {"proxy-il-sock",       1, NULL,        'X'},
        {"proxy-il-fprefix",    1, NULL,        'Y'},
+#ifdef LB_PERF
+       {"perf-sink",           1, NULL,        'K'},
+#endif
        {NULL,0,NULL,0}
 };
 
-static const char *get_opt_string = "p:c:dm:s:l:i:X:Y:z";
+static const char *get_opt_string = "p:c:dm:s:l:i:X:Y:z"
+#ifdef LB_PERF
+       "K:"
+#endif
+;
 
 static void usage(char *me) 
 {
@@ -108,6 +118,9 @@ static void usage(char *me)
                "\t--proxy-il-sock\t socket to send events to\n"
                "\t--proxy-il-fprefix\t file prefix for events\n"
                "\t--silent\t don't print diagnostic, even if -d is on\n"
+#ifdef LB_PERF
+               "\t--perf-sink\t where to sink events\n"
+#endif
        ,me);
 }
 
@@ -176,6 +189,9 @@ int main(int argc, char *argv[])
                case 'X': lbproxy_ilog_socket_path = strdup(optarg); break;
                case 'Y': lbproxy_ilog_file_prefix = strdup(optarg); break;
                case 'i': strcpy(pidfile, optarg); break;
+#ifdef LB_PERF
+               case 'K': sink_mode = atoi(optarg); break;
+#endif
                case '?': usage(name); return 1;
        }
 
index 271703a..cb46f41 100644 (file)
@@ -355,6 +355,7 @@ install:
                if [ x${LB_STANDALONE} = x ]; then \
                        ${INSTALL} -m 755 ${PLUGIN_LIB} ${PREFIX}/lib; \
                fi; \
+               ${INSTALL} -m 644 ${top_srcdir}/interface/srv_perf.h ${PREFIX}/include/${globalprefix}/${lbprefix}; \
        fi
 
 clean:
diff --git a/org.glite.lb.server/interface/srv_perf.h b/org.glite.lb.server/interface/srv_perf.h
new file mode 100644 (file)
index 0000000..621a60e
--- /dev/null
@@ -0,0 +1,10 @@
+enum lb_srv_perf_sink {
+       GLITE_LB_SINK_NONE = 0,
+       GLITE_LB_SINK_PARSE,
+       GLITE_LB_SINK_STORE,
+       GLITE_LB_SINK_STATE,
+       GLITE_LB_SINK_SEND,
+};
+
+
+extern enum lb_srv_perf_sink sink_mode;
index 8b80c7d..03aa2b4 100644 (file)
 #include "glite/lb/context-int.h"
 #include "glite/lb/lb_maildir.h"
 
+#ifdef LB_PERF
+#include "glite/lb/lb_perftest.h"
+#include "glite/lb/srv_perf.h"
+
+enum lb_srv_perf_sink sink_mode;
+#endif
+
 #include "lb_http.h"
 #include "lb_proto.h"
 #include "index.h"
@@ -166,14 +173,20 @@ static struct option opts[] = {
        {"count-statistics",    1, NULL,        'T'},
        {"request-timeout",     1, NULL,        't'},
        {"silent",      0, NULL, 'z' },
+#ifdef LB_PERF
+       {"perf-sink",           1, NULL,        'K'},
+#endif
        {NULL,0,NULL,0}
 };
 
+static const char *get_opt_string = "a:c:k:C:V:p:drm:ns:l:L:N:i:S:D:X:Y:T:t:J:jz"
 #ifdef GLITE_LB_SERVER_WITH_WS
-static const char *get_opt_string = "a:c:k:C:V:p:w:drm:ns:l:L:N:i:S:D:X:Y:T:t:J:jz";
-#else
-static const char *get_opt_string = "a:c:k:C:V:p:drm:ns:l:L:N:i:S:D:X:Y:T:t:J:jz";
-#endif /* GLITE_LB_SERVER_WITH_WS */
+       "w:"
+#endif
+#ifdef LB_PERF
+       "K:"
+#endif
+;
 
 static void usage(char *me) 
 {
@@ -210,6 +223,10 @@ static void usage(char *me)
                "\t--count-statistics=1\t count certain statistics on jobs\n"
                "\t                  =2\t ... and allow anonymous access\n"
                "\t--silent\t don't print diagnostic, even if -d is on\n"
+#ifdef LB_PERF
+               "\t--perf-sink\t where to sink events\n"
+#endif
+
        ,me);
 }
 
index 13a56fd..edf0b2f 100644 (file)
 #include "lock.h"
 #include "il_lbproxy.h"
 
+#ifdef LB_PERF
+#include "glite/lb/lb_perftest.h"
+#include "glite/lb/srv_perf.h"
+#endif
+
+
 /* XXX */
 #define use_db 1
 
@@ -37,6 +43,16 @@ db_store(edg_wll_Context ctx,char *ucs, char *event)
   if(edg_wll_ParseEvent(ctx, event, &ev))
     goto err;
 
+#ifdef LB_PERF
+  if (sink_mode == GLITE_LB_SINK_STORE) {
+         glite_wll_perftest_consumeEvent(ev);
+         edg_wll_FreeEvent(ev);
+         free(ev);
+         return 0;
+  }
+#endif
+
+
   /* XXX: if event type is user tag, convert the tag name to lowercase!
    *     (not sure whether to convert a value too is reasonable
    *     or keep it 'case sensitive')
@@ -64,8 +80,17 @@ db_store(edg_wll_Context ctx,char *ucs, char *event)
                        ev->changeACL.user_id, ev->changeACL.user_id_type,
                        ev->changeACL.permission, ev->changeACL.permission_type,
                        ev->changeACL.operation);
-  else
+  else {
+#ifdef LB_PERF
+    if(sink_mode == GLITE_LB_SINK_STATE) {
+            glite_wll_perftest_consumeEvent(ev);
+            edg_wll_UnlockJob(ctx,ev->any.jobId);
+            goto err;
+    }
+#endif
+
     err = edg_wll_StepIntState(ctx,ev->any.jobId, ev, seq, ctx->isProxy? NULL: &newstat);
+  }
 
   if (edg_wll_UnlockJob(ctx,ev->any.jobId)) goto err;
   if (err) goto err;
index 5e1100e..ed78612 100644 (file)
 
 #include "store.h"
 
+#ifdef LB_PERF
+#include "srv_perf.h"
+#endif
+
 
 static
 int
@@ -108,12 +112,12 @@ int edg_wll_StoreProtoProxy(edg_wll_Context ctx)
        ret = read_il_data(ctx, &buf, gss_plain_reader);
        if ( ret < 0 ) return(ret);
 #ifdef LB_PERF
-       glite_wll_perftest_consumeEventIlMsg(buf);
-#else
+       if (sink_mode == GLITE_LB_SINK_PARSE) glite_wll_perftest_consumeEventIlMsg(buf);
+       else
+#endif
        if ( !(ret = handle_request(ctx, buf)) ) {
                if ( (err = edg_wll_Error(ctx, NULL, &errd)) ) edg_wll_ResetError(ctx);
        }
-#endif
        free(buf);