I've written an OSS project called Clippy which stores clipboard history in an embedded H2 database: https://github.com/EsotericSoftware/clippy/
I'm seeing the Clippy process sometimes causes CPU usage for long periods of time. It jumps between 1% and 20% on a 12 core processor and this continues for hours and hours. I captured stacktraces using jstack have have attached one below [1]. It appears that MVStore compactRewrite is the culprit. My H2 version is 1.4.192. I will update to the latest, but I wanted to report this now since I don't know how long it will take before I see the issue again. My db file is 590 MB and has 83,341 rows. The schema is simple, just 3 columns: id INTEGER IDENTITY text VARCHAR_IGNORECASE NOT NULL snip VARCHAR_IGNORECASE(2048) NOT NULL I have 3 indexes: id DESC snip text The data is like: MAX(LENGTH(text)) == 995,797 AVG(LENGTH(text)) == 783 FWIW, I use "SET LOG 0" to disable the transaction log, as it seems unnecessary for my app's usage. Is there anything I can do to reduce MVStore compactRewrite CPU usage? I don't mind it happening occasionally, but I'm seeing it happen for 12+ hours, until I restart my app. Even if the background processing doesn't affect write speeds, it's not ideal for an app such as mine which is intended to run in the background on user workstations rather than servers. Restarting my app seems to help for some time. If it shouldn't be running constantly, is there something I can do to collect information about the problem? Unfortunately I can't send the database file, as it may contain personal information. Thanks! -Nate [1]: jstack stacktrace: "MVStore background writer nio:C:/path/db/db.mv.db" daemon prio=6 tid=0x000000000ab6e800 nid=0x2148 runnable [0x000000001192d000] java.lang.Thread.State: RUNNABLE at org.h2.mvstore.db.ValueDataType.readString(ValueDataType.java:637) at org.h2.mvstore.db.ValueDataType.readValue(ValueDataType.java:532) at org.h2.mvstore.db.ValueDataType.readValue(ValueDataType.java:572) at org.h2.mvstore.db.ValueDataType.read(ValueDataType.java:172) at org.h2.mvstore.db.ValueDataType.read(ValueDataType.java:159) at org.h2.mvstore.Page.read(Page.java:708) at org.h2.mvstore.Page.read(Page.java:195) at org.h2.mvstore.MVStore.readPage(MVStore.java:1944) at org.h2.mvstore.MVMap.readPage(MVMap.java:736) at org.h2.mvstore.Page.getChildPage(Page.java:217) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:823) at org.h2.mvstore.MVMap.rewrite(MVMap.java:782) at org.h2.mvstore.MVStore.compactRewrite(MVStore.java:1910) at org.h2.mvstore.MVStore.compact(MVStore.java:1802) - locked <0x00000000f00a2c18> (a java.lang.Object) at org.h2.mvstore.MVStore.writeInBackground(MVStore.java:2504) at org.h2.mvstore.MVStore$BackgroundWriterThread.run(MVStore.java:2694) -- 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 h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.