Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Currently I noticed there are about 15K open connections to localhost. It is mainly connecting to Memcached. I am clueless where I should start to optimize TCP/IP stack. Memcached support UDP, but the PHP library doesn't support it.

The server has a lot of memory, about 7GB and it is dual core. Any pointers in how to optimize TCP / IP stack in Linux ?

share|improve this question

closed as not a real question by Chris S Apr 5 '13 at 12:47

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

3  
Why do you feel that you need to optimize it? –  Shane Madden Oct 24 '11 at 17:09
    
Is this large number of connections on the stack causing slow downs for other services? –  user606723 Oct 24 '11 at 17:15
    
Doing performance testing, 39% of the time is spent getting data from memcached. To many open connections also causing the main site to slow down –  mary Oct 24 '11 at 17:17
    
What is the output of netstat -natp | grep memcached | awk '{ print $6 }' | sort | uniq -c | sort -rn? –  quanta Oct 25 '11 at 7:24

2 Answers 2

Since memcached is running on the same server, consider configuring it (and your web app) to use a UNIX socket instead of network connections.

share|improve this answer

What state are the connections in? If you only need more TCP connections (with identical source-destination pairs), ip_local_port_range might be something to look at: http://www.faqs.org/docs/securing/chap6sec70.html . If you use connection tracking, http://www.faqs.org/docs/iptables/theconntrackentries.html might be useful. If you want to push the maximum connection/s, tcp_tw_recycle and tcp_tw_reuse might be interesting, but be careful with those and NAT.

share|improve this answer
    
I think the local port range is most likely to be your problem. –  David Schwartz Oct 25 '11 at 2:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.