may icon indicating copy to clipboard operation
may copied to clipboard

How can May be used for shared-nothing architecture?

Open Eugene-Usachev opened this issue 11 months ago • 3 comments

I would like to have an example in the documentation for this task. I looked at the source code and I had some doubts about the possibility of building a shared-nothing architecture. On the one hand, there is CoroutineLocal and the ability to create multiple Schedulers. But on the other hand, almost everywhere there is a requirement for Send and almost everywhere there are, if not locks, then atomics. If I'm wrong and May allows you to build shared-nothing architectures, let me know.

Eugene-Usachev avatar Mar 09 '24 11:03 Eugene-Usachev

stackful coroutines are independent to some extend, in theory they can be executed everywhere. The atomics and locks are only tools that designed for state sharing and it totally depends on how custom program coroutines. I don't have too much knowledge about shared-nothing architecture. and don't fully understand the real requirements.

Xudong-Huang avatar Mar 09 '24 14:03 Xudong-Huang

I would like to have some kind of LocalExecuter that has no requirements for either Send or Sync and that performs tasks strictly sequentially. Conditionally, within the framework of one such executor, I could create 10 tasks that generate other tasks, but all these tasks will be performed within the same thread and sequentially. This allows us to get rid of locks and atomics, since we do not have competition for resources.

If this functionality already exists, I'd like to know about it. If such a thing exists, I am ready to write an example for documentation myself.

Eugene-Usachev avatar Mar 10 '24 09:03 Eugene-Usachev

oh, currently there is no mechanism for coroutine thread affinity. but when work_steal feature is disabled, coroutines would execute in the same thread where they got first executed.

Xudong-Huang avatar Mar 10 '24 13:03 Xudong-Huang