Better HN
topnewbestaskshowjobs
Log inSign up

ioquatix

1,352 karma · joined Oct 2, 2009 (17y ago) · 504 submissions

http://www.codeotaku.com
Submissions

1.

Streaming Rack with Falcon(codeotaku.com ↗)

4 points · by ioquatix · 2y ago · discuss

comment 2y ago · link · parent

Have you actually benchmarked this and published the benchmarks somewhere?

comment 3y ago · link · parent

https://github.com/socketry/async uses coroutines and I think in general it’s been a great model with very few downsides in practice.

comment 3y ago · link · parent

Sounds like a useful feature to me.

comment 3y ago · link · parent

"All Programming is about State". All code is state. All state is code. It's turtles all the way down.

comment 4y ago · link · parent

It's adopted by Ruby: <https://github.com/socketry/io-event> which is used by <https://github.com/socketry/async> which is part of the Ruby 3+ Fiber Scheduler for light weight concurrency. It shows promising performance.

comment 5y ago · link · parent

The fiber scheduler also hooks into the `Timeout` module to provide safe(r) timeouts using the event loop.

comment 5y ago · link · parent

Every task is a promise you can wait on for the result. Concurrent fan out is trivial.

comment 5y ago · link · parent

That's pretty accurate.

comment 5y ago · link · parent

The gem namespace was transferred to me some time around 2017.

comment 5y ago · link · parent

ActiveRecord does work but it’s hugely limited because they have explicit per-thread resource pools which we can’t get around very easily.

comment 5y ago · link · parent

> When designing an API in Rust which performs IO, you have to make a decision whether you want it to be synchronous, asynchronous, or both.

Why must that be true? Why can't you write the interface once, and have concurrency be an implementation detail?

comment 5y ago · link · parent

So what are we going to do about it?

comment 5y ago · link · parent

Extinction :(

comment 5y ago · link · parent

Nope, they are totally different. However, the DB gem is an interface/driver similar to PHP's PDO, while AR is a set of drivers, interfaces and high level ORM interfaces. In theory, one could probably use DB as a driver under AR. One person even basically uses AR to generate SQL and then executes it with the DB gem, which I thought was pretty clever.

comment 5y ago · link · parent

The fiber scheduler solves this as concurrent execution is now built into the core of Ruby 3.

comment 5y ago · link · parent

Also, it turns out the `pg` is also partially non-blocking. But AR may need to improve their connection pool implementation.

comment 5y ago · link · parent

Non-blocking Postgres https://github.com/socketry/db-postgres

Non-blocking MariaDB https://github.com/socketry/db-mariadb

comment 5y ago · link · parent

Yes, it was. It was originally a front end and back end (query server) for CouchDB. But CouchDB 2 really went in a different direction to what I expected with query servers so I gave up and decided to pivot in a different direction with the code base.

https://github.com/ioquatix/relaxo-query-server FYI.

comment 5y ago · link · parent

For the lolz: https://github.com/ioquatix/relaxo

comment 5y ago · link · parent

This problem is being addressed in Ruby 3.

comment 5y ago · link · parent

Ruby FFI has been experimenting with provided support for kicking external functions to background threads with a single keyword argument.

comment 5y ago · link · parent

https://github.com/socketry/async-pool

comment 5y ago · link · parent

We can do the same model for Ruby (preemption of event driven fibers) and may choose to do so in the future. We are just taking one step at a time.

comment 5y ago · link · parent

Yes, you run one scheduler per core.

comment 5y ago · link · parent

async/await is a huge anti-pattern IMHO.

comment 5y ago · link · parent

Well, it's not a list. It's just a set of hooks. But that's basically it.

comment 6y ago · link · parent

Actually... I've implemented both client and server side HTTP/2 push and I'd say... it's a hack and we should deprecate it and remove it from the spec.

comment 6y ago · link · parent

Yes, it lets you implement event loop for Ruby. We use fibers to avoid callback hell and avoid rewriting existing code. This is covered in my talk here: https://www.youtube.com/watch?v=qKQcUDEo-ZI

comment 6y ago · link · parent

Latest talk about scheduler: https://www.youtube.com/watch?v=Y29SSOS4UOc

Recent summary of scheduler, a little bit out of date (changes to interface): https://www.codeotaku.com/journal/2020-04/ruby-concurrency-f...

12345
17