From: Eric Wong Date: 2018-05-01T01:13:44+00:00 Subject: [ruby-core:86784] Re: [Ruby trunk Feature#14723] [WIP] sleepy GC sam.saffron@gmail.com wrote: > Implementation wise it seems like you only have it on rb_wait_for_single_fd, is there any way you can make this work with the pg gem? It just builds on libpq per: https://www.postgresql.org/docs/8.3/static/libpq-async.html so maybe you would need to expose an end point for libpq to "trigger" partial gc processes just when you send a query? Actually, it seems it seems pg is using rb_thread_fd_select in some places which will benefit from sleep detection, here. pgconn_block -> wait_socket_readable -> rb_thread_fd_select So it looks like the PG::Connection#async_exec/async_query/block methods will all hit that. So it looks like PG users can automatically benefit from this work (as well as some of the auto-fiber stuff). That said, it looks like they're using rb_thread_fd_select on a single FD, and Linux users would be better off if they used rb_wait_for_single_fd instead. The latter has been optimized for Linux since 1.9.3 to avoid malloc and O(n) behavior based on FD number. Unsubscribe: