This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-12
Channels
- # announcements (2)
- # architecture (1)
- # aws (22)
- # babashka (2)
- # beginners (39)
- # bristol-clojurians (2)
- # cider (1)
- # clj-kondo (12)
- # cljfx (75)
- # cljs-dev (16)
- # clojure (51)
- # clojure-berlin (1)
- # clojure-france (4)
- # clojure-nl (2)
- # clojure-norway (36)
- # clojurescript (5)
- # community-development (8)
- # data-science (1)
- # datomic (4)
- # emacs (4)
- # fulcro (7)
- # jobs-discuss (7)
- # juxt (1)
- # nrepl (3)
- # off-topic (38)
- # reitit (1)
- # ring (7)
- # sci (79)
- # shadow-cljs (5)
- # sql (15)
- # tools-deps (22)
- # uncomplicate (7)
- # vrac (1)
- # xtdb (18)
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?cc @U055NJ5CC 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
Not sure how transit & clj-http play together when streaming. The :as :stream
might be blocking operation as I think is the transit write (but, with different streams). Might also be a bug in muuntaja-streamong-transit. If there is a jsva-side reverse proxy code available, I would anyway go with that.
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.
@U0BKWMG5B is the best person to help I guess
Not sure how transit & clj-http play together when streaming. The :as :stream
might be blocking operation as I think is the transit write (but, with different streams). Might also be a bug in muuntaja-streamong-transit. If there is a jsva-side reverse proxy code available, I would anyway go with that.