Dkfilter's children consuming 125 Mb memory

Discussion in 'Server Operation' started by Aldert, Jul 27, 2007.

  1. Aldert

    Aldert New Member

    Hi all,

    Very simple and short question. After I followed the howto on domainkeys and did some googling I managed to get it working. But now when I do top and sort it by % of memory usage there are 6 dkfilter.in and 6 dkfilter.out children. Summing the percentages gives a usage of about 30%, equivallent to about 125 megs of my RAM!

    How to reduce the usage? Why should there be 6 children alive? How to reduce it to like 1 or 2? There is not many mail coming in, so that much children are not needed?

    (this issue has not been, well, issued before)

    TIA and B/R from the 'windy' Netherlands,
    Aldert Berends
     
  2. falko

    falko Super Moderator ISPConfig Developer

    Is the number ofchildren set somewhere in your dkfilter init script (or the scripts included in there)?
     
  3. Aldert

    Aldert New Member

    Hello Falko!

    Hmm, none that I can see of:
    Code:
    case "$1" in
    	start-in)
    		echo -n "Starting inbound DomainKeys-filter (dkfilter.in)..."
    
    		# create directory for pid files if necessary
    		test -d $PIDDIR || mkdir -p $PIDDIR || exit 1
    
    		# start the filter
    		$DKFILTER_IN_BIN $DKFILTER_COMMON_ARGS --pidfile=$DKFILTER_IN_PID $DKFILTER_IN_ARGS
    		RETVAL=$?
    		if [ $RETVAL -eq 0 ]; then
    			echo done.
    		else
    			echo failed.
    			exit $RETVAL
    		fi
    		;;
    dkfilter.in does not say to start more children, so far I can see.

    I currently have no knowledge on C++ and moreover not on apache's variables and parameters...
     
  4. falko

    falko Super Moderator ISPConfig Developer

    Can you post the full init script?
     
  5. Aldert

    Aldert New Member

    Code:
    #!/bin/sh
    #
    # Copyright (c) 2005-2006 Messiah College.
    #
    ### BEGIN INIT INFO
    # Default-Start:  3 4 5
    # Default-Stop:   0 1 2 6
    # Description:    Runs dkfilter
    ### END INIT INFO
    
    DKFILTERUSER=dkfilter
    DKFILTERGROUP=dkfilter
    DKFILTERDIR=/usr/local/dkfilter
    
    HOSTNAME=`hostname -f`
    DOMAIN=aerotronic.nl
    DKFILTER_IN_ARGS="
    	--hostname=$HOSTNAME
    	127.0.0.1:10025 127.0.0.1:10026"
    DKFILTER_OUT_ARGS="
    	--keyfile=$DKFILTERDIR/private.key
    	--selector=m1
    	--domain=aerotronic.nl,aerotronicvds.jronline.nl
    	--method=nofws
    	--headers
    	127.0.0.1:10027 127.0.0.1:10028"
    
    DKFILTER_COMMON_ARGS="
    	--user=$DKFILTERUSER
    	--group=$DKFILTERGROUP
    	--daemonize"
    
    DKFILTER_IN_BIN="$DKFILTERDIR/bin/dkfilter.in"
    DKFILTER_OUT_BIN="$DKFILTERDIR/bin/dkfilter.out"
    
    PIDDIR=$DKFILTERDIR/var/run
    DKFILTER_IN_PID=$PIDDIR/dkfilter_in.pid
    DKFILTER_OUT_PID=$PIDDIR/dkfilter_out.pid
    
    case "$1" in
    	start-in)
    		echo -n "Starting inbound DomainKeys-filter (dkfilter.in)..."
    
    		# create directory for pid files if necessary
    		test -d $PIDDIR || mkdir -p $PIDDIR || exit 1
    
    		# start the filter
    		$DKFILTER_IN_BIN $DKFILTER_COMMON_ARGS --pidfile=$DKFILTER_IN_PID $DKFILTER_IN_ARGS
    		RETVAL=$?
    		if [ $RETVAL -eq 0 ]; then
    			echo done.
    		else
    			echo failed.
    			exit $RETVAL
    		fi
    		;;
    
    	start-out)
    		echo -n "Starting outbound DomainKeys-filter (dkfilter.out)..."
    
    		# create directory for pid files if necessary
    		test -d $PIDDIR || mkdir -p $PIDDIR || exit 1
    
    		# start the filter
    		$DKFILTER_OUT_BIN $DKFILTER_COMMON_ARGS --pidfile=$DKFILTER_OUT_PID $DKFILTER_OUT_ARGS
    		RETVAL=$?
    		if [ $RETVAL -eq 0 ]; then
    			echo done.
    		else
    			echo failed.
    			exit $RETVAL
    		fi
    		;;
    
    	stop-in)
    		echo -n "Shutting down inbound DomainKeys-filter (dkfilter.in)..."
    		if [ -f $DKFILTER_IN_PID ]; then
    			kill `cat $DKFILTER_IN_PID` && rm -f $DKFILTER_IN_PID
    			RETVAL=$?
    			[ $RETVAL -eq 0 ] && echo done. || echo failed.
    			exit $RETVAL
    		else
    			echo not running.
    		fi
    		;;
    	stop-out)
    		echo -n "Shutting down outbound DomainKeys-filter (dkfilter.out)..."
    		if [ -f $DKFILTER_OUT_PID ]; then
    			kill `cat $DKFILTER_OUT_PID` && rm -f $DKFILTER_OUT_PID
    			RETVAL=$?
    			[ $RETVAL -eq 0 ] && echo done. || echo failed.
    			exit $RETVAL
    		else
    			echo not running.
    		fi
    		;;
    	start)
    		$0 start-in && $0 start-out || exit $?
    		;;
    	stop)
    		$0 stop-in && $0 stop-out || exit $?
    		;;
    	restart)
    		$0 stop && $0 start || exit $?
    		;;
    	status)
    		echo -n "dkfilter.in..."
    		if [ -f $DKFILTER_IN_PID ]; then
    			pid=`cat $DKFILTER_IN_PID`
    			if ps -ef |grep -v grep |grep -q "$pid"; then
    				echo " running (pid=$pid)"
    			else
    				echo " stopped (pid=$pid not found)"
    			fi
    		else
    			echo " stopped"
    		fi
    		echo -n "dkfilter.out..."
    		if [ -f $DKFILTER_OUT_PID ]; then
    			pid=`cat $DKFILTER_OUT_PID`
    			if ps -ef |grep -v grep |grep -q "$pid"; then
    				echo " running (pid=$pid)"
    			else
    				echo " stopped (pid=$pid not found)"
    			fi
    		else
    			echo " stopped"
    		fi
    		;;
    	*)
    		echo "Usage: $0 {start|stop|restart|status}"
    		exit 1
    		;;
    esac
    
    Thanks for your time!
     
  6. falko

    falko Super Moderator ISPConfig Developer

    Hm, there's no indication why it starts six children for dkfilter.in and another six for dkfilter.out... :(
     
  7. Aldert

    Aldert New Member

    Indeed. Well, just a printscreen with the output of top a certain time:

    [​IMG]

    After the following:
    Code:
    -bash-3.00# /etc/init.d/dkfilter status
    dkfilter.in... running (pid=2584)
    dkfilter.out... running (pid=2593)
    -bash-3.00# /etc/init.d/dkfilter stop
    Shutting down inbound DomainKeys-filter (dkfilter.in)...done.
    Shutting down outbound DomainKeys-filter (dkfilter.out)...done.
    -bash-3.00# /etc/init.d/dkfilter start
    Starting inbound DomainKeys-filter (dkfilter.in)...running
    done.
    Starting outbound DomainKeys-filter (dkfilter.out)...running
    done.
    Still 6 children, with new pids of course. May be it is a good idea ask the designer to take a look at it?
     
  8. falko

    falko Super Moderator ISPConfig Developer

    Yes, I think he can explain it. :)
     

Share This Page