• Post Reply Bookmark Topic Watch Topic
  • New Topic

Handling large number of threads(Server Side)  RSS feed

 
pb citeee
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a chatting application which follows a client server architecture, how can we improve/handle excessive thread creation on the server side.
Can someone pls throw light on how servers like Yahoo handle them (some other technique other than increasing memory on the box or load balancing??).


pb citeee
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you trying to solve a specific problem or do you just want less threads created?

It's fairly simple to implement a Thread pool if that's all you require.
 
pb citeee
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David O'Meara:
Are you trying to solve a specific problem or do you just want less threads created?

It's fairly simple to implement a Thread pool if that's all you require.


Hi David,

Thanks for the response.

I want to avoid thrashing on the server side.Let me elaborate - I have a chat client-server appl. that can talk to other third party chat systems(like MSN), so i spawn a separate thread for each system.

Also pls elaborate on the Thread pool(using work queque ??).

Thanks a lot
pb citeee
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See JDK 5's Executor and BlockingQueue for some neat background on thread pools. I found these very intuitive to use. If you don't, just give a holler up in the theading forum.

If you're on JDK 1.4 or later, read up on NIO. I need to set aside a block of time to make my Wiki do this just to learn how it works.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!