@rustaceans

Tokio!

It's 'static + multithreaded-by-default requirement has created the myth that async #Rust is inherently difficult.

People should use `smol` more - here's why:

#Async Rust can be a pleasure to work with (without `Send + Sync + 'static`) - by Evan Schwartz:

https://emschwartz.me/async-rust-can-be-a-pleasure-to-work-with-without-send-sync-static/

https://floss.social/@janriemer/114681713674697800

#smol #RustLang #Asynchronous #AsyncRust

Async vs Sync in .NET: Understanding ThreadPool Impact | Stefan Đokić posted on the topic | LinkedIn

Some developers still think async/await makes code faster. I thought the same when I started with .NET. Then one day, our API started slowing down under load. Not because of the CPU. Not because of the database. Because we were blocking threads everywhere. .Result .Wait() Sync database calls Sync HTTP calls Everything worked perfectly… until traffic increased. What many developers miss is this: Async doesn’t make one request faster. A request that takes 400ms with sync code will still take ~400ms with async. The real difference is what happens to the ThreadPool. With synchronous code: Thread → waits for HTTP → waits for DB → waits for I/O The thread is blocked the whole time. With async code: Thread → starts I/O → returns to ThreadPool OS notifies completion → continuation resumes. That single difference is what allows ASP .NET Core to handle thousands more concurrent requests. The real killer I keep seeing in production codebases is this: Sync-over-async var result = httpClient.SendAsync(...).Result; This blocks the thread again and under load it can lead to ThreadPool starvation. And once that happens, your API starts feeling “mysteriously slow”. No CPU spikes. No database bottlenecks. Just no threads left to process requests. I made this visual to explain what actually happens inside ASP .NET Core. Curious: Have you ever debugged a production issue that turned out to be sync-over-async? __ 📌 Don't miss the next newsletter issue, 20,000 engineers will read it, join them: thecodeman.net 📌 Join our Free Closed .NET Hub (1.1k members) and get access to content nobody publicly has: https://lnkd.in/gu_5HiMD ♻️ Repost to others. 📂 You can save this post for later, and you should do it. ➕ Follow me ( Stefan Đokić ) to learn .NET and Architecture every day. | 32 comments on LinkedIn

LinkedIn

How to Stop Async forEach From Doing Nothing

forEach ignores await and hides failures.

#javascript #async #foreach #bug #howto #promises

https://www.youtube.com/watch?v=eFG7zmWkYRk

How to Stop Async forEach From Doing Nothing #async

YouTube

How to Prevent Promise Race From Hiding Errors

race resolves early and drops later failures.

#javascript #promise #race #bug #howto #async

https://www.youtube.com/watch?v=xfMh3EdzQxc

How to Prevent Promise Race From Hiding Errors #howto

YouTube

[Перевод] Async Coalescing: 5 стратегий объединения асинхронных запросов

Асинхронное программирование сегодня используется почти везде — от пользовательских интерфейсов до серверных систем с высокой нагрузкой. Оно позволяет не блокировать поток выполнения и эффективно работать с операциями ввода-вывода. Но вместе с этой гибкостью появляется и обратная сторона: пересекающиеся асинхронные вызовы начинают конкурировать друг с другом. Представим простой пример. Пользователь печатает в строке поиска, и каждый символ запускает новый запрос. Или серверный сервис несколько раз запрашивает одни и те же данные, потому что разные части системы одновременно обращаются к одному ресурсу. Это не редкие случаи — такое происходит постоянно. Если такие вызовы никак не координировать, система начинает выполнять лишнюю работу. Возникают дублирующиеся запросы, гонки данных и дополнительные вычисления. В интерфейсах результаты могут приходить в неправильном порядке, а на сервере растёт нагрузка и появляются трудно воспроизводимые ошибки. Обычно проблему пытаются решать блокировками, токенами отмены или дополнительными проверками в коде, но такие решения часто оказываются лишь временными костылями. Более системный подход — объединять пересекающиеся асинхронные операции. Если несколько вызовов требуют один и тот же результат, нет необходимости выполнять работу несколько раз. Гораздо разумнее выполнить её один раз и распределить результат между всеми ожидающими. Однако в реальных системах одного такого поведения недостаточно. Иногда результат должен определяться самым последним запросом. Иногда выполнение лучше немного отложить, чтобы дождаться стабилизации входных данных. А в некоторых случаях операции вообще нужно выполнять строго по очереди. В этой статье я разберу пять стратегий Async Coalescing — подхода, который позволяет контролировать конкуренцию асинхронных операций. Мы посмотрим, в каких ситуациях каждая стратегия полезна и какие компромиссы она вносит в систему.

https://habr.com/ru/articles/1006676/

#multithreading #async #net

Async Coalescing: 5 стратегий объединения асинхронных запросов

Асинхронное программирование сегодня используется почти везде — от пользовательских интерфейсов до серверных систем с высокой нагрузкой. Оно позволяет не блокировать поток выполнения и эффективно...

Хабр

Never snooze a future, https://jacko.io/snooze.html.

An interesting article explaining how a “snoozed future” can be a source of deadlock. The article discusses potential solutions to overcome this problem.

#RustLang #async

Never snooze a future

Futurelock, https://rfd.shared.oxide.computer/rfd/0609.

Discussion and concrete examples about “a type of deadlock where a resource owned by Future A is required for another Future B to proceed, while the Task responsible for both Futures is no longer polling A. Futurelock is a particularly subtle risk in writing asynchronous Rust.”

Well written! Once again, async code is hard.

#RustLang #async #future #task

609 - Futurelock / RFD / Oxide

I might be looking for one or more coding buddies for a modest after work #python #game project.
Especially someone who can support keeping me organized and motivated. Both are hard with ADHD.
No need to be a professional it is meant for fun and learning. Ideally, we can learn from each other while having fun
#codingtogether.
Moderate Python skills needed. German or English speaker. No Vibe coding.

Here is my pitch:
I miss the old browser games of 10-20 years ago without all sorts of fancy frontend nonsense.
Animations, graphics, overbearing JS, Flash or similar. I'd like to do a very toned-down CLI style UX.
Maybe some
#asciiart.

And I'd like to use and improve my
#async programming skills as well as try out/showcase the #textual library.
I have also wanted to build something on top of the Space Traders API for a while.
I have been a developer on the
#OGame Team for a while and have worked on porting old browser games to newer PHP versions before.
I have been an OGame player for about a decade.
I have 20 years of experience in web development in PHP.

Here is my proposed Stack:
* Python 3.10 or above
*
Textual Frontend
*
AioHTTP via OpenApi Generator
* SQLite / SqlAlchemy for local storage
*
Space Traders API
* Bonus points for hosting the app on a server with textual-serve or textual-web.
GitHub - Textualize/textual: The lean application framework for Python. Build sophisticated user interfaces with a simple Python API. Run your apps in the terminal and a web browser.

The lean application framework for Python. Build sophisticated user interfaces with a simple Python API. Run your apps in the terminal and a web browser. - Textualize/textual

GitHub

🥳 New Kitten Release

I just reworked the fix for this to simplify the Kitten renderer (as this fix introduced a regression with components getting instantiated multiple times due to the fall-through logic between asynchronous and synchronous rendering). The renderer now treats every component render function as asynchronous, thereby avoiding the issue entirely.

https://kitten.small-web.org

Enjoy!

💕

#Kitten #KittenReleases #SmalWeb #SmallTech #web #dev #components #async #rendering

Kitten: Home

🥳 New Kitten Release

This one fixes a bug that you would have encountered had you had an asynchronous component (component with asynchronous render method) nested more than one-level deep within synchronous components.

(Kitten’s html renderer transparently supports both synchronous and asynchronous render methods.)

So, this (taken from my unit test), for example, works correctly now:

```js
class AsynchronousOtherName extends KittenComponent {
async html () {
await new Promise(resolve => setTimeout(resolve, 10))
return kitten.html`<i>Balkan</i>`
}
}

class SynchronousName extends KittenComponent {
/* NOT async */ html () {
return kitten.html`<strong>Aral</strong> <${AsynchronousOtherName.connectedTo(this)} />`
}
}

class SynchronousTemplate extends KittenComponent {
html ({ SLOT }) {
return kitten.html`[Before slot]${SLOT}[After slot]`
}
}

class MyPage extends KittenPage {
html () {
return kitten.html`
<${SynchronousTemplate.connectedTo(this)}>
<h1>This should render all at once after a short delay.</h1>
<p>Hello, <${SynchronousName.connectedTo(this)} /></p>
</>
`
}
}
```

Enjoy!

💕

https://kitten.small-web.org

#Kitten #KittenReleases #SmallWeb #SmallTech #web #dev #JavaScript #NodeJS #async #render

Kitten: Home