Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-2547

Perform gathering write in HttpRequestConduit to decrease latency

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • Core
    • None

      A customer is complaining about a delay with small packets sent by the EJB client over HTTP and awaiting for server acks between each packet send. It can take up to 40 ms of a delay for the packets to be acked so the next packet send is delayd by 40 ms. I tested with https://github.com/jboss-developer/jboss-eap-quickstarts/tree/7.4.x/ejb-remote and see such a concern. Install kernel-modules-extra matching your kernel and you can use sch_netem to easily insert TCP latency:

      Insert delay
      $ sudo dnf install kernel-modules-extra-4.18.0-513.24.1.el8_9.x86_64
      $ sudo modprobe sch_netem
      $ sudo tc qdisc add dev lo root netem delay 500ms
      
      Remove delay
      $ sudo tc qdisc del dev lo root
      

      And I see the client sends the post line and headers then waits for an ack before sending the post body:

      Client Sends post line and headers:
      
      8	2024-08-05 17:07:26.880864603	127.0.0.1	127.0.0.1	TCP	508	33834 → 8080 [PSH, ACK] Seq=1 Ack=1 Win=43776 Len=442 TSval=3831831052 TSecr=3831830514 [TCP segment of a reassembled PDU]
      
      Server acks:
      
      9	2024-08-05 17:07:27.380959914	127.0.0.1	127.0.0.1	TCP	66	8080 → 33834 [ACK] Seq=1 Ack=443 Win=44800 Len=0 TSval=3831831552 TSecr=3831831052
      
      Sends post body:
      
      10	2024-08-05 17:07:27.881213665	127.0.0.1	127.0.0.1	HTTP	90	POST /wildfly-services/ejb/v1/invoke/-/ejb-remote-server-side/-/CalculatorBean/-/org.jboss.as.quickstarts.ejb.remote.stateless.RemoteCalculator/add/int/int HTTP/1.1  (application/x-wf-ejb-jbmar-invocation)
      

      Would there be any means of getting a single packet sent for that EJB POST to decrease back and forth latency? Or are we missing any TCP_NODELAY on the EJB client to proceed sending the second packet before the server ACK?

              jaslee@redhat.com Jason Lee
              jaslee@redhat.com Jason Lee
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: