Lucee 5 ConcurrentHashMapPro needs to be upgraded

Description

You have done amazing work for us with Lucee 5 and the osgi extensions. I have been inspired to dive deep into changing Lucee and doing more with Java. I've already got 100 hours of my spare time into this effort in the last month, so I've figured a bunch of things out now and I have working extension code that gives me new APIs and data types.

During my research, I noticed that ConcurrentHashMapPro in Lucee 5 is some old version of JDK's source code copy and pasted into the Lucee codebase. This worried me a bit since I found other information saying that JDK 8 had a much improved version, and there are a lot of benchmarks showing how good it is out there.

I thoroughly checked the performance of Lucee's Struct vs JDK 8 ConcurrentHashMap on new versions of Lucee 5.3 and Ubuntu 18.04 Linux and also on Windows 10. I found that JDK 8's version is up to 5 times faster especially under moderate or heavy load. You may see it to be closer with near-idle cpu. 5 times is huge, very exciting that we have this opportunity to improve performance globally like this.

I also want to note that my implementation of this test was made to be completely CFML compatible. I extended "StructSupport" as a custom function and loaded as extension, and the test code was written in CFML and utilized the server scope and cfthread under both low and high contention for both read and write operations, so I know it doesn't break the language and that the performance is being tested fairly.

Obviously, Struct (and concurrentHashMapPro) is one of the most fundamental objects that the entire Lucee CFML language and some of the internal java objects use for everything that needs a hashmap. It should be worth upgrading this bit of code. I'm going to attempt to put this change in my test and production server before long, but I wanted to report this so you could consider upgrading this for the benefit of all Lucee users.

My goal was to build an Immutable Cache Lucee extension that offers ImmutableStructNew and ImmutableArrayNew and additional limitation. I started testing JDK 8's version after extending StructSupport successfully. I've tested other things, but I don't have much to say about them. I think concurrencyLevel could be reduced from 16 or those options made accessible to minimize memory usage on small objects if you know in advance what you need. Because it's not really possible to measure any benefits to that, I doubt it's worth putting those options into the core CFML structnew. However, I'm going to allow it in my extension as optional arguments since the main purpose for my extension work is to unlock the hidden Java performance that CFML can't get to yet. I'm also going to re-think my application design now that I know Java and Lucee so well.

Assignee

Unassigned

Reporter

Bruce Kirkpatrick

Labels

None

Sprint

None

Affects versions

Priority

Major
Configure