<commit_before>---
published: true
title: Async (Ruby)
tags: ruby async thread quote
---
> Async Ruby adds new concurrency features to the language; you can think of it as "threads with none of the downsides". It's been in the making for a couple of years, and with Ruby 3.0, it's finally ready for prime time. - [<NAME>](https://brunosutic.com/blog/async-ruby) / [HN](https://news.ycombinator.com/item?id=29049881)

Ruby 3.0 implements a ["fiber scheduler"](https://noteflakes.com/articles/2021-10-20-explaining-ruby-fibers) feature that enables "colorless Async".

- Async Ruby is much more performant than threads. There are less context switches, enabled by the event reactor. The performance benefits are visible in simple scenarios like making a thousand HTTP requests.

- Async is more scalable, can handle millions concurrent tasks (like HTTP connections). There can only be a couple thousand threads at the same time.

> I regret adding threads. —Matz

see also
- [thread]({% post_url 2018-11-23-thread %})






<commit_msg>Update 2021-10-31-ruby-async.md<commit_after>---
published: true
title: Async (Ruby)
tags: ruby async thread quote
---
> Async Ruby adds new concurrency features to the language; you can think of it as "threads with none of the downsides". It's been in the making for a couple of years, and with Ruby 3.0, it's finally ready for prime time. - [<NAME>](https://brunosutic.com/blog/async-ruby) / [HN](https://news.ycombinator.com/item?id=29049881)

Ruby 3.0 implements a ["fiber scheduler"](https://noteflakes.com/articles/2021-10-20-explaining-ruby-fibers) feature that enables "colorless Async".

- Async Ruby is much more performant than threads. There are less context switches, enabled by the event reactor. The performance benefits are visible in simple scenarios like making a thousand HTTP requests.

- Async is more scalable, can handle millions concurrent tasks (like HTTP connections). There can only be a couple thousand threads at the same time.

> I regret adding threads. —Matz

see also
- [thread]({% post_url 2018-11-23-thread %})
- [Concurrent Ruby](https://github.com/ruby-concurrency/concurrent-ruby)

{'fraction_non_alphanumeric': 0.10032512772875057, 'fraction_numerical': 0.029725963771481654, 'mean_word_length': 4.305418719211823, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5192802', 'n_tokens_mistral': 685, 'n_tokens_neox': 597, 'n_words': 265}