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

performance: use kqueue with libevent on Apple platforms #215

Closed
rebello95 opened this issue Jul 2, 2019 · 2 comments · Fixed by #222
Closed

performance: use kqueue with libevent on Apple platforms #215

rebello95 opened this issue Jul 2, 2019 · 2 comments · Fixed by #222
Assignees
Labels
perf/cpu perf platform/ios Issues related to iOS
Milestone

Comments

@rebello95
Copy link
Contributor

Context

Based on this discussion, we are seeing that libevent is using polling on iOS instead of kqueue.

This is extremely unperformant, and is causing Envoy Mobile to use ~100% CPU on iOS devices.

To validate that this was the root cause, we were able to hardcode an entry in this file to force kqueue to be enabled:

"EVENT__HAVE_WORKING_KQUEUE": "on"

After building, we could verify that the expected conditional was defined:

mrebello-mbp151:envoy-mobile mrebello$ cat ./bazel-out/ios-x86_64-min10.0-applebin_ios-ios_x86_64-fastbuild/bin/external/envoy/bazel/foreign_cc/event/include/event2/event-config.h|grep WORKING
#define EVENT__HAVE_WORKING_KQUEUE 1

When running Envoy on a device, CPU went from ~100% to just 1.5% with this change.

Task

Apply an upstream fix that enables kqueue on Apple/iOS platforms so that we can fix this performance issue on iOS.

@rebello95 rebello95 added platform/ios Issues related to iOS perf labels Jul 2, 2019
@rebello95 rebello95 added this to the v0.2 "Primo" milestone Jul 2, 2019
@keith
Copy link
Member

keith commented Jul 2, 2019

Here's a upstream libevent fix so we don't have have to explicitly set this only for Apple targets libevent/libevent#849

rebello95 added a commit to rebello95/envoy that referenced this issue Jul 2, 2019
Pulls in the change added by libevent/libevent#849 to fix envoyproxy/envoy-mobile#215.

Signed-off-by: Michael Rebello <mrebello@lyft.com>
@rebello95
Copy link
Contributor Author

Updating envoy upstream with the libevent fix: envoyproxy/envoy#7453

@rebello95 rebello95 reopened this Jul 3, 2019
rebello95 added a commit that referenced this issue Jul 3, 2019
Updating Envoy to include envoyproxy/envoy#7453 (and subsequently libevent/libevent#849), which should fix the performance issues we're seeing on iOS. Resolves #215.

Signed-off-by: Michael Rebello <mrebello@lyft.com>
rebello95 added a commit that referenced this issue Jul 3, 2019
Updating Envoy to include envoyproxy/envoy#7453 (and subsequently libevent/libevent#849), which should fix the performance issues we're seeing on iOS. Resolves #215.
rebello95 added a commit that referenced this issue Jul 3, 2019
Update the docs to reflect new analyses following the libevent fixes from #215.

Signed-off-by: Michael Rebello <mrebello@lyft.com>
rebello95 added a commit that referenced this issue Jul 4, 2019
Update the docs to reflect new analyses following the libevent fixes from #215.

Signed-off-by: Michael Rebello <mrebello@lyft.com>
jpsim pushed a commit to envoyproxy/envoy that referenced this issue Nov 28, 2022
Updating Envoy to include #7453 (and subsequently libevent/libevent#849), which should fix the performance issues we're seeing on iOS. Resolves envoyproxy/envoy-mobile#215.

Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit to envoyproxy/envoy that referenced this issue Nov 28, 2022
Update the docs to reflect new analyses following the libevent fixes from envoyproxy/envoy-mobile#215.

Signed-off-by: Michael Rebello <mrebello@lyft.com>
Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit to envoyproxy/envoy that referenced this issue Nov 29, 2022
Updating Envoy to include #7453 (and subsequently libevent/libevent#849), which should fix the performance issues we're seeing on iOS. Resolves envoyproxy/envoy-mobile#215.

Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit to envoyproxy/envoy that referenced this issue Nov 29, 2022
Update the docs to reflect new analyses following the libevent fixes from envoyproxy/envoy-mobile#215.

Signed-off-by: Michael Rebello <mrebello@lyft.com>
Signed-off-by: JP Simard <jp@jpsim.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf/cpu perf platform/ios Issues related to iOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants