james-project icon indicating copy to clipboard operation
james-project copied to clipboard

JAMES-3771 Migrate opensearch high level rest client to new java client

Open Arsnael opened this issue 2 years ago • 7 comments

A much more reworked cleaner version of https://github.com/apache/james-project/pull/1051

Still a few things remain:

  • [x] the ssl tests on the backends to debug and re-enable
  • [x] the sort issue with null fields... there was a workaround in the POC (that I personally don't like but I don't think we can do better)... I was hoping that the PR to fix on the opensearch client would be merged with a bit of change but.... nope (disabled the test for now, might put back the workaround though)
  • [x] debugging what's left

Arsnael avatar Jun 22 '22 04:06 Arsnael

Do we have a JIRA for this?

chibenwa avatar Jun 22 '22 10:06 chibenwa

Do we have a JIRA for this?

I reused JAMES-3771 but as we don't upgrade to es 8 anymore... should we create a new one or just update that task on the jira explaining it changed to this?

Arsnael avatar Jun 22 '22 10:06 Arsnael

I reused JAMES-3771 but as we don't upgrade to es 8 anymore... should we create a new one or just update that task on the jira explaining it changed to this?

No that's OK

However you should...

  • [ ] Link the ML conversations on the JIRA ticket
  • [ ] Clearly explain that we switch to OpenSearch and adopt the Java client in there too.

chibenwa avatar Jun 22 '22 11:06 chibenwa

I think something rather obscure is happening on the builds of this PR... will investigate

Arsnael avatar Jun 30 '22 02:06 Arsnael

test this please.

quantranhong1999 avatar Jul 03 '22 14:07 quantranhong1999

Now this work becomes based on #1078

We can then probably migrate faster to opensearch when waiting for this to be more stable

Arsnael avatar Aug 01 '22 10:08 Arsnael

rebased

Arsnael avatar Aug 04 '22 08:08 Arsnael

Rebased

Arsnael avatar Dec 08 '22 04:12 Arsnael

Exception in thread "OpenSearch-driver-0" java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached
	at java.base/java.lang.Thread.start0(Native Method)
	at java.base/java.lang.Thread.start(Thread.java:798)
	at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:337)
	at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:221)
	at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64)
	at java.base/java.lang.Thread.run(Thread.java:829)

Well I'm gonna give OpenSearch a bit more mem then...

Arsnael avatar Dec 09 '22 07:12 Arsnael

Could you please give us the output of jstack?

You get this error in James tests, or in the container output?

chibenwa avatar Dec 09 '22 09:12 chibenwa

No No that's the CI... That's the problem with local... I can't reproduce anything wrong at all, it runs fine all the time :(

Arsnael avatar Dec 09 '22 09:12 Arsnael

@chibenwa I must admit I did not have the motivation to switch back to master and recompile everything to test, but introducing the cleanup strategy on the alias and starting the opensearch docker container on a beforeAll for OpenSearchIntegrationTests... Was it really faster?

What I can observe locally is that if I revert this (see last commit) I earn 2 minutes back on the test suite regarding OpenSearchIntegrationTest in this PR so... I'm rather surprised :)

Arsnael avatar Dec 09 '22 09:12 Arsnael

Fair, don't hesitate to revert then.

chibenwa avatar Dec 09 '22 13:12 chibenwa

Amazing, that's :green_apple:

Can we measure performance for this (IMAP benches?)

Can we also compare the docker image size before / after ?

chibenwa avatar Dec 09 '22 16:12 chibenwa

Can we measure performance for this (IMAP benches?)

Will take a look

Can we also compare the docker image size before / after ?

Of James you mean? Ok

Arsnael avatar Dec 12 '22 02:12 Arsnael

Of James you mean? Ok

Yes it would allow us to measure the gains in dependency cleaning <3

chibenwa avatar Dec 12 '22 02:12 chibenwa

So I generated the distributed apache james image with that PR and without (so master) and I can see a 20MB size reduction with this new java client: from 453 to 433MB

Arsnael avatar Dec 12 '22 04:12 Arsnael

Good but not game changing...

chibenwa avatar Dec 12 '22 06:12 chibenwa

I think it's because you still need to use the rest client as a dependency and it still includes a bunch... I think from what I remember they were supposed to get rid of it and implement directly the needed methods in the opensearch java client (like in ES8) but seems they still didn't do

Arsnael avatar Dec 12 '22 11:12 Arsnael

I'm alright with the last commit

Arsnael avatar Dec 15 '22 07:12 Arsnael


07:07:16,935 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.2:check (check-style) on project apache-james-backends-opensearch: You have 12 Checkstyle violations. -> [Help 1]

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.2:check (check-style) on project apache-james-backends-opensearch: You have 12 Checkstyle violations.

quantranhong1999 avatar Dec 15 '22 07:12 quantranhong1999

Rebase needed...

chibenwa avatar Dec 28 '22 02:12 chibenwa