users@glassfish.java.net

Re: Changing thread priority in session bean

From: <glassfish_at_javadesktop.org>
Date: Mon, 04 Jun 2007 15:44:12 PDT

No, you shouldn't be tweaking the thread priority on anything in an EJB server, as they're not "your" threads to be playing with.

If you were to do so, the server could easily reuse that thread for your response sensitive bean later, or even worse, an internal GC thread.

So, no, playing with priorities is a bad idea.

Is the working thread really affecting the other thread in terms of performance and response?

If you want to offload the that calculation, you could easily deploy it on a separate server, and invoke the calculation remotely. That would off load the impact completely.

You could also launch it in to a separate Glassfish instance, even on the same machine, and then perhaps using the Unix 'nice' facility to lower the priority of the entire server instance that the calculation is running in. (Dunno how to do this on Windows.)

If you're running on a multi-processor, perhaps you could pin the response sensitive server to some dedicated CPUs, and then let the calc thread work with whatever is left.

The point is, that there are several other ways you can do this, but many of them are probably OS specific.
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=220443