2015-04-09 13:07 GMT+02:00 Noel Grandin <[email protected]>:

> That's cache warmup, basically.
>
> The only way to circumvent this is to warm up the caches yourself.
> If you are running some kind of long-lived server application, it's fairly
> normal to run a thread at startup that executes some common queries to warm
> up the caches.


​I tried that, but not with much success until now. One problem is that
after restarting the server I do not have the delay any-more. (What I do
not understand.) So to test my changes I need to do a complete reboot.
Something to look into if I have a little bit more time.

The way I start the service is with:
    #!/usr/bin/env bash

    # An error should terminate the script
    set -o errexit
    set -o nounset


    # Always define all used variables
    # I use uppercase for readonly variables
    declare -r H2_JAR=/var/lib/h2/jars/h2-current.jar
    declare -r LOGFILE="/var/lib/h2/Logging/H2_$(date +%FT%H-%M).log"
    declare -r MAX=8912M
    declare -r MIN=4096M


    # main code
    if [[ "$(whoami)" != "h2" ]] ; then
        printf "This script should be run as h2 user\n"
        exit 1
    fi

    # Limit memory usage
    # Description in startShowMemory.sh
    /usr/bin/java -Xloggc:"${LOGFILE}" \
                  -XX:+PrintGCDateStamps \
                  -Xms"${MIN}" \
                  -Xmx"${MAX}" \
                  -cp "${H2_JAR}" \
                  org.h2.tools.Console \
                  -ifExists \
                  -tool \
                  -tcp


>
> On 2015-04-09 12:13 PM, Cecil Westerhof wrote:
>
>> The first time I send a query to H2 it takes around 25 seconds. All
>> subsequent queries are ready in less as a second. Is
>> this normal? Can I circumvent this?
>>
>
-- 
Cecil Westerhof

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to