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

high CPU use for large HTTP response #108

Open
belm0 opened this issue Feb 25, 2019 · 0 comments
Open

high CPU use for large HTTP response #108

belm0 opened this issue Feb 25, 2019 · 0 comments

Comments

@belm0
Copy link

belm0 commented Feb 25, 2019

My Trio app is making simple, periodic (persistent connection), non-SSL get requests for content of ~200K. I noticed high CPU use due to this request and confirmed with a sampling profiler.

I replaced use of asks with a bare-bones HTTP get implementation using Trio high-level networking and httptools for parsing. CPU use due to the HTTP requests decreased significantly (from about 11% to 3% of total app CPU), despite both implementations using Trio networking with a 10,000 byte receive size.

The profiler suggests that h11's next_event() adds significant overhead (4.3% of app total). The code of _catch_response proper is adding overhead as well (.9%). Generally the size of the call stack is alarming-- it goes on for pages.

screen shot 2019-02-25 at 2 32 34 pm

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

1 participant