Welcome! Log In Create A New Profile

Advanced

Re: nginx uses high ram

John Feuerstein
January 12, 2011 07:04AM
Hi,

> php read file and echo on the browser
> but nginx uses high ram

since we have no detail on how you measured this and did not show us the
PHP code (*looking at crystal ball*), I suspect it's the common problem:

If you use readfile(), make sure to disable output buffering or PHP will
happily read large files into memory until it hits the memory limit. As
an alternative, implement a chunking readfile() or use something like
http_send_file().

The most efficient way however is to use X-Accel-Redirect [1] (also
known as X-SendFile). Skip piping the file through PHP and let nginx
serve it directly!

Hope this helps,
John

[1] http://wiki.nginx.org/XSendfile

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx uses high ram

khizar January 12, 2011 05:31AM

Re: nginx uses high ram

John Feuerstein January 12, 2011 07:04AM

Re: nginx uses high ram

khizar January 12, 2011 07:15AM

Re: nginx uses high ram

khizar January 12, 2011 07:16AM

Re: nginx uses high ram

vt January 12, 2011 07:44AM

Re: nginx uses high ram

John Feuerstein January 12, 2011 08:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 192
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready