When using KeepAlive directive, Can I force reset a connection

Hi all,

I'm using Apache HTTP Server Version 2.2.
I want to use the directive keepAlive in order to enhance the performance of existing connection.
The problem is I have requests that are waiting for the keepAlive timeout in the queue.
Is there a directive that says something like - if you have a new request and a connection that is open and just waiting, clos this connection and use it for the new request?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bryan ButlerCommented:

this link has what I think you are looking for:

MyWebRequest and MyWebResponse use the Socket class to manage connections, and they are similar to WebRequest and WebResponse, but they support concurrent responses at the same time. In addition, MyWebRequest supports a built-in flag, KeepAlive, to support Keep-Alive connections.
omni_expertAuthor Commented:

Thanks for the answer. This is not exactly what I'm looking for.
What I want is to use the parameter of keepAlive by default but if I have shortage of threads because all of them are idle on open connections - close the connections and use the threads.
Is it more clear now?

I dont think there is any setting that can do that ...

according to apache2 documentation

if you set keepAlive timeout too long, then it will impact in your server performance.

if there is any kind of setting to handle what you are trying to achieved, it should of mention in keep Alive section, but there is not anything

Bryan ButlerCommented:
In that article it has:

This code works well but it has a very serious problem as the WebRequest class function GetResponse locks the access to all other processes, the WebRequest tells the retrieved response as closed, as in the last line in the previous code.

Is the GetResponse lock your issue?  Either way, it seems like you will need to control the connection yourself.  Does minimizing the KeepAliveTimeout setting help you?  Or just keep it off....


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
omni_expertAuthor Commented:
There isn't a way to set what I was hoping for.
Nevertheless, The links and answers helped a lot and the best thing to do in my case is to probably shut down the keep alive directive.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java App Servers

From novice to tech pro — start learning today.