When to Use Apache Derby vs. An External Database

When to Use Apache Derby vs. An External Database

AuthorFullName__c
Patrick Russell
articleNumber
000001236
ft:sourceType
Salesforce
FirstPublishedDate
2016-10-06T13:38:06Z
lastModifiedDate
2024-03-10T07:47:59Z
VersionNumber
7

For ease of setup, Artifactory comes bundled with an internal database out of the box.

When there are fewer than 500,000 artifacts, this bundled Derby database will provide excellent performance. When Artifactory is that small, its Derby DB will perform even better than an external database such as MySQL. This is because a Derby DB runs on the same Java Virtual Machine (JVM) as Artifactory, so there is zero network latency. 

However, above the 500,000 artifact threshold, performance will start to degrade. This is especially the case under very heavy load. The reason is for this degradation is the same reason for the high performance mentioned earlier. The shared JVM resources, mainly RAM and CPU threads, are shared between these two separate processes.

During periods of high traffic Artifactory will start to use more RAM. Yet, at the same time, the Derby database must also use more RAM to handle the influx of SQL queries Artifactory is making. This greatly increases the load on the server, and can reach a point where the Artifactory JVM exceeds its memory limits and crashes.

There are other considerations besides performance for choosing an external and out-of-process database. If your organization has its own DataBase Administrators (DBAs), they can and should manage the Artifactory database for you. Another reason to have an external database is to make backups easier, you can find the details on backup best practices HERE. The document recommends capturing a database snapshot, which is not possible on a Derby database.

Finally, the biggest non-performance reason to migrate to an external database is that after 500,000 artifacts, moving to another database will become increasingly difficult. As advised on the JFrog Wiki HERE, the only way to change databases is to perform a System Export. Above 500,000 artifacts this System Export will take above an hour to run, which is not normally acceptable downtime.

In practically every high-scale circumstance, migrating away from the Derby database is the first recommendation by JFrog.