Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

h2 console glacially slow

Tags:

console

h2

Earlier this year I moved to El Capitan on my MacBook Pro. Ever since I've been finding the h2 console very very slow. Here are timings taken today, no other apps running:

  • 2 min 5 sec: Launch the console and wait for it to finish loading. Uses a shell script which does the following:

    cd "/Applications/h2 1.3.167/bin"

    java -cp h2-1.3.167.jar org.h2.tools.Server

  • 2 min 48 sec: Click on the console's Connect button in my browser and wait for the database to be opened and the console to be ready to work

  • 2 min 20 sec: Run a very simple query which the DB engine takes 18ms to process
  • 21 sec: Click on the console's disconnect button and wait to be back at the "front page" for the console

This is on 1.3.167; I tried 1.3.176 earlier today, and it's just as slow, but it gives an error about my database contents once it's finally been opened, so I'll have to look into that sometime.

Has anyone else come across this extreme slowness? What can I do to solve it?

like image 681
skiaddict1 Avatar asked Dec 08 '16 00:12

skiaddict1


1 Answers

For those who may come along after me, here is the resolution (for my configuration).

It turned out the problem was that my machine name (in Sharing preferences) consisted of my first name and then an apostrophe and then "MacBook Pro". (for example, Santa's MacBook Pro) Except, the apostrophe wasn't: it was a smart quote.

No, I didn't put it there! I didn't even know until now that it was possible to do that. The Mac did it all on its own.

And, of course, the machine name was copied through to HostName. The smart quote was in there, too. Which was causing Java's StringCoding.encode() to have problems encoding the host name string in UTF-8. Which was causing DNS resolution to take 5s instead of 80ms. Which was making the h2 Console work glacially slowly...

Here are the two threads which helped me solve the problem:

h2 google groups

another thread here

Good luck! I hope your resolution is as simple as mine turned out to be!

like image 98
skiaddict1 Avatar answered Nov 12 '22 04:11

skiaddict1