jetty.project icon indicating copy to clipboard operation
jetty.project copied to clipboard

Issue #6328 - avoid binding WebSocket MethodHandles

Open lachlan-roberts opened this issue 2 years ago • 4 comments

Issue #6328

Use a new JettyMethodHandle interface so that implementations can be used which avoid binding the MethodHandles for each WebSocket connection. This will avoid the multiple spikes seen on the flamegraph from #6328.

For Javax endpoints we are creating new method handles each time because we cannot have the same MetaData cache as used in the JettyWebSocketFrameHandlerFactory because it depends on both the endpointClass and the endpointConfig. However javax.websocket.MessageHandler does not actually use method handles at all and has a special implementation of JettyMethodHandle.

lachlan-roberts avatar Jun 01 '22 04:06 lachlan-roberts

Do we want this in Jetty 10.0.10 release?

joakime avatar Jun 08 '22 13:06 joakime

@joakime no this does not need to be in the 10.0.10 release.

I think it also needs some performance testing to assess the impact of this.

lachlan-roberts avatar Jun 08 '22 13:06 lachlan-roberts

Skipping this release, moving to 10.0.12 / 11.0.12 release.

joakime avatar Jun 21 '22 20:06 joakime

@lachlan-roberts you can merge this one now.

joakime avatar Aug 02 '22 18:08 joakime

@lachlan-roberts can this be merged?

joakime avatar Nov 10 '22 15:11 joakime

@joakime no, the benchmarks indicated that using the wrapper around methodhandle is significantly slower. So we need to further assess the performance impact this change would have.

I don't think this should be classified as a bug, the current usage of MethodHandles is not wrong.

lachlan-roberts avatar Nov 11 '22 01:11 lachlan-roberts

Moving this to 10.0.14 then.

joakime avatar Nov 14 '22 17:11 joakime

@lachlan-roberts what's the status of this one? Should it be moved back to Draft status?

janbartel avatar Jul 03 '23 09:07 janbartel

@janbartel yes I converted it back to a draft.

Maybe this PR is something we want to consider for Jetty 12.

lachlan-roberts avatar Jul 03 '23 23:07 lachlan-roberts

@lachlan-roberts I've asked the OP what their status is. Can you update the branch against latest 10.0.x and repeat performance tests to check impact.

I would think this is something we want to do for 10/11/12 or not at all. If there is a net benefit, then best to keep the code similar in all branches.

gregw avatar Jul 05 '23 08:07 gregw

closing in favor of #10750 for Jetty 12

lachlan-roberts avatar Oct 18 '23 20:10 lachlan-roberts