Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-14224

Camel-Websocket: The sendToAll method in the Producer is really slow

    XMLWordPrintableJSON

    Details

    • Estimated Complexity:
      Unknown

      Description

      I don't know what the idea behind but in this class (Producer) sendToAll method the Thread.sleep in the while loop make all the process crazy slow just try to run this code

          @Override
          public void configure() throws Exception {
              String uri = "websocket://127.0.0.1:8443/test?sendToAll=true&sendTimeout=0";
      
              from(uri).to(uri);
          }
      

      and send multiple message to the server and you will see how slow is it for my point there is two defect:

      1. Give the availability to send to all expect the sender
      2. Fix the while loop

      During my test to have decent performance i set this parameter `sendTimeout` to 0 but i got this exception then:

      org.apache.camel.component.websocket.WebsocketSendException: Failed to deliver message within 0 millis to one or more recipients.. Exchange[ID-DESKTOP-S8PM2C4-1574865248397-0-3]
      	at org.apache.camel.component.websocket.WebsocketProducer.sendToAll(WebsocketProducer.java:149) ~[camel-websocket-2.24.2.jar:2.24.2]
      	at org.apache.camel.component.websocket.WebsocketProducer.process(WebsocketProducer.java:52) ~[camel-websocket-2.24.2.jar:2.24.2]
      	at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) ~[camel-core-2.24.2.jar:2.24.2]
      	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148) [camel-core-2.24.2.jar:2.24.2]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) [camel-core-2.24.2.jar:2.24.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.24.2.jar:2.24.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.24.2.jar:2.24.2]
      	at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:76) [camel-core-2.24.2.jar:2.24.2]
      	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148) [camel-core-2.24.2.jar:2.24.2]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) [camel-core-2.24.2.jar:2.24.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.24.2.jar:2.24.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.24.2.jar:2.24.2]
      	at org.apache.camel.component.websocket.WebsocketConsumer.sendMessage(WebsocketConsumer.java:75) [camel-websocket-2.24.2.jar:2.24.2]
      	at org.apache.camel.component.websocket.WebsocketConsumer.sendMessage(WebsocketConsumer.java:59) [camel-websocket-2.24.2.jar:2.24.2]
      	at org.apache.camel.component.websocket.DefaultWebsocket.onMessage(DefaultWebsocket.java:66) [camel-websocket-2.24.2.jar:2.24.2]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_201]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201]
      	at org.eclipse.jetty.websocket.common.events.annotated.CallableMethod.call(CallableMethod.java:70) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.events.annotated.OptionalSessionCallableMethod.call(OptionalSessionCallableMethod.java:72) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.events.JettyAnnotatedEventDriver.onTextMessage(JettyAnnotatedEventDriver.java:251) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.message.SimpleTextMessage.messageComplete(SimpleTextMessage.java:69) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.appendMessage(AbstractEventDriver.java:65) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.events.JettyAnnotatedEventDriver.onTextFrame(JettyAnnotatedEventDriver.java:243) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.incomingFrame(AbstractEventDriver.java:150) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.WebSocketSession.incomingFrame(WebSocketSession.java:322) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.extensions.AbstractExtension.nextIncomingFrame(AbstractExtension.java:147) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.extensions.compress.PerMessageDeflateExtension.nextIncomingFrame(PerMessageDeflateExtension.java:112) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.extensions.compress.CompressExtension.forwardIncoming(CompressExtension.java:168) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.extensions.compress.PerMessageDeflateExtension.incomingFrame(PerMessageDeflateExtension.java:92) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.extensions.ExtensionStack.incomingFrame(ExtensionStack.java:202) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.Parser.notifyFrame(Parser.java:225) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.Parser.parseSingleFrame(Parser.java:259) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:460) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:441) [websocket-common-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [jetty-io-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [jetty-io-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) [jetty-io-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) [jetty-util-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) [jetty-util-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) [jetty-util-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) [jetty-util-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:388) [jetty-util-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806) [jetty-util-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938) [jetty-util-9.4.22.v20191022.jar:9.4.22.v20191022]
      	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201]
      
      

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              michael992 michael elbaz
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: