• Type: Enhancement
    • Status: Open (View Workflow)
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 4.4.1.Final
    • Fix Version/s: 4.6.0.Final
    • Component/s: jaxrs
    • Labels:
    • Affects:
      User Experience


      Dear RESTEasy Maintainers,

      I am trying to implement a simple messaging system based on Server-Sent Events aka SSE.

      Message broker has trivial interface and implementation, source code is on GitHub

      For testing purpose I am using the following:

      There are 64 clients sending messages via message broker (POST request -> SSE broadcast)

      On the other side there is a component (source code) that listens for the messages (RESTEasy SSE client) and process them sending response back via the message broker (again SSE broadacst).

      Running some performance tests I have got quite unexpected result. Namely Client request/response latency is huge, up to a few minutes. See screenshot In the screen shot server processes 60K clients requests for a couple of minutes, while without SSE the exact same amount takes 15s

      My wild guess is that SseEventSource in the processing component reads messages one by one buffering them and spending lots of time in read method: see screenshot  and visualvm snapshot (attached)

      Test setup is the following:

      uname -a
      Linux hzgc103k 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11) x86_64 GNU/Linux
      java -version
      openjdk version "11.0.7" 2020-04-14
      OpenJDK Runtime Environment (build 11.0.7+10-post-Debian-3deb10u1)
      OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Debian-3deb10u1, mixed mode, sharing)

      All components are on the same host. Message broker and processing application are deployed to Tomcat 9.0.12. No any special tweaks were made to increase performance (no http2, no apr connector etc)


      Could you please advise whether it is feasible to decrease latency in this case? Something like reading input events in a thread pool?!

        Gliffy Diagrams


          1. after-fix.png
            95 kB
          2. before-fix.png
            116 kB
          3. resteasy_patch.nps
            45 kB
          4. resteasy.nps
            77 kB
          5. resteasy-core-4.4.1.Final-RESTASY-2658.patch.jar
            718 kB
          6. Screenshot_20200722_152534.png
            266 kB
          7. WhatsApp Image 2020-07-15 at 18.51.46.jpeg
            WhatsApp Image 2020-07-15 at 18.51.46.jpeg
            149 kB



              • Assignee:
       Jim Ma
                ingvord Igor Khokhriakov
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: