Linux下高并发的Squid服务器,TCP TIME_WAIT套接字数量经常达到两、三万,服务器很容易被拖死。通过修改Linux内核参数,可以减少Squid服务器的TIME_WAIT套接字数量。
  
vi /etc/sysctl.conf

  增加以下几行:
引用
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 1024    65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000

  说明:
  net.ipv4.tcp_syncookies = 1 表示开启SYN Cookies。当出现SYN等待队列溢出时,启用cookies来处理,可防范少量SYN攻击,默认为0,表示关闭;
  net.ipv4.tcp_tw_reuse = 1 表示开启重用。允许将TIME-WAIT sockets重新用于新的TCP连接,默认为0,表示关闭;
  net.ipv4.tcp_tw_recycle = 1 表示开启TCP连接中TIME-WAIT sockets的快速回收,默认为0,表示关闭。
  net.ipv4.tcp_fin_timeout = 30 表示如果套接字由本端要求关闭,这个参数决定了它保持在FIN-WAIT-2状态的时间。
  net.ipv4.tcp_keepalive_time = 1200 表示当keepalive起用的时候,TCP发送keepalive消息的频度。缺省是2小时,改为20分钟。
  net.ipv4.ip_local_port_range = 1024    65000 表示用于向外连接的端口范围。缺省情况下很小:32768到61000,改为1024到65000。
  net.ipv4.tcp_max_syn_backlog = 8192 表示SYN队列的长度,默认为1024,加大队列长度为8192,可以容纳更多等待连接的网络连接数。
  net.ipv4.tcp_max_tw_buckets = 5000 表示系统同时保持TIME_WAIT套接字的最大数量,如果超过这个数字,TIME_WAIT套接字将立刻被清除并打印警告信息。默认为180000,改为5000。对于Apache、Nginx等服务器,上几行的参数可以很好地减少TIME_WAIT套接字数量,但是对于Squid,效果却不大。此项参数可以控制TIME_WAIT套接字的最大数量,避免Squid服务器被大量的TIME_WAIT套接字拖死。

  执行以下命令使配置生效:
/sbin/sysctl -p


