Skip to content

performance: use kqueue with libevent on Apple platforms #215

@rebello95

Description

@rebello95

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions