• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hot to improve the socket performance ?

 
sachin kataria
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hot to improve the socket performance ?
i.e. allocation and deallocation of buffer
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, welcome to the ranch!

It helps if you can make your questions more specific. What kind of performance problem are you running into? How do you know the problem is in the socket code?

If you're just concerned about "am I using sockets wisely" or "could I do something better" feel free to post some small, focused sections of code for comment. Use the "CODE" button below the editor to preserve code formatting.

 
sachin kataria
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my project , java handles the server....
so, there is so much load on server...
and i am getting error ....
" Maximum connection reach
No buffer space available ...."
so, what is reason?
pls help me....
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A couple shots in the dark ... Have you tried tuning the "backlog" parameter on the ServerSocket constructor? I don't think you're getting a full queue error, but I'd have to force the error and see what the exception I get to be sure.

Take a look at the Apache Commons replacement for ServerSocket. It has tunable buffer size.

Other things I find on Google about this error appear to all be Linux. Are you on Linux? I know zip about that.
 
sachin kataria
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is on windows platform..........
i increase the buffer size in registry, ie. MaxBufferSize in Tcp/ip/parameter
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad you found that.

Anyone, is there a general way for a server to throttle overwhelming connect requests? I made a server that accepts connection and passes the work of to a thread pool. If my task queue blocks when full I guess that would block me from accepting more connections. Then the requests would pile up in queue until it's full, and then the caller would get some kind of unavailable error?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic