Skip to content

merge all the event loops #144

Closed
Closed

Description

@Geal

currently, we start a different event loop per protocol (one for HTTP, one for HTTPS, one for TCP), and this results in duplicate workers.

One worker should be able to handle all of the configured protocols. This means having the Server struct (in src/network/proxy.rs) not generic on the type of protocol, but decide everything at runtime.

This is a good occasion to refactor the TCP proxy with the other ones, since it already requires multiple listening addresses (other protocols listen on only one socket currently). Message dispatching would be done more on the workers than on the master.

The sockets related for each type of proxy should have different ranges in their token identifiers.

What is the performance impact of deciding at runtime what to do with a socket? Can some parts stay generic over the protocol type?

Activity

  1. added this to the needed for the release milestone on Apr 12, 2017
  2. Geal commented on Apr 12, 2017

    @Geal
    MemberAuthor

    Plan:

    separating the token space in 3 should leave enough token for every kind (it's a usize).

  3. Geal commented on Apr 13, 2017

    @Geal
    MemberAuthor

    since d7b2dbe it's working, but the design is still a bit awkward.
    The token space is currently separated in 3, so in one instance of the proxy, there is only one of each proxy type (HTTP, HTTPS or TCP). (2^64 -1)/3 is still a pretty big address space, but the calculation for token ranges complexifies the code a bit.

    The executable does not support yet the merge, currently every proxy type has its own set of workers.

  4. Geal commented on Apr 16, 2017

    @Geal
    MemberAuthor

    Should we also merge the code that finds an app id based on the domain and possible URI prefix? If we centralized that code, we could move up connections to backend as well and merge the implementations. The HTTP and TLS proxy would only handle buffers and network.

  5. KellerFuchs commented on Apr 17, 2017

    @KellerFuchs

    FWIW, I would expect it to be very low overhead in most cases (due to branch prediction).

  6. Geal commented on Apr 20, 2017

    @Geal
    MemberAuthor

    as of 97b47fd all the crates support the new scheme. There are no more tags, every worker handles everything. A few bugs might appear due to the refactoring, so let's wait a bit for more tests before closing that bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions