Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using with HTTP Chunked Transfer Encoding, 6.7MB becomes 10.5MB due to chunking overheads #46

Open
SevereOverfl0w opened this issue Mar 4, 2020 · 5 comments

Comments

@SevereOverfl0w
Copy link

SevereOverfl0w commented Mar 4, 2020

This is a big problem for me. I am using transit-json on a Web endpoint, and I am streaming the result of encoding. The stream is using HTTP chunked transfer encoding. This essentially indicates the overall size is unknown, and informs you of how many bytes are about to come repeatedly until it is finished.

Due to the flushes from Transit, these chunks end up very small. Usually just a string and some open/close parens. This overhead causes the 6.7MB of transit to transport as 10.5MB of HTTP. That is, it gets significantly bigger when transferred this way. For this application and expected timing, this directly impacts 10s of load time.

transit-clj seems to flush after every write (https://github.com/cognitect/transit-java/blob/cff7111c2081fc8415cd9bd6c6b2ba518680d660/src/main/java/com/cognitect/transit/impl/AbstractEmitter.java#L189). I would guess this is related to #43.

@SevereOverfl0w SevereOverfl0w changed the title Flushes too often When using with HTTP Chunked Transfer Encoding, 6.7MB becomes 10.5MB due to chunking overheads Mar 4, 2020
@SevereOverfl0w
Copy link
Author

Additionally, these chunking overheads seem to drastically limit the ability of gzip to function.

@computeremotion
Copy link

@puredanger
Copy link
Contributor

Those links are primarily for Clojure itself or the Clojure contrib libraries. transit-clj is not a Clojure core project, it is managed by Cognitect (admittedly this is mostly the same people, but they have different licenses and contribution processes).

This is the proper place to log this issue for this project.

@computeremotion
Copy link

sry. my bad.

@zeitstein
Copy link

Reporting from Slack. Saw this exact behaviour when using transit-body-interceptor from pedestal, which uses .flush. Using the strategy mentioned by @borkdude in #43 improves matters significantly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants