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

remove tokio runners #253

Merged
merged 6 commits into from
Jan 29, 2021
Merged

remove tokio runners #253

merged 6 commits into from
Jan 29, 2021

Conversation

robjtede
Copy link
Member

@robjtede robjtede commented Jan 28, 2021

PR Type

Refactor

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt

Overview

  • Remove run_in_tokio and attach_to_tokio.
  • Remove AsyncSystemRunner.
  • Return JoinHandle from actix_rt::spawn.
    • Remove old Arbiter::spawn. Implementation is now inlined into actix_rt::spawn.
  • Rename Arbiter::{send => spawn} and Arbiter::{exec_fn => spawn_fn}.
  • Remove Arbiter::exec.
  • Remove deprecated Arbiter::local_join.

@robjtede robjtede merged commit ba39c84 into master Jan 29, 2021
@robjtede robjtede deleted the remove-tokio-runners branch January 29, 2021 02:21
@nooberfsh
Copy link

Why it is removed?
Many people use this to run actix inside tokio runtime. actix/actix-web#1283

@fakeshadow
Copy link
Contributor

It's removed for misleading and not working properly.

  1. actix always runs in tokio. It never support runtime other than tokio from what I know.
  2. The said API only attach SystemArbiter to an existing tokio runtime. Every new Arbiter(include actix-web worker) would still spawn it's tokio runtime regardless. Even when you limit your actix-web worker count to 1 that worker would still run on it's own tokio runtime. It has nothing to do with the runtime you pass to run_in_tokio unless you explicitly send boxed future to SystemArbiter.
  3. There is nothing wrong with running multiple runtimes in an app. actix and actix-web are examples on this where you can have more than dozens of runtime working on their own at the same time. Therefore if you need another tokio runtime you can spawn it along side your actix-rt. There is no observable overhead on doing this.

@Overdash
Copy link

Overdash commented Mar 7, 2021

There is nothing wrong with running multiple runtimes in an app. actix and actix-web are examples on this where you can have more than dozens of runtime working on their own at the same time. Therefore if you need another tokio runtime you can spawn it along side your actix-rt. There is no observable overhead on doing this.
Do you have an example of doing this (spawning another tokio runtime along side an actix system)?

From what I see, instances like actix-web HttpServer creation are blocking. So in this case it's not possible/difficult to spawn a usable tokio Runtime that can be used by all the endpoints (for example). I could be missing something here though

@fakeshadow
Copy link
Contributor

fakeshadow commented Mar 7, 2021

From what I see, instances like actix-web HttpServer creation are blocking. So in this case it's not possible/difficult to spawn a usable tokio Runtime that can be used by all the endpoints (for example). I could be missing something here though

Please check point two. You endpoints run on workers that are in their own runtime which is not in your main or have anything to do with the runtime you set up in mian. Except the condition described by it.

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.

4 participants