6

I use

  • Tomcat
  • C3p0 (JNDI configured inside Tomcat)
  • MySQL (InnoDB) / Derby (not embedded) as Database
  • EHCache (in Memory)
  • Hibernate
  • Testmachine runs WinXP

I used Derby for development and wanted to switch to MySQL. I was surprised to see that with MySQL my Tests were approximately 50% slower than with Derby.

My Testscenario :

  • Approximately 2000 Selects, varying in complexity, but none used more than one join. All SQLs use Indexes
  • Ehcache is filled up with a setup Run. After that I run the Testscenario at least 50x to overcome Optimizer/GC Effects

I verified that the cache is in use. There are NO real SQLs coming to the database. So I just guess it's the connection creation time which slows the MySQL tests down.

pala_
  • 8,901
  • 1
  • 15
  • 32
Michael Pralow
  • 6,560
  • 2
  • 30
  • 46
  • If you're using C3P0, wouldn't the connections be pooled/cached? – jdigital Feb 15 '09 at 19:16
  • yes that should be the case, hmm maybe c3p0 makes some tests before it returns the connection from the pool. ill look into that – Michael Pralow Feb 15 '09 at 19:34
  • In my experience, establishing connections to MySQL has always been very fast. Have you tried using a profiler? – Matt Solnit Feb 18 '09 at 00:12
  • I don't have the same settings as you, but i've always found MySQL to be quite fast about JDBC connections. I'm running DBCP as the pool connection, MySQL (InnoDB) / Oracle / HSQLDB, Linux or Solaris OS, and in the end, the winner is HSQLDB, closely followed by MySQL. Maybe you should check the new pool created by the Tomcat folks : http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html – SRG Apr 30 '12 at 23:50
  • If there are no SQL statements being executed due to the caching, why would there be any connections? – user207421 Apr 25 '14 at 15:08
  • Derby is filebased database – Sumesh TG Jun 20 '18 at 12:17

0 Answers0