# Bad PHP performance since upgrade to 9.2



## Ben (Oct 28, 2013)

Hi,

I am running a server which is not yet open to the public, which means there is a load of 0. Since I upgraded to 9.2 (at least that was the last bigger change to the system) the performance is really bad. On the server (Quadcore Xeon, 32 GB RAM, 2 SSDs in a mirrored ZFS pool) I have MariaDB running in a jail and nginx with PHP 5.5 in a jail. When I try to open the website I get a response from the webserver and then it takes about 1 minute until the page loads. All processes at that time show a load of 0 in `top`. Also PHP, it's just sitting there. In PHP's slowload I get even for the simple phpinfo() function a record. Nginx itself seems to be fast. When I request static files it's fast as normal.

I don't know how I can narrow down the problem. The application itself says that the execution time is roughly 40 ms. This would mean that the communication between PHP and nginx would be maximum slow, but how can I prove this?

I rebooted several times already, updated all ports recompiled my ezjail-Basejail etc. First I thought it's a ZFS problem, but then sending static files would be slow as well. I really appreciate any help or hints how I can narrow down the problem.

Thanks in advance!


----------



## Ben (Oct 28, 2013)

Ok, I found out that the TCP stack seems to be the problem. When I access PHP via socket it;s fast as normal.

The solution was:
In /etc/sysctl.conf the settings of FreeBSD 9.1 were the following:

```
net.inet.tcp.recvspace=8192
net.inet.tcp.sendspace=16384
```
I now changed it to:

```
net.inet.tcp.recvspace=262144
net.inet.tcp.sendspace=262144
```
The performance is like normal now. I am still open for advice.


----------



## hedon (Nov 8, 2013)

Hi,

I have exactly the same problem with the same configuration. Did you make some progress?

Regards


----------



## aupanner (Nov 8, 2013)

9.2 defaults are:


```
net.inet.tcp.sendspace: 32768
net.inet.tcp.recvspace: 65536
```

tcpdump can show you what's going on with the data from the webserver. It might be interesting to run it both ways and see how many packets you're sending with each setting. systat with the ip setting might be interesting too.

You can tune your TCP stack, but you can't tune a fish.


----------

