Does anyone have a working example of a manual Dis...
# lucee
d
Does anyone have a working example of a manual Distributed ehCache they can share? I have it working via multicast (with my fixes), but a manual configuration does not seem to work. I believe the issue to be with the RMI URIs. I know in AFC I needed special paths to get it to work after the hostname/port definitions. I can't end up using multicasting because there are issues with our datacenter host and their cloud solution, so I have to use a manual configuration.
So it turns out I found another bug in the ehCache extension. The RMI URLs are being cast to lower case, which breaks the configuration if your cache name has any upper case characters.
@zackster Where's a good place to discuss some changes to the ehCache plugin? The current admin UI is a little misleading and I think there are some things that could be done to simplify things. Should I just open a Jira issue?
@bdw429s I would love to get your feedback on some ideas as well.
Anyway, in a nutshell, I think the ehCache stuff could be simplified quite a bit with a few changes, but it might break the mental model for users because it would not match up with the way you'd configure the ehcache.xml directly. Today, to get ehCache working in distributed mode, you first need to download my fixes. It's just plain broken without it! However, if you're trying to configure "manual discovery", there are a few things that are not clear from the admin: 1. The RMI URLs, must contain not only a hostname:port, but also the current cache name. So, you can't just do:
192.168.1.20:40001|192.168.1.30:40001
, you would need
192.168.1.20:40001/CurrentCacheName|192.168.1.30:40001/CurrentCacheName
. That seems odd to me that you'd need to duplicate the cache name. Seems like Lucee should just add that for you. 2. This is an ehCache thing, but in the RMI URLs you must exclude the current server from the list of listeners. This makes it difficult to push out Lucee configurations to a pool of servers, because you need to push a different configuration out to each node. For example, if you have 3 nodes (A, B, C), then node A must set up B & C, node B set up A & C and finally node C would set up A & B. I think it would simplify things a lot if Lucee would just ignore any hosts that match the current server. This might be difficult to do if not using IP addresses, but if it can be done, it would allow the same configuration to be pushed out to each node. 3. The "Listener" port is required for both automatic and distributed mode. Since it's required, we could simplify the RMI URLs even more by not making the port required. The only use case where this could be a problem is if you're using different ports for each host. However, if the port is supplied, we use the port supplied. So, if you were using port 40001 for your RMI listener, you could just configure the RMI setup with hostname A,B,C on each server. It would automatically append the cachenames and port (when applicable) and ignore hostnames that match the current server. I think this would simplify things greatly.
z
let's move this on the mailing list, great info which is all going into a black hole....?
jira tickets aren't the place for discussions
d
Do you mean dev.lucee.org?
b
Yes, discourse is what he meant.
I assume the code in question is part of the exchache extension
Tickets for extensions still go in JIRA FWIW
And the extension code will be in a separate repo from Lucee itself
I've never touched the ehcache extension, but Zac has a lot of knowledge around compiling and testing extensions.
d
@bdw429s I've already supplied some pull requests for the ehCache extension. There's a number of bugs in the current version that make it essentially unusable. It will work, but only in some very specific use cases.
👍 1
z
@dswitzer not sure if it's possible due to this being distributed stuff, but are there any test cases you can add for these changes / improvements? https://github.com/lucee/extension-ehcache/pull/1
d
Possibly, but I'd need to understand how your test environments work. Testing multicasting might be very difficult. I'd be happy to take some time to talk on Tuesday (via Skype, Zoom, whatever) to discuss what might we might be able to test and how. (Monday is a holiday, so I'm not planning on working much tomorrow)
z
can do, I'll try and get micha to once over your changes then I'll release a snapshot
a few test cases are failing, i had to approve your first run, any subsequent commits / prs will now be automatically CI-ed https://github.com/lucee/extension-ehcache/runs/6631576508?check_suite_focus=true#step:9:456
d
@zackster I'm not sure why the ORM tests are failing. The stacktrace doesn't show any classes I touched and I'm not seeing the ehCache extension being referenced in the extension-hibernate code, but I might be missing something. You could try enabling "debug" logging for the Application log, that should give some decent insight as to what's happening in the ehcache-extension. I added debug logging to more of the extension code.
I will add that I did change how serialization works in the ehcache extension to fix some bugs and improver performance. For example, there was no reason to serialize objects when the cached object is not be pushed to other servers in the distributed configuration (which is honestly the way ehCache should be configured). You normally only want to have ehCache announce that a key should be invalidated to the other nodes and let the nodes then regenerated the value and put it into cache when needed. The only time you'd really want to have the cached item propagated to your other nodes is if the creating of the object has a high cost.
z
oh yeah, the orm ones are failing due to multiple labels, i need to make the label matching stricter
d
I'm glad I didn't break something!
@bdw429s / @zackster , So I finally created a thread to discuss changes to the ehCache extension: https://dev.lucee.org/t/improving-the-ehcache-extension/10326
👍 1
z
can you squash and your PR, that will trigger the CI with the changes to exclude orm stuff
d
@zackster I think I did that correctly.
ok, balls in my court, 0 tests found to run, sigh
all the ehcache tests are tagged with
labels="cache,ehCache"
but i'm only specifying
ehCache
ok, fixed that, if you rebase your PR it should all work. I also updated the extension to target java 1.8
hmmmf, almost! works on my machine lol
d
Ok, I rebased it
z
ok, build kungfu complete, even added a readme, do a rebase again and you PR should be green!
dunno if i shared this with you before, this little script allows you to run all the tests locally, just like github actions does just need to checkout lucee/lucee 6 and lucee/script-runner as per the paths (or tweak em)
d
I've rebased my branch. Hopefully this resolves the issue. Did @micha need anything from me? Did he have a chance to review it?
z
maybe tomorrow when he's working on Lucee stuff PR passed all tests and is Green https://github.com/lucee/extension-ehcache/runs/6713183014?check_suite_focus=true
👍 1