tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oded Arbel <o...@m-wise.com>
Subject Re: Java databases as alternative to MySQL on OS X Server? (OT)
Date Tue, 29 Nov 2005 09:00:42 GMT
On Tuesday, 29 בNovember 2005 03:21, Mieke Banderas wrote:
> Oded Arbel said:
> >b) Even assuming they are right, you still want to choose MySQL over
> > JVM space databases, because Java and Java databases are very much
> > thread enabled and create and destroy many threads.
>
> But do they do it mainly within the OS or within the JVM? 

The JVM can't create threads without OS support. Even user-space threads 
need some OS support.

> Top or PS 
> doesn't show individual processes within the JVM. 

That means they use kernel threads.

> I'm not clear on 
> how Java processes/threads relate to OS processes/threads. 
> to know where/how exactly Java threads are started/killed on Hotspot
> in OS X. Doesn't java threads mainly intercommunicate within the JVM?
> Context switches?

Not an OS X expert, but from Anandtech explanations and from what I've 
read elsewhere, Java threads are kernelthreads and are mapped to Mach 
threads. inter-thread communication in java is done through shared 
memory - shared variables, but the Java memory sharing model doesn't 
really share memory, Instead it uses thread local storage to store 
copies of shared variables and when you cross into or out of a 
synchronized block, the contents of the variables are copied. That 
means a lot of context switches through the kernel, and if you OS 
doesn't do that very well (and few do it as well as Solaris), then 
you'd be hard pressed for performance.

> Is it really a completely dead end that minimizing the OS threading
> in Mac OS X and keeping threads within JVM could improve performance?

As discussed above, there isn't much difference.

> Of course the Java DB in question would have to be somewhat similar
> to MySQL in performance, but possibly the Java DB could perform
> better with many connections as that is where MySQL on OS X breaks
> down according to anandtech.

I believe you wont see much improvement, if at all.

> >MySQL OTOH uses very
> >little threads - essentially it only creates a new thread to handle
> > a new client, and even then a single thread handles several clients
> > before another thread is required.
>
> But according to the anandtech article OS X is the only platform
> where performance breaks down after raising the amount of
> connections. So it would seem until Apple fixes the performance
> problems - which certainly may take a while-,  ways to use databases
> without creating many expensive (in theory) OS threads could be
> desirable.

That is if you subscribe to Anandtech's explanation that the poor MySQL 
performance is the result of poor threading performance. I think I 
provided enough evidence that their conclusions will not be taken at 
face value. Again, not an OS X expert, but I think its much more likely 
that the MySQL have problems with locking and context switches, as 
Anandtech themselves have mentioned and even quoted MySQL on the issue 
- and immediately disregarded it in favor of the thread theory.

-- 
Oded Arbel
m-Wise mobile solutions
oded@m-wise.com

+972-9-9611212 (204)
+972-54-7340014

::..
Conscience is what hurts when everything else feels so good.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message