hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : NginX upstream timed out (110: Connection timed out) while connecting to upstream
Reply

Forum Jump

NginX upstream timed out (110: Connection timed out) while connecting to upstream

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 01-06-2011, 12:42 PM
GarS GarS is offline
Newbie
 
Join Date: Jan 2011
Posts: 18

NginX upstream timed out (110: Connection timed out) while connecting to upstream


Hello,

I keep on getting problems with my NginX setup using php-fpm, all latest versions.
It's many like these:
2011/01/06 19:50:00 [error] 4660#0: *10702343 upstream timed out (110: Connection timed out) while connecting to upstream, client: xx.xx.xx.xx, server: xxx.yyy, request: "GET / HTTP/1.0", upstream: "fastcgi://127.0.0.1:9000", host: "xxx.yyy"

These errors only occur while there are many requests, like over 1,000/s.

[root@db ~]# uname -a
Linux db.2.6.18-194.26.1.el5 #1 SMP Tue Nov 9 12:54:20 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
[root@db ~]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 210944
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 50000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 210944
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited


request_terminate_timeout = 60 is already set in php-fpm.conf .
I searched the whole Internet for this problem and couldn't find anything to help me out.
Thank you!

Reply With Quote


Sponsored Links
  #2  
Old 01-06-2011, 12:51 PM
fabin fabin is offline
Web Hosting Master
 
Join Date: Mar 2009
Location: Gods Own Country
Posts: 660
Try increasing the worker thread ( max_children )

__________________
Fabin Mundattil @ Xieles Support
High Quality Server Management | support @ xieles.com
http://xieles.com

Reply With Quote
  #3  
Old 01-06-2011, 12:59 PM
Steven Steven is offline
Problem Solver
 
Join Date: Mar 2003
Location: California USA
Posts: 13,073
You need more php workers, not nginx workers.

__________________
Steven Ciaburri | Proactive Linux Server Management - Rack911.com
System Administration Extraordinaire | Follow us on twitter:@Rack911Labs
Managed Servers (AS62710), Server Management, and Security Auditing.
www.HostingSecList.com - Security notices for the hosting community.

Reply With Quote
Sponsored Links
  #4  
Old 01-06-2011, 01:31 PM
GarS GarS is offline
Newbie
 
Join Date: Jan 2011
Posts: 18
That still didn't work.
These are my php-fpm settings:

pm.max_children = 20000
pm.start_servers = 40
pm.min_spare_servers = 20
pm.max_requests = 0
pm.max_spare_servers = 40

Thanks

Reply With Quote
  #5  
Old 01-07-2011, 12:11 AM
Steven Steven is offline
Problem Solver
 
Join Date: Mar 2003
Location: California USA
Posts: 13,073
You could be hitting other limits in your fastcgi implementation - file descriptor limits on the php user (you only showed us root limit) etc.

Regardless of the cause, the problem is with php. Check/Enable logging for your php fastcgi installation.

__________________
Steven Ciaburri | Proactive Linux Server Management - Rack911.com
System Administration Extraordinaire | Follow us on twitter:@Rack911Labs
Managed Servers (AS62710), Server Management, and Security Auditing.
www.HostingSecList.com - Security notices for the hosting community.

Reply With Quote
  #6  
Old 01-07-2011, 01:38 AM
Jay Suds Jay Suds is offline
Web Hosting Master
 
Join Date: Jun 2001
Location: Denver, CO
Posts: 3,294
Why are you running PHP on your nginix host? Use nginix to reverse proxy to a couple of backend servers. Spread the love.

__________________
Jay Sudowski // Handy Networks LLC // Co-Founder & CTO
AS30475 - Level(3), HE, Telia, XO and Cogent. Noction optimized network.
Offering Dedicated Server and Colocation Hosting from our SSAE 16 SOC 2, Type 2 Certified Data Center.
Current specials here. Check them out.

Reply With Quote
  #7  
Old 01-07-2011, 06:08 AM
GarS GarS is offline
Newbie
 
Join Date: Jan 2011
Posts: 18
Quote:
Originally Posted by Steven View Post
You could be hitting other limits in your fastcgi implementation - file descriptor limits on the php user (you only showed us root limit) etc.

Regardless of the cause, the problem is with php. Check/Enable logging for your php fastcgi installation.
It's not that
[root@db ~]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 210944
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 10000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 210944
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited


daemon soft nofile 90000
daemon hard nofile 90000

Thanks

Reply With Quote
  #8  
Old 01-07-2011, 11:30 AM
twikamltd twikamltd is online now
Premium Member
 
Join Date: Nov 2006
Posts: 568
Also, when using php-fpm with nginx, I've found it better to use a unix socket instead of tcp/ip if it's all on the same box.

Reply With Quote
  #9  
Old 01-07-2011, 11:35 AM
GarS GarS is offline
Newbie
 
Join Date: Jan 2011
Posts: 18
Quote:
Originally Posted by nickakam View Post
Also, when using php-fpm with nginx, I've found it better to use a unix socket instead of tcp/ip if it's all on the same box.
That would fix the problem most likely, how did you do it?

Reply With Quote
  #10  
Old 01-07-2011, 12:03 PM
twikamltd twikamltd is online now
Premium Member
 
Join Date: Nov 2006
Posts: 568
Taken from a live conf file:

In nginx.conf:

location ~ \.php$ {
fastcgi_pass unix:/tmp/php.sock;
etc etc etc
}

In php-fpm.conf:

;listen = 127.0.0.1:9000
listen = /tmp/php.sock

Just change from an IP address to a unix socket address basically, simples. Not sure it'd fix your problem though. Are you on 5.3.4?


Last edited by twikamltd; 01-07-2011 at 12:10 PM.
Reply With Quote
  #11  
Old 01-07-2011, 12:17 PM
Steven Steven is offline
Problem Solver
 
Join Date: Mar 2003
Location: California USA
Posts: 13,073
Quote:
Originally Posted by GarS View Post
It's not that
[root@db ~]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 210944
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 10000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 210944
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited


daemon soft nofile 90000
daemon hard nofile 90000

Thanks
Thats still the root limit. Are you running php as root?

__________________
Steven Ciaburri | Proactive Linux Server Management - Rack911.com
System Administration Extraordinaire | Follow us on twitter:@Rack911Labs
Managed Servers (AS62710), Server Management, and Security Auditing.
www.HostingSecList.com - Security notices for the hosting community.

Reply With Quote
  #12  
Old 01-07-2011, 05:23 PM
dotHostel dotHostel is offline
Web Hosting Master
 
Join Date: Jun 2005
Posts: 2,569
Quote:
Originally Posted by Jay Suds View Post
Why are you running PHP on your nginix host? Use nginix to reverse proxy to a couple of backend servers. Spread the love.
OFF-TOPIC

What is your opinion about running Varnish instead Nginx as reverse proxy to backend servers? Thanks.

__________________
You will only find out how good a provider is when the going gets tough

Reply With Quote
  #13  
Old 01-08-2011, 06:46 AM
GarS GarS is offline
Newbie
 
Join Date: Jan 2011
Posts: 18
Quote:
Originally Posted by Steven View Post
Thats still the root limit. Are you running php as root?
No, I am running it under a default user "daemon".
I've added session required pam_limits.so to /etc/pam.d/login and also set
daemon soft nofile unlimited
daemon hard nofile unlimited
daemon soft nproc unlimited
daemon hard nproc unlimited

in /etc/security/limits.conf
I still get the error "upstream timed out (110: Connection timed out) while connecting to upstream, client"

Reply With Quote
  #14  
Old 01-08-2011, 06:56 AM
GarS GarS is offline
Newbie
 
Join Date: Jan 2011
Posts: 18
Quote:
Originally Posted by Jay Suds View Post
Why are you running PHP on your nginix host? Use nginix to reverse proxy to a couple of backend servers. Spread the love.
I can't see the point in making a separation between the nginx and php-fpm. I would just do useless network traffic.

Reply With Quote
  #15  
Old 01-08-2011, 07:00 AM
GarS GarS is offline
Newbie
 
Join Date: Jan 2011
Posts: 18
Quote:
Originally Posted by dotHostel View Post
OFF-TOPIC

What is your opinion about running Varnish instead Nginx as reverse proxy to backend servers? Thanks.
I am not sure how would that work for me and what other advantages would it bring. I am already using memcache an round robin nginx+php-fpm servers.
Thanks

Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
nginx upstream timed out error heropage Hosting Security and Technology 14 11-30-2012 06:39 PM
Connection Timed Out mamasfinds Web Hosting 5 01-27-2008 01:57 PM
The connection has timed out - Please Help computerness Hosting Security and Technology 7 01-24-2008 11:59 PM
The connection has timed out zodehala Hosting Security and Technology 2 12-25-2007 09:26 PM
425 Unable to build data connection: Connection timed out vnunited Hosting Security and Technology 3 05-15-2006 12:42 PM

Related posts from TheWhir.com
Title Type Date Posted
Nginx to be Included in Upcoming Ubuntu Release Web Hosting News 2014-01-08 15:17:12
Nginx Raises $10M to Extend Commercial Support Web Hosting News 2013-10-15 11:20:26
Apache Market Share Dips Slightly in June Netcraft Web Server Survey Web Hosting News 2013-06-06 13:40:21
nginx Version 1.4.0 Supports SPDY Protocol Web Hosting News 2013-04-29 15:08:14
Nginx Aims to Grow Market Share Under New CEO Gus Robertson Web Hosting News 2013-04-08 14:28:48


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?