Is a Socket Cache needed?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Matthias_David
Posted On:   Tuesday, December 3, 2002 03:47 AM

Is it necessary to set up a Socket Cache to improve performance? Here's the situation: I have a static helper class that makes some communication over a socket. This helper class may be invoked by many users (say 100 - 1000) and is used within a J2EE AppServer. Right now the helper class always creates a new Socket for the communication. I am wondering if a cache for sockets would be useful, so I could reuse already instantiated sockets. How does the system (jvm) handle closed socket connections? Are they cached inernally? What's the cost of opening a socket connection? What do you think? Does it make a difference if I need different sockets (e.g. different ips, ports) or if the connection should always   More>>

Is it necessary to set up a Socket Cache to improve performance?


Here's the situation:

I have a static helper class that makes some communication over a socket. This helper class may be invoked by many users (say 100 - 1000) and is used within a J2EE AppServer. Right now the helper class always creates a new Socket for the communication. I am wondering if a cache for sockets would be useful, so I could reuse already instantiated sockets.


How does the system (jvm) handle closed socket connections? Are they cached inernally? What's the cost of opening a socket connection?

What do you think? Does it make a difference if I need different sockets (e.g. different ips, ports) or if the connection should always have the same ip and port?

Thanks for any hints,
Matthias.

   <<Less

Re: Is a Socket Cache needed?

Posted By:   Benoit_Quintin  
Posted On:   Tuesday, December 3, 2002 01:27 PM

Mmmh...My impression is that a socket cache is probably a can of worms you don't really want to open.

I mean that if your appserver manages only one socket, it'll be bound one connection at a time (so that when one user connects to the port, the others won't be able to connect to it). This is why we usually have a listening port on a server that creates another connection for the incoming request and all the work is done from that new port (in order to leave the listening port open as long as possible).

I don't think creating sockets is that expensive resource and/or cycle wise, and I don't think there is such a thing as a Socket Pool (like datasources)...

About | Sitemap | Contact