Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Tomcat Multi-Threading

Reply
Thread Tools

Tomcat Multi-Threading

 
 
Lew
Guest
Posts: n/a
 
      01-30-2013
Magnus Warker wrote:
> Lew wrote:
>> Magnus Warker wrote:
>>> Arne Vajh�j wrote:
>>>> Lew wrote:
>>>>> In the world of Java, no applications are single threaded.
>>>> I think most people would consider a console app with no
>>>> threads to be single-threaded.

>
>>> There is even no relationship between a programming language and the
>>> threading architecture of an application. The fact that Java supports
>>> multi-threading does not lead to the fact that every Java application is
>>> multi-threaded.

>>
>> No, the first fact does not lead to the second fact, but the second factis nevertheless true.

>
>> The JVM is multi-threaded and has, what, a minimum of four? at any rate severa; threads running
>> even if the application only uses one of them.

>
> There is a mistake in your logical conclusion: Even if the VM is
> multi-threaded, the applications running on top of them may still be
> single-threaded. So your statement ("no applications are single
> threaded") is simply wrong.


No, it isn't.

The Java application, from the OS perspective, comprises the JVM and everything it runs.

The application doesn't exist outside the context of the JVM, so such considerations matter.

Even more important, the OP wants to know if multiple CPUs will help performance of a
Java app if it's multithreaded. Since the app runs in a multi-threaded context, if multiple
CPUs would speed up a multi-threaded app, they'd help *any* Java app. I made this point
upthread; I guess you decided to ignore it in order to snark, huh?

Let's try to stay focused on the OP's concern here, shall we?

--
Lew
 
Reply With Quote
 
 
 
 
zigzagdna@yahoo.com
Guest
Posts: n/a
 
      01-30-2013
On Wednesday, January 30, 2013 12:49:24 PM UTC-5, lipska the kat wrote:
> On 30/01/13 16:28, Lew wrote: > Magnus Warker wrote: >> Arne Vajhøj wrote: >>> Lew wrote: >>>> In the world of Java, no applications are single threaded. >>> I think most people would consider a console app with no >>> threads to be single-threaded. >> >> There is even no relationship between a programming language and the >> threading architecture of an application. The fact that Java supports >> multi-threading does not lead to the fact that every Java application is >> multi-threaded. > > No, the first fact does not lead to the second fact, but the second fact is nevertheless true. > > The JVM is multi-threaded and has, what, a minimum of four? at any rate severa; threads running > even if the application only uses one of them. I think you may be confusing the VM and the threads it uses to do housekeeping (garbage collection, assignment of execution threads to multiple processors etc) with the application running in the VM, which, unless you explicitly create a new Thread in your code will by default be single threaded. > Do a little research. Well quite lipska -- Lipska the Kat©: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun


Thanks a lot to all of your insight. I do not see any separate java processfor my "application". I only see tomcata6.exe which shows many threads, soI assuming my "application" is multi-theraded and more CPU's should help!!!
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      01-30-2013
lipska the kat wrote:
>Lew wrote:
>>>>> In the world of Java, no applications are single threaded.

> I think you may be confusing the VM and the threads it uses to do
> housekeeping (garbage collection, assignment of execution threads to
> multiple processors etc) with the application running in the VM, which,
> unless you explicitly create a new Thread in your code will by default
> be single threaded.


No, I'm not confusing them, I'm referring to them.

>> Do a little research.

>
> Well quite


You obviously have done the research, since you mentioned the very threads to
which I'm referring.

The OP's question, as I'm pointing out for the third time, has to do with whether
multi-core platforms will enhance performance if there are multiple threads. Since
every Java program involves multiple threads, it's reasonable to assume that any
effect that exists due to multiple CPUs would be relevant.

--
Lew
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      01-31-2013
On 1/30/2013 2:29 PM, wrote:
> Thanks a lot to all of your insight. I do not see any separate java
> process for my "application". I only see tomcata6.exe which shows
> many threads, so I assuming my "application" is multi-theraded and
> more CPU's should help!!!


It is correct that it is a single process with multiple threads.

Performance will be improved by adding more CPU's *if* the application
is CPU bound.

If you are currently using 10% of available CPU power, because all
threads are waiting for the database, then adding more CPU's will
not help.

If you are using 100% of available CPU power and the threads are
waiting to get the CPU, then adding more CPU's should help.

Arne


 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      01-31-2013
On 1/30/2013 3:30 PM, Leif Roar Moldskred wrote:
> wrote:
>> Thanks a lot to all of your insight. I do not see any separate java
>> process for my "application". I only see tomcata6.exe which shows
>> many threads, so I assuming my "application" is multi-theraded and
>> more CPU's should help!!!

>
> That's not necessarily the case. Whether more CPU cores will improve
> an application's performance depends on how the application balances
> CPU load across threads -- not just the number of threads it uses. If
> an application uses 20 threads, but 19 of those spends almost all
> their time waiting on work being done in the 20th thread, throwing
> more cores at the application isn't going to make a measureable
> difference.


But that is not a very likely scenario for a web app.

Arne

 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      01-31-2013
On 1/30/2013 1:54 AM, Lew wrote:
> Arne Vajhøj wrote:
>> Lew wrote:
>>> In the world of Java, no applications are single threaded.

>>
>> I think most people would consider a console app with no
>> threads to be single-threaded. Whether the JVM uses some
>> threads behind the scene for various purposes is a JVM
>> implementation detail.

>
> A detail that is directly relevant to the OP's question about whether
> multiple CPUs would enhance performance!
>
> This is one scenario where you cannot merely wave your hands and pretend
> the console app is single threaded, because if multiple CPUs do help performance
> of multi-threaded Java programs, then they'll help that app, too.
>
> In your rush to disagree you threw out the baby with the bath water.


That comment was specifically towards you claim that there were
no single threaded apps in Java.

The discussion is not relevant for OP as he has very multi threaded
app.

Arne


 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      01-31-2013
On 1/30/2013 11:28 AM, Lew wrote:
> Magnus Warker wrote:
>> Arne Vajhøj wrote:
>>> Lew wrote:
>>>> In the world of Java, no applications are single threaded.
>>> I think most people would consider a console app with no
>>> threads to be single-threaded.

>>
>> There is even no relationship between a programming language and the
>> threading architecture of an application. The fact that Java supports
>> multi-threading does not lead to the fact that every Java application is
>> multi-threaded.

>
> No, the first fact does not lead to the second fact, but the second fact is nevertheless true.
>
> The JVM is multi-threaded and has, what, a minimum of four? at any rate severa; threads running
> even if the application only uses one of them.


The JVM does not have a specific number of threads. The specific JVM you
are using have a specific number of threads.

The fact that some JVM's start extra threads does not make all
Java apps multi threaded.

Arne


 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      01-31-2013
On 1/30/2013 12:49 PM, Lew wrote:
> Magnus Warker wrote:
>> Lew wrote:
>>> Magnus Warker wrote:
>>>> Arne Vajh�j wrote:
>>>>> Lew wrote:
>>>>>> In the world of Java, no applications are single threaded.
>>>>> I think most people would consider a console app with no
>>>>> threads to be single-threaded.

>>
>>>> There is even no relationship between a programming language and the
>>>> threading architecture of an application. The fact that Java supports
>>>> multi-threading does not lead to the fact that every Java application is
>>>> multi-threaded.
>>>
>>> No, the first fact does not lead to the second fact, but the second fact is nevertheless true.

>>
>>> The JVM is multi-threaded and has, what, a minimum of four? at any rate severa; threads running
>>> even if the application only uses one of them.

>>
>> There is a mistake in your logical conclusion: Even if the VM is
>> multi-threaded, the applications running on top of them may still be
>> single-threaded. So your statement ("no applications are single
>> threaded") is simply wrong.

>
> No, it isn't.
>
> The Java application, from the OS perspective, comprises the JVM and everything it runs.
>
> The application doesn't exist outside the context of the JVM, so such considerations matter.


As you can write runtimes and runtime libs that start threads for any
language, then you logic of "some JVM's start threads => Java
applications are always multi threaded" implies that it is
only possible to write single threaded apps in languages
like assembler where you can control exactly what happens.

That is of course a perfectly consistent terminology.

But it is not the terminology used in the IT industry.

A multi threaded app in common terminology is where the application
itself contains code that result in threads being started.

Arne

 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      01-31-2013
On 1/30/2013 5:48 PM, Lew wrote:
> lipska the kat wrote:
>> Lew wrote:
>>>>>> In the world of Java, no applications are single threaded.

>> I think you may be confusing the VM and the threads it uses to do
>> housekeeping (garbage collection, assignment of execution threads to
>> multiple processors etc) with the application running in the VM, which,
>> unless you explicitly create a new Thread in your code will by default
>> be single threaded.

>
> No, I'm not confusing them, I'm referring to them.
>
>>> Do a little research.

>>
>> Well quite

>
> You obviously have done the research, since you mentioned the very threads to
> which I'm referring.
>
> The OP's question, as I'm pointing out for the third time, has to do with whether
> multi-core platforms will enhance performance if there are multiple threads. Since
> every Java program involves multiple threads, it's reasonable to assume that any
> effect that exists due to multiple CPUs would be relevant.


The effect of multi core from just the house keeping threads would
not be that big.

But I don't think anyone argued against that multi core is good for
Java in general (besides the JVM house keeping threads a modern OS
usually runs dozens of other processes).

What we are skeptical about is you claim that all Java apps
are multi threaded. That seems to be based on a rather unsual
definition of multi threaded.

Arne


 
Reply With Quote
 
Magnus Warker
Guest
Posts: n/a
 
      02-01-2013
On 01/30/2013 06:49 PM, Lew wrote:
> Magnus Warker wrote:
>> Lew wrote:


>>> The JVM is multi-threaded and has, what, a minimum of four? at any rate severa; threads running
>>> even if the application only uses one of them.


>> There is a mistake in your logical conclusion: Even if the VM is
>> multi-threaded, the applications running on top of them may still be
>> single-threaded. So your statement ("no applications are single
>> threaded") is simply wrong.


> Even more important, the OP wants to know if multiple CPUs will help performance of a
> Java app if it's multithreaded. Since the app runs in a multi-threaded context, if multiple
> CPUs would speed up a multi-threaded app, they'd help *any* Java app. I made this point
> upthread;


I can only repeat what others already pointed out:

You are confusing multi-threading in java applications and processes
that are multi-threaded from the os perspective.

> I guess you decided to ignore it in order to snark, huh?


This is your job.

Magnus

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Which JVM to use for Tomcat 5.0.28 and Tomcat 5.5.4? Katerina McLean Java 1 12-10-2004 10:55 PM
Tomcat 4.1.31 - huge count of webapps, Tomcat hangs up Martin Eberle Java 2 12-03-2004 07:10 PM
Tomcat Web application manager - Virtual host Tomcat 4.30 + Apache2 + JK2 connector with multi IPs Joe Java 0 07-12-2004 03:06 PM
Apache Tomcat 4.1.24: problem with Tomcat Administration link Christos Gravvanis Java 0 07-07-2004 05:21 PM
[TOMCAT] Tomcat crashes %=zerointeractive.it% Java 1 01-22-2004 12:08 PM



Advertisments