Vector: Extract usage of `tokio::runtime::Runtime` into our own

Created on 24 Oct 2019  路  3Comments  路  Source: timberio/vector

As we move closer to things like async/await and more flexible usage of the tokio runtime. We should provide our own wrappers so that we can easily change out the runtime type in the future. This would mean removing all occurrences of tokio::runtime::Runtime and providing our own spawn function. This should be fairly trivial but would go a long way to improving the experience working with the actual runtime within the codebase. This would also allow us to try other runtimes to see how they impact performance. One example of this is to try out the tokio-io-pool which does less work-stealing and thus might give us better results.

Specification

  • [x] Create our own runtime.rs that contains a Runtime struct and a free spawn fn. These should generally wrap around the tokio runtime.
  • [x] Replace ALL usage of tokio::runtime::Runtime throughout the codebase. We may also at this point want to move in test_utils::runtime to be a fn that lives within create::runtime.
topology good first issue enhancement tech debt

Most helpful comment

I'll take a stab at it this weekend then!

All 3 comments

I'm learning Rust and have been interested in Vector, so I'd be interested in giving this one a shot!

From the description, it seems like after following the first two steps the compiler will guide me and the tests will ensure I did it correctly, is that mostly right?

@Michael-J-Ward yup! mostly what I want is some struct that looks like

pub struct Runtime {
    rt: tokio::runtime::Runtime,
}

That then exposes all the fn that we actually use off of the runtime.

I'll take a stab at it this weekend then!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LucioFranco picture LucioFranco  路  3Comments

a-rodin picture a-rodin  路  3Comments

a-rodin picture a-rodin  路  3Comments

raghu999 picture raghu999  路  3Comments

lewisthompson picture lewisthompson  路  3Comments