Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7765171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:06:14+00:00 2026-06-01T15:06:14+00:00

If we must connect the db (redis)every time we need to write to or

  • 0

If we must connect the db (redis)every time we need to write to or read from the db .After some operates then close the connection . Because the connect is frequently (assume the case must connect and then close) .As a result ,Too many TIME_WAIT state socket stay in kernel.
some thing like :

`netstat -vatnl | grep 6379

tcp        0      0 127.0.0.1:6379              0.0.0.0:*                   LISTEN         
tcp        0      0 127.0.0.1:36476             127.0.0.1:6379              TIME_WAIT   
tcp        0      0 127.0.0.1:37193             127.0.0.1:6379            ESTABLISHED 
tcp        0      0 127.0.0.1:36480             127.0.0.1:6379              TIME_WAIT   
tcp        0      0 127.0.0.1:36479             127.0.0.1:6379              TIME_WAIT   
tcp        0      0 127.0.0.1:36472             127.0.0.1:6379              TIME_WAIT   
tcp        0      0 127.0.0.1:36457             127.0.0.1:6379              TIME_WAIT   
tcp        0      0 127.0.0.1:36460             127.0.0.1:6379              TIME_WAIT   
tcp        0      0 127.0.0.1:36481             127.0.0.1:6379              TIME_WAIT `
  1. Can we reuse the port in client ? such call bind() before connect() with the sock opt SO_REUSEPORT
  2. sysctl -w net.ipv4.tcp_timestamps=1
    sysctl -w net.ipv4.tcp_tw_recycle=1
    <
    This way indeed help a lot .But I can still see many TIME_WAIT state
  3. Set socket opt SO_LINGER l_onoff=0 ; l_liger=1
    or some other ways?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:06:15+00:00Added an answer on June 1, 2026 at 3:06 pm

    TIME_WAITs are part of tcp protocol tear-down processes. They ensure that packets of old-connection aren’t accepted as part of new-connection. So unless there are 1000s of them should leave them as it is.

    Having said that as source/dest are localhost there shouldn’t be a situation where packets of old-connection can be considered as new-connection’s. Among your proposed solutions 1 can be used. Solutions 2 & 3 may have wider implications, so please check before applying them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All I need to to do is to connect via https. Must I use
When we connect to a database in ASP.NET you must specify the appropriate connection
i need to connect for many databases the primary connection in the database.php and
how can i connect with MySql in app?and what software,i must install for mysql?thanks.
For a new website we must connect to a MySQL master-master setup. This is
I am trying to connect to a server from my app using the following
I'm writing a process which must connect (and keep alive) to several (hundreds) remote
I have a Windows Service that must connect, via VPN, to the network in
I have technical strings as the following: The thing P1 must connect to the
Must iOS apps have a globally unique name? The iTunes Connect Developer Guide implies

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.