ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "forthoney (Seong-Heon Jung) via ruby-core" <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: "forthoney (Seong-Heon Jung)" <noreply@ruby-lang.org>
Subject: [ruby-core:116827] [Ruby master Feature#20276] Introduce Fiber interfaces for Ractors
Date: Sat, 17 Feb 2024 20:55:36 +0000 (UTC)	[thread overview]
Message-ID: <redmine.issue-20276.20240217205535.53072@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-20276.20240217205535.53072@ruby-lang.org

Issue #20276 has been reported by forthoney (Seong-Heon Jung).

----------------------------------------
Feature #20276: Introduce Fiber interfaces for Ractors
https://bugs.ruby-lang.org/issues/20276

* Author: forthoney (Seong-Heon Jung)
* Status: Open
* Priority: Normal
----------------------------------------
## Motivation
I am trying to build a web server with Ractors. The lifecycle for a request in the current implementation is 
1. main ractor buffers request
2. main ractor sends request to worker ractor
3. worker ractor sends response to main ractor
4. main ractor writes response
5. repeat

The main ractor utilizes the Async gem (specifically async-http) to handle connections concurrently, meaning each request is handled on a separate fiber.
The issue I am running into is after I send a request to a worker ractor, I need to do a blocking wait until I receive a response.
While I am waiting for the response, I cannot take any more connections.

## Solution
If the fiber scheduler had a hook for `Ractor.receive` or `Ractor#take` (both of which are blocking), the main ractor can send the message, handle other connections while the worker processes the request. When the worker produces a message, it will then take the reqeust and write it in the socket.




-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

       reply	other threads:[~2024-02-17 20:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-17 20:55 forthoney (Seong-Heon Jung) via ruby-core [this message]
2024-02-19  1:40 ` [ruby-core:116836] [Ruby master Feature#20276] Introduce Fiber interfaces for Blocking operations on Ractors ko1 (Koichi Sasada) via ruby-core
2024-02-19 18:20 ` [ruby-core:116850] " forthoney (Seong-Heon Jung) via ruby-core
2024-03-11 23:06 ` [ruby-core:117102] " ioquatix (Samuel Williams) via ruby-core
2024-03-12  4:58 ` [ruby-core:117108] " forthoney (Seong-Heon Jung) via ruby-core
2024-03-12  5:00 ` [ruby-core:117109] " forthoney (Seong-Heon Jung) via ruby-core
2024-03-12 21:25 ` [ruby-core:117123] " ioquatix (Samuel Williams) via ruby-core
2024-03-18 19:09 ` [ruby-core:117217] " forthoney (Seong-Heon Jung) via ruby-core

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-20276.20240217205535.53072@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    --cc=noreply@ruby-lang.org \
    --cc=ruby-core@ml.ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).