Tags: , , ,
技术大类 » Cache与存储 | 评论(68) | 引用(0) | 阅读(56289)
louis vuitton outlet Email Homepage
2011-12-8 11:20
louis vuitton outlet is really so well-liked and also treasured during the human beings to be a number of high-end, they may realize that the bring up to date might impact their very own laurels signature in the fashion world as well as talk about in your predisposition in their enthusiasts.They also have put their louis vuitton sale to make it more convenient and economical for their customers to buy their goods. http://www.louisvuittonoutletsale2012.com
louis vuitton outlet Email Homepage
2011-12-8 11:20
louis vuitton outlet is really so well-liked and also treasured during the human beings to be a number of high-end, they may realize that the bring up to date might impact their very own laurels signature in the fashion world as well as talk about in your predisposition in their enthusiasts.They also have put their louis vuitton sale to make it more convenient and economical for their customers to buy their goods. http://www.louisvuittonoutletsale2012.com
louis vuitton outlet Email Homepage
2011-12-8 11:21
louis vuitton outlet is really so well-liked and also treasured during the human beings to be a number of high-end, they may realize that the bring up to date might impact their very own laurels signature in the fashion world as well as talk about in your predisposition in their enthusiasts.They also have put their louis vuitton sale to make it more convenient and economical for their customers to buy their goods. http://www.louisvuittonoutletsale2012.com
coach Email Homepage
2011-12-8 11:22
coach outlet has become necessary in everyday life of women seeking fashion and simple designs simple and elegant to look at very affordable and practical.Are you still worrying about where to buy yourself a Coach? Then coach outlet store online Online offering top-quality goods and first-class service can be your way-out. http://www.coachoutlet-coachoutlet.com
coach Email Homepage
2011-12-8 11:22
coach outlet has become necessary in everyday life of women seeking fashion and simple designs simple and elegant to look at very affordable and practical.Are you still worrying about where to buy yourself a Coach? Then coach outlet store online Online offering top-quality goods and first-class service can be your way-out. http://www.coachoutlet-coachoutlet.com
coach Email Homepage
2011-12-8 11:22
coach outlet has become necessary in everyday life of women seeking fashion and simple designs simple and elegant to look at very affordable and practical.Are you still worrying about where to buy yourself a Coach? Then coach outlet store online Online offering top-quality goods and first-class service can be your way-out. http://www.coachoutlet-coachoutlet.com
louis vuitton uk Email Homepage
2011-12-12 14:49
They're not chosen, so one of these ideal for you. For more flexibleness a lot more like these, there are lots of discount 'shoulder' variations outlet louis vuitton uk.louis vuitton Store Online Handbags can also bring great accuracy as well as practical applicability and fashionable.
coach outlet store online Homepage
2011-12-12 14:50
coach outlet has become necessary in everyday life of women seeking fashion and simple designs simple and elegant to look at very affordable and practical.You will easily notice the unfold zippers of this coach outlet store online. That is the decoration. There are some inside pockets for you as well. They are easy to match your clothes and to carry.
christian louboutin Homepage
2011-12-12 14:50
You'll fall in love with this red christian louboutin. The large crystal heart pendant shaped crystal is wrapped in a silver tone frame and hangs from a 30'long chain.All christian louboutin sale is hypoallergenic therefore all those with super sensitive skin can enjoy wearing it without any fear of getting an ugly reaction or rash.
coach factory outlet Homepage
2011-12-12 14:51
Coach is a leading American designer and maker of luxury lifestyle handbags and accessories.There is no doubt that here coach factory outlet is the exact place you should visit.Maybe you haven't seen such a great handbag sold at such a cheap price. Various Coach Handbags are provided in the coach factory with other wonderful colors and styles for your demand.
louis vuitton uk Email Homepage
2012-3-1 09:49
You're going to buy  new cheap louis vuitton uk and that is really good value.Typically the efficiency, combined with beauty, not to mention adjusted price get this to a victor.Now there are now a multitude of available as well as many creative options.LV bags in the louis vuitton outlet are a feminine update on an urban classic. With plenty of room for all of your essentials this covetable carryall will take you through the weekend in style.<br/>
louis vuitton outlet Email Homepage
2012-3-1 15:26
louis vuitton outlethttp://www.louisvuittonoutletuk.org.ukonline just like a person who want to show himself in front of other people, because he is confident enough, he can attain the respect of other people.We aim to make all our customers satisfy with our products. You will find a variety of Men's fashionlouis vuitton ukhttp://www.louisvuittonoutletuk.org.uk, fashion Women's cheap Louis Vuitton bags in our store at affordable price.
coach outlet online Email Homepage
2012-3-1 17:14
If you buy Coach items at the coach outlet online store, the goods will be sent out within 24 hours after confirming your payment and arrive to your door within 7 work days.Bright colors, exquisite workmanship, durable material and up-to-date style all lead to the great fame of the goods in coach outlet.<br/>
coach outlet online Email Homepage
2012-3-1 19:07
Lots of women like which usually amount normally include a coach outlet online ,it provides coziness to many girls that don't even think it is a great bushel of great interest directly to them.discount coach handbags, leaders and affordable for the American luxury brand known to create attractive designer coach outlet online store and accessories.<br/>
dr dre beats Email Homepage
2012-3-3 13:37
In particular, products from dr dre beats with leather design are fashionable, handmade,leading the wave of American pop.It with simple,durable and unique style to win consumers.Finished with the signature clasp, the classic and generous proportions and luxurious drapes make beats headphones so noble and famous.
ralph lauren uk Email Homepage
2012-3-3 13:37
Thinking silver and gold ornaments are a little bit ordinary? Why not try ralph lauren uk Jewelry. With charming colors and delicate shapes.Yesterday was my aunt and uncle's silver wedding anniversary. My uncle sent his wife a set of polo ralph lauren uk.
coach2outlet Email Homepage
2012-3-3 16:07
coach outlet handbags You can not just save your cash but also your time inside a convenient way to obtain the exact same bags product and do not be concerned the shippment of one's products.As our coach outlet online guarantees high quality for you, we have gained more customers'trust. The more they order, the more discounts they will enjoy.
beats by dre Email Homepage
2012-3-3 16:08
Different style bags from beats by dre are always eloquent statement outside a woman's attitude towards life and career. Thus, women's bag, must exchange the use of occasions, so they are not the same as showing different spatial and temporal rhythm of beauty.beats is universally renowned as a luxury brand. dre beats store offers customers the newest fashion collections which can make you different.
分页: 2/4 第一页 上页 1 2 3 4 下页 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]