From 12b92b39596dacff3703395a835b4cd8e37f2bcb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Fri, 19 May 2006 13:46:14 +0000 Subject: [PATCH] megajob --- org.glite.lb.client/Makefile | 8 +++----- org.glite.lb.client/src/perftest_logjobs.c | 30 ++++++++++++++++++++++++++++- org.glite.lb.common/Makefile | 13 ++----------- org.glite.lb.common/interface/lb_perftest.h | 2 +- org.glite.lb.common/src/lb_perftest.c | 4 ++-- org.glite.lb.logger/Makefile | 10 +++++----- org.glite.lb.logger/src/logd.c | 7 +++++++ org.glite.lb.logger/src/logd_proto.c | 13 +++++++++---- org.glite.lb.logger/src/send_event.c | 2 +- org.glite.lb.proxy/Makefile | 16 +++++++++------ org.glite.lb.proxy/src/lbproxy.c | 7 +++++++ org.glite.lb.server/Makefile | 10 ++++++++-- org.glite.lb.server/src/stored_master.c | 6 +++++- 13 files changed, 89 insertions(+), 39 deletions(-) diff --git a/org.glite.lb.client/Makefile b/org.glite.lb.client/Makefile index 823c98b..01861ee 100644 --- a/org.glite.lb.client/Makefile +++ b/org.glite.lb.client/Makefile @@ -74,12 +74,9 @@ endif ifdef LB_PERF LB_PERF_FLAGS:=-DLB_PERF -DLB_PERF_DROP LB_PERF_TOOLS:=perftest_logjobs - COMMON_LIB:=-lglite_lb_common_perf_${nothrflavour} - COMMON_LIB_THR:=-lglite_lb_common_perf_${thrflavour} -else - COMMON_LIB:=-lglite_lb_common_${nothrflavour} - COMMON_LIB_THR:=-lglite_lb_common_${thrflavour} endif +COMMON_LIB:=-lglite_lb_common_${nothrflavour} +COMMON_LIB_THR:=-lglite_lb_common_${thrflavour} CFLAGS:=${DEBUG} \ -I${top_srcdir}/src -I${top_srcdir}/interface \ @@ -315,6 +312,7 @@ endif ${INSTALL} -m 755 "$$p" "${PREFIX}/examples/glite-lb-$$p"; \ done ${INSTALL} -m 755 ${top_srcdir}/examples/export.sh "${PREFIX}/examples/glite-lb-export.sh" + ${INSTALL} -m 755 ${top_srcdir}/examples/log_dag.sh "${PREFIX}/examples/glite-lb-log_dag.sh" ${INSTALL} -m 644 ${MAN_GZ} ${PREFIX}/share/man/man1 clean: diff --git a/org.glite.lb.client/src/perftest_logjobs.c b/org.glite.lb.client/src/perftest_logjobs.c index c085e97..54dcaf9 100644 --- a/org.glite.lb.client/src/perftest_logjobs.c +++ b/org.glite.lb.client/src/perftest_logjobs.c @@ -3,9 +3,12 @@ #include #include #include - +#include "glite/lb/context-int.h" #include "glite/lb/lb_perftest.h" +extern int edg_wll_DoLogEvent(edg_wll_Context context, edg_wll_LogLine logline); +extern int edg_wll_DoLogEventProxy(edg_wll_Context context, edg_wll_LogLine logline); + /* extern char *optarg; extern int opterr,optind; @@ -68,8 +71,12 @@ main(int argc, char *argv[]) { char *destname= NULL,*testname = NULL,*filename = NULL; + char *event; int lbproxy = 0, num_jobs = 1; int opt; + edg_wll_Context ctx; + + edg_wll_InitContext(&ctx); opterr = 0; @@ -104,6 +111,27 @@ main(int argc, char *argv[]) fprintf(stderr,"%s: glite_wll_perftest_init failed\n",argv[0]); } + while (glite_wll_perftest_produceEventString(&event)) { + if (lbproxy) { + ctx->p_tmp_timeout = ctx->p_sync_timeout; + if (edg_wll_DoLogEventProxy(ctx,event)) { + char *et,*ed; + edg_wll_Error(ctx,&et,&ed); + fprintf(stderr,"edg_wll_DoLogEvent(): %s (%s)\n",et,ed); + exit(1); + } + } else { + ctx->p_tmp_timeout = ctx->p_log_timeout; + if (edg_wll_DoLogEvent(ctx,event)) { + char *et,*ed; + edg_wll_Error(ctx,&et,&ed); + fprintf(stderr,"edg_wll_DoLogEvent(): %s (%s)\n",et,ed); + exit(1); + } + + } + } + edg_wll_FreeContext(ctx); return 0; } diff --git a/org.glite.lb.common/Makefile b/org.glite.lb.common/Makefile index 5ec89e2..fa3b1b1 100644 --- a/org.glite.lb.common/Makefile +++ b/org.glite.lb.common/Makefile @@ -41,10 +41,8 @@ else JOBID_LIB:=-lglite_wmsutils_cjobid endif -ifdef LB_PERF - PERF_HDRS:=lb_perftest.h - PERF_OBJS:=lb_perftest.o -endif +PERF_HDRS:=lb_perftest.h +PERF_OBJS:=lb_perftest.o CFLAGS:=${DEBUG} -I${top_srcdir}/src -I${top_srcdir}/interface \ -I. \ @@ -111,17 +109,10 @@ HDRS:=context-int.h lb_plain_io.h mini_http.h authz.h xml_parse.h \ xml_conversions.h log_proto.h events_parse.h il_string.h il_msg.h \ escape.h ulm_parse.h trio.h lb_maildir.h ${PERF_HDRS} -ifdef LB_PERF -STATICLIB:=libglite_lb_common_perf_${nothrflavour}.a -THRSTATICLIB:=libglite_lb_common_perf_${thrflavour}.a -LTLIB:=libglite_lb_common_perf_${nothrflavour}.la -THRLTLIB:=libglite_lb_common_perf_${thrflavour}.la -else STATICLIB:=libglite_lb_common_${nothrflavour}.a THRSTATICLIB:=libglite_lb_common_${thrflavour}.a LTLIB:=libglite_lb_common_${nothrflavour}.la THRLTLIB:=libglite_lb_common_${thrflavour}.la -endif REPORTS:=${top_srcdir}/reports diff --git a/org.glite.lb.common/interface/lb_perftest.h b/org.glite.lb.common/interface/lb_perftest.h index 2e8399b..4a4fc11 100644 --- a/org.glite.lb.common/interface/lb_perftest.h +++ b/org.glite.lb.common/interface/lb_perftest.h @@ -27,7 +27,7 @@ int glite_wll_perftest_consumeEventString(const char *event_string); int -glite_wll_perftest_consumeEventIlMsg(const char *msg, int len); +glite_wll_perftest_consumeEventIlMsg(const char *msg); int glite_wll_perftest_createJobId(const char *bkserver, diff --git a/org.glite.lb.common/src/lb_perftest.c b/org.glite.lb.common/src/lb_perftest.c index c41b0d4..38e3904 100644 --- a/org.glite.lb.common/src/lb_perftest.c +++ b/org.glite.lb.common/src/lb_perftest.c @@ -370,7 +370,7 @@ glite_wll_perftest_consumeEventString(const char *event_string) int -glite_wll_perftest_consumeEventIlMsg(const char *msg, int len) +glite_wll_perftest_consumeEventIlMsg(const char *msg) { int ret = 0; char *event; @@ -383,7 +383,7 @@ glite_wll_perftest_consumeEventIlMsg(const char *msg, int len) gettimeofday(&endtime, NULL); /* decode event */ - if(decode_il_msg(&event, msg+17) < 0) { + if(decode_il_msg(&event, msg) < 0) { fprintf(stderr, "PERFTEST: error decoding consumed event, aborting!\n"); abort(); } diff --git a/org.glite.lb.logger/Makefile b/org.glite.lb.logger/Makefile index a15f26f..6eadf70 100644 --- a/org.glite.lb.logger/Makefile +++ b/org.glite.lb.logger/Makefile @@ -125,13 +125,13 @@ glite_lb_logd: ${LOGD_OBJS} ${LINK} -o $@ ${LOGD_OBJS} ${COMMON_LIB}_${nothrflavour} glite_lb_logd_perf: ${LOGD_OBJS} - ${LINK} -o $@ ${LOGD_OBJS} ${COMMON_LIB}_perf_${nothrflavour} + ${LINK} -o $@ ${LOGD_OBJS} ${COMMON_LIB}_${nothrflavour} glite_lb_logd_nofile: ${LOGD_NOBJS} ${LINK} -o $@ ${LOGD_NOBJS} ${COMMON_LIB}_${nothrflavour} glite_lb_logd_perf_nofile: ${LOGD_NOBJS} - ${LINK} -o $@ ${LOGD_NOBJS} ${COMMON_LIB}_perf_${nothrflavour} + ${LINK} -o $@ ${LOGD_NOBJS} ${COMMON_LIB}_${nothrflavour} glite_lb_interlogd: ${INTERLOG_OBJS} ${LINK} -o $@ ${INTERLOG_OBJS} ${COMMON_LIB}_${thrflavour} @@ -140,14 +140,14 @@ glite_lb_notif_interlogd: ${INTERLOG_NOBJS} ${LINK} -o $@ ${INTERLOG_NOBJS} ${COMMON_LIB}_${thrflavour} glite_lb_interlogd_perf: ${INTERLOG_OBJS} - ${LINK} -o $@ ${INTERLOG_OBJS} ${COMMON_LIB}_perf_${thrflavour} + ${LINK} -o $@ ${INTERLOG_OBJS} ${COMMON_LIB}_${thrflavour} glite_lb_interlogd_perf_empty: ${INTERLOG_EMPTY_OBJS} - ${LINK} -o $@ ${INTERLOG_EMPTY_OBJS} ${COMMON_LIB}_perf_${thrflavour} + ${LINK} -o $@ ${INTERLOG_EMPTY_OBJS} ${COMMON_LIB}_${thrflavour} glite_lb_interlogd_perf_inline_empty: ${INTERLOG_INLINE_EMPTY_OBJS} ${LINK} -o $@ ${INTERLOG_INLINE_EMPTY_OBJS} \ - ${COMMON_LIB}_perf_${thrflavour} + ${COMMON_LIB}_${thrflavour} stage: compile $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes diff --git a/org.glite.lb.logger/src/logd.c b/org.glite.lb.logger/src/logd.c index 6c253b1..e062f90 100644 --- a/org.glite.lb.logger/src/logd.c +++ b/org.glite.lb.logger/src/logd.c @@ -17,6 +17,9 @@ #include "logd_proto.h" #include "glite/lb/consumer.h" #include "glite/security/glite_gss.h" +#ifdef LB_PERF +#include "glite/lb/lb_perftest.h" +#endif static const char rcsid[] = "@(#)$Id$"; static int verbose = 0; @@ -326,6 +329,10 @@ Copyright (c) 2002 CERN, INFN and CESNET on behalf of the EU DataGrid.\n"); if (mysignal(SIGTERM, handle_signal) == SIG_ERR) { perror("signal"); exit(1); } if (mysignal(SIGCHLD, handle_signal) == SIG_ERR) { perror("signal"); exit(1); } +#ifdef LB_PERF + glite_wll_perftest_init(NULL, NULL, NULL, NULL, 0); +#endif + edg_wll_gss_watch_creds(cert_file,&cert_mtime); /* XXX DK: support noAuth */ ret = edg_wll_gss_acquire_cred_gsi(cert_file, key_file, &cred, &my_subject_name, diff --git a/org.glite.lb.logger/src/logd_proto.c b/org.glite.lb.logger/src/logd_proto.c index b820dd4..f39b24d 100644 --- a/org.glite.lb.logger/src/logd_proto.c +++ b/org.glite.lb.logger/src/logd_proto.c @@ -463,16 +463,21 @@ int edg_wll_log_proto_server(edg_wll_GssConnection *con, char *name, char *prefi /* if not command, save message to file */ +#ifdef LOGD_NOFILE + edg_wll_ll_log(LOG_DEBUG,"Calling perftest\n"); + glite_wll_perftest_consumeEventString(msg); + edg_wll_ll_log(LOG_DEBUG,"o.k.\n"); + filepos = 0; +#else if(strstr(msg, "DG.TYPE=\"command\"") == NULL) { /* compose the name of the log file */ -// edg_wll_ll_log(LOG_DEBUG,"Composing filename from prefix \"%s\" and jobId \"%s\"...",prefix,jobId); + edg_wll_ll_log(LOG_DEBUG,"Composing filename from prefix \"%s\" and jobId \"%s\"...",prefix,jobId); count = strlen(prefix); strncpy(outfilename,prefix,count); count_total=count; strncpy(outfilename+count_total,".",1); count_total+=1; count=strlen(jobId); strncpy(outfilename+count_total,jobId,count); count_total+=count; outfilename[count_total]='\0'; -// edg_wll_ll_log(LOG_DEBUG,"o.k.\n"); -#ifndef LOGD_NOFILE + edg_wll_ll_log(LOG_DEBUG,"o.k.\n"); edg_wll_ll_log(LOG_INFO,"Writing message to \"%s\"...",outfilename); i = 0; @@ -487,10 +492,10 @@ open_event_file: free(errd); goto edg_wll_log_proto_server_end; } else edg_wll_ll_log(LOG_INFO,"o.k."); -#endif } else { filepos = 0; } +#endif /* if not priority send now the answer back to client */ diff --git a/org.glite.lb.logger/src/send_event.c b/org.glite.lb.logger/src/send_event.c index 750374b..dc33757 100644 --- a/org.glite.lb.logger/src/send_event.c +++ b/org.glite.lb.logger/src/send_event.c @@ -277,7 +277,7 @@ event_queue_send(struct event_queue *eq) } #ifdef LB_PERF } else { - glite_wll_perftest_consumeEventIlMsg(msg->msg); + glite_wll_perftest_consumeEventIlMsg(msg->msg+17); code = LB_OK; } #endif diff --git a/org.glite.lb.proxy/Makefile b/org.glite.lb.proxy/Makefile index 147c1dd..c435469 100644 --- a/org.glite.lb.proxy/Makefile +++ b/org.glite.lb.proxy/Makefile @@ -31,6 +31,13 @@ AT3=perl -I${top_srcdir}/project ${top_srcdir}/project/at3 TEST_LIBS:=-L${cppunit_prefix}/lib -lcppunit TEST_INC:=-I${cppunit_prefix}/include +ifdef LB_PERF + STATIC_LIB_BK:=${stagedir}/lib/libglite_lb_bkserver_perf.a + LB_PERF_FLAGS:=-DLB_PERF +else + STATIC_LIB_BK:=${stagedir}/lib/libglite_lb_bkserver.a +endif + SUFFIXES = .T DEBUG:=-g -O0 -Wall @@ -48,7 +55,7 @@ CFLAGS:= ${DEBUG} \ -I${mysql_prefix}/include -I${mysql_prefix}/include/mysql \ -I${globus_prefix}/include/${nothrflavour} \ -I${gridsite_prefix}/include -I${globus_prefix}/include/${nothrflavour}/openssl \ - -D_GNU_SOURCE ${LB_STANDALONE_FLAGS} + -D_GNU_SOURCE ${LB_STANDALONE_FLAGS} ${LB_PERF_FLAGS} LINK:=libtool --mode=link ${CC} ${LDFLAGS} @@ -74,9 +81,6 @@ endif SRVBONES_LIB:= -L${stagedir}/lib -lglite_lb_server_bones -LB_SERVER_SHARE_LIB:=${stagedir}/lib/libglite_lb_bkserver.a -LB_PROXY_COMMON_LIB:= -L${stagedir}/lib -lglite_lb_common_${nothrflavour} -COMMON_LIBS:= -L${stagedir}/lib -lglite_lb_common_${nothrflavour} -lglite_security_gss_${nothrflavour} GRIDSITE_LIBS = -lgridsite_globus `xml2-config --libs` vomsflavour := _${nothrflavour} @@ -98,7 +102,7 @@ EXT_LIBS:= \ LB_PROXY_LIBS:= \ - ${LB_SERVER_SHARE_LIB} \ + ${STATIC_LIB_BK} \ ${SRVBONES_LIB} \ -lglite_lb_common_${nothrflavour} \ -lglite_security_gss_${nothrflavour} \ @@ -106,7 +110,7 @@ LB_PROXY_LIBS:= \ -glite_lb_proxy: lbproxy.o fake_write2rgma.o ${LB_SERVER_SHARE_LIB} +glite_lb_proxy: lbproxy.o fake_write2rgma.o ${STATIC_LIB_BK} @echo DEBUG: mysql_version=${mysql_version} mysql_prefix=${mysql_prefix} @echo DEBUG: shell: x$(shell echo ${mysql_version} | cut -d. -f1,2)x ${LINK} -o $@ lbproxy.o fake_write2rgma.o ${LB_PROXY_LIBS} diff --git a/org.glite.lb.proxy/src/lbproxy.c b/org.glite.lb.proxy/src/lbproxy.c index c7d5329..4f209c9 100644 --- a/org.glite.lb.proxy/src/lbproxy.c +++ b/org.glite.lb.proxy/src/lbproxy.c @@ -27,6 +27,9 @@ #include "glite/lb/srvbones.h" #include "glite/lb/context.h" #include "glite/lb/context-int.h" +#ifdef LB_PERF +#include "glite/lb/lb_perftest.h" +#endif extern int edg_wll_DBCheckVersion(edg_wll_Context); extern edg_wll_ErrorCode edg_wll_Open(edg_wll_Context ctx, char *cs); @@ -340,6 +343,10 @@ int clnt_data_init(void **data) cdata->mysql = ctx->mysql; edg_wll_FreeContext(ctx); +#ifdef LB_PERF + glite_wll_perftest_init(NULL, NULL, NULL, NULL, 0); +#endif + *data = cdata; return 0; } diff --git a/org.glite.lb.server/Makefile b/org.glite.lb.server/Makefile index f12c373..271703a 100644 --- a/org.glite.lb.server/Makefile +++ b/org.glite.lb.server/Makefile @@ -34,6 +34,13 @@ ifdef LB_STANDALONE # GLITE_LB_SERVER_WITH_WS=no endif +ifdef LB_PERF + STATIC_LIB_BK:=libglite_lb_bkserver_perf.a + LB_PERF_FLAGS:=-DLB_PERF +else + STATIC_LIB_BK:=libglite_lb_bkserver.a +endif + ifeq ($(GLITE_LB_SERVER_WITH_WS),yes) WS_CFLAGS=-DGLITE_LB_SERVER_WITH_WS NSMAP=LoggingAndBookkeeping.nsmap @@ -74,7 +81,7 @@ CFLAGS:= \ -I${mysql_prefix}/include -I${mysql_prefix}/include/mysql \ -I${globus_prefix}/include/${nothrflavour} \ $(GRIDSITE_CFLAGS) \ - -D_GNU_SOURCE ${LB_STANDALONE_FLAGS} + -D_GNU_SOURCE ${LB_STANDALONE_FLAGS} ${LB_PERF_FLAGS} TEST_LIBS:=-L${cppunit_prefix}/lib -lcppunit TEST_INC:=-I${cppunit_prefix}/include @@ -203,7 +210,6 @@ LIB_OBJS_BK:= \ lock.o openserver.o query.o userjobs.o db_store.o request.o store.o \ stored_master.o srv_purge.o server_state.o dump.o lb_authz.o load.o \ notification.o il_notification.o notif_match.o stats.o -STATIC_LIB_BK:=libglite_lb_bkserver.a glite_lb_bkserverd: ${NSMAP} ${BKSERVER_OBJS} ${LINKXX} -o $@ ${BKSERVER_OBJS} ${BKSERVER_LIBS} diff --git a/org.glite.lb.server/src/stored_master.c b/org.glite.lb.server/src/stored_master.c index c2ca48d..5e1100e 100644 --- a/org.glite.lb.server/src/stored_master.c +++ b/org.glite.lb.server/src/stored_master.c @@ -107,12 +107,16 @@ int edg_wll_StoreProtoProxy(edg_wll_Context ctx) edg_wll_ResetError(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 ( !(ret = handle_request(ctx, buf)) ) { if ( (err = edg_wll_Error(ctx, NULL, &errd)) ) edg_wll_ResetError(ctx); } +#endif free(buf); + if ( (len = create_reply(ctx, &buf)) > 0 ) { if ( edg_wll_plain_write_full(&ctx->connProxy->conn, buf, len, &ctx->p_tmp_timeout) < 0 ) { if ( errd ) free(errd); -- 1.8.2.3