orientechnologies / orientdb

OrientDB is the most versatile DBMS supporting Graph, Document, Reactive, Full-Text and Geospatial models in one Multi-Model product. OrientDB can run distributed (Multi-Master), supports SQL, ACID Transactions, Full-Text indexing and Reactive Queries.
https://orientdb.dev
Apache License 2.0
4.76k stars 872 forks source link

Opening a Database on Raspberry PI extremly slow #7806

Closed EricSchreiner closed 4 years ago

EricSchreiner commented 7 years ago

OrientDB Version: <2.2.29>

Java Version: <Oracle 1.8.0_141-8u141-b15-1~deb9u1-b15>

OS: <Linux on Raspberry PI os.version: 4.9.41-v7+>

Expected behavior

<Some Seconds to start a Database this is what we had with Version 2.1.x>

Actual behavior

<Something between 7minutes (existing db) and 20! minutes(create new empty database)>

Steps to reproduce

Hello @laa, Hello @lvca after you have solved #7586 Our photoserver PicApport is running fine on 32 Bit platforms(Linux, Windows, MacOS) with one Exception: The Raspberry PI. PicApport was running fine on the Raspberry with Orient DB 2.1.x

We have already spend hours with different memory configurations without any result.

In the code below and the logfile you see that just opening (an empty) database takes 7 Minutes. Creating a new one takes 20 Minutes(without creating the tables) I've marked the relevant parts in the code and log-output in bold italic(I've also added a config dump):

Any ideas / suggestions? ConfigDump.txt

GenLog.dumpFormattedMessage("PicApportDBService.startDatabase:" + dbName); if (!databaseMustBeCreated) { ODatabaseDocumentTx databaseInit = getPooledDbInstance(); GenLog.dumpDebugMessage("PicApportDBService.startDatabase.afterGetPooledDbInstance()"); String databaseVersion = getDatabaseVersion(databaseInit); ..... .....

public ODatabaseDocumentTx getPooledDbInstance() { ODatabaseDocumentTx db = getDbPool().acquire(); return db; }

Logoutput

MSG @ 10:00:59.819 java.runtime totalMemory=518mb maxMemory=518mb freeMemory=515mb processors=4 MSG @ 10:00:59.828 java.runtime.argument: -Duser.language=de MSG @ 10:00:59.829 java.runtime.argument: -DTRACE=DEBUG MSG @ 10:00:59.830 java.runtime.argument: -Duser.home=/opt/picapport MSG @ 10:00:59.832 java.runtime.argument: -Xmx512m MSG @ 10:00:59.833 java.runtime.argument: -Xms512m MSG @ 10:00:59.834 java.runtime.argument: -XX:MaxDirectMemorySize=256m MSG @ 10:00:59.835 java.runtime.argument: -Dstorage.diskCache.bufferSize=128 MSG @ 10:00:59.836 java.runtime.argument: -Dmemory.chunk.size=10000 ... ... DEBUG@ 10:29:30.013 PicApportDBService.setDbConfig: ----- end dump db-configuration ----- MSG @ 10:29:30.018 PicApportDBService.startDatabase:plocal:/opt/picapport/.picapport/db/db.2.2.26 DEBUG@ 10:36:20.721 PicApportDBService.startDatabase.afterGetPooledDbInstance() MSG @ 10:36:20.741 PicApportDBService.startDatabase: Database version=2.2.26 DEBUG@ 10:36:20.913 PicApportCmdQueue.queueCmd: statusmessage Starte Robot ...

andrii0lomakin commented 7 years ago

Hi, @EricSchreiner, as I got it, DB open/create is slow on any platform right? Could you try on Linux using this profiler? Hope it will help us to identify hotspots at once. I need only raw file from profiler I will process it myself https://github.com/jvm-profiling-tools/honest-profiler

EricSchreiner commented 7 years ago

Hi @laa, the problem only occurs on a Raspberry PI on 2.2.x (It worked fine with 2.1). Does the profiler work on a Raspberry PI ? What is the profiler exactly doing?

andrii0lomakin commented 7 years ago

Hi @EricSchreiner . I got the problem. The profiler should work on Debian distributions so if you have debain for Raspberry PI it should work. Theoretically. The profiler gathers statistics about call stacks of methods during snapshotting and writes it to the log using proprietary OpenJDK/Oracle JDK API. I will process it later to find your bottlenecks.

EricSchreiner commented 7 years ago

Hi @laa I don't think this works for a Raspberry PI we get the following error message: root@raspberrypi:/opt/picapport# ./StartPicApport.sh Error occurred during initialization of VM Could not find agent library /opt/picapport/liblagent.so in absolute path, with error: /opt/picapport/liblagent.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch) root@raspberrypi:/opt/picapport#

andrii0lomakin commented 7 years ago

@EricSchreiner because you use Oracle JDK could you run the application with this command: java -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=delay=20s,duration=1500s,name=myrecording,filename=/tmp/myrecording.jfr And try to create a database. Please do not be scared about word "commercial" in the names of options you are free to use them unless you do not use them in production. Sorry for the delay was busy by one commercial support issue.

EricSchreiner commented 7 years ago

@laa ...no problem we'll try to find some room today and provide you the results

EricSchreiner commented 7 years ago

Hi @Iaa, when we started to execute your requested setup it turned out, that we where not using the Oracle JDK in our test-environment. After installing the Oracle JDK the problem disappeared. We digged more into that and it turned out the the described problem above only occurs with the Open-JRE on the Raspberry PI. As soon as we changed to Oracle-JRE the problem disappeared. We can reproduce the problem but I have no clue where to start investigating. For the moment we will recommend our users to use the Oracle JRE on the raspberry PI......

andrii0lomakin commented 7 years ago

OK, I will set low priority issue for this issue. Will back to it if we have time. I am even not sure whether that ODB issue. More likely that is JDK issue.

EricSchreiner commented 7 years ago

the only thing I know is that it happens during open of the database... but anyway for the moment you decision seems to be OK

andrii0lomakin commented 7 years ago

Well probably we will by RapberiPI and will fix it on it, if possible to fix it of course

andrii0lomakin commented 4 years ago

Sorry not a priority right now