[httperf] Bug Fix Patches to Date

Mark Nottingham mnot at yahoo-inc.com
Sun Nov 26 10:09:48 PST 2006


This is great!

I haven't looked deeply yet, but a few comments in the meantime;

* I share your concern WRT the fd_setsize patch; it's very useful on  
Linux, but causes problems on other platforms. It would be *very*  
nice if it could be included, but it does need to be rewritten.  
Another option might be to make fd_setsize a ./configure parameter  
(Squid does this...)

* To allow persistent connections with HTTP/1.0 servers (e.g.,  
Squid), Connection: keep-alive needs to be added to requests; e.g.,
core.c:70  static char http10req[] = " HTTP/1.0\r\nUser-Agent:  
httperf/"VERSION"\r\nConnection: keep-alive\r\nHost: ";

* Not sure if you caught it in (4), but core.c:973 needs to be
       call->req.iov[IE_HOST].iov_base = (caddr_t) conn->fqdname;
       call->req.iov[IE_HOST].iov_len = conn->fqdname_len;

I'll try out your patches next week; I'll be using FreeBSD, Linux and  
MacOSX.

Thanks!


On 2006/11/25, at 10:30 PM, Ted Bullock wrote:

> Hey there,
>
> Resending this email since I forgot to copy the mailing list last  
> time....
>
> Attached to this email is a cumulative candidate for a 0.9 bugfix  
> patch
> to httperf. The collection of patches we have so far was collected  
> from
> the mailing list over the past 6 years. We are certainly interested
> in any additional bug fix patches (Not feature enhancements at this
> time).  One patch that we don't have yet is one that makes this  
> software
> compile on Solaris as it seems this has given people a certain  
> amount of
> trouble in the past, if anybody has any experience with this we would
> certainly be interested in a functioning patch.
>
> Also, has (can) anybody tried this on modern versions of
> FreeBSD/OpenBSD/NetBSD and Mac OS X?
>
> Here is a a description of the patches we have collected so far.  Most
> of them are very minor changes, but potentially useful ones.
>
> 1)
> Adjusts the autoconf configuration script to allow placement of the
> binary executable in a customizable place via the --prefix parameter.
>
> 2)
> Fixes a problem with the wsesslog crashing httperf due to an unhandled
> session failure
>
> 3)
> One small change to the lib/ssl_writev.c file, alloca system  
> function is
> provided in stdlib.h rather than in alloca.h (For Mac OS X and
> potentially others)
>
> 4)
> Fixes a bug where a request which goes to server 1.2.3.4, but with a
> hostheader "x.y.com" would give SH0:Host: 1.2.3.4 instead of the
> expected SH0:Host: x.y.com
>
> This can be applied with:
>
> tar -xzvf httperf-0.8.tar.gz
> cd httperf-0.8
> patch -p1 < ../httperf-0.9-candidate.patch
>
> NOTE:
>
> There is a fifth patch attached separately as
> Glibc_FD_SETSIZE_fix.patch, however I have reviewed the patch and I am
> unhappy with its implementation, if there are any comments on this
> (especially in cross platform situations) we are interested in  
> reviewing
> them.
>
> Again, we are working on httperf as part of our fourth year project in
> engineering at the University of Calgary.  We set up a wiki as a  
> project
> management tool.  It can be accessed at
> http://httperf01.enel.ucalgary.ca (new location).
>
> We are interested in feedback from users and developers of the httperf
> project.
>
> diff -Naur httperf-0.8/core.c httperf-0.8-jtjm/core.c
> --- httperf-0.8/core.c	2000-10-31 23:57:50.000000000 +0000
> +++ httperf-0.8-jtjm/core.c	2005-11-24 19:38:25.000000000 +0000
> @@ -51,7 +51,7 @@
>  #include <event.h>
>  #include <http.h>
>  #include <conn.h>
> -
> +#include "fd_set.h"
>  #define HASH_TABLE_SIZE	1024	/* can't have more than this many  
> servers */
>  #define MIN_IP_PORT	IPPORT_RESERVED
>  #define MAX_IP_PORT	65535
> @@ -60,7 +60,7 @@
>  static int running = 1;
>  static int iteration;
>  static u_long max_burst_len;
> -static fd_set rdfds, wrfds;
> +static jtjm_fd_set rdfds, wrfds;
>  static int min_sd = 0x7fffffff, max_sd = 0, alloced_sd_to_conn = 0;
>  static struct timeval select_timeout;
>  static struct sockaddr_in myaddr;
> @@ -317,7 +317,7 @@
>  }
>
>  static void
> -set_active (Conn *s, fd_set *fdset)
> +set_active (Conn *s, jtjm_fd_set *fdset)
>  {
>    int sd = s->sd;
>    Any_Type arg;
> @@ -672,11 +672,11 @@
>        exit (1);
>      }
>
> -  if (rlimit.rlim_max > FD_SETSIZE)
> +  if (rlimit.rlim_max > LOCAL_FD_SETSIZE)
>      {
> -      fprintf (stderr, "%s: warning: open file limit > FD_SETSIZE; "
> -	       "limiting max. # of open files to FD_SETSIZE\n", prog_name);
> -      rlimit.rlim_max = FD_SETSIZE;
> +      fprintf (stderr, "%s: warning: open file limit >  
> LOCAL_FD_SETSIZE; "
> +	       "limiting max. # of open files to LOCAL_FD_SETSIZE\n",  
> prog_name);
> +      rlimit.rlim_max = LOCAL_FD_SETSIZE;
>      }
>
>    rlimit.rlim_cur = rlimit.rlim_max;
> @@ -1103,7 +1103,7 @@
>  core_loop (void)
>  {
>    int is_readable, is_writable, n, sd, bit, min_i, max_i, i = 0;
> -  fd_set readable, writable;
> +  jtjm_fd_set readable, writable;
>    fd_mask mask;
>    Any_Type arg;
>    Conn *conn;
> diff -Naur httperf-0.8/fd_set.h httperf-0.8-jtjm/fd_set.h
> --- httperf-0.8/fd_set.h	1970-01-01 01:00:00.000000000 +0100
> +++ httperf-0.8-jtjm/fd_set.h	2005-11-24 19:33:50.000000000 +0000
> @@ -0,0 +1,8 @@
> +#define LOCAL_FD_SETSIZE 102400
> +
> +typedef long int __jtjm_fd_mask;
> +typedef struct
> +  {
> +      __jtjm_fd_mask fds_bits[LOCAL_FD_SETSIZE / (8 * sizeof  
> (__jtjm_fd_mask))];
> +
> +  } jtjm_fd_set;
> diff -Naur httperf-0.8/idleconn.c httperf-0.8-jtjm/idleconn.c
> --- httperf-0.8/idleconn.c	2000-10-12 00:35:38.000000000 +0100
> +++ httperf-0.8-jtjm/idleconn.c	2005-11-24 19:35:29.000000000 +0000
> @@ -37,6 +37,7 @@
>  #include <sys/types.h>
>  #include <sys/resource.h>
>  #include <sys/socket.h>
> +#include "fd_set.h"
>
>  const char *prog_name;
>  unsigned long num_conn, num_closed;
> @@ -63,7 +64,7 @@
>  {
>    int desired, current = 0, port, sd, max_sd = 0, n, i;
>    struct sockaddr_in sin, server_addr;
> -  fd_set readable, rdfds;
> +  jtjm_fd_set readable, rdfds;
>    struct rlimit rlimit;
>    struct hostent *he;
>    char *server;
> @@ -96,11 +97,11 @@
>        exit (1);
>      }
>
> -  if (rlimit.rlim_max > FD_SETSIZE)
> +  if (rlimit.rlim_max > LOCAL_FD_SETSIZE)
>      {
> -      fprintf (stderr, "%s: warning: open file limit > FD_SETSIZE; "
> -	       "limiting max. # of open files to FD_SETSIZE\n", prog_name);
> -      rlimit.rlim_max = FD_SETSIZE;
> +      fprintf (stderr, "%s: warning: open file limit >  
> LOCAL_FD_SETSIZE; "
> +	       "limiting max. # of open files to LOCAL_FD_SETSIZE\n",  
> prog_name);
> +      rlimit.rlim_max = LOCAL_FD_SETSIZE;
>      }
>
>    rlimit.rlim_cur = rlimit.rlim_max;
> -------------- next part --------------
> diff -cr httperf-0.8-jtjm/Makefile.in httperf-0.8-jj/Makefile.in
> *** httperf-0.8-jtjm/Makefile.in	Thu Oct 19 03:38:59 2000
> --- httperf-0.8-jj/Makefile.in	Mon Nov 28 12:46:27 2005
> ***************
> *** 6,11 ****
> --- 6,12 ----
>   top_builddir = .
>
>   prefix = @prefix@
> + exec_prefix = @exec_prefix@
>   bindir = @bindir@
>   mandir = @mandir@
> # 0.9 Patch File
> # Contains 4 Fixes
> #
> # 1)
> # Adjusts the autoconf configuration script to allow placement
> # of the binary executable in a customizable place via the
> # --prefix parameter.
> #
> # 2)
> # Fixes a problem with the wsesslog crashing httperf due to
> # an unhandled session failure
> #
> # 3)
> # One small change to the lib/ssl_writev.c file, alloca system
> # function is provided in stdlib.h rather than in alloca.h
> #
> # 4)
> # Fixes a bug where a request which goes to server 1.2.3.4,
> # but with a hostheader "x.y.com" would give SH0:Host: 1.2.3.4
> # instead of the expected SH0:Host: x.y.com
>
> diff -Naur httperf-0.8/httperf.h httperf/httperf.h
> --- httperf-0.8/httperf.h	2000-10-31 13:32:09.000000000 -0700
> +++ httperf/httperf.h	2006-11-24 21:22:33.000000000 -0700
> @@ -31,7 +31,7 @@
>  #include <sys/types.h>
>  #include <sys/resource.h>
>
> -#define VERSION	"0.8"
> +#define VERSION	"0.9"
>
>  typedef double Time;
>
> diff -Naur httperf-0.8/core.c httperf/core.c
> --- httperf-0.8/core.c	2000-10-31 16:57:50.000000000 -0700
> +++ httperf/core.c	2006-11-24 18:59:17.000000000 -0700
> @@ -970,8 +970,8 @@
>    else if (!call->req.iov[IE_HOST].iov_base)
>      {
>        /* Default call's hostname to connection's hostname: */
> -      call->req.iov[IE_HOST].iov_base = (caddr_t) conn->hostname;
> -      call->req.iov[IE_HOST].iov_len = conn->hostname_len;
> +      call->req.iov[IE_HOST].iov_base = (caddr_t) conn->fqdname;
> +      call->req.iov[IE_HOST].iov_len = conn->fqdname_len;
>      }
>
>    /* NOTE: the protocol version indicates what the _client_ can
> diff -Naur httperf-0.8/gen/wsesslog.c httperf/gen/wsesslog.c
> --- httperf-0.8/gen/wsesslog.c	2000-10-11 17:40:46.000000000 -0600
> +++ httperf/gen/wsesslog.c	2006-11-24 18:19:01.000000000 -0700
> @@ -312,6 +312,9 @@
>    sess = session_get_sess_from_call (call);
>    priv = SESS_PRIVATE_DATA (sess);
>
> +  if (sess->failed)
> +    return;
> +
>    ++priv->num_calls_destroyed;
>
>    if (priv->num_calls_destroyed >= priv->total_num_reqs)
> diff -Naur httperf-0.8/lib/ssl_writev.c httperf/lib/ssl_writev.c
> --- httperf-0.8/lib/ssl_writev.c	2000-10-11 18:09:47.000000000 -0600
> +++ httperf/lib/ssl_writev.c	2006-11-24 18:25:41.000000000 -0700
> @@ -31,7 +31,9 @@
>
>  #ifdef HAVE_OPENSSL_SSL_H
>
> -#include <alloca.h>
> +#include <alloca.h>
> + /* stdlib.h provides the alloca functionality. */
> +#include <stdlib.h>
>  #include <string.h>
>
>  #include <sys/types.h>
> diff -Naur httperf-0.8/Makefile.in httperf/Makefile.in
> --- httperf-0.8/Makefile.in	2000-10-19 01:38:59.000000000 -0600
> +++ httperf/Makefile.in	2006-11-24 18:11:31.000000000 -0700
> @@ -6,6 +6,7 @@
>  top_builddir = .
>
>  prefix = @prefix@
> +exec_prefix = @exec_prefix@
>  bindir = @bindir@
>  mandir = @mandir@
>
> # eof 0.9 Patch
> _______________________________________________
> httperf mailing list
> httperf at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/httperf/

--
Mark Nottingham
mnot at yahoo-inc.com





More information about the httperf mailing list