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?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.
@weavejester is the best person to help I guess
Thank you!
cc @ikitommi because muuntaja is involved
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