So I am implementing a search service that needs to be highly scaleable
behind an xfireservlet. The search service is a number of threads pulling
queries off of a queue, searching an index and passing the results back to a
hash for the webservice that called the search to access and return to the
client.

The issue lies in the way that you're polling those queues.  Is
"queue" a java.util.concurrent queue?  A JMS queue?  In the j.u.c
context, if you do something like this:

while (true) {
 Object foo = queue.poll();
 if (foo != null) process(foo);
}

You will absolutely peg the CPU.  You need to introduce some delays
into your polling passes, e.g.:

queue.poll(50L, TimeUnit.MILLISECONDS)

And that should take the load off of the CPU.

-- Paul

---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to