Winbind patch fixes broken client. Please have a look.

Hannes Schmidt mail at schmidt-net.via.t-online.de
Mon Aug 5 09:22:04 GMT 2002


Hi Andrew. Hi all.

Andrew Bartlett wrote:

> Can you write up a little prog based on wbinfo for me?
> 
> wbinfo have a '--ping' command.  Write a prog that does this, and
> measurees pings/second.
> 
> Make on version that re-opens the socket, the other that keeps it
> around.
> 
> This should show us the performance issue.
> 

I did benchmarks on wbinfo -p and on wbinfo -n. The performance impact of opening and 
closing the socket for every request is moderate. It roughly doubles the time needed. 
The benchmarks also show that winbind performance is very good, no matter whether 
the socket is left open or not. It does ten thousand name-to-sid lookups per  second! Of 
course that is all information which is cached locally and if winbindd has to fetch it from
the DC, a request will take much longer and the close_sock() issue will have even less 
influence.

Do you think it's worth keeping the socket open and implementing all the necessary 
precautions?

--- BENCHMARK RESULTS ---

Tests were done using a vanilla 2.5.5 source tree.

'wbinfo -p' with close_sock()
average: 0.833132, standard derivation 0.020328
    hulk:~/samba-2.2.5/source/bin # while true; do ./wbinfo -p; done
    10000 successful 'ping(s)' to winbindd took 0.835437 seconds
    10000 successful 'ping(s)' to winbindd took 0.836908 seconds
    10000 successful 'ping(s)' to winbindd took 0.820883 seconds
    10000 successful 'ping(s)' to winbindd took 0.843827 seconds
    10000 successful 'ping(s)' to winbindd took 0.827916 seconds
    10000 successful 'ping(s)' to winbindd took 0.806194 seconds
    10000 successful 'ping(s)' to winbindd took 0.825855 seconds
    10000 successful 'ping(s)' to winbindd took 0.835930 seconds
    10000 successful 'ping(s)' to winbindd took 0.830178 seconds
    10000 successful 'ping(s)' to winbindd took 0.806163 seconds
    10000 successful 'ping(s)' to winbindd took 0.818367 seconds
    10000 successful 'ping(s)' to winbindd took 0.836038 seconds
    10000 successful 'ping(s)' to winbindd took 0.807360 seconds
    10000 successful 'ping(s)' to winbindd took 0.840921 seconds
    10000 successful 'ping(s)' to winbindd took 0.854113 seconds
    10000 successful 'ping(s)' to winbindd took 0.860330 seconds
    10000 successful 'ping(s)' to winbindd took 0.902387 seconds
    10000 successful 'ping(s)' to winbindd took 0.822661 seconds
    10000 successful 'ping(s)' to winbindd took 0.832270 seconds
    10000 successful 'ping(s)' to winbindd took 0.848825 seconds
    10000 successful 'ping(s)' to winbindd took 0.816804 seconds
    10000 successful 'ping(s)' to winbindd took 0.834832 seconds
    10000 successful 'ping(s)' to winbindd took 0.825558 seconds
    10000 successful 'ping(s)' to winbindd took 0.825420 seconds
    
'wbinfo -p' without close_sock()
average 0.417645, derivation 0.009147
    hulk:~/samba-2.2.5/source/bin # while true; do ./wbinfo -p; done
    10000 successful 'ping(s)' to winbindd took 0.441577 seconds
    10000 successful 'ping(s)' to winbindd took 0.430498 seconds
    10000 successful 'ping(s)' to winbindd took 0.413202 seconds
    10000 successful 'ping(s)' to winbindd took 0.407783 seconds
    10000 successful 'ping(s)' to winbindd took 0.420399 seconds
    10000 successful 'ping(s)' to winbindd took 0.421895 seconds
    10000 successful 'ping(s)' to winbindd took 0.413579 seconds
    10000 successful 'ping(s)' to winbindd took 0.412236 seconds
    10000 successful 'ping(s)' to winbindd took 0.430298 seconds
    10000 successful 'ping(s)' to winbindd took 0.420147 seconds
    10000 successful 'ping(s)' to winbindd took 0.422493 seconds
    10000 successful 'ping(s)' to winbindd took 0.414776 seconds
    10000 successful 'ping(s)' to winbindd took 0.419185 seconds
    10000 successful 'ping(s)' to winbindd took 0.407816 seconds
    10000 successful 'ping(s)' to winbindd took 0.423022 seconds
    10000 successful 'ping(s)' to winbindd took 0.422444 seconds
    10000 successful 'ping(s)' to winbindd took 0.413424 seconds
    10000 successful 'ping(s)' to winbindd took 0.408743 seconds
    10000 successful 'ping(s)' to winbindd took 0.407335 seconds
    10000 successful 'ping(s)' to winbindd took 0.417861 seconds
    10000 successful 'ping(s)' to winbindd took 0.429694 seconds
    10000 successful 'ping(s)' to winbindd took 0.412602 seconds
    10000 successful 'ping(s)' to winbindd took 0.408925 seconds
    10000 successful 'ping(s)' to winbindd took 0.403548 seconds

wbinfo -n with close_sock()
average 1.085709, derivation 0,008246
    hulk:~/samba-2.2.5/source/bin # while true; do ./wbinfo -n Gast; done
    10000 successful name lookups to winbindd took 1.086192 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.096187 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.086017 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.067051 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.085589 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.082172 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.102654 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.079996 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.095484 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.082117 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.089172 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.097867 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.086276 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.082187 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.090938 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.087968 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.075475 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.086678 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.076389 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.081573 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.082186 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.096906 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.084804 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 1.075145 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1

wbinfo -n with close_sock()
average 0.620905, derivation 0,032128
    hulk:~/samba-2.2.5/source/bin # while true; do ./wbinfo -n Gast; done
    10000 successful name lookups to winbindd took 0.608197 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.654928 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.595833 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.651956 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.580442 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.656078 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.589018 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.646496 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.601220 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.647956 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.584196 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.644763 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.586220 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.653557 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.596373 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.650961 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.585603 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.661689 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.578761 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.646142 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.604084 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.648143 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.575531 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1
    10000 successful name lookups to winbindd took 0.653561 seconds
    S-1-5-21-796845957-1580436667-1957994488-501 1


--- MODIFIED FUNCTION IN WB_COMMON.C ---

    NSS_STATUS winbindd_request(int req_type, 
                     struct winbindd_request *request,
                     struct winbindd_response *response)
    {
        NSS_STATUS status;
    
        status = winbindd_send_request(req_type, request);
        if (status == NSS_STATUS_SUCCESS) {
            status = winbindd_get_response(response);
        }
        close_sock();
        return status;
    }

    The close_sock() function is commented out for second part
    of test. The vanilla 2.5.5 source doesn't do a close_sock(),
    so second part of test resembles the current 2.5.5 
    behaviour.


--- MODIFIED FUNCTIONS IN WBINFO.C ---

    static BOOL wbinfo_ping(void)
    {
        NSS_STATUS result;
        struct timeval tv1, tv2;
        struct timezone tz;
        int i, n = 10000;
        long diff;
        
        if( 0 != gettimeofday( &tv1, &tz ) ) {
            printf( "gettimeofday() failed\n" );
        }    
        for( i = 0; i < n; i++ ) {
            result = winbindd_request(WINBINDD_PING, NULL, NULL);
            if( result != NSS_STATUS_SUCCESS ) break;
        }
        if( 0 != gettimeofday( &tv2, &tz ) ) {
            printf( "gettimeofday() failed\n" );
        }    
    
        /* Display response */
        diff = ( tv2.tv_sec - tv1.tv_sec ) * 1000000 + tv2.tv_usec - tv1.tv_usec;
        printf("%d successful 'ping(s)' to winbindd took %d.%06d seconds\n", i, diff / 1000000, diff % 1000000 );
    
        return result == NSS_STATUS_SUCCESS;
    }
    
    static BOOL wbinfo_lookupname(char *name)
    {
        struct winbindd_request request;
        struct winbindd_response response;
            NSS_STATUS status;
        struct timeval tv1, tv2;
        struct timezone tz;
        int i, n = 10000;
        long diff;
    
        /* Send off request */
    
        ZERO_STRUCT(request);
        ZERO_STRUCT(response);
    
        parse_wbinfo_domain_user(name, request.data.name.dom_name, 
                     request.data.name.name);
    
        if( 0 != gettimeofday( &tv1, &tz ) ) {
            printf( "gettimeofday() failed\n" );
        }
        for( i = 0; i < n; i++ ) {
          status = winbindd_request(WINBINDD_LOOKUPNAME, &request, &response);
          if ( status != NSS_STATUS_SUCCESS ) break;
        }
        if( 0 != gettimeofday( &tv2, &tz ) ) {
            printf( "gettimeofday() failed\n" );
        }
    
        /* Display response */
        diff = ( tv2.tv_sec - tv1.tv_sec ) * 1000000 + tv2.tv_usec - tv1.tv_usec;
        printf( "%d successful name lookups to winbindd took %d.%06d seconds\n", 
            i, diff / 1000000, diff % 1000000 );
    
        if( status != NSS_STATUS_SUCCESS ) return False;
    
        printf("%s %d\n", response.data.sid.sid, response.data.sid.type);
    
        return True;
    }

--- TEST SYSTEM ---

Intel Celeron 1000MHz, 256k Cache, 1998 BogoMips, 512MB RAM,
Suse Linux 7.2, UDMA Hardisk






More information about the samba-technical mailing list