Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Use requests directly, instead of sseclient. #114

Merged
merged 1 commit into from
Mar 23, 2016
Merged

Conversation

brndnmtthws
Copy link
Contributor

To address #35.

@brndnmtthws brndnmtthws force-pushed the drop-sseclient branch 2 times, most recently from 218cd8d to 3905f17 Compare March 19, 2016 16:00
This will hopefully resolve some of the issues seen with SSE mode (see
#35).
@brndnmtthws brndnmtthws merged commit a02653e into master Mar 23, 2016
@brndnmtthws brndnmtthws deleted the drop-sseclient branch March 23, 2016 15:04
toofishes pushed a commit to toofishes/marathon-lb that referenced this pull request Dec 14, 2016
Earlier issues d2iq-archive#35 and d2iq-archive#114 made things better in this department. However,
when running marathon-lb with a large (400+ applications) marathon instance,
there are still problems.

These problems can be traced back to Python itself, unfortunately:
http://stackoverflow.com/questions/21797753/efficiently-reading-lines-from-compressed-chunked-http-stream-as-they-arrive

Python requests uses urllib under the covers, and there are implicit issues
when 7.5 MB of JSON comes back on a single line, as we're seeing when certain
events are emitted. These events are deployment_info and deployment_success at
a minimum, there may be more.

By switching to PycURL, as noted in the Stack Overflow post, we bypass this
whole issue. We use an HTTP library that handles this particular edge case
well, reducing CPU usage dramatically when a large event comes in. It also
handles gzip compression, which means any 7.5 MB JSON dumps should shrink
significantly.

One unsolved problem remains here: the addition of DC/OS authentication support
in d2iq-archive#285 is extremely tightly coupled to internal implementation details of the
python requests module. This simply won't work with this code, and I have zero
ability to fix or test it as we don't use DC/OS.
toofishes pushed a commit to toofishes/marathon-lb that referenced this pull request Dec 28, 2016
Earlier issues d2iq-archive#35 and d2iq-archive#114 made things better in this department. However,
when running marathon-lb with a large (400+ applications) marathon instance,
there are still problems.

These problems can be traced back to Python itself, unfortunately:
http://stackoverflow.com/questions/21797753/efficiently-reading-lines-from-compressed-chunked-http-stream-as-they-arrive

Python requests uses urllib under the covers, and there are implicit issues
when 7.5 MB of JSON comes back on a single line, as we're seeing when certain
events are emitted. These events are deployment_info and deployment_success at
a minimum, there may be more.

By switching to PycURL, as noted in the Stack Overflow post, we bypass this
whole issue. We use an HTTP library that handles this particular edge case
well, reducing CPU usage dramatically when a large event comes in. It also
handles gzip compression, which means any 7.5 MB JSON dumps should shrink
significantly.
toofishes pushed a commit to toofishes/marathon-lb that referenced this pull request Jan 20, 2017
Earlier issues d2iq-archive#35 and d2iq-archive#114 made things better in this department. However,
when running marathon-lb with a large (400+ applications) marathon instance,
there are still problems.

These problems can be traced back to Python itself, unfortunately:
http://stackoverflow.com/questions/21797753/efficiently-reading-lines-from-compressed-chunked-http-stream-as-they-arrive

Python requests uses urllib under the covers, and there are implicit issues
when 7.5 MB of JSON comes back on a single line, as we're seeing when certain
events are emitted. These events are deployment_info and deployment_success at
a minimum, there may be more.

By switching to PycURL, as noted in the Stack Overflow post, we bypass this
whole issue. We use an HTTP library that handles this particular edge case
well, reducing CPU usage dramatically when a large event comes in. It also
handles gzip compression, which means any 7.5 MB JSON dumps should shrink
significantly.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant