ports/145985: [PATCH] www/lighttpd: add optional extra-patch for TCP_NODELAY

Martin Matuska mm at FreeBSD.org
Fri Apr 23 17:15:37 UTC 2010


>Number:         145985
>Category:       ports
>Synopsis:       [PATCH] www/lighttpd: add optional extra-patch for TCP_NODELAY
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 23 17:15:36 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Martin Matuska
>Release:        FreeBSD 8.0-STABLE amd64
>Organization:
>Environment:
System: FreeBSD neo.vx.sk 8.0-STABLE FreeBSD 8.0-STABLE #1 r206844M: Mon Apr 19 18:29:50 CEST
>Description:
- Add an optional extra-patch for TCP_NODELAY

This assumes for lighttpd: net.inet.tcp.delayed_ack=0
and gives a speed boost for serving many small files.
Several other operating systems (e.g. OpenSolaris) always apply this patch.

Added file(s):
- files/extra-patch-nodelay

Port maintainer (mnag at FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.99
>How-To-Repeat:
>Fix:

--- lighttpd-1.4.26_1.patch begins here ---
Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/www/lighttpd/Makefile,v
retrieving revision 1.77
diff -u -r1.77 Makefile
--- Makefile	16 Feb 2010 21:22:00 -0000	1.77
+++ Makefile	23 Apr 2010 09:22:10 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	lighttpd
 PORTVERSION=	1.4.26
+PORTREVISION=	1
 CATEGORIES=	www
 MASTER_SITES=	http://download.lighttpd.net/lighttpd/releases-1.4.x/
 
@@ -35,6 +36,7 @@
 		MAGNET		"Enable magnet support" off \
 		MEMCACHE	"Enable memory caching support" off \
 		MYSQL		"Enable MYSQL support" off \
+		NODELAY		"Optimize speed with TCP_NODELAY" off \
 		OPENLDAP	"Enable LDAP support" off \
 		OPENSSL		"Enable SSL support" on \
 		SPAWNFCGI	"Enable spawn-fcgi utility" on \
@@ -95,6 +97,10 @@
 _REQUIRE+=		mysql
 .endif
 
+.if defined(WITH_NODELAY)
+EXTRA_PATCHES+=		${FILESDIR}/extra-patch-nodelay
+.endif
+
 .if defined(WITH_OPENLDAP)
 USE_OPENLDAP=		yes
 CONFIGURE_ARGS+=	--with-ldap
Index: files/extra-patch-nodelay
===================================================================
RCS file: files/extra-patch-nodelay
diff -N files/extra-patch-nodelay
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/extra-patch-nodelay	23 Apr 2010 09:22:10 -0000
@@ -0,0 +1,15 @@
+--- src/network.c.orig	Tue Jan 26 14:33:01 2010
++++ src/network.c	Tue Jan 26 14:37:39 2010
+@@ -226,6 +226,12 @@
+ 		log_error_write(srv, __FILE__, __LINE__, "ss", "socketsockopt failed:", strerror(errno));
+ 		goto error_free_socket;
+ 	}
++	if(srv_socket->addr.plain.sa_family == AF_INET || srv_socket->addr.plain.sa_family == AF_INET6 ) {
++		if (setsockopt(srv_socket->fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)) < 0) {
++			log_error_write(srv, __FILE__, __LINE__, "ss", "socketsockopt failed:", strerror(errno));
++			goto error_free_socket;
++		}
++	}
+ 
+ 	switch(srv_socket->addr.plain.sa_family) {
+ #ifdef HAVE_IPV6
--- lighttpd-1.4.26_1.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list