# Strange change in writing. (webserver)

**URL:** <https://www.ruby-forum.com/t/strange-change-in-writing-webserver/194557>\
**Category:** NGINX\
**Created:** [September 7, 2010, 5:10am UTC](https://www.ruby-forum.com/t/strange-change-in-writing-webserver/194557 "2010-09-07T05:10:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![heric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7ab992/32.png) [@heric](https://www.ruby-forum.com/u/heric)\
**Post date:** [September 7, 2010, 5:10am UTC](https://www.ruby-forum.com/t/strange-change-in-writing-webserver/194557/1 "2010-09-07T05:10:27Z")

</div>

Hello!

I use Nginx / fastcgi.

See the graph of connections:

![](http://img707.imageshack.us/img707/3285/graf19.png)

Normal requests:

Active connections: 2185  
Reading: 94 Writing: 736 Waiting: 1355

Strange behavior:

Active connections: 10893  
Reading: 136 Writing: 9454 Waiting: 1303

Periodically, the number of “Writing” requests increases, slowing the  
server.

part of nginx.conf:

worker\_processes 2;  
events {  
worker\_connections 11000;  
}  
http {  
keepalive\_timeout 30 60;  
limit\_zone eueu $binary\_remote\_addr 10m;  
limit\_req\_zone $binary\_remote\_addr zone=one:10m rate=2r/s;

server {

```
    location ~ \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME

```

/var/www$fastcgi\_script\_name;  
include fastcgi\_params;  
}

limit\_conn eueu 30;  
limit\_req zone=one burst=5;

}

Could anyone help me?

(sorry my bad english)

Posted at Nginx Forum:

> **[Strange change in writing. (webserver)](https://forum.nginx.org/read.php?2,127823,127823#msg-127823)**
>
> Hello! I use Nginx / fastcgi. See the graph of connections: \[img\]http://img707.imageshack.us/img707/3285/graf19.png\[/img\] \[b\]Normal requests:\[/b\] Active connections: 2185 Reading: 94 Writing: 736 Waiting: 1355

---

<div class="post-metadata">

**Author:** ![heric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7ab992/32.png) [@heric](https://www.ruby-forum.com/u/heric)\
**Post date:** [September 7, 2010, 8:54pm UTC](https://www.ruby-forum.com/t/strange-change-in-writing-webserver/194557/2 "2010-09-07T20:54:53Z")

</div>

I have the same problem.

Posted at Nginx Forum:

> **[Re: Strange change in writing. (webserver)](https://forum.nginx.org/read.php?2,127823,128087#msg-128087)**
>
> Hello! I use Nginx / fastcgi. See the graph of connections: \[img\]http://img707.imageshack.us/img707/3285/graf19.png\[/img\] \[b\]Normal requests:\[/b\] Active connections: 2185 Reading: 94 Writing: 736 Waiting: 1355

---

<div class="post-metadata">

**Author:** ![heric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7ab992/32.png) [@heric](https://www.ruby-forum.com/u/heric)\
**Post date:** [September 7, 2010, 10:11pm UTC](https://www.ruby-forum.com/t/strange-change-in-writing-webserver/194557/3 "2010-09-07T22:11:33Z")

</div>

Hello!

On Mon, Sep 06, 2010 at 11:08:50PM -0400, heric wrote:

> Active connections: 2185  
> Reading: 94 Writing: 736 Waiting: 1355
> 
> Strange behavior:
> 
> Active connections: 10893  
> Reading: 136 Writing: 9454 Waiting: 1303
> 
> Periodically, the number of “Writing” requests increases, slowing the  
> server.

“Writing” state counts requests with already read request headers,  
but not yet fully answered.

Increase may indicate that your backend(s) don’t cope with load  
and nginx is waiting for backend replies…

> limit\_conn eueu 30;  
> limit\_req zone=one burst=5;

… or requests are just sitting in limit\_req’s delay. Extra 8k  
connections with limit\_conn set to 30 will require only something  
about 300 clients. And 2r/s is quite low, especially if images  
are on the same server with the same limits applied, and likely to  
delay significant part of your users. You may want to try  
limit\_req with ‘nodelay’ flag. Or at least do some stats to check  
if the above actually applies.

Maxim D.

---

<div class="post-metadata">

**Author:** ![heric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7ab992/32.png) [@heric](https://www.ruby-forum.com/u/heric)\
**Post date:** [September 8, 2010, 5:19pm UTC](https://www.ruby-forum.com/t/strange-change-in-writing-webserver/194557/4 "2010-09-08T17:19:32Z")

</div>

![](http://i53.tinypic.com/2yzhfec.jpg)

apparently, php-cgi is causing server overload. How to reduce overload?

thanks

Posted at Nginx Forum:

> **[Re: Strange change in writing. (webserver)](https://forum.nginx.org/read.php?2,127823,128455#msg-128455)**
>
> Hello! I use Nginx / fastcgi. See the graph of connections: \[img\]http://img707.imageshack.us/img707/3285/graf19.png\[/img\] \[b\]Normal requests:\[/b\] Active connections: 2185 Reading: 94 Writing: 736 Waiting: 1355

---

<div class="post-metadata">

**Author:** ![heric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7ab992/32.png) [@heric](https://www.ruby-forum.com/u/heric)\
**Post date:** [September 8, 2010, 7:35am UTC](https://www.ruby-forum.com/t/strange-change-in-writing-webserver/194557/5 "2010-09-08T07:35:15Z")

</div>

Thanks for the reply!

## Maxim D. Wrote:

> Maxim D.

I think it is. But how can solve?

My server is 2x quad core / 16gb ram / 6x300gb raid5 / 1gbps full duplex  
/ debian lenny.

can be resolved or should I upgrade the server?

Thanks in advance!

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,127823,128259#msg-128259](http://forum.nginx.org/read.php?2,127823,128259#msg-128259)

---

<div class="post-metadata">

**Author:** ![heric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7ab992/32.png) [@heric](https://www.ruby-forum.com/u/heric)\
**Post date:** [September 8, 2010, 5:46pm UTC](https://www.ruby-forum.com/t/strange-change-in-writing-webserver/194557/6 "2010-09-08T17:46:29Z")

</div>

> apparently, php-cgi is causing server overload. How to reduce overload?

By optimising your php code, using php opcode cache (apc, xcache,  
eaccelerator), by caching page parts (apc, memcache), by caching whole  
output (nginx fastcgi cache (  
[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/NginxHttpFcgiModule#fastcgi_cache) ), varnish as  
front), by adding more hardware ..

rr

---

<div class="post-metadata">

**Author:** ![heric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7ab992/32.png) [@heric](https://www.ruby-forum.com/u/heric)\
**Post date:** [September 8, 2010, 11:00pm UTC](https://www.ruby-forum.com/t/strange-change-in-writing-webserver/194557/7 "2010-09-08T23:00:55Z")

</div>

Hello!

Thanks for reply!

Why the overload is not growing? The change is sudden. Is this normal?  
How to enable memcache after install? Must enter the code in the php.ini  
or recompilar php?

Posted at Nginx Forum:

> **[Re: Strange change in writing. (webserver)](https://forum.nginx.org/read.php?2,127823,128582#msg-128582)**
>
> Hello! I use Nginx / fastcgi. See the graph of connections: \[img\]http://img707.imageshack.us/img707/3285/graf19.png\[/img\] \[b\]Normal requests:\[/b\] Active connections: 2185 Reading: 94 Writing: 736 Waiting: 1355

---

<div class="post-metadata">

**Author:** ![heric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7ab992/32.png) [@heric](https://www.ruby-forum.com/u/heric)\
**Post date:** [September 9, 2010, 5:43am UTC](https://www.ruby-forum.com/t/strange-change-in-writing-webserver/194557/8 "2010-09-09T05:43:02Z")

</div>

PHP\_FCGI\_CHILDREN changed from 8 to 16 and the server stabilized. the  
two times it was slow, was improved without my intervention.

![](http://img815.imageshack.us/img815/5465/graf20.png)

Posted at Nginx Forum:

> **[Re: Strange change in writing. (webserver)](https://forum.nginx.org/read.php?2,127823,128666#msg-128666)**
>
> Hello! I use Nginx / fastcgi. See the graph of connections: \[img\]http://img707.imageshack.us/img707/3285/graf19.png\[/img\] \[b\]Normal requests:\[/b\] Active connections: 2185 Reading: 94 Writing: 736 Waiting: 1355
