0

I have a scenario, where I can initially spread many threads, but after some time if i found machine is getting too much loaded , then i should remove some threads to other machines at the run time, similarly if threads are making less utilization of resource, then i should be able to launch more threads. This all should be able at run time. Can any one please help to design this type of architecture. Programming Language : JAVA

BigBang
  • 149
  • 12
  • What you need is a load balancer which sits before your application not inside your application. – shazin Jan 27 '15 at 09:21
  • I'm voting to close this question as off-topic because it reads as a request for work - i.e 'please design me a load balancer'. – totallyNotLizards Jan 27 '15 at 14:38
  • It is not "please design me a load balancer" ... It is..."please help to design this type of architecture".. get the difference first.. – BigBang Jan 28 '15 at 08:54

2 Answers2

1

It sounds like you need a distributed job scheduler; see Distributed Job scheduling, management, and reporting.

It should be noted that the job scheduler approach assumes that your workloads can be broken up into independent jobs, and that those jobs (typically) can be distributed to different machines where the data resides (or can be made to reside). You can't apply this when the workload you are trying to balance is the threads themselves. Or to put it another way, moving an active thread from one machine to another won't work. (The problem is that a thread's state is intimately intertwined with the JVM in which it currently runs. Current generation JVMs do not support migration of threads, and don't provide anything that could be used to do this.)

Another way to do this (if you are processing web requests for example) is to put a load balancer in front of your servers that sends requests to different servers depending on load. This assumes that the necessary data for the request is equally available in or accessible from all servers.

Community
  • 1
  • 1
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
1

this link would help you to find the solution. http://www.infoq.com/news/2006/12/terracotta-jvm-clustering

Jamsheed
  • 47
  • 3