Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #10353
| Date | 2011-11-30 03:11 -0800 |
|---|---|
| From | Patricia Shanahan <pats@acm.org> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Thread question |
| References | <i9tbd7ppgalucct4i2t2agj9hldjumnmk4@4ax.com> <081cd7paqgsa8bbg5gjh8v1kinfp7asgt0@4ax.com> |
| Message-ID | <YbKdnc-ylpHAkkvTnZ2dnUVZ_vudnZ2d@earthlink.com> (permalink) |
On 11/30/2011 2:32 AM, Roedy Green wrote: ... > I'll be curious to find out the optimal number of threads. I don't > like to pester the book stores. I can debug this with 2 threads > without doing too much pestering, but repeated runs to binary search > the optimum number of threads... maybe I should use the fancy > features to dynamically adjust it via a feedback mechanism. > Here's a basic approach to picking a thread count: 1. Measure a single thread and a small number of threads, and estimate the usage for each critical resource as a function of the number of threads. The critical resources will be things like CPU utilization, memory footprint, and average number of outstanding requests. For most resources, N threads will have N times the utilization of a single thread. Memory footprint will probably show an overhead for shared code plus a component that scales with the number of threads. 2. Decide how much of each resource you want to permit the job to use. This may change with e.g. the hardware configuration on which it is running. It is rarely a good idea to allow one job to use the whole of anything. 3. For each resource, calculate the maximum number of threads that will not overload the resource. 4. Pick the smallest result from step 3. That is the largest number of threads that will not overload any resource. For example, suppose you are willing to have an average of 20 requests outstanding, and each thread averages one request outstanding. Then that resource sets a limit of 20 threads. This approach needs only a couple of measurement runs and some decisions about the total resource levels you want to dedicate to this job. Patricia
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Thread question Roedy Green <see_website@mindprod.com.invalid> - 2011-11-30 01:31 -0800
Re: Thread question Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-11-30 01:48 -0800
Re: Thread question Roedy Green <see_website@mindprod.com.invalid> - 2011-11-30 02:32 -0800
Re: Thread question Roedy Green <see_website@mindprod.com.invalid> - 2011-11-30 02:48 -0800
Re: Thread question Patricia Shanahan <pats@acm.org> - 2011-11-30 03:11 -0800
Re: Thread question Paul Cager <paul.cager@googlemail.com> - 2011-11-30 07:10 -0800
Re: Thread question Patricia Shanahan <pats@acm.org> - 2011-11-30 09:34 -0800
Re: Thread question Roedy Green <see_website@mindprod.com.invalid> - 2011-11-30 06:10 -0800
Re: Thread question markspace <-@.> - 2011-11-30 06:13 -0800
Re: Thread question Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-11-30 11:53 -0800
Re: Thread question Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-30 07:28 -0500
Re: Thread question markspace <-@.> - 2011-11-30 05:30 -0800
Re: Thread question Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-30 21:04 -0500
Re: Thread question markspace <-@.> - 2011-11-30 18:28 -0800
Re: Thread question markspace <-@.> - 2011-11-30 05:50 -0800
Re: Thread question markspace <-@.> - 2011-11-30 06:04 -0800
Re: Thread question Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-11-30 11:48 -0800
Re: Thread question Roedy Green <see_website@mindprod.com.invalid> - 2011-11-30 13:23 -0800
csiph-web