On 07/05/2012 23:13, Christopher Schultz wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Miguel,

On 5/5/12 5:41 AM, Miguel González Castaños wrote:
Yes, I have pinpointed several queries that took quite long
and specially subqueries. I forwarded this info to the
developer but she said it was alright. More than a second to
run a query seems to be a lot to me.
That depends on what the query does. If it checks permissions to
login, that's insane and you should get a new programmer. If it's
a reporting query that gathers lots of data then 1 second might
not be quite so far-fetched.
I have checked directly the slow query log to pinpoint the real
queries. I found many subqueries, which I believe is not a good
practice, am I right?
There's nothing wrong with subqueries in general, it's just that the
MySQL query optimizer appears to be particularly stupid when it comes
to them, and you often end up with *DEPENDENT* subqueries which
essentially issue N queries instead of only 2 queries (if the subquery
for instance were to be independent, it could be evaluated first and
then essentially substituted in the outer query). Only EXPLAIN can
tell you what will happen with each query. Remember to use live data
with EXPLAIN because the query optimizer is very sensitive to the data
it will be scanning... if you have a test table with 5 records in it,
you're going to get worthless EXPLAIN results.
Sorry I didn't reply to your email, but somehow it got lost in my inbox.

Well, in the end my client managed to get the developer onboard again and to rewrite the subqueries since they were not using any index at all. Let's see how that goes.


Thread dumps can be very helpful as well. You might also want to look at running 'sar' all the time to get CPU/IO/etc sampling to see if you have any other kind of resource shortcoming.

I have just installed sar yesterday and I'm downloading the reports through ksar remotely through SSH. Nice tool BTW.

Tomorrow we are probably getting many clients connecting to the webapp and we can get some conclusions.

I have just realized the server is running a 32 bits 1.5 JDK and the OS is a 64 bits linux machine. I'm wondering if using a JVM 1.7 for 64 bits could give us more room to have more people connected simultaneously.

Miguel







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

Reply via email to