ring

antonmos 2020-09-12T02:52:05.016300Z

ive got kind of an obscure question šŸ™‚ I have 2 apps, both with jetty/ring-adapter 1.8.1, muuntaja 0.6.7 for transit. Iā€™d like to stream it all the way to the browser. the browser calls app A, which calls app B using clj-http 3.10.1 and with the following options

(defn as-stream [params]
  (-> params
      (assoc :as :stream :decompress-body false)
      (update :headers assoc :accept-encoding "gzip")))
to avoid unziping and rezipping the response. App B pulls a large dataset from the db. I just enabled streaming in muuntaja with :return :output-stream When i call app B directly via curl, i get the response within a reasonable time. When i call app A, the streaming happens very very slowly, with multi second pauses. Does this ring any bells for anyone?

ikitommi 2020-09-12T07:51:48.018Z

for async clj-proxy, I believe you need: - run server in (ring-)async-mode - use the async mode in clj-http - stream out asynchronously: ring1 only defines blocking writes, but usually this is not a problem. You could bypass ring here and write lazily to the underlaying java web servers channel etc.

ikitommi 2020-09-12T07:52:19.018200Z

@weavejester is the best person to help I guess

antonmos 2020-09-13T02:18:00.020100Z

Thank you!

antonmos 2020-09-12T02:53:34.016500Z

cc @ikitommi because muuntaja is involved

antonmos 2020-09-12T03:15:13.017100Z

google has led me to http://jetty.4.x6.nabble.com/Streaming-proxy-of-content-using-jetty-and-jetty-client-with-end-to-end-flow-control-td4967006.html#a4967012 which seems potentially relevant except that i just want to proxy the response, not the request