• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Handling large number of threads(Server Side)

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic