Skip to content

remove use of bufferevent for both plain and ssl connections#183

Merged
mattklein123 merged 3 commits intomasterfrom
remove_bufferevent
Nov 2, 2016
Merged

remove use of bufferevent for both plain and ssl connections#183
mattklein123 merged 3 commits intomasterfrom
remove_bufferevent

Conversation

@mattklein123
Copy link
Copy Markdown
Member

From perf investigations, a big slow down at high throughput is inside
libevent. bufferevent does not use edge triggered events, so it ends up
calling epoll_ctl on very write.

This change implements our own version of bufferevent inside of
ConnectionImpl. We need to do this for both plain and ssl connections.

This is an incredibly scary change. I've already run this on a prod box
for a while but will do more smoke testing before we merge and do a full
canary.

From perf investigations, a big slow down at high throughput is inside
libevent. bufferevent does not use edge triggered events, so it ends up
calling epoll_ctl on very write.

This change implements our own version of bufferevent inside of
ConnectionImpl. We need to do this for both plain and ssl connections.

This is an incredibly scary change. I've already run this on a prod box
for a while but will do more smoke testing before we merge and do a full
canary.
@mattklein123
Copy link
Copy Markdown
Member Author

@lyft/network-team

virtual ~FileEvent() {}

/**
* Active the file event explicitly for a set of events. Should be a logical OR of FileReadyType
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

activate?

virtual ~FileEvent() {}

/**
* Active the file event explicitly for a set of events. Should be a logical OR of FileReadyType
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: activate


#include "common/event/libevent.h"

// Forward decls to avoid leaking libevent headers to reset of program.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/reset/rest

static const evbuffer_cb_func buffer_cb_;

Event::Libevent::BufferPtr buffer_;
Callback cb_;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you put comments on cb_ and buffer_cb_ ?


ConnectionImpl::PostIoAction ConnectionImpl::doReadFromSocket() {
do {
int rc = read_buffer_.read(fd_, 16384);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you put comment on how value is chosen?

bool keep_reading = true;
PostIoAction action = PostIoAction::KeepOpen;
while (keep_reading) {
Buffer::RawSlice slices[2];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why two?

fd_(fd), id_(++next_global_id_) {

file_event_ =
dispatcher_.createFileEvent(fd, [this](uint32_t events) -> void { onFileEvent(events); });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fd_?

@mattklein123 mattklein123 merged commit a10174c into master Nov 2, 2016
@mattklein123 mattklein123 deleted the remove_bufferevent branch November 2, 2016 21:05
gargnupur added a commit to gargnupur/envoy that referenced this pull request Mar 12, 2020
wolfguoliang pushed a commit to wolfguoliang/envoy that referenced this pull request Jan 23, 2021
…s/service_to_service

zh-translation: docs/root/intro/deployment_types/service_to_service.rst
jpsim pushed a commit that referenced this pull request Nov 28, 2022
Resolves the following warning when building:

> DEBUG: Rule 'io_bazel_rules_kotlin' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1556831609 -0700"

Signed-off-by: Michael Rebello <mrebello@lyft.com>
Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit that referenced this pull request Nov 29, 2022
Resolves the following warning when building:

> DEBUG: Rule 'io_bazel_rules_kotlin' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1556831609 -0700"

Signed-off-by: Michael Rebello <mrebello@lyft.com>
Signed-off-by: JP Simard <jp@jpsim.com>
mathetake pushed a commit that referenced this pull request Mar 3, 2026
**Commit Message**:

Updating the netlify.toml configurations
I have validated the configurations work with Netlify here:
https://celebrated-zabaione-b8a322.netlify.app/

The purpose and function of the config:

- setting the `base` as `site/` which ensures netlify builds and deploys
**only happen** when there's changes to the site directory, this is a
special netlify config
- setting up a `context.deploy-preview` so we get preview deploys for
PRs when there are changes to the `site/` directory
 - updating headers with additional security headers to improve site

---------

Signed-off-by: Erica Hughberg <erica.sundberg.90@gmail.com>
mathetake added a commit that referenced this pull request Mar 3, 2026
**Commit Message**:

This was added in #178 but become obsolete in #183.

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
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

Successfully merging this pull request may close these issues.

3 participants