# Lighttpd outgoing traffic is too low.



## iliaviht (Jun 8, 2009)

Hi. I have a high load server. And after I update FreeBSD to 7.2 version. Sometimes lighttpd web server's outgoing traffic became too low. Only reboot solves the problem(
 Here is my configs:

```
# cat /boot/loader.conf
net.inet.tcp.syncache.hashsize=1024
net.inet.tcp.syncache.bucketlimit=100
net.inet.tcp.tcbhashsize=4096
kern.ipc.nsfbufs=10240

]# cat /etc/sysctl.conf
net.inet.tcp.blackhole=1
net.inet.udp.blackhole=1
kern.ipc.nmbclusters=0
kern.ipc.nmbclusters=262144
kern.ipc.somaxconn=4096
kern.ipc.maxsockets=204800
kern.maxfiles=204800
kern.maxfilesperproc=200000
net.inet.ip.portrange.first=1024
net.inet.ip.portrange.last=65535
net.inet.ip.portrange.randomized=0
net.inet.tcp.maxtcptw=40960
net.inet.tcp.msl=30000
net.inet.tcp.syncookies=1
net.inet.tcp.nolocaltimewait=1
net.inet.tcp.fast_finwait2_recycle=1
```
Is anyone have same problems? Maybe my configs is wrong? Which kernel variables I must check?


----------



## trev (Jun 10, 2009)

iliaviht said:
			
		

> Sometimes lighttpd web server's outgoing traffic became too low.



Can you explain what this sentence means? Do you mean "slow" rather than "low"?


----------



## iliaviht (Jun 11, 2009)

Yes I mean "low". It seems I solve this. 
I add 

```
server.max-connections = 3072
server.max-fds = 6144
```
to lighttpd.conf.

But also I add 1 Gb RAM to my server. 
May be additional ram solve the problem?


----------



## vivek (Jun 11, 2009)

Yes, additional RAM and RAID can always help boost server performance. How many requests per second your server handles 10-100-1000? Do you see any error message in lighttpd error log file? What kind of backend used for fastcgi local/ remote?


----------



## iliaviht (Jun 15, 2009)

There is no any fastcgi scripts, only static data(media files). 

[cmd=]netstat -an | grep xx.xxx.xxx.xxx.80 | wc -l[/cmd]
shows  1000 ~ 1500 max

In lighttpd error logs :

```
2009-06-15 01:33:52: (connections.c.604) connection closed: write failed on fd 21
```


----------



## vivek (Jun 15, 2009)

You are running out of open FDs. For static files lighttpd should able to handle large number of requests such as 2000 - 3000 req/s. netstat is not accurate way to find out this info as it will include other stat also. Use mod_status to get correct info. Make sure lighttpd user can open large number of files and backend is set  as follows 
	
	



```
server.network-backend = "freebsd-sendfile"
```

There are other factors too like other servers (like mysql and daemons) running and opening fds. In some cases you need to split server into multiple backends.


----------



## iliaviht (Jun 16, 2009)

Thank you  for your recomendations) 
kern.maxfiles - is this max number of files for user
or kern.maxproc this?


----------

