[ Team LiB ] Previous Section Next Section

Using Thread Pools

Threading is more than just a programming issue, of course; it's also a tuning issue. The more threads your Java Virtual Machine or operating system must keep track of, the slower your overall performance.

Many JSP/servlet engines let you configure the number of threads for performing various operations. They allow you to create a thread pool with a minimum and maximum number of available threads. You should have some idea of how many requests the server should be handling during a peak load, and the documentation for your JSP/servlet engine should give you an idea of how it uses threads and what numbers you can set for threading.

You also need to decide whether you should gear your server for best performance under peak load or for better performance the rest of the time but some degradation at peak time. If you expect a huge load at peak time but peak time is only a small part of the day, and if gearing your server for peak time hogs resources the rest of the time, you might consider lowering your resource allocation.

    [ Team LiB ] Previous Section Next Section