Paul Chibulcuteanu created OAK-9963: ---------------------------------------
Summary: Performance degradation when reading system properties on each NodeImpl Key: OAK-9963 URL: https://issues.apache.org/jira/browse/OAK-9963 Project: Jackrabbit Oak Issue Type: Bug Components: jcr Affects Versions: 1.22.11 Reporter: Paul Chibulcuteanu Reading system properties on each NodeImpl causes performance issues especially on Java 8. Code: {code:java} public NodeImpl(T dlg, SessionContext sessionContext) { super(dlg, sessionContext); logWarnStringSizeThreshold = Integer.getInteger( OakJcrConstants.WARN_LOG_STRING_SIZE_THRESHOLD_KEY, OakJcrConstants.DEFAULT_WARN_LOG_STRING_SIZE_THRESHOLD_VALUE); } {code} One more important point on system property lookup in Oak. There is a huge difference between running the code on Java 8 and 11. The following test looks up a system property with 32 concurrent threads. Each reading the system property 10M times. {code:java} @Test public void run() throws Exception { List<Thread> threads = new ArrayList<>(); for (int i = 0; i < 32; i++) { threads.add(new Thread(this::getProperty)); } Stopwatch sw = Stopwatch.createStarted(); threads.forEach(Thread::start); for (Thread t : threads) { t.join(); } System.out.println("time: " + sw); } private void getProperty() { for (int i = 0; i < 10_000_000; i++) { System.getProperty("foo"); } } {code} On my machine the outputs are: Java 8: ~20 seconds Java 11: 0.5 seconds Reason is how Properties implementation changed with Java 11. It is now using a ConcurrentHashMap. -- This message was sent by Atlassian Jira (v8.20.10#820010)