Board index » jbuilder » Threading

Threading


2003-08-12 08:47:11 PM
jbuilder17
I'm using threads in my app, but I'd like to use them more efficient
then at the present. How can I get info about CPU usage and then start more
threads if CPU usage is at low level? Is there a better way?
 
 

Re:Threading

Java doesn't give you that kind of low-level access.
How exactly do you plan to use the extra CPU time? Surely if your other
threads are busy enough they will consume all available CPU.
--
Check out our latest white papers at
www.datadevelopment.com/papers/index.html
BladeNET Scores With Borland Enterprise Tools
Team Development with JBuilder and Borland Enterprise Server
Dolphin Data Development Ltd.
www.datadevelopment.com/
"Oliver Young" < XXXX@XXXXX.COM >wrote in message
Quote

I'm using threads in my app, but I'd like to use them more efficient
then at the present. How can I get info about CPU usage and then start
more
threads if CPU usage is at low level? Is there a better way?


 

Re:Threading

Oliver Young wrote:
Quote

>How exactly do you plan to use the extra CPU time?
I'm trying to send as much as it is possible e-mails per minute. I'd
like to start more threads if there is a lot of free CPU time. I
belive number of started threads is dependant of CPU power. Am I
wrong?
Quite possibly; the optimum number of worker threads in such a system
will also be affected by contention for shared resources between
threads (i.e. how much time threads spend waiting for resources to
become available) and, in this case, the network.
How are these e-mails being sent? Are you performing mx lookups, or
just fowarding to an SMTP server? In the first case it makes some sense
to have multiple threads processing jobs, although the network and the
machine will still have an affect on how many it's worth having. In the
second case, everything's being pushed to a single socket anyway, so
network access (at least) will have to be single-threaded.
Quote
>Surely if your other threads are busy enough they will
>consume all available CPU.
Yes, but I was thinking that I should start 5 threads on P II 450
MHz, and 15 threads on P III 1,0 GHz, and 30 threads on P4 2,4 GHz.
Am I wrong?
Depends what they're doing, whether they're all doing it at the same
time, etc etc.
There are no hard and fast numbers in concurrency requirements, even
for a given machine - it depends upon work load as well.
If you describe a bit more about your architecure (provided this isn't
spam software :) I'll try and make some more concrete reccomendations.
 

{smallsort}

Re:Threading

Quote
How are these e-mails being sent? Are you performing mx lookups, or
What are mx lookups?
Quote
just fowarding to an SMTP server?
Yes, but first they are digitally signed and/or encrypted. It is SMIME.
Quote
although the network and the
machine will still have an affect on how many it's worth having.
Yes, I've tested it on different PC configurations and faster PCs send more
mails per minute.
Quote
In the
second case, everything's being pushed to a single socket anyway, so
network access (at least) will have to be single-threaded.
I'm using Bouncy Castle libraries. I'm not dealing with network at all.
Quote
There are no hard and fast numbers in concurrency requirements, even
for a given machine - it depends upon work load as well.
Can I start high fixed number (i.e. 30) of threads on any machine? Will that
(high number of threads) slow down slow machines?
Quote
If you describe a bit more about your architecure (provided this isn't
spam software :) I'll try and make some more concrete reccomendations.
No, it is not spam software. :) My mail app will send digitally signed
(and/or encrypted) invoices to the customers (companies).
Thank you.
 

Re:Threading

"Oliver Young" < XXXX@XXXXX.COM >writes:
Quote
What are mx lookups?
DNS lookups for mail exchange (MX) records for a domain. usually you
just deliver mail to a local SMTP server's spooling and let it look it
up for you later. The alternative is to find a MX for each recipient's
domain and deliver to the local users directly